Re: False divergence of the NDSolve solution: how to avoid
- To: mathgroup at smc.vnet.net
- Subject: [mg101819] Re: False divergence of the NDSolve solution: how to avoid
- From: sean <sean_incali at yahoo.com>
- Date: Sat, 18 Jul 2009 04:50:29 -0400 (EDT)
- References: <h3n5uh$2gp$1@smc.vnet.net>
I think this arises from NDSolve not having the solutions beyond the point where it reaches the max number of steps. You can increase the number of steps NDSolve takes to a higher number of you can just set it to infinity.(obviously is not a good idea if your system is weird...) eq1=x'[t]==y[t]; eq2=y'[t]==1/x[t]-1.4-(4.5+y[t])*(1+z[t]^2); eq3=z'[t]==18*z[t]-0.75*(4.5+y[t])^2*z[t]-z[t]^3; DynamicModule[{}, Manipulate[ s=NDSolve[{eq1,eq2,eq3,x[0]==0.669,y[0]==0.881,z[0]==0.988}, = {x,y,z}, {t,0,tf}, MaxSteps->Infinity]; Plot[{Evaluate[x[t]/.s], Evaluate[y[t]/.s], Evaluate[z[t]/.s]}, {t, 0,tf}, PlotRange-> All, PlotStyle->{Red,Green,Blue}, AxesLabel->{Style ["t",16], Style["x, y, z",16]}], {tf, 10, 100}] ] On Jul 16, 5:20 am, Alexei Boulbitch <Alexei.Boulbi... at iee.lu> wrote: > Dear Community, > > I am simulating a system of ODE using v6. Here are the equations: > > eq1 = x'[t] == y[t]; > eq2 = y'[t] == 1/x[t] - 1.4 - (4.5 + y[t])*(1 + z[t]^2); > eq3 = z'[t] == 18*z[t] - 0.75*(4.5 + y[t])^2*z[t] - z[t]^3; > > It is simulated at x>0. This system at x>0 seems to be globally stable. > To understand it observe that at large x, y, and z one finds > y' ~ - y*z^2 and z' ~ - z^3. In other words, there is a kind of a > non-linear "returning force" for y and z, while x follows the dynamics > of y. > > However, when solving it on Mathematica I sometimes find trajectories > that counterintuitively diverge. > Check this for example: > > NDSolve[{eq1, eq2, eq3, x[0] == 0.669, y[0] == 0.881, > z[0] == 0.988}, {x, y, z}, {t, 0, 40}]; > > Plot[{Evaluate[x[t] /. s], Evaluate[y[t] /. s], > Evaluate[z[t] /. s]}, {t, 0, 45}, PlotRange -> All, > PlotStyle -> {Red, Green, Blue}, > AxesLabel -> {Style["t", 16], Style["x, y, z", 16]}] > > My guess is that this is due to some peculiarity in the numeric method > used, and the method should be probably changed, or its parameters > specified. I am however, not experienced in numeric approaches for > solving ODEs. > > Now comes the question: > Can you give me a hint, of > (i) what may be the reason of such a behavior? > and > (ii) What should I do to avoid such a false divergence? > > Thank you, Alexei > > -- > Alexei Boulbitch, Dr., habil. > Senior Scientist > > IEE S.A. > ZAE Weiergewan > 11, rue Edmond Reuter > L-5326 Contern > Luxembourg > > Phone: +352 2454 2566 > Fax: +352 2454 3566 > > Website:www.iee.lu > > This e-mail may contain trade secrets or privileged, undisclosed or other= wise confidential information. If you are not the intended recipient and ha= ve received this e-mail in error, you are hereby notified that any review, = copying or distribution of it is strictly prohibited. Please inform us imme= diately and destroy the original transmittal from your system. Thank you fo= r your co-operation.