Jump to content

Cramer's rule: Difference between revisions

(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 1,625:
 
=={{header|Maple}}==
<lang Maple>A := Matrixwith([[2,-1,5,1],[3,2,2,-6],[1,3,3,-1],[5,-2,-3,3]]LinearAlgebra):
cramer:=proc(A,B)
w := LinearAlgebra:-Determinant(Matrix([[-3,-1,5,1],[-32,2,2,-6],[-47,3,3,-1],[49,-2,-3,3]]))/ LinearAlgebra:-Determinant(A);
local n,d,X,V,i;
x := LinearAlgebra:-Determinant(Matrix([[2,-3,5,1],[3,-32,2,-6],[1,-47,3,-1],[5,49,-3,3]]))/LinearAlgebra:-Determinant(A);
n:=upperbound(A,2);
y := LinearAlgebra:-Determinant(Matrix([[2,-1,-3,1],[3,2,-32,-6],[1,3,-47,-1],[5,-2,49,3]]))/LinearAlgebra:-Determinant(A);
d:=Determinant(A);
z := LinearAlgebra:-Determinant(Matrix([[2,-1,5,-3],[3,2,2,-32],[1,3,3,-47],[5,-2,-3,49]]))/LinearAlgebra:-Determinant(A);</lang>
X:=Vector(n,0);
{{Out|Output}}
for i from 1 to n do
<pre>w := 2
x V:= A(1..-121,i);
A(1..-1,i):=B;
y := -4
X[i]:=Determinant(A)/d;
z := 1</pre>
A(1..-1,i):=V;
od;
X;
end:
 
w A:= LinearAlgebra:-Determinant(Matrix([[-32,-1,5,1],[-323,2,2,-6],[-471,3,3,-1],[495,-2,-3,3]]))/ LinearAlgebra:-Determinant(A);
B:=Vector([-3,-32,-47,49]):
printf("%a",cramer(A,B));</lang>
 
{{out}}
 
<pre>Vector(4, [2,-12,-4,1])</pre>
 
=={{header|Mathematica}}==
175

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.