доброго времени суток
задача: реализовать метод простой итерации для решения слау
вроде бы как легкий метод, теорию взял http://www.fm.cdml.ru/otherfiles/simple_iter_method.pdf
пока не смог выяснить, почему программа зацикливается
const
n=6;
e=0.000001;
type
Tmass=array[1..n] of real;
Tmatrix=array[1..n] of TMass;
var
korni, betta, z, old:Tmass;
ish_matr:TMatrix; svob_koeffs:TMass;
alpha: TMatrix;
max: double;
...
function usl(a,b:TMass):boolean; //условие завершения итераций
var i: integer;
flag: boolean;
jin: TMass;
norma: double;
begin
flag:=True;
for i := 1 to n do jin[i] := a[i] - b[i];
for i := 1 to n do norma := norma + abs(jin[i]);
if norma>( (e*(1-max))/max ) then flag:=False;
Result:=flag;
end;
...
var i, j: integer;
s, v, m: double;
error: boolean;
begin
...
for i := 1 to n do
for j := 1 to n do
if i = j then alpha[i,j] := 0
else alpha[i,j] := -ish_matr[i,j]/ish_matr[i,i];
for i:=1 to n do
betta[i] := svob_koeffs[i]/ish_matr[i,i];
for j := 1 to n do
for i := 1 to n do
z[j]:=z[j]+abs(alpha[i,j]);
max:=z[1];
for i := 1 to n do
if z[i] > max then max := z[i];
if max>=1 then showmessage ('Метод простых итераций не сходится!')
else begin
old := betta;
for i := 1 to n do begin
for j := 1 to n do
korni[i] := korni[i] + alpha[i,j]*old[i];
korni[i] := korni[i] + betta[i];
end;
repeat
old := korni;
for i := 1 to n do begin
for j := 1 to n do
korni[i] := korni[i] + alpha[i,j]*old[i];
korni[i] := korni[i] + betta[i];
end;
until usl(korni, old)=True;
end;
...
end;
Эх я, в последнем цикле кажется корни забыл обнулять
а надо то было всего лишь обнулять в начале norma := 0;
Why not settling on games that is fun and at the same time your earning. Well it'll make suspense because the game is well but dude just try it and it gave me hope while pandemic is real rn. https://densipaper.com/objectives-and-goals-of-casinos/