Phase space trajectories



On Thu, Nov 26, 2009 at 12:52 AM, julien cubizolles
<j.cubizolles at free.fr> wrote:
> Hi, I'm trying to display several trajectories in phase space
> corresponding to the same ODEs but with different initial conditions.
> I'd also like to use sliders.
>
> I tried to use the "parameters" options in plotdf but it seems you can
> only use it for the ODE expressions, not the initial conditions.
>
> So I turned to "manually" do it. I'm using a list of rk to numerically
> solve the ODE system and with_slider to draw the trajectories. The code
> is like :
>
> load(dynamics);
> sol : makelist(rk([-x,v],[v,x],[0,i],[t,0,10,.5]),i,1,3)$
> sol_points:makelist(makelist(rest(sol[i][j]),j,1,length(sol[i])),i,1,length(sol));
> with_slider(n,makelist(i,i,1,2),[discrete,sol_points[i]]);
>
> but I'm running into the error :
>
> Subscript must be an integer:
> i
> ?-- an error. ?To debug this try debugmode(true);

That should be with_slider(n,makelist(i,i,1,2),[discrete,sol_points[n]]);
but you would get the same error for n.

The function with_slider maybe needs an update so that it works for
examples such as this one. For a workaround, you can use

with_slider(n, sol_points, [discrete, n]);

Andrej