Hi Jaime,
I have made a slight modification to the function you kindly wrote for me and
now it seems to work with Maxima 5.12 (see below).
If I call mydisplay() from within my other Maxima functions, is there some
risk of errors due to using ev() within mydisplay(), and interactions with
local and global variables, etc
Thanks.
Regards,
C. Frangos.
mydisplay([zargs]) := block(
for i:1 thru length(zargs) do
(
printf(true, "~a = ",zargs[i]),
if matrixp(ev(zargs[i])) then
/* printf(true,"~%~{[ ~{~a~^, ~} ]~%~}~%", ev(zargs[i])) */
printf( true,"~%~{[ ~{~a~^, ~} ]~%~}~%", args(ev(zargs[i])) )
else
printf(true, "~a~%~%", ev(zargs[i]))
)
);
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