Maxima: mydisplay() function.



Hi Jaime

Thanks very much for the program. I am using Maxima 5.12, and there is the 
following error:

mydisplay('a1,'a2);
a1 = sin(x1)

a2 = 
[ 
Maxima encountered a Lisp error:

 Type-error in KERNEL::OBJECT-NOT-LIST-ERROR-HANDLER:
    "matrix([x2^2+sin(x1),cos(x3)+tan(x1)],[2*x3^5+%e^x1,x2^3])" is not of 
type LIST

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

If  I replace the line  
printf(true,"~%~{[ ~{~a~^, ~} ]~%~}~%", ev(args[i]))

with simply
printf(true, "~a~%~%", ev(args[i]))

then I get:

mydisplay('a1,'a2);
a1 = sin(x1)

a2 = matrix([x2^2+sin(x1),cos(x3)+tan(x1)],[2*x3^5+%e^x1,x2^3])

(%o38) done

This is acceptable if the above problem cannot be fixed.

Any assistance would be appreciated - thanks.

Regards,

C. Frangos.




On Thursday 26 November 2009 09:17:23 pm Jaime Villate wrote:
> On Thu, 2009-11-26 at 21:48 +0200, Constantine Frangos wrote:
> > On Thursday 26 November 2009 04:52:59 pm Jaime Villate wrote:
> > > On Thu, 2009-11-26 at 17:57 +0200, Constantine Frangos wrote:
> > > > >> mydisplay(a1,a2,a3,a4)
> > > >
> > > > a1 =
> > > > [ sin(x1)+x2^2,  cos(x3)+tan(x1) ]
> > > > [ exp(x1)+2*x3^5,  x2^3+x1^2 ]
> > > >
> > > > a2 = sin(x2)^2
>
> Try this:
>
> (%i1) a1: matrix([sin(x1)+x2^2, cos(x3)+tan(x1)],[exp(x1)+2*x3^5,x2^3
> +x1^2])$
> (%i2) a2: sin(x2)^2$
> (%i3) a4: cos(x1)$
>
> (%i4) mydisplay([args]) := for i:1 thru length(args) do
>      (printf(true, "~a = ",args[i]),
>       if matrixp(ev(args[i])) then
>          printf(true,"~%~{[ ~{~a~^, ~} ]~%~}~%", ev(args[i]))
>       else
>          printf(true, "~a~%~%", ev(args[i])))$
>
> (%i5) mydisplay('a1,'a2,'a4);
> a1 =
> [ x2^2+sin(x1), cos(x3)+tan(x1) ]
> [ 2*x3^5+%e^x1, x2^3+x1^2 ]
>
> a2 = sin(x2)^2
>
> a4 = cos(x1)
>
>
> Cheers,
> Jaime