Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a plot with sliders in maxima?

In order to illustrate a Cauchy problem for first order ode with infinite family of solutions, I would plot the parametrized solution and having the possility of control the value the parameter through a slider.

To be complete the Cauchy problem is y'=sqrt(|y|), y(0)=0, and the parametric solution is y_c(x):={0, if c=>x; (x-c)^2/4, if x=>c}.
So I would get a plotting of y=y_c(x) with a slider to control the value of c.

Thank you.

like image 939
agt Avatar asked Feb 20 '23 19:02

agt


2 Answers

You can use with_slider_draw in wxMaxima to do this.

   Y(c,x) := if c>x then 0 else (x-c)^2/4;
   with_slider_draw(
       c, /* the name of the variable to attach to the slider */
       makelist(i,i,0,1,0.1), /* a list of values that the variable can have */
       explicit(Y(c,x), x, 0, 2) /* plot the function */
   )$

In wxMaxima, click on the graph and then click on the Play button on the toolbar to play the animation, or use the slider on the tool bar to change the value of c.

like image 61
Fred Senese Avatar answered Feb 23 '23 21:02

Fred Senese


You could use Maxima from within the Sage notebook and resort to the interact command. See also Sage's interface to Maxima.

like image 32
jmbr Avatar answered Feb 23 '23 22:02

jmbr