matrix square



Yes, this often works.  Sometimes, however, Maxima is unable to solve the
system, e.g. for X^^2-ident(2): "algsys: tried and failed to reduce system
to a polynomial in one variable; give up."  It is possible to solve this
using Maxima step-by-step, though.

          -s

On Sat, Dec 29, 2012 at 10:00 AM, Aleksas Domarkas <aleksasd873 at gmail.com>wrote:

> see:  http://www.math.utexas.edu/pipermail/maxima/2012/031320.html
> Square roots  of matrix
>
>  Example1. Find square roots of matrix([33,24],[48,57])
> (%i1) X:matrix([a,b],[c,d])$
> (%i2) A:matrix([33,24],[48,57])$
> (%i3) X.X-A;
> (%o3) matrix([b*c+a^2-33,b*d+a*b-24],[c*d+a*c-48,d^2+b*c-57])
> (%i4) append(%[1],%[2]);
> (%o4) [b*c+a^2-33,b*d+a*b-24,c*d+a*c-48,d^2+b*c-57]
> (%i5) solve(%);
> (%o5)
> [[d=-5,c=-8,b=-4,a=-1],[d=7,c=4,b=2,a=5],[d=5,c=8,b=4,a=1],[d=-7,c=-4,b=-2,a=-5]]
> (%i6) makelist(ev(X,%[k]),k,1,4);
> (%o6)
> [matrix([-1,-4],[-8,-5]),matrix([5,2],[4,7]),matrix([1,4],[8,5]),matrix([-5,-2],[-4,-7])]
>  Test:
> (%i7) makelist(%[k]^^2-A,k,1,4);
> (%o7)
> [matrix([0,0],[0,0]),matrix([0,0],[0,0]),matrix([0,0],[0,0]),matrix([0,0],[0,0])]
>
>  Example2. Find square roots of matrix([0.8,0.5],[0.2,0.5]);
>  This problem also has four solutions.
> (%i8) X:matrix([a,b],[c,d])$
> (%i9) A:matrix([0.8,0.5],[0.2,0.5]);
> (%o9) matrix([0.8,0.5],[0.2,0.5])
> (%i10) ratprint:false$ algebraic:true$
> (%i12) load(diag)$
> (%i13) mat_function(sqrt,A);
> (%o13)
> matrix([(2*sqrt(3))/(7*sqrt(10))+5/7,5/7-(5*sqrt(3))/(7*sqrt(10))],[2/7-(2*sqrt(3))/(7*sqrt(10)),(5*sqrt(3))/(7*sqrt(10))+2/7])
> (%i14) sr1:expand(rootscontract(ratsimp(%))); float(%);
> (%o14)
> matrix([sqrt(30)/35+5/7,5/7-sqrt(30)/14],[2/7-sqrt(30)/35,sqrt(30)/14+2/7])
> (%o15)
> matrix([0.8707778735729,0.32305531606774],[0.1292221264271,0.67694468393226])
>  Other solution is:
> (%i16)
> sr2:matrix([5/7-sqrt(30)/35,sqrt(30)/14+5/7],[sqrt(30)/35+2/7,2/7-sqrt(30)/14]);
> float(%);
> (%o16)
> matrix([5/7-sqrt(30)/35,sqrt(30)/14+5/7],[sqrt(30)/35+2/7,2/7-sqrt(30)/14])
> (%o17)
> matrix([0.55779355499852,1.10551611250369],[0.44220644500148,-0.10551611250369])
> (%i18) sr3:-sr1$
> (%i19) sr4:-sr2$
>  Test:
> (%i20) [sr1^^2-A,sr2^^2-A,sr3^^2-A,sr4^^2-A]$
> (%i21) ratsimp(%);
> (%o21)
> [matrix([0,0],[0,0]),matrix([0,0],[0,0]),matrix([0,0],[0,0]),matrix([0,0],[0,0])]
>
> best
>
> Aleksas Domarkas
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>