One missing maxima feature, that I have the math behind, but not a program



Here is a working example:

m1: matrix([1, 1, 0, 0],[0, 1, 1, 0],[0,0,1,-1/8],[0,0,1/2,1/2])$
sympower(t):= (''(matrix_power(m1, t)));

%o
sympower(t):=matrix([1,t,4^(2-t)*3^(t+1)+t*4^(2-t)*3^(t-1)+8*t-48,-4^(2-t)*3^t-2*t*4^(1-t)*3^(t-1)-2*t+16],[0,1,-2*4^(1-t)*3^t-t*4^(1-t)*3^(t-1)+8,(2*3^t)/4^t+(2*t*3^(t-1))/4^t-2],[0,0,3^t/4^t+(t*3^(t-1))/4^t,-(t*3^(t-1))/(2*4^t)],[0,0,(2*t*3^(t-1))/4^t,3^t/4^t-(t*3^(t-1))/4^t])


is( m1^^15 = sympower(15));
is( m1^^-1 = sympower(-1));

%o
True
%o
True





On Sat, Dec 21, 2013 at 8:21 AM, Barton Willis <willisb at unk.edu> wrote:

>  Two more examples:
>
> (%i14) m : matrix([5,7,1],[9,11,7],[5,7,8])$
>
> OK, but suboptimal (linsolve detects under determined equations)
>
> (%i23) matrix_power(m,1);
> solve: dependent equations eliminated: (3)
> (%o23)
> matrix([-5*(4*%r5-1)+(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+7,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+1],[(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+9,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+11,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+7],[-5*(4*%r5-1)+(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5-20*%r5+7,(sqrt(2)*sqrt(3)*sqrt(19)+10)*%r5+(10-sqrt(2)*sqrt(3)*sqrt(19))*%r5+4*(2-5*%r5)])
>
> (%i24) ratsimp(%);
> (%o24) matrix([5,7,1],[9,11,7],[5,7,8])
>
> Likely completely bogus:
>
> (%i30) ratsimp(matrix_power(m,1/2). matrix_power(m,1/2));
> solve: dependent equations eliminated: (3)
> solve: dependent equations eliminated: (3)
>  << Expression too long to display! >>
>
> OK:
>
> (%i31) ratsimp(matrixfun(lambda([x], sqrt(x)), m) . matrixfun(lambda([x],
> sqrt(x)), m));
> (%o31) matrix([5,7,1],[9,11,7],[5,7,8])
>
>
>
>  --Barton
>
>
>  ------------------------------
> *From:* maxima-bounces at math.utexas.edu <maxima-bounces at math.utexas.edu>
> on behalf of Barton Willis <willisb at unk.edu>
> *Sent:* Saturday, December 21, 2013 07:21
> *To:* Mike Valenzuela
> *Cc:* maxima at math.utexas.edu
> *Subject:* Re: [Maxima] One missing maxima feature, that I have the math
> behind, but not a program
>
>
> Examples:
>
>
>  (%i2) m : matrix([5,7],[9,11])$
>
>
>  Suboptimal?
>
>
>      (%i3) matrix_power(m,0);
>       expt: undefined: 0^0
>
>       0: matrix_power(a=matrix([5,7],[9,11]),t=0)(mp.mac line 35)
>
>
>  For the 0-th power, matrixfun gives the identity:
>
>
>    (%i4) matrixfun(lambda([x], x^0), m);
>    (%o4) matrix([1,0],[0,1])
>
>
>  For an inverse, matrix_power returns a scalar
>
>
>     (%i5) matrix_power(m,-1);
>    (%o5) B_[2]/(3*2^(3/2)+8)+B_[1]/(8-3*2^(3/2))
>
>
>     (%i6) matrixfun(lambda([x], x^-1), m);
>     (%o6) matrix([-11/8,7/8],[9/8,-5/8])
>
>
>      (%i9) m : matrix([a,b],[b,c]);
>     (%o9) matrix([a,b],[b,c])
>
>
>  Symbolic matrices:
>
>
>      (%i18) m : matrix([a,b],[b,c]);
>     (%o18) matrix([a,b],[b,c])
>
>
>      (%i19) matrix_power(m,2);
>     (%o19)
> (B_[2]*(sqrt(c^2-2*a*c+4*b^2+a^2)+c+a)^2)/4+(B_[1]*(sqrt(c^2-2*a*c+4*b^2+a^2)-c-a)^2)/4
>
>
>
>     (%i20) matrixfun(lambda([x],x^2),m);
>     Proviso: assuming c^2-2*a*c+4*b^2+a^2 # 0
>     (%o20) matrix([b^2+a^2,b*c+a*b],[b*c+a*b,c^2+b^2])
>
>
>   --Barton (author of matrixfun)
>
>
>  ------------------------------
>