.


           


Function fx(x : real) : real;

begin

fx := 1/x

end;

{----------------------------------------------------------------------------------------}

{ - - }

Function t(eps : real) : integer;

var

k : integer;

begin

k := -1;

repeat

eps := eps*10;

k := k + 1

until eps > 1;

t := k

end;

{----------------------------------------------------------------------------------------}

{ }

Function derivat2(x0, eps : real) : real;

var

dx, dy, dy3 : real;

begin

dx := 1;

repeat

dx := dx/2;

dy := fx(x0 + dx) - 2*fx(x0) + fx(x0 - dx);

dy3 := fx(5*x0/4 + 2*dx) - 2*fx(5*x0/4 + dx);

dy3 := dy3 - fx(5*x0/4 - 2*dx) + 2*fx(5*x0/4 - dx)

until abs(dy3/(6*dx)) < eps;

derivat2 := dy/(dx*dx)

end;

{----------------------------------------------------------------------------------------}

{ . }

Procedure Number(a, b, eps : real; var

n : integer);

var

dy2, d, c, dx : real;

begin

c := (a + b)/2;

dy2 := derivat2(c, eps);

dx := (b - a)/10;

if dy2 = 0

then

begin

c := a;

while derivat2(c, eps) = 0 do c := c + dx;

dy2 := derivat2(c, eps)

end;

n := 1;

d := abs((b - a)*(b - a)*(b - a));

while abs(dy2*d)/(12*n*n) >= eps do n := n+1;

end;

{----------------------------------------------------------------------------------------}

{ . . Trapezoid - }

Procedure Trapezoid(a, b : real; n : integer; var j : real);

var

dx, c, f : real;

i : integer;

begin

dx := (b - a)/n;