"matrix([matrix([" returned with mat_function (Was: Re: Symbolic matrix power)



On 10/28/2013 07:25 PM, Robert Dodier wrote:
>> On 10/25/2013 08:26 PM, andre maute wrote:
>>> (%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* ...
> This is due to Maxima's dynamic binding policy -- there is a local
> variable in diag_mode_matrix named 'a' which is bound to the value of
> the user variable 'A'. Try it again w/ A : matrix([b, c], [d, e]) --
> I think you'll get a different result.

And here is the next problem with trigreduce

$ 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([q,p],[r,s]);

(%o2) matrix([q,p],[r,s])
(%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) h : mat_function(f,A)$

(%i6) trigreduce(h);

Maxima encountered a Lisp error:

  The value 0 is not of type LIST.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i7)