RE: Re: odd behavior of NDSolv
- To: mathgroup@smc.vnet.net
- Subject: [mg11745] RE: [mg11624] Re: odd behavior of NDSolv
- From: Ersek_Ted%PAX1A@mr.nawcad.navy.mil
- Date: Thu, 26 Mar 1998 03:09:12 -0500
The information below indicates a non-default for the MaxStepSize option can be used to fix the problem. NDSolve has several options that I barely understand, and I suspect many other users are just as bad off. The NDSolve options (with default settings) that give me trouble are: DifferenceOrder -> Automatic, MaxRelativeStepSize -> 1, MaxStepSize -> Infinity, Method -> Automatic, SolveDelayed -> False, StartingStepSize -> Automatic, StoppingTest -> None Has a tutorial been written to demonstrate when non default settings for these options are useful? If not it would be a good topic. Ted Ersek ---------- |From: "paul"@physics.uwa.edu.au@PMDF@PAXMB1 To: mathgroup@smc.vnet.net |To: ersek ted; "mathgroup"@smc.vnet.net@PMDF@PAXMB1 |Subject: [mg11745] [mg11624] Re: odd behavior of NDSolve |Date: Friday, March 20, 1998 12:35AM | |<<File Attachment: 00000000.TXT>> |Selwyn Hollis wrote: | |> I've discovered a very disturbing problem with NDSolve. I'd like to know |> if others can reproduce this. |> |> f[x_, y_] := 1 - Exp[-(x^2 + y^2)] |> fx[x_, y_] = D[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 = 12.03; |> {x0, y0, u0, v0} = {4, 3, -0.7, -0.17}; |> soln = Flatten[NDSolve[diffeqs, {x, y}, {t, 0, endTime}]]; |> r[t_] = {x[t], y[t]} /. soln; |> path = ParametricPlot[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. | |The problem is that the NDSolve default setting of MaxStepSize is |Infinity. If you manually change this, the problem goes away, e.g., | | soln = Flatten[NDSolve[diffeqs, {x, y}, {t, 0, |endTime},MaxStepSize->1]]; | |Cheers, | Paul | |____________________________________________________________________ |Paul Abbott Phone: +61-8-9380-2734 |Department of Physics Fax: +61-8-9380-1014 |The University of Western Australia Nedlands WA 6907 |mailto:paul@physics.uwa.edu.au AUSTRALIA |http://www.pd.uwa.edu.au/~paul | | God IS a weakly left-handed dice player |____________________________________________________________________ |