Command Line and Plot2d: different resutls



On 5/3/06, John P Oliver <jpoliver at ameritech.net> wrote:

> Yet, when I try
>
> > (%i9) plot2d([triangleWv(t,10.0)], [t,0,20], [gnuplot_preamble, "set
> > xrange [0:20];"])$
> I get two periods of a straight line with negative slope.

I think if you do this:

  tw10 (t) := triangleWv (t, 10);
  plot2d (tw10, [t, 0, 20]);

you;ll get the expected result.
Also

  plot2d (lambda ([t], triangleWv (t, 10)), [t, 0, 20]);

should work if you have Maxima 5.9.3.

The problem is that triangleWv (t, 10) is evaluated (once) when plot2d
is called.
So plot2d doesn't see the whole definition of triangleWv.

(Note to everyone else -- maybe plot2d should quote its first argument.
Just a thought.)

HTH
Robert Dodier