Cramer's rule: Difference between revisions

Line 1,537:
{{out}}
<pre>{2,-12,-4,1}</pre>
 
=={{header|Maxima}}==
<lang Maxima>
{{out}}
(%o1) [z + 5 y - x + 2 w = - 3, (- 6 z) + 2 y + 2 x + 3 w = - 32,
(- z) + 3 y + 3 x + w = - 47, 3 z - 3 y - 2 x + 5 w = 49]
(%i2) A: augcoefmatrix (eqns, [w,x,y,z]);
[ 2 - 1 5 1 3 ]
[ ]
[ 3 2 2 - 6 32 ]
(%o2) [ ]
[ 1 3 3 - 1 47 ]
[ ]
[ 5 - 2 - 3 3 - 49 ]
(%i3) C: coefmatrix(eqns, [w,x,y,z]);
[ 2 - 1 5 1 ]
[ ]
[ 3 2 2 - 6 ]
(%o3) [ ]
[ 1 3 3 - 1 ]
[ ]
[ 5 - 2 - 3 3 ]
(%i4) c[n]:= (-1)^(n+1) * determinant (submatrix (A,n))/determinant (C);
n + 1
(- 1) determinant(submatrix(A, n))
(%o4) c := ---------------------------------------
n determinant(C)
(%i5) makelist (c[n],n,1,4);
(%o5) [2, - 12, - 4, 1]
(%i6) linsolve(eqns, [w,x,y,z]);
(%o6) [w = 2, x = - 12, y = - 4, z = 1]
 
</lang>
 
=={{header|PARI/GP}}==
Anonymous user