# [Maxima] a example function for Cramer Rule

=?big5?B?tsAguM62rw==?= bear.tw at hotmail.com
Wed Oct 28 07:12:28 CDT 2009

```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("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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20091028/d7bafd86/attachment.htm
```