MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve - how to bypass safety chceck?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111373] Re: NDSolve - how to bypass safety chceck?
  • From: sean <sean_incali at yahoo.com>
  • Date: Thu, 29 Jul 2010 06:44:03 -0400 (EDT)
  • References: <i2m4lo$o4n$1@smc.vnet.net> <i2mhbu$3c0$1@smc.vnet.net>

Maybe this helps

Below throws max steps error.

t1 = 0; t2 = 10000;

sol = NDSolve[{x'[t] == y[t], y'[t] == x[t] - x[t]^3 - .15 y[t] +=
 .3
Cos[t], x[0] == -1,  y[0] == 1}, {x[t], y[t]}, {t, t1, t2}]
Plot[Evaluate[{x[t], y[t]} /. sol], {t, 0, 100}]
ListPlot[Table[Evaluate[{x[t], y[t]} /. sol], {t, t1, t2, 2 Pi}]]


NDSolve::mxst: Maximum number of 10000 steps reached at the point t ==
676.9646955474411`. >>


One way to circumvent is to increase the number of steps. For above
system, something like 500000 will do it. I found it by trial and
error. maybe it will work for your system.

t1 = 0; t2 = 10000;
sol = NDSolve[{x'[t] == y[t],
   y'[t] == x[t] - x[t]^3 - .15 y[t] + .3 Cos[t], x[0] == -1,
   y[0] == 1}, {x[t], y[t]}, {t, t1, t2}, MaxSteps -> 500000]

Plot[Evaluate[{x[t], y[t]} /. sol], {t, 0, 100}]
ListPlot[Table[Evaluate[{x[t], y[t]} /. sol], {t, t1, t2, 2 Pi}]]


The other way is to set it to infinity, but as you said it may take
infinite time. No way of knowing without the actual system.

Sean


On Jul 27, 4:53 am, "slawek" <sla... at host.pl> wrote:
> U=BFytkownik "J. Batista" <jbatista... at gmail.com> napisa=B3 w wiadomo=
=B6ci grup
> dyskusyjnych:i2m4lo$o4... at smc.vnet.net...
>
> > Here is a possible answer to your question.  You can append the optio=
n
> > MaxSteps -> Infinity to the end of your NDSolve command line.  This w=
ill
> > allow NDSolve to use an unlimited number of steps in generating a
> > solution.
> > Hopefully this helps.
>
> > Regards,
> > J. Batista
>
> The infinite number of steps would take infinite time.
>
> Thus it's not so brillant idea as it pretend to be.
>
> slawek



  • Prev by Date: Re: FindRoot with NDSolve inside of it doesn't work
  • Next by Date: Re: FindRoot with NDSolve inside of it doesn't work
  • Previous by thread: Re: NDSolve - how to bypass safety chceck?
  • Next by thread: Re: NDSolve - how to bypass safety chceck?