Re: odd behavior of NDSolve
- To: mathgroup@smc.vnet.net
- Subject: [mg11702] Re: odd behavior of NDSolve
- From: Selwyn Hollis <shollis@peachnet.campus.mci.net>
- Date: Sat, 21 Mar 1998 18:35:39 -0500
- References: <6esju3$5u4@smc.vnet.net>
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: [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_] =[f[x, y], x]; fy[x_, y_] = D[f[x, y], y]; > > Clear[x0, y0, u0, v0]; > diffeqs {x''[t] == -fx[x[t], y[t]], > y''[t] =-fy[x[t], y[t]], > x[0] =x0, x'[0] == u0, y[0] == y0, y'[0] == v0} > > endTime =2.03; > {x0, y0, u0, v0} =4, 3, -0.7, -0.17}; > soln =latten[NDSolve[diffeqs, {x, y}, {t, 0, endTime}]]; > r[t_] =x[t], y[t]} /. soln; > path =arametricPlot[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/> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~