# [Maxima] Matrix Power ?

sen1 at math.msu.edu sen1 at math.msu.edu
Tue Apr 3 18:43:59 CDT 2007

```Thanks to Baron and Stavros for the information.

Is there any reason why the power shouldn't be M^3 instead of M^^3?

Also, is this in any of the manuals?

-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                |
---------------------------------------------------------------------------

On Tue, 3 Apr 2007, Barton Willis wrote:

> (%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)])
> (%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: [Maxima] 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
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
```