Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Cramers-rule/XPL0/cramers-rule.xpl0
Normal file
25
Task/Cramers-rule/XPL0/cramers-rule.xpl0
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
func Det(A, N); \Return value of determinate A, order N
|
||||
int A, N;
|
||||
int B, Sum, I, K, L, Term;
|
||||
[if N = 1 then return A(0, 0);
|
||||
B:= Reserve((N-1)*4\IntSize\);
|
||||
Sum:= 0;
|
||||
for I:= 0 to N-1 do
|
||||
[L:= 0;
|
||||
for K:= 0 to N-1 do
|
||||
if K # I then
|
||||
[B(L):= @A(K, 1); L:= L+1];
|
||||
Term:= A(I, 0) * Det(B, N-1);
|
||||
if I & 1 then Term:= -Term;
|
||||
Sum:= Sum + Term;
|
||||
];
|
||||
return Sum;
|
||||
];
|
||||
|
||||
real D;
|
||||
[D:= float(Det([[2,-1,5,1], [3,2,2,-6], [1,3,3,-1], [5,-2,-3,3]], 4));
|
||||
RlOut(0, float(Det([[-3,-1,5,1], [-32,2,2,-6], [-47,3,3,-1], [49,-2,-3,3]], 4)) / D);
|
||||
RlOut(0, float(Det([[2,-3,5,1], [3,-32,2,-6], [1,-47,3,-1], [5,49,-3,3]], 4)) / D);
|
||||
RlOut(0, float(Det([[2,-1,-3,1], [3,2,-32,-6], [1,3,-47,-1], [5,-2,49,3]], 4)) / D);
|
||||
RlOut(0, float(Det([[2,-1,5,-3], [3,2,2,-32], [1,3,3,-47], [5,-2,-3,49]], 4)) / D);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue