Logare

Utilizator:
Parola:

Inregistrare

Ultimele noutăţi

Admitere 2018
DISTRIBUȚIA locurilor la programele de formare profesională tehnică postsecundară  Specialitatea Buget Contract Total Filatură si tesătorie 17 10 27 Modelarea, proiectarea şi tehnologia confecţiilor din tricot 17 10 27 ..

Cramer
Inapoi la lista cursurilor

  const nmax=10;

type mat=array[1..nmax,1..nmax] of real;

Var a:mat;

b,sol:array[1..nmax] of real;

P,n:integer;

De:real;

 

function det(var x:mat; t:integer) : real;

var

i, j, k, l : integer;

s : real;

minor : mat;

begin

if t=1 then det:=x[1,1] {caz elementar}

else

    begin

        s:=0;

        for k:=1 to t do begin

                for i:=1 to t-1 do

                    for j:=1 to k-1 do

                        minor[i,j]:=x[i+1,j];

                for i:=1 to t-1 do

                    for j:=k to t-1 do

                        minor[i,j]:=x[i+1,j+1];

                    if odd(k)

                        then s:=s+x[1,k]*det(minor, t-1)

                    else s:=s-x[1,k]*det(minor, t-1);

           end;

        det:=s;

    end;

end;

Function schimb(x:mat;t,l:integer):real;

Var i :integer;

Begin

for i:=1 to t do x[i,l]:=b[i];

                 schimb:=det(x,t);

End;

Begin

n:=3;

a[1,1]:=3;                a[1,2]:=2;                a[1,3]:=-1;                              b[1]:=7;

a[2,1]:=-1;              a[2,2]:=1;                a[2,3]:=1;                               b[2]:=4;

a[3,1]:=1;                a[3,2]:=-6;  a[3,3]:=2;            b[3]:=-13;

De:=det(a,n);

If De<>0 then begin

                for p:=1 to n do sol[p]:= schimb (a,n,p)/de;

                 for p:=1 to n do writeln('x[',p,']= ',sol[p]:3:2); end;

End.

ComentariiReinoieste comentariile

Logare

Utilizator:
Parola:
Retine-ma
Inregistrare
Twitter   facebook facebook Mail.ru