Вот, собственно, код. В процедуре ODE вычисляются два массива Y[k] и TT[k]. Собственно, в процедуре kholeckyнужен только второй.
Код:
program numbers;
const
Nt=40;
type
mass=array[0..Nt] of real;
var
a,b,h: real;
n: integer;
TT,Y: mass;
procedure ODE;
const
n=Nt;
var
x,t,h: real;
i,k,l: integer;
function F(t,x:real): real;
begin
F:=0.1*t*t-2*t*x;
end;
begin
h:=1.485/Nt;
TT[0]:=0;
TT[1]:=h;
Y[0]:=0.1;
Y[1]:=0.1+h*F(h/2,0.1+(h/2)*F(0,0.1));
for k:=2 to n do
begin
TT[k]:=k*h;
Y[k]:=Y[k-2]+2*h*F((k-1)*h,Y[k-1]);
end;
end;
procedure kholecky;
type
mkh=array[0..4,0..4] of real;
var
matr,lt,llt: mkh;
S: array[0..8] of real;
b,z,akh: array[0..4] of real;
i,j,k: integer;
p: real;
khol: text;
begin
for j:=0 to 4 do
begin
S[j]:=0;
for i:=0 to 4 do
begin
lt[i,j]:=0;
llt[i,j]:=0;
matr[i,j]:=0;
end;
end;
for j:=0 to Nt do
begin
p:=1;
for k:=0 to 8 do
begin
S[k]:=S[k]+p;
p:=p*TT[j];
end;
end;
for k:=0 to 4 do
for i:=0 to 4 do
matr[i,k]:=S[i+k];
for j:=0 to 4 do
writeln(matr[j,0]:10:6,' ',matr[j,1]:10:6,' ',matr[j,2]:10:6,' ',matr[j,3]:10:6,' ',matr[j,4]:10:6);
for j:=0 to 4 do
for i:=0 to 4 do
begin
end;
for j:=0 to 4 do
begin
lt[j,j]:=sqrt(matr[j,j]-llt[j,j]);
if j<4 then
for i:=j+1 to 4 do
begin
lt[i,j]:=(matr[i,j]-llt[i,j])/lt[j,j];
for k:=0 to j do
llt[i,j+1]:=llt[i,j+1]+lt[i,k]*lt[j+1,k];
end
else
end;
assign(khol,'c:\tp7\khol');
rewrite(khol);
for j:=0 to 4 do
writeln(khol,lt[j,0]:10:6,' ',lt[j,1]:10:6,' ',lt[j,2]:10:6,' ',lt[j,3]:10:6,' ',lt[j,4]:10:6);
close(khol);
for j:=0 to 4 do
writeln(lt[j,0]:10:6,' ',lt[j,1]:10:6,' ',lt[j,2]:10:6,' ',lt[j,3]:10:6,' ',lt[j,4]:10:6);
end;
begin
ode;
kholecky;
readln;
end.