ВУЗ:
Составители:
16
k1:=i;
for l:=i+1 to n do
if abs(A[l,i])>max then
begin
max:=abs(A[l,i]);
k1:=l;
end;
if (max<E) then begin Ks:=1; exit end else Ks:=0;
if k1<>i then
for j:=i to n+1 do
begin
U:=A[i,j];
A[i,j]:=A[k1,j];
A[k1,j]:=U;
end;
V:=A[i,i];
for j:=i to n+1 do A[i,j]:=A[i,j]/V;
for l:=i+1 to n do
begin
V:=A[l,i];
for j:=i+1 to n+1 do A[l,j]:=A[l,j]-A[i,j]*V;
end;
end;
b[n]:=A[n,n+1];
for i:=n-1 downto 1 do
begin
b[i]:=A[i,n+1];
for j:=i+1 to n do b[i]:=b[i]-A[i,j]*b[j];
end;
end;
{_____________________________}
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Visible:=false;
StringGrid2.Visible:=false;
Label2.Visible:=false;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
if tryStrtoInt(Edit1.Text,N) then
begin
StringGrid1.Visible:=true;
StringGrid1.RowCount:=N+1;
StringGrid1.cells[1,0]:='Gamma';
StringGrid1.cells[2,0]:='Mu';
StringGrid1.cells[3,0]:='m';
StringGrid1.cells[4,0]:='k';
for i:=1 to N do StringGrid1.cells[0,i]:='Узел '+inttostr(i);
k1:=i; for l:=i+1 to n do if abs(A[l,i])>max then begin max:=abs(A[l,i]); k1:=l; end; if (maxi then for j:=i to n+1 do begin U:=A[i,j]; A[i,j]:=A[k1,j]; A[k1,j]:=U; end; V:=A[i,i]; for j:=i to n+1 do A[i,j]:=A[i,j]/V; for l:=i+1 to n do begin V:=A[l,i]; for j:=i+1 to n+1 do A[l,j]:=A[l,j]-A[i,j]*V; end; end; b[n]:=A[n,n+1]; for i:=n-1 downto 1 do begin b[i]:=A[i,n+1]; for j:=i+1 to n do b[i]:=b[i]-A[i,j]*b[j]; end; end; {_____________________________} procedure TForm1.FormCreate(Sender: TObject); begin StringGrid1.Visible:=false; StringGrid2.Visible:=false; Label2.Visible:=false; end; procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin if tryStrtoInt(Edit1.Text,N) then begin StringGrid1.Visible:=true; StringGrid1.RowCount:=N+1; StringGrid1.cells[1,0]:='Gamma'; StringGrid1.cells[2,0]:='Mu'; StringGrid1.cells[3,0]:='m'; StringGrid1.cells[4,0]:='k'; for i:=1 to N do StringGrid1.cells[0,i]:='Узел '+inttostr(i); 16