20 Reputation

8 years, 157 days

Plotting ODE solutions with parameters...

Maple

I'm trying to plot the varying results to a second degree differential function with different values for one constant in one graph. Here is what I have so far, which is already working.

______________________________________________________________________

> with(plots);
> m := 0.46e-1; d := 0.42e-1; v := 60; alpha0 := convert(12*degrees, radians); g := 9.81; pa := 1.205; cd := .2; n := 4000; omega := 2*Pi*(1/60);

> p := 6*m/(Pi*d^3);

> k1 := (3/4)*cd*pa/(d*p); k2 := (3/8)*omega*n*pa/p;

> gl1 := vx(t) = diff(x(t), t);

> gl2 := vy(t) = diff(y(t), t);

> gl3 := diff(vx(t), t) = -k1*vx(t)*(vx(t)^2+vy(t)^2)^(1/2)-k2*vy(t);

> gl4 := diff(vy(t), t) = -g-k1*vy(t)*(vx(t)^2+vy(t)^2)^(1/2)+k2*vx(t);

> init1 := x(0) = 0;
> init2 := y(0) = 0;
> init3 := vx(0) = v*cos(alpha0);
> init4 := vy(0) = v*sin(alpha0);
> sol := dsolve({gl1, gl2, gl3, gl4, init1, init2, init3, init4}, {vx(t), vy(t), x(t), y(t)}, type = numeric);

> sol(.5);
> odeplot(sol, [x(t), y(t)], t = 0 .. 6.7);

______________________________________
What I'd like to do now is, for example, plot the solutions in one graph (preferably as a gif) for when n=1500, n=3000, n=4500 etc. Is there a simple way to achieve this? I've tried various methods so far without success.

Problem with ODE system...

Maple

I'm trying to solve a system of two differential equations of the second order in Maple. I set it up as a system of four differential equations of the first order, but after calling for the solution, all I get back is what I entered in without receiving a solution of any sort. What do I need to fix?

Here's what I did:

_________________________________________________

> with(plots);
print(`output redirected...`); # input placeholder

> m := 0.46e-1; d := 0.42e-1; v := 60; alpha0 := 12; g := 9.81; pa := 1.205; cd := .2; n := 100; omega := 2*Pi*(1/60);

> p := 6*m/(Pi*d^3);

> k1 := (3/4)*cd*pa/(d*p); k2 := (3/8)*omega*pa/p;

> gl1 := vx(t) = diff(x(t), t);
> gl2 := vy(t) = diff(y(t), t);

> gl3 := diff(vx(t), t) = -k1*vx(t)*(vx(t)^2+vy(t)^2)^(1/2)-k2*vy(t);

> gl4 := diff(vy(t), t) = -g-k1*vy(t)*(vx(t)^2+vy(t)^2)^(1/2)+k2*vy(t);

> init1 := x(0) = 0;
> init2 := y(0) = 0;
> init3 := vx(0) = v*cos((1/15)*Pi);
> init4 := vy(0) = v*sin((1/15)*Pi);

> sol; dsolve({gl1, gl2, gl3, gl4, init1, init2, init3, init4}, {vx(t), vy(t), x(t), y(t)}, type = numeric);

> sol(.1);
sol(0.1)

> odeplot(sol, t, x(t), t, y(t), t = 0 .. 1);
Error, (in plots/odeplot) input is not a valid dsolve/numeric solution

____________________________________________________________________________

After calling for the solution at t=0.1, I don't get anything back. I also tried plotting the solution, but then I receive an error message.

 Page 1 of 1
﻿