Matrix Power ?



(%i1) m : matrix([1,h],[-h,1])$
(%i2) m^^2;
(%o2) matrix([1-h^2,2*h],[-2*h,1-h^2])
(%i3) m^^-1;
(%o3) matrix([1/(h^2+1),-h/(h^2+1)],[h/(h^2+1),1/(h^2+1)])
(%i4) load(linearalgebra)$
(%i5) matrixfun(lambda([x],x^n),m);
Proviso: assuming 4*h # 0
(%o5)
matrix([((%i*h+1)^n+(1-%i*h)^n)/2,-(%i*(%i*h+1)^n-%i*(1-%i*h)^n)/2],[(%i*(%i*h+1)^n-%i*(1-%i*h)^n)/2,((%i*h+1)^n+(1-%i*h)^n)/2])

(%i6) rectform(%);
(%o6)
matrix([(h^2+1)^(n/2)*cos(atan(h)*n),(h^2+1)^(n/2)*sin(atan(h)*n)],[-(h^2+1)^(n/2)*sin(atan(h)*n),(h^2+1)^(n/2)*cos(atan(h)*n)])


Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To: maxima at math.utexas.edu
>From: sen1 at math.msu.edu
>Sent by: maxima-bounces at math.utexas.edu
>Date: 04/03/2007 05:01PM
>Subject: Matrix Power ?
>
>Hello,
>  I did not find a function to take the n-th power of a square matrix.
>
>One can, of course, write a simple routine to do this, but is there
>already one built into maxima?
>
>Incidentally, I looked at mat_function, but could now see how to use
>it for this simple thing.
>
>
>TIA,
>  -sen
>
>
>--------------------------------------------------------------------------
>-
>  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu
> |
>  | Mathematics Department         |
|
>  | Michigan State University      | telephone: 517-355-9684
> |
>  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562
> |
>
>--------------------------------------------------------------------------
>-
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima