a example function for Cramer Rule



I post a Cramer function that can solve two variables linear equation.
Only for delta is not equal 0.

powerdisp:true;
kill(all);
Cramer(L1,L2):=(kill(x,y),
print("eq1:",eq1:L1[1,1]*x+L1[1,2]*y=L1[1,3],ascii(10),
"eq2:",eq2:L2[1,1]*x+L2[1,2]*y=L2[1,3]),
A:matrix([L1[1,1]],[L2[1,1]]),
B:matrix([L1[1,2]],[L2[1,2]]),
C:matrix([L1[1,3]],[L2[1,3]]),
print("D=",D:addcol( A,B)),
print("Dx=",Dx:addcol(C,B)),
print("Dy=",Dy:addcol(A,C)),
print("detD=",detD:determinant(D)),
print("detDx=",detDx:determinant(Dx)),
print("detDy=",detDy:determinant(Dy)),
print("x=detDx/detD=",x:detDx/detD,ascii(10),ascii(10),"y=detDy/detD=",y:detDy/detD)
);
/*given example data*/
L1:matrix([1,2,3]);
L2:matrix([4,5,2]);
Cramer(L1,L2);
L1:matrix([a1,b1,c1]);
L2:matrix([a2,b2,c2]);
Cramer(L1,L2);
L1:matrix([1,2,3]);
L2:matrix([1,2,4]);
Cramer(L1,L2);
 		 	   		  
_________________________________________________________________
???s?? Windows 7?G???X?A?X?z???q???C?`?J?F???C
http://windows.microsoft.com/shop