RE: Re: odd behavior of NDSolve
- To: mathgroup@smc.vnet.net
- Subject: [mg11747] RE: [mg11702] Re: odd behavior of NDSolve
- From: R Finley <trfin@umsmed.edu>
- Date: Thu, 26 Mar 1998 03:09:14 -0500
Hi Selwyn, I agree that it is probably more correct to think of the problem in this case as one of wrong step size instead of accumulated error, although the two are not independent. It appears that in this case the wrong step is taken as the first step and I note that there is a warning to this effect in the documentation to NDSolve...where they give one solution to this problem as specifying the StartingStepSize. Indeed that works in your case (StartingStepSize->1)and is probably a better solution than changing the MaxStepSize although I guess it would depend on the interval you were interested in. One can also get the correct result, however, by changing AccuracyGoal->Infinity. RF -----Original Message----- From: Selwyn Hollis [SMTP:shollis@peachnet.campus.mci.net] To: mathgroup@smc.vnet.net Sent: Saturday, March 21, 1998 5:36 PM To: mathgroup@smc.vnet.net Subject: [mg11702] Re: odd behavior of NDSolve Richard Finley wrote: > Hi Selwyn, > > Actually, I don't believe there is any mystery behind the behavior. > Since it is a numerical integration routine, it is subject to > accumulated error depending on step size, maximum number of steps, > etc...and it just so happens in this case that it becomes unstable > around 12.03. Accumulated error is something I'm quite familiar with, but this behavior is not about accumulated error. NDSolve is taking ONE giant step, right past the interesting part of the solution when tmax > 12.03. As Paul Abbott correctly pointed out, the real cause is the default value of Infinity for MaxStepSize. (Seems to me that a more sensible default for MaxStepSize might be something like tmax/10.) Selwyn -----Original Message----- > From: Selwyn Hollis [SMTP:shollis@peachnet.campus.mci.net] To: To: mathgroup@smc.vnet.net > mathgroup@smc.vnet.net > Sent: Tuesday, March 17, 1998 9:43 AM To: mathgroup@smc.vnet.net > Subject: [mg11747] [mg11702] [mg11580] odd behavior of NDSolve > > I've discovered a very disturbing problem with NDSolve. I'd like to > know > if others can reproduce this. > > Here's an example: > > f[x_, y_] : Exp[-(x^2 + y^2)] > > fx[x_, y_] ¿[x, y], x]; fy[x_, y_] [f[x, y], y]; > > Clear[x0, y0, u0, v0]; > diffeqs {x''[t] Ð-fx[x[t], y[t]], > y''[t] ßy[x[t], y[t]], > x[0] , x'[0] Ðu0, y[0] Ðy0, y'[0] Ðv0} > > endTime .03; > {x0, y0, u0, v0} L 3, -0.7, -0.17}; > soln õatten[NDSolve[diffeqs, {x, y}, {t, 0, endTime}]]; > r[t_] t], y[t]} /. soln; > path rametricPlot[r[t], {t, 0, endTime}, > PlotRange -> {{-4, 4}, {-4, 4}}]; > > You should see a curve with a slight bend to it. Now change endTime to > 12.04. The bend is gone. Shouldn't we get the same curve for 0 < t < > 12.03? Either I'm missing something or NDSolve has a serious problem. > -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dr. Selwyn Hollis Associate Professor of Mathematics Armstrong Atlantic State University Savannah, GA 31419 USA <http://www.math.armstrong.edu/faculty/hollis/> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~