From 12e8b6ddb67bf5f512e3d3abbba1a062dbbdabf2 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 6 Jul 2000 12:36:10 +0000 Subject: [PATCH] + Added examples 5-24 --- docs/mathex/Makefile | 5 ++++- docs/mathex/README | 21 ++++++++++++++++++++- docs/mathex/ex10.pp | 10 ++++++++++ docs/mathex/ex11.pp | 11 +++++++++++ docs/mathex/ex12.pp | 13 +++++++++++++ docs/mathex/ex13.pp | 11 +++++++++++ docs/mathex/ex14.pp | 27 +++++++++++++++++++++++++++ docs/mathex/ex15.pp | 11 +++++++++++ docs/mathex/ex16.pp | 11 +++++++++++ docs/mathex/ex17.pp | 9 +++++++++ docs/mathex/ex18.pp | 22 ++++++++++++++++++++++ docs/mathex/ex19.pp | 10 ++++++++++ docs/mathex/ex20.pp | 11 +++++++++++ docs/mathex/ex21.pp | 15 +++++++++++++++ docs/mathex/ex22.pp | 15 +++++++++++++++ docs/mathex/ex23.pp | 15 +++++++++++++++ docs/mathex/ex24.pp | 13 +++++++++++++ docs/mathex/ex5.pp | 10 ++++++++++ docs/mathex/ex6.pp | 15 +++++++++++++++ docs/mathex/ex7.pp | 11 +++++++++++ docs/mathex/ex8.pp | 10 ++++++++++ docs/mathex/ex9.pp | 11 +++++++++++ 22 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 docs/mathex/ex10.pp create mode 100644 docs/mathex/ex11.pp create mode 100644 docs/mathex/ex12.pp create mode 100644 docs/mathex/ex13.pp create mode 100644 docs/mathex/ex14.pp create mode 100644 docs/mathex/ex15.pp create mode 100644 docs/mathex/ex16.pp create mode 100644 docs/mathex/ex17.pp create mode 100644 docs/mathex/ex18.pp create mode 100644 docs/mathex/ex19.pp create mode 100644 docs/mathex/ex20.pp create mode 100644 docs/mathex/ex21.pp create mode 100644 docs/mathex/ex22.pp create mode 100644 docs/mathex/ex23.pp create mode 100644 docs/mathex/ex24.pp create mode 100644 docs/mathex/ex5.pp create mode 100644 docs/mathex/ex6.pp create mode 100644 docs/mathex/ex7.pp create mode 100644 docs/mathex/ex8.pp create mode 100644 docs/mathex/ex9.pp diff --git a/docs/mathex/Makefile b/docs/mathex/Makefile index 37297231e0..cdfcd302c8 100644 --- a/docs/mathex/Makefile +++ b/docs/mathex/Makefile @@ -32,7 +32,10 @@ endif .PHONY: all tex clean -OBJECTS=ex1 ex2 ex3 ex4 +OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 \ + ex11 ex12 ex13 ex14 ex15 ex16 ex17 ex18 ex19 ex20 \ + ex21 ex22 ex23 ex24 +# ex15 ex16 ex17 ex18 ex19 ex20 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS)) diff --git a/docs/mathex/README b/docs/mathex/README index a2568a8384..1d930cdc08 100644 --- a/docs/mathex/README +++ b/docs/mathex/README @@ -6,4 +6,23 @@ Example programs ex1.pp contains an example of the arccos function. ex2.pp contains an example of the arcsin function. ex3.pp contains an example of the arcosh function. -ex4.pp contains an example of the arsinh function. \ No newline at end of file +ex4.pp contains an example of the arsinh function. +ex5.pp contains an example of the artanh function. +ex7.pp contains an example of the Ceil function. +ex8.pp contains an example of the cosh function. +ex9.pp contains an example of the cotan function. +ex10.pp contains an example of the cycletorad function. +ex11.pp contains an example of the degtograd function. +ex12.pp contains an example of the degtorad function. +ex13.pp contains an example of the floor function. +ex14.pp contains an example of the frexp function. +ex15.pp contains an example of the gradtodeg function. +ex16.pp contains an example of the gradtorad function. +ex17.pp contains an example of the hypot function. +ex18.pp contains an example of the intpower function. +ex19.pp contains an example of the ldexp function. +ex20.pp contains an example of the lnxp1 function. +ex21.pp contains an example of the log10 function. +ex22.pp contains an example of the log2 function. +ex23.pp contains an example of the logn function. +ex24.pp contains an example of the max function. diff --git a/docs/mathex/ex10.pp b/docs/mathex/ex10.pp new file mode 100644 index 0000000000..d0348651f9 --- /dev/null +++ b/docs/mathex/ex10.pp @@ -0,0 +1,10 @@ +Program Example10; + +{ Program to demonstrate the cycletorad function. } + +Uses math; + +begin + writeln(cos(cycletorad(1/6))); // Should print 1/2 + writeln(cos(cycletorad(1/8))); // should be sqrt(2)/2 +end. diff --git a/docs/mathex/ex11.pp b/docs/mathex/ex11.pp new file mode 100644 index 0000000000..dd751ec033 --- /dev/null +++ b/docs/mathex/ex11.pp @@ -0,0 +1,11 @@ +Program Example11; + +{ Program to demonstrate the degtograd function. } + +Uses math; + +begin + writeln(degtograd(90)); + writeln(degtograd(180)); + writeln(degtograd(270)) +end. diff --git a/docs/mathex/ex12.pp b/docs/mathex/ex12.pp new file mode 100644 index 0000000000..3345379025 --- /dev/null +++ b/docs/mathex/ex12.pp @@ -0,0 +1,13 @@ +Program Example12; + +{ Program to demonstrate the degtorad function. } + +Uses math; + +begin + writeln(degtorad(45)); + writeln(degtorad(90)); + writeln(degtorad(180)); + writeln(degtorad(270)); + writeln(degtorad(360)); +end. diff --git a/docs/mathex/ex13.pp b/docs/mathex/ex13.pp new file mode 100644 index 0000000000..043591f58a --- /dev/null +++ b/docs/mathex/ex13.pp @@ -0,0 +1,11 @@ +Program Example13; + +{ Program to demonstrate the floor function. } + +Uses math; + +begin + Writeln(Ceil(-3.7)); // should be -4 + Writeln(Ceil(3.7)); // should be 3 + Writeln(Ceil(-4.0)); // should be -4 +end. diff --git a/docs/mathex/ex14.pp b/docs/mathex/ex14.pp new file mode 100644 index 0000000000..e9327da11e --- /dev/null +++ b/docs/mathex/ex14.pp @@ -0,0 +1,27 @@ +Program Example14; + +{ Program to demonstrate the frexp function. } + +Uses math; + +Procedure dofrexp(Const X : extended); + +var man : extended; + exp: integer; + +begin + man:=0; + exp:=0; + frexp(x,man,exp); + write(x,' has '); + Writeln('mantissa ',man,' and exponent ',exp); +end; + + +begin +// dofrexp(1.00); + dofrexp(1.02e-1); + dofrexp(1.03e-2); + dofrexp(1.02e1); + dofrexp(1.03e2); +end. diff --git a/docs/mathex/ex15.pp b/docs/mathex/ex15.pp new file mode 100644 index 0000000000..19c86c936c --- /dev/null +++ b/docs/mathex/ex15.pp @@ -0,0 +1,11 @@ +Program Example15; + +{ Program to demonstrate the gradtodeg function. } + +Uses math; + +begin + writeln(gradtodeg(100)); + writeln(gradtodeg(200)); + writeln(gradtodeg(300)); +end. diff --git a/docs/mathex/ex16.pp b/docs/mathex/ex16.pp new file mode 100644 index 0000000000..55e78f53c7 --- /dev/null +++ b/docs/mathex/ex16.pp @@ -0,0 +1,11 @@ +Program Example16; + +{ Program to demonstrate the gradtorad function. } + +Uses math; + +begin + writeln(gradtorad(100)); + writeln(gradtorad(200)); + writeln(gradtorad(300)); +end. diff --git a/docs/mathex/ex17.pp b/docs/mathex/ex17.pp new file mode 100644 index 0000000000..f48a7fcae2 --- /dev/null +++ b/docs/mathex/ex17.pp @@ -0,0 +1,9 @@ +Program Example17; + +{ Program to demonstrate the hypot function. } + +Uses math; + +begin + Writeln(hypot(3,4)); // should be 5 +end. diff --git a/docs/mathex/ex18.pp b/docs/mathex/ex18.pp new file mode 100644 index 0000000000..75a9580819 --- /dev/null +++ b/docs/mathex/ex18.pp @@ -0,0 +1,22 @@ +Program Example18; + +{ Program to demonstrate the intpower function. } + +Uses math; + +Procedure DoIntpower (X : extended; Pow : Integer); + +begin + writeln(X:8:4,'^',Pow:2,' = ',intpower(X,pow):8:4); +end; + +begin + dointpower(0.0,0); + dointpower(1.0,0); + dointpower(2.0,5); + dointpower(4.0,3); + dointpower(2.0,-1); + dointpower(2.0,-2); + dointpower(-2.0,4); + dointpower(-4.0,3); +end. diff --git a/docs/mathex/ex19.pp b/docs/mathex/ex19.pp new file mode 100644 index 0000000000..f416dc6588 --- /dev/null +++ b/docs/mathex/ex19.pp @@ -0,0 +1,10 @@ +Program Example19; + +{ Program to demonstrate the ldexp function. } + +Uses math; + +begin + writeln(ldexp(2,4):8:4); + writeln(ldexp(0.5,3):8:4); +end. diff --git a/docs/mathex/ex20.pp b/docs/mathex/ex20.pp new file mode 100644 index 0000000000..bd8d4becf2 --- /dev/null +++ b/docs/mathex/ex20.pp @@ -0,0 +1,11 @@ +Program Example20; + +{ Program to demonstrate the lnxp1 function. } + +Uses math; + +begin + writeln(lnxp1(0)); + writeln(lnxp1(0.5)); + writeln(lnxp1(1)); +end. diff --git a/docs/mathex/ex21.pp b/docs/mathex/ex21.pp new file mode 100644 index 0000000000..66565ba1bd --- /dev/null +++ b/docs/mathex/ex21.pp @@ -0,0 +1,15 @@ +Program Example21; + +{ Program to demonstrate the log10 function. } + +Uses math; + +begin + Writeln(Log10(10):8:4); + Writeln(Log10(100):8:4); + Writeln(Log10(1000):8:4); + Writeln(Log10(1):8:4); + Writeln(Log10(0.1):8:4); + Writeln(Log10(0.01):8:4); + Writeln(Log10(0.001):8:4); +end. diff --git a/docs/mathex/ex22.pp b/docs/mathex/ex22.pp new file mode 100644 index 0000000000..757e5e9df8 --- /dev/null +++ b/docs/mathex/ex22.pp @@ -0,0 +1,15 @@ +Program Example22; + +{ Program to demonstrate the log2 function. } + +Uses math; + +begin + Writeln(Log2(2):8:4); + Writeln(Log2(4):8:4); + Writeln(Log2(8):8:4); + Writeln(Log2(1):8:4); + Writeln(Log2(0.5):8:4); + Writeln(Log2(0.25):8:4); + Writeln(Log2(0.125):8:4); +end. diff --git a/docs/mathex/ex23.pp b/docs/mathex/ex23.pp new file mode 100644 index 0000000000..afdec534de --- /dev/null +++ b/docs/mathex/ex23.pp @@ -0,0 +1,15 @@ +Program Example23; + +{ Program to demonstrate the logn function. } + +Uses math; + +begin + Writeln(Logn(3,4):8:4); + Writeln(Logn(2,4):8:4); + Writeln(Logn(6,9):8:4); + Writeln(Logn(exp(1),exp(1)):8:4); + Writeln(Logn(0.5,1):8:4); + Writeln(Logn(0.25,3):8:4); + Writeln(Logn(0.125,5):8:4); +end. diff --git a/docs/mathex/ex24.pp b/docs/mathex/ex24.pp new file mode 100644 index 0000000000..8ce10c5a0e --- /dev/null +++ b/docs/mathex/ex24.pp @@ -0,0 +1,13 @@ +Program Example24; + +{ Program to demonstrate the max function. } + +Uses math; + +Var + A,B : Cardinal; + +begin + A:=1;b:=2; + writeln(max(a,b)); +end. diff --git a/docs/mathex/ex5.pp b/docs/mathex/ex5.pp new file mode 100644 index 0000000000..dd6207cd49 --- /dev/null +++ b/docs/mathex/ex5.pp @@ -0,0 +1,10 @@ +Program Example5; + +{ Program to demonstrate the artanh function. } + +Uses math; + +begin + Writeln(artanh(0)); + Writeln(artanh(0.5)); +end. \ No newline at end of file diff --git a/docs/mathex/ex6.pp b/docs/mathex/ex6.pp new file mode 100644 index 0000000000..8959604c6d --- /dev/null +++ b/docs/mathex/ex6.pp @@ -0,0 +1,15 @@ +Program Example6; + +{ Program to demonstrate the arctan2 function. } + +Uses math; + + Procedure WriteRadDeg(X : float); + + begin + Writeln(X:8:5,' rad = ',radtodeg(x):8:5,' degrees.') + end; + +begin + WriteRadDeg (arctan2(1,1)); +end. diff --git a/docs/mathex/ex7.pp b/docs/mathex/ex7.pp new file mode 100644 index 0000000000..088b5daf7e --- /dev/null +++ b/docs/mathex/ex7.pp @@ -0,0 +1,11 @@ +Program Example7; + +{ Program to demonstrate the Ceil function. } + +Uses math; + +begin + Writeln(Ceil(-3.7)); // should be -3 + Writeln(Ceil(3.7)); // should be 4 + Writeln(Ceil(-4.0)); // should be -4 +end. diff --git a/docs/mathex/ex8.pp b/docs/mathex/ex8.pp new file mode 100644 index 0000000000..c272b6f8f3 --- /dev/null +++ b/docs/mathex/ex8.pp @@ -0,0 +1,10 @@ +Program Example8; + +{ Program to demonstrate the cosh function. } + +Uses math; + +begin + Writeln(Cosh(0)); + Writeln(Cosh(1)); +end. diff --git a/docs/mathex/ex9.pp b/docs/mathex/ex9.pp new file mode 100644 index 0000000000..fc21330cda --- /dev/null +++ b/docs/mathex/ex9.pp @@ -0,0 +1,11 @@ +Program Example9; + +{ Program to demonstrate the cotan function. } + +Uses math; + +begin + writeln(cotan(pi/2)); + Writeln(cotan(pi/3)); + Writeln(cotan(pi/4)); +end.