home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
turbopas
/
pas_sci.arc
/
TRAP3.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-09-06
|
504b
|
30 lines
program trap3; { -> 270 }
{ integration by the trapezoidal rule }
const tol = 1.0E-6;
var sum,upper,lower : real;
function fx(x: real): real;
{ find f(x)=1/x }
{ watch out for x=0 ! }
begin
fx:=1.0/x
end;
function dfx(x: real): real;
begin
dfx:=-1.0/sqr(x)
end;
{$I trapez.lib}
begin { main program }
ClrScr;
lower:=1.0;
upper:=9.0;
writeln;
trapez(lower,upper,tol,sum);
writeln;
writeln(chr(7),'area=',sum)
end.