+ Added examples 5-24

This commit is contained in:
michael 2000-07-06 12:36:10 +00:00
parent eed3807af0
commit 12e8b6ddb6
22 changed files with 285 additions and 2 deletions

View File

@ -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))

View File

@ -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.
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.

10
docs/mathex/ex10.pp Normal file
View File

@ -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.

11
docs/mathex/ex11.pp Normal file
View File

@ -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.

13
docs/mathex/ex12.pp Normal file
View File

@ -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.

11
docs/mathex/ex13.pp Normal file
View File

@ -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.

27
docs/mathex/ex14.pp Normal file
View File

@ -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.

11
docs/mathex/ex15.pp Normal file
View File

@ -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.

11
docs/mathex/ex16.pp Normal file
View File

@ -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.

9
docs/mathex/ex17.pp Normal file
View File

@ -0,0 +1,9 @@
Program Example17;
{ Program to demonstrate the hypot function. }
Uses math;
begin
Writeln(hypot(3,4)); // should be 5
end.

22
docs/mathex/ex18.pp Normal file
View File

@ -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.

10
docs/mathex/ex19.pp Normal file
View File

@ -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.

11
docs/mathex/ex20.pp Normal file
View File

@ -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.

15
docs/mathex/ex21.pp Normal file
View File

@ -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.

15
docs/mathex/ex22.pp Normal file
View File

@ -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.

15
docs/mathex/ex23.pp Normal file
View File

@ -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.

13
docs/mathex/ex24.pp Normal file
View File

@ -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.

10
docs/mathex/ex5.pp Normal file
View File

@ -0,0 +1,10 @@
Program Example5;
{ Program to demonstrate the artanh function. }
Uses math;
begin
Writeln(artanh(0));
Writeln(artanh(0.5));
end.

15
docs/mathex/ex6.pp Normal file
View File

@ -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.

11
docs/mathex/ex7.pp Normal file
View File

@ -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.

10
docs/mathex/ex8.pp Normal file
View File

@ -0,0 +1,10 @@
Program Example8;
{ Program to demonstrate the cosh function. }
Uses math;
begin
Writeln(Cosh(0));
Writeln(Cosh(1));
end.

11
docs/mathex/ex9.pp Normal file
View File

@ -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.