вот мой код:
Код:
program lab4_11v;
uses Crt;
const a = 0;
b = 3;
E = 0.001;
function arcsin(x:real):real;
begin
if x=1.0 then arcsin:=Pi/2.0
else arcsin:=arctan(x/sqrt(1-x*x));
end;
function fpp(x:double):double;
var t,tp:double;
begin
if ((1+x)<>0) and (x<>0) then
fpp:= -(sqrt(x)/(1+x))*( (1/(x*(1+x))) + 1/(2*x) ) else
fpp:=-1;
end;
function f(x:double):double;
begin
f:= arcsin(sqrt(x/(1+x)));
end;
var
max,maxJ,maxN, sum, h,n,M,x,Xnext,I : double;
j:double;
begin
ClrScr;
sum:=0;
max := -555;
j:=a;
while j<b do
begin
maxN := fpp(j);
if max<maxN then begin max:=maxN;
maxJ:=j;
end;
j:=j+E;
end;
max := abs(max);
writeln('max= ',max:3:3,' ,step= ',maxJ:1:1,#13#10);
M := max;{max|f''(x)|}
h := sqrt( (24*E) / ((b-a)*M) );
n := (b-a)/h;
writeln('KPoK = ',h:3:3);
writeln('4aCTuH = ',n:3:3);
{n := sqrt( ((b-a)*(b-a)*(b-a)*M)/(24*E) );
writeln('n = ',n);}
x:=a;
repeat
begin
Xnext := x+h;
sum := sum + f((x+Xnext)/2);
x := Xnext;
end;
until (Xnext<=(b-h));
I:= h * sum;
writeln(#13#10,'I = ',I:5:5);
readln;
end.
обсуждалось тут:
http://dxdy.ru/topic17893-15.html#166199
где моя ошибка?