(%i1) yrange(a) := [y,-a,a]$
(%i2) plot2d(x^2/(x+1), [x,-2,2], yrange(20));
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To: maxima at math.utexas.edu
>From: sen1 at math.msu.edu
>Sent by: maxima-bounces at math.utexas.edu
>Date: 03/21/2007 06:02AM
>Subject: plotting syntax
>
>Hello,
>
> I would like to define a simple function to dynamically set ranges
> with plot2d.
>
> I know draw2d in in the works, but I am teaching a
> class now in which the students are using maxima in Windows. I don't
> know how to tell them how to get and use draw2d.
>
>Consider the following
>
>(%i17) yrange_20: [gnuplot_preamble, [ " set yrange [-20:20] " ]];
>(%o17) [gnuplot_preamble, [ set yrange [-20:20] ]]
>(%i18) plot2d(x^2/(x+1), [x,-2,2], yrange_20);
>
>This works fine.
>
>Now, I would like to have 'yrange_20' as a function.
>
>For instance,
>
>%i19) yrange(a): [gnuplot_preamble, [ " set yrange [-a:a] " ]];
>
>Improper value assignment:
>yrange(a)
> -- an error. To debug this try debugmode(true);
>
>I can't get the 'a' to be put inside the double quotes so the y range
>can be dynamically set.
>
>Any ideas?
>
>TIA,
> -sen
>
>
>--------------------------------------------------------------------------
>-
> | Sheldon E. Newhouse | e-mail: sen1 at math.msu.edu
> |
> | Mathematics Department |
|
> | Michigan State University | telephone: 517-355-9684
> |
> | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562
> |
>
>--------------------------------------------------------------------------
>-
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima