Symbolic matrix power



On 10/25/2013 07:50 PM, Aleksas Domarkas wrote:
> (%i1) A:matrix([2, 0, 0], [0, 2, 0], [-1, 0, 3])$
> (%i2) load("diag")$
> (%i3) integer_pow(x) := block ([k], declare (k, integer), x^k)$
> (%i4) mat_function (integer_pow, A);
> (%o4) matrix([2^k,0,0],[0,2^k,0],[2^k-3^k,0,3^k])
Hi list,
I tried the following

[user at host ~]$ rmaxima
Maxima 5.30.0 http://maxima.sourceforge.net
using Lisp SBCL 1.1.2-1.fc18
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
STYLE-WARNING: redefining MAXIMA::$FILE_TYPE in DEFUN
(%i1) display2d : false;

(%o1) false
(%i2) A : matrix([a,b],[c,d]);

(%o2) matrix([a,b],[c,d])
(%i3) load("diag");

(%o3) "/home/user/opt/maxima/share/maxima/5.30.0/share/contrib/diag.mac"
(%i4)  integer_pow(x) := block ([k], declare (k, integer), x^k);

(%o4) integer_pow(x):=block([k],declare(k,integer),x^k)
(%i5) mat_function (integer_pow, A);

(%o5) matrix([matrix([(sqrt(d^2-2*a*d+4*b*c+a^2)-d-a)^k* ...

Where %o5 consists of a long long expression
But can you see it the two occurrences of "matrix"?

Andre