|
procedure complemento(var inv,inv2: mat; l: integer; det: double);
var i,j: integer;
mc: mat;
begin
writeln;
writeln('Matrice inversa');
for i:=1 to l do
begin
for j:=1 to l do
begin
if l>2 then copia_matrice(i,j,l,inv,mc); { in mc c'Š la semimatrice }
if l=2 then inv2[i,j]:=inv[3-i,3-j]
else inv2[i,j]:=ricorsiva(mc,(l-1)); { calcolo complemento --> determinante della semimatrice }
inv2[i,j]:=inv2[i,j] / det; { divido per il determinante della matrice iniziale }
if (( (i+j) mod 2 ) = 1) then inv2[i,j]:=inv2[i,j] * (-1);
write(inv2[i,j]:6:3,' ');
end;
writeln;
end;
end;
|
|