uses crt type matr array of real rev_t function matr_t matr real const

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
uses crt;
type matr=array[1..3, 1..3] of real;
// rev_t
function matr_t(a:matr):real;
const n=3;
var
i,j,k,l :integer;
t1, t2 :real;
a1, a2, a3 :matr;
begin
clrscr;
matr_t:=1;
for i:=1 to n-1 do begin
for j:=i+1 to n do begin
t1:=a[i,i];t2:=a[j,i];
matr_t:=matr_t*(1/t1);
for k:=1 to n do begin
a[j,k]:=a[j,k]*t1+(-1)*a[i,k]*t2;
end;
end;
end;
for i:=0 to n-2 do begin
for j:=1 to n-1 do begin
if j<n-i then
begin
t1:=a[j,j+i+1];t2:=(-1)*a[j+i+1,j+i+1];
matr_t:=matr_t*(1/t2);
for k:=1 to n do begin
a[j,k]:=a[j,k]*t2+a[j+1+i,k]*t1;
end;
end;
end;
end;
for i:=1 to n do
for j:=1 to n do
if (i=j) then
matr_t:=matr_t*a[i,j];
end;
// end_ matr_t
const
a:matr=((5,1,7),(1,3,8),(3,5,9));
var i :real;
begin
i:=matr_t(a);
writeln( i:4:2 );
end.