[Maxima] Plotting with sliders
villate at fe.up.pt
Mon Sep 10 07:24:14 CDT 2007
On Mon, 2007-09-10 at 07:06 -0300, Ismael Garrido wrote:
> I couldn't find a complete command reference for openmath. Is there
I don't think William Shelter ever wrote one. I've discovered openmath
commands by looking at the tcl source code interfaces/xmaxima/Tkmaxima/.
In particular, you can find openmath's plot2d options in Plot2d.tcl
> Digging in the source I found that I can execute in maxima:
> :lisp (show-open-plot "plot2d -xfun exp(m*x) -sliders m=-10:10");
> And that will display the graph.
Oh yes, I had forgotten about that method, which is the one I used for
plotdf before I wrote plotdf.lisp
> I wanted to graph, for instance, e^x against it's Taylor series
> expansion of different orders and see how it varies when you change
> order. I guess that's not currently possible. You'd have to make
> openmath evaluate the expression in maxima and then plot it, whenever
> a slider is changed.
The problem is that the "exp(m*x)" string that you used in the command
above is being passed directly to tcl's script Plot2d.tcl. It will not
be interpreted by Maxima. In plotdf.lisp, the function given to Maxima's
plotdf will be simplified by Maxima before passing it to Plotdf.tcl.
plot2d currently calls Plot2d.tcl passing to it a set of numerical
values, rather than giving it a symbolic function. To make the slider
work, will have to modify Plot2d.tcl so that it queries Maxima for new
sets of values whenever it needs to redo the plot. The same will have to
be done with plotdf to make it work with all the sort of functions that
you can define in Maxima.
> As for what to do with gnuplot, you could either disregard commands
> that can't be used there and issue a warning, or you could create a
> new command which specifically uses openmath and lets you access all
> the openmath goodness.
The same approach that has been used for plots embedded within Xmaxima
can be used here. Namely, if the current plotting method is gnuplot, it
will temporarily be changed to openmath to produce the requested plot.
> Also, I want to thank you for openmath. Plotdf is great! It helped me
> understand differential equations.
You're welcome. I've just done a simple lisp interface and solved some
bugs to prevent William Shelter's work from being forgotten. He did all
the Tcl/Tk coding for Openmath.
More information about the Maxima