Maxima: mydisplay() function.



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