行列演算を記号的に出来る (lsolve
で線形方程式の解法、 determinant
で行列式、 inverse で逆行列、 etc.)
$ ginsh
ginsh - GiNaC Interactive Shell (GiNaC V1.0.3)
__, _______ Copyright (C) 1999-2001 Johannes Gutenberg University Mainz,
(__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.
._) i N a C | You are welcome to redistribute it under certain conditions.
<-------------' For details type `warranty;'.
Type ?? for a list of help topics.
> lsolve ({a*x+b*y == c, d*x+e*y == f}, {x, y});
{x==(-c*e+f*b)*(d*b-a*e)^(-1),y==(c*d-f*a)*(d*b-a*e)^(-1)}
> M = [ [a, b, c], [d, e, f], [g, h, i]];
[[a,b,c],[d,e,f],[g,h,i]]
> determinant(M);
a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e
> inverse(M);
[[(e*i-f*h)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1),
(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1)*(-b*i+c*h),
(-c*e+b*f)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1)],
[(-d*i+f*g)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1),
(-c*g+a*i)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1),
(-f*a+c*d)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1)],
[(d*h-g*e)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1),
(-h*a+b*g)*(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1),
(a*e*i-b*d*i-f*h*a+b*f*g+c*d*h-c*g*e)^(-1)*(a*e-b*d)]]