Items tagged with odeplot

I am having touble plotting the equation, diff(y(t), t$3)+3*(diff(y(t), t$2))+4*(diff(y(t), t))+12*y(t) = 0. With the intional conditons y'(0)=y''(0)=0 and y(0)=3.

Currently I am getting this error, "Error, (in dsolve/numeric/type_check) insufficient initial/boundary value information for procedure defined problem."

My current eqution is DEplot(ode, y(t), t = -1 .. 5, y(t) = -5 .. 5, [ivp]), with ivp := [((D@D)(y(t)))(0) = 0, (D(y(t)))(0) = 0, (y(t))(0) = 3].

> restart; for j to nops(n) do sys := diff(f(eta), eta, eta, eta)+f(eta)*(diff(f(eta), eta, eta))+1-(diff(f(eta), eta))^2 = 0, (diff(diff(theta(eta), eta), eta))/pr+f(eta)*(diff(theta(eta), eta))-(diff(f(eta), eta))*theta(eta) = 0; bcs := f(0) = 0, (D(f))(0) = l+b*((D@@2)(f))(0), (D(f))(-.5) = 1, theta(0) = 1+s*(D(theta))(-.5), theta(2) = 0; n := [1, 2, 3, 4, 5, 6]; pr := .71; p := 0; q := 0; b := 0; l := 0; s := 0; L := [red, blue, orange]; R1 := 2*n[j]/(1+n[j]); R2 := 2*p/(1+n); p := proc (f1, th1, { output::name := 'number' }) local res1, fvals, thvals, res2; option remember; res1 := dsolve({sys, f(1) = 0, theta(0) = 1+th1, (D(f))(0) = f1, (D(theta))(0) = th1, ((D@@2)(f))(0) = f1-1}, numeric, :-output = listprocedure); fvals := (subs(res1, [seq(diff(f(eta), [`$`(eta, i)]), i = 0 .. 2)]))(0); thvals := (subs(res1, [seq(diff(theta(eta), [`$`(eta, i)]), i = 0 .. 1)]))(0); res2 := dsolve({sys, f(0) = fvals[1], theta(0) = thvals[1], theta(5) = 0, (D(f))(0) = fvals[2], (D(f))(5) = 1}, numeric, :-output = listprocedure); if output = 'number' then [fvals[3]-(subs(res2, diff(f(eta), `$`(eta, 2))))(0), thvals[2]-(subs(res2, diff(theta(eta), eta)))(0)] else res1, res2 end if end proc; p1 := proc (f1, th1) p(args)[1] end proc; p2 := proc (f1, th1) p(args)[2] end proc; p(.3, -.2); par := fsolve([p1, p2], [.3, -.2]); res1, res2 := p(op(par), output = xxx); plots:-display(plots:-odeplot(res1, [[eta, f(eta)], [eta, theta(eta)]]), plots:-odeplot(res2, [[eta, f(eta)], [eta, theta(eta)]])); plots:-display(plots:-odeplot(res1, [[eta, diff(f(eta), eta)], [eta, diff(theta(eta), eta)]]), plots:-odeplot(res2, [[eta, diff(f(eta), eta)], [eta, diff(theta(eta), eta)]])); plots:-display(plots:-odeplot(res1, [[eta, diff(f(eta), eta, eta)]]), plots:-odeplot(res2, [[eta, diff(f(eta), eta, eta)]])); plots:-display(plots:-odeplot(res1, [[eta, diff(f(eta), eta)]])); fplt[j] := plots[odeplot](res1, [eta, diff(diff(f(eta), eta), eta)], color = L[j], axes = boxed); tplt[j] := plots[odeplot](res1, [[eta, theta(eta)]], color = L[j], axes = boxed) end do;
> plots:-display([seq(fplt[j], j = 1 .. nops(n))]);


Dear Sir

In my above problem i trying to plot for set of values of n but in plot command it not executing , can you do this why it is not executing ??

 

> restart;
> with(plots);
> pr := .72; p := 0; n := 1; s := 1; a := [-0.5,0.0,0.5]; b := 1;
> R1 := 2*n/(n+1);
                                      1
> R2 := 2*p/(n+1);
                                      0
>
>
> for j to nops(a) do R1 := 2*n/(n+1); R2 := 2*p/(n+1); sol1 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R1*(1-(diff(f(eta), eta))^2) = 0, diff(diff(theta(eta), eta), eta)+pr*s^f(eta)*(diff(theta(eta), eta))+R2*pr*s*(diff(f(eta), eta))*theta(eta)+2*(a[j]*(diff(f(eta), eta))+b*theta(eta))/(n+1) = 0, f(-.5) = 0, (D(f))(0) = 1+b*((D@@2)(f))(0), (D(f))(5) = 0, theta(-.5) = 1+s*(D(theta))(0), theta(5) = 0], numeric, method = bvp); fplt[j] := plots[odeplot](sol1, [eta, diff(diff(f(eta), eta), eta)], color = ["blue", "black", "orange"]); tplt[j] := plots[odeplot](sol1, [eta, theta(eta)], color = setcolors(["red", "Coral"])) end do;
Error, (in dsolve/numeric/process_input) boundary conditions specified at too many points: {0, 5, -1/2}, can only solve two-point boundary value problems
>
> plots:-display([seq(fplt[j], j = 1 .. nops(a))], color = [green, red]);

> plots:-display([seq(tplt[j], j = 1 .. nops(a))], color = [green, red]);

 

Dear sir,

In this program i m not getting the solution for decimal values and i do not have idea about the how to set different color for multiple lines(i tried for different set of colors but it shows that only for first color )

 

Hi,

Does anyone no how to normalize wavefunctions such that the plot on the right looks like the one on the left.

Here's my code:-

schro := {diff(psi(x), x, x)-(alpha*x^4+x^2-energy)*psi(x) = 0};

ic := {psi(3) = 0, (D(psi))(3) = 1};

Ic := [{psi(3) = 0, (D(psi))(3) = -1}, %$2];

E := [1.06538, 3.306, 5.74796];

schro1 := [seq(subs(energy = e, alpha = .1, schro), e = E)];

soln1 := [seq(dsolve(schro1[i] union Ic[i], {psi(x)}, type = numeric), i = 1 .. nops(E))]; with(plots);

display(seq(odeplot(soln1[i], [x, psi(x)], -3 .. 3, color = [red, blue, green][i]), i = 1 .. nops(E)))

 

Thanks in advance

> restart;
> with(plots);
> setoptions(title = `Family Plot`, axes = boxed);
> pr := .71; n := 1; p := 0; q := 0; b := 0; l := 0; s := 0; m := 0;
>
>
> R1 := 2.*n/(1+n);
                                 1.000000000
> R2 := 2.*p/(1+n);
                                     0.
> sol1 := dsolve([diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))+R1*(1-(diff(f(eta), eta))^2) = 0, diff(diff(theta(eta), eta), eta)+.71*f(eta)*(diff(theta(eta), eta))-.71*(diff(f(eta), eta))*theta(eta)*R2 = 0, f(0) = 0, (D(f))(0) = 1.8+b*((D@@2)(f))(0), (D(f))(18) = 0, theta(0) = 1+s*(D(theta))(0), theta(18) = 0], numeric, method = bvp[midrich]); plots[odeplot](sol1, [eta, theta(eta)], color = red, axes = boxed);

Dear sir/madam

In my program i want to plot multiple lines for diffrent values of n, but i do not have such type of idea please can you help me.

Hi everybody,

I solve an ODE system numerically with the command

Tend := ….. :
sol := dsolve(MySys, numeric, method=rosenbrock, range=0..Tend):    # or rkf45

One of my colleagues wants the solution in array form for using it in a spreadsheet (namely Excel). 
Here is an example of what I do :
 
data := plottools:-getdata( plots:-odeplot(sol, […..], 0..Tend, refine = Q) )
:  # Q rational
result := data[3]:
ExcelTools:-Export (result, …)


To understand the following, you need to know that
the time step varies by several decades (at least 3 or 4). and that  numfun
is typically in the order of 10^5
 
When I ask Maple to construct  data , Maple seems to sample the solution 
sol
according to the local time step dsolve has selected (and probably some other parameters ?)
Because this time step varies in very large proportions, the result is sometimes a concentration of points in regions where the solution is rapidly changing (which is desirable) … with some lacunarity in slow varying regions.

To obviate this, sometimes  poor appearance, I used to force Maple to compute the solution by regularly sampling the range
]0, Tend[  and combining this array with the original one (result
).
But this not satisfactory for I do not avoid lacunarity region (unless I proceed in some ad hoc way)

Here is my question :
Could you give me some elements about  the way odeplot adapts its sampling strategy according to the local time step, the budget N (the Q value I guess) and maybe numfun
?

Thank you in advance

Hello,

 

I tried to plot the problem presented below:

restart; with(plots); C := setcolors(); with(LinearAlgebra);

formula1 := 2.6*BodyWeight*abs(sin(4*Pi*t));
2.6 BodyWeight |sin(4 Pi t)|
BodyWeight := 80*9.81;
plot(formula1, t = 0 .. 2);


eq2 := formula1-SpringConstant*y(t)-DampConstant*(diff(y(t), t)) = Mass*(diff(y(t), `$`(t, 2)));
2040.480 |sin(4 Pi t)| - SpringConstant y(t)

/ d \ / d / d \\
- DampConstant |--- y(t)| = Mass |--- |--- y(t)||
\ dt / \ dt \ dt //
DampConstant := 50;
50
Mass := .200;
Springt := 200;
200
SpringConstant := Youngsmodulus*Surface/DeltaLength;
DeltaLength := 0.2e-1-y(t);
Surface := .15;
Youngsmodulus := 6.5*10^6/(t+1)+6.5*10^6;
plot(Youngsmodulus, t = 0 .. 10000);

eq2;
2040.480 |sin(4 Pi t)|

/ 6 \
|6.5000000 10 6|
0.15 |------------- + 6.5000000 10 | y(t)
\ t + 1 / / d \
- ----------------------------------------- - 50 |--- y(t)| =
0.02 - y(t) \ dt /

/ d / d \\
0.200 |--- |--- y(t)||
\ dt \ dt //

incs := y(0) = 0, (D(y))(0) = 0;
eq4 := dsolve({eq2, incs}, y(t), type = numeric, method = lsode[backfull], maxfun = 0);
proc(x_lsode) ... end;

plots:-odeplot(eq4, [t, y(t)], 0 .. 5);

 When I try to plot it beyond t=5, Maple gives the following error:

Warning, could not obtain numerical solution at all points, plot may be incomplete

Does anyone know how to plot it even further?

 

 

Here is ODE

restart:
with(plots):
Digits:=35:

ini1:=D(x)(0)=0,x(0)=1:
dsys:=diff(x(t),t,t)+(x(t)-2)*diff(x(t),t)+5*x(t)=0;
dsol1 :=dsolve({dsys,ini1},numeric,abserr=1e-9, relerr=1e-8,maxfun=0);
plots:-odeplot(dsol1,[[t,x(t)]],0..20,axes=boxed,color=black,linestyle=1,tickmarks=[6, 6],axes=boxed,titlefont=[SYMBOL,12]);

1-Why when i run for long time>1.5 give me error

2- how to plot phase plot of x'(t) against x(t)

Any comments will be helpful

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.

I want to plot the position of Spherical pendulum. there are differential equation for spherical pendulum in spherical coordinates

sys := {((D@@2)(phi))(t) = -2*(D(phi))(t)*(D(theta))(t)*cos(theta(t))/sin(phi(t)),
((D@@2)(theta))(t) = (D(phi))(t)^2*cos(theta(t))*sin(theta(t))-9.8*sin(theta(t))}

 

with initial conditions

theta(0) = (1/2)*Pi, (D(theta))(0) = 0, phi(0) = (1/2)*Pi, (D(phi))(0) = 1

I tried:

eq := dsolve([((D@@2)(theta))(t) = (D(phi))(t)^2*cos(theta(t))-9.8*sin(theta(t)),
((D@@2)(phi))(t) = -2*(D(phi))(t)*(D(theta))(t)*cos(theta(t))/sin(phi(t)),
theta(0) = (1/2)*Pi, (D(theta))(0) = 0, phi(0) = (1/2)*Pi, (D(phi))(0) = 1],numeric)

how to change coordinates

x(t) = sin(theta(t))*cos(phi(t))
y(t) = sin(theta(t))*sin(phi(t))
z(t) = cos(theta(t))

and how to plot it from t=0 to 10?

I have a set of differential equations on 3 variables, B[1],B[2] and C. Its not physically meaningful for B[1]+B[2]>0.5 so i would ideally like to replace the cube that the solutions are displayed on (the axis take the limits B[1]=0...0.5,B[2]=0...0.5,C=0...100 ) with a triangular prism (the axis take the limits B[1]=0...0.5,B[2]=0...0.5,B[1]+B[2]<0.5,C=0...100 ).

Failing that i'd like the plot to display a plane showing where the meaningful values for the variables end.

here is the code I use to put the ODEplot together

Model := [diff(B[1](t), t) = k[a1]*C(t)*(R-B[1](t)-B[2](t))-k[d1]*B[1](t), diff(B[2](t), t) = k[a2]*C(t)*(R-B[1](t)-B[2](t))-k[d2]*B[2](t), diff(C(t), t) = (-(k[a1]+k[a2])*C(t)*(R-B[1](t)-B[2](t))+k[d1]*B[1](t)+k[d2]*B[2](t)+k[m]*((I)(t)-C(t)))/h];
DissMod := subs((I)(t) = 0, Model);
AssMod := subs((I)(t) = C[T], Model);

Pars1a := [k[a1] = 6*10^(-4), k[d1] = 7*10^(-3), k[a2] = 6*10^(-4), k[d2] = (7/5)*10^(-3), R = .5, k[m] = 10^(-4), C[T] = 100, h = 10^(-6)];

Pars := Pars1a; thing11 := subs(Pars, AssMod[1]), subs(Pars, AssMod[2]); thing12 := diff(C(t), t) = piecewise(t <= 100, subs(Pars, rhs(AssMod[3])), subs(Pars, rhs(DissMod[3]))); sol := dsolve({thing11, thing12, C(0) = 0, B[1](0) = 0, B[2](0) = 0}, {C(t), B[1](t), B[2](t)}, numeric, output = listprocedure, maxstep = 2, maxfun = 1000000); ParsPlot1a := odeplot(sol, [B[1](t), B[2](t), C(t)], t = 0 .. 700, color = blue, view = [0 .. .5, 0 .. .5, 0 .. 100], tickmarks = [[0 = 0, .5 = R], [0 = 0, .5 = R], [0 = 0, 25 = (1/4)*C[T], 50 = (1/2)*C[T], 100 = C[T]]]);


But I can't see a way of either making the plane or making the ODEplot axis into something other than a cube.

I have some differential equations that I want to plot on the same axis (as i have below), but would like to plot with a log scale to illustrate the fact that one is simply a logarithmic decay (solid line) and all the others are not.

I had used deplot and display to make the above graph,

but if you want more detail, here is a worksheet with the relevant differntial equations:
MaplePrimesGraphUpload.mw

 

 

 

Hi everyone!

I tried to plot the solution of the following ode, but I only got the message error:

Warning, cannot evaluate the solution past the initial point, problem may be complex, initially singular or improperly set up

(file attached)

Problem.mw

https://dl.dropboxusercontent.com/u/66502600/Problem.mw

 

Please, help me!

 

Thank you so much!

 



thanks. I played around, and had problems implementing your ideas for one of the systems I'm interested in.I don't see a difference between this and what you had advised me on, but it gets an error.

any idea why?
or how to fix it?

thing1 := diff(B[1](t), t) = piecewise(t <= 500, 0.3e-2-(63/10000)*B[1](t)-(3/500)*B[2](t), -(3/10000)*B[1](t)):
thing2 := diff(B[1](t), t) = piecewise(t <= 500, 0.1e-1-(1/50)*B[1](t)-(13/625)*B[2](t), -(1/1250)*B[2](t)):
sol := dsolve({thing1, thing2, B[1](0) = 0, B[2](0) = 0}, {B[1](t), B[2](t)}, numeric, output = listprocedure); plots:-odeplot(sol, [B[1](t), B[2](t)], t = 450 .. 550);

Error, (in dsolve/numeric/DAE/explicit) unable to obtain the standard form of the DAE system due to the presence of leading dependent variables/derivatives in the piecewise: piecewise(t <= 500, 1/100-(1/50)*B[1](t)-(13/625)*B[2](t), -(1/1250)*B[2](t))-piecewise(t <= 500, 3/1000-(63/10000)*B[1](t)-(3/500)*B[2](t), -(3/10000)*B[1](t))
Error, (in plots/odeplot) curve is not fully specified in terms of the ODE solution, found additional unknowns {B[1](t), B[2](t)}


Hello,

I would like to plot gait diagrams (the lines you can see on the picture belowà from the solutions obtained with a NL oscillator (composed with 8 coupled odes). Here the result that I would like to obtain.

Initial plot:

 

Desired plot

 

 

I would like to obtain 4 lines corresponding to the 4 elliptic trajectories obtained with the NL oscillator. The four lines should be done like this. When the trajectory is above 0, the line should be colored in green. When the trajectory is below 0, the line should be colored in black. 

May you help me to define this kind of graph called gait diagrams from the solution of the NL oscillator ?

Here you can find my maple code:

K:=Matrix([<0, -1, 1, -1>,<-1, 0, -1, 1>,<-1, 1, 0,-1>,<1, -1, -1,0>]);

for i to 4
do
r[i]:=sqrt((u[i](t))^2+(v[i](t))^2):
omega[i]:=omega[sw]/(1+exp(b*v[i](t)))+omega[st]/(1+exp(-b*v[i](t))):
Equ[i]:=diff(u[i](t),t)=Au*(1-r[i]^2)*u[i](t)-omega[i]*v[i](t):
Eqv[i]:=diff(v[i](t),t)=Av*(1-r[i]^2)*v[i](t)+omega[i]*u[i](t)+MatrixVectorMultiply(K,<seq(v[i](t),i=1..4)>)[i]:
EqSys[i]:=[Equ[i],Eqv[i]]:
end do:

paramsCycle:=omega[st]=4*2*Pi,omega[sw]=2*Pi,Au=5,Av=50,b=100;
params:=paramsCycle;

Differential system 
sys:=map(op,eval([seq(EqSys[i],i=1..4)],[params]));
ic:=[u[1](0)=0, v[1](0)=0,u[2](0)=0, v[2](0)=-0.1,u[3](0)=0, v[3](0)=0.1,u[4](0)=0, v[4](0)=0.1];
Résolution1
res:=dsolve([sys[],ic[]],numeric):
Initial boundaries
tcalc:=4;
ic2:=[seq(u[i](0)=eval(u[i](t), res(tcalc)),i=1..4),seq(v[i](0)=eval(v[i](t), res(tcalc)),i=1..4)];
Résolution2
res:=dsolve([sys[],ic2[]],numeric):

tmax:= 40:
numpts:=100*tmax:
plots:-odeplot(res,[t,v[1](t)],0..tmax,thickness=2, view=[0..5, -1.5..1.5],numpoints = numpts);
plots:-odeplot(res,[t,v[2](t)],0..tmax,thickness=2, view=[0..5, -1.5..1.5],numpoints = numpts);
plots:-odeplot(res,[t,v[3](t)],0..tmax,thickness=2, view=[0..5, -1.5..1.5],numpoints = numpts);
plots:-odeplot(res,[t,v[4](t)],0..tmax,thickness=2, view=[0..5, -1.5..1.5],numpoints = numpts);
plots:-odeplot(res,[seq([t,v[i](t)+i*5],i=1..4)],0..tmax,thickness=2,view=[0..5,0..25], numpoints = numpts);

Thanks a lot for your help

1 2 3 4 Page 1 of 4