Re: Options for DSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg123424] Re: Options for DSolve
- From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
- Date: Wed, 7 Dec 2011 06:12:56 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201112060812.DAA18378@smc.vnet.net>
Hello Martin, On Tue, 6 Dec 2011, Martin wrote: > Hello, > > I have a question concerning the options for Mathematica's DSolve. I > want to find the InterpolatingFunction for a function depending on two > independent variables U[k,phi] in the range {k,1,500} and {phi, > 1600,2500}. I try to solve a single differential equation for U[k,phi] > involving the first derivative with respect to k, and the first and > the second derivative with respect to phi. > I use DSolve in the following form: > NDSolve[{ differential equation , initial condition }, U , {k, > 1,500} , {phi,1600,2500} , Options] > My initial condition is U[500,phi]= 2.5 phi^2 . > > The method worked for simpler differential equations involving also > two independent variables. The actual one however is a bit more > complicated, involving for example Coth and Tanh. Although Mathematica > finds a solution, it cannot be correct, since adding options like > PrecisionGoal change the result dramatically. So I tried to improve > the result using such options, but I don't know what is the right > strategy. I considered > PrecisionGoal , > AccuracyGoal , > MaxStepSize. > > Using PrecisionGoal and AccuracyGoal simultaneously, at PrecisionGoal- >> 18, AccuracyGoal->10 I obtain the following warnings: > > NDSolve::mxsst: Using maximum number of grid points 10000 allowed by > the MaxPoints or MinStepSize options for independent variable \ > [CurlyPhi]. > NDSolve::ndtol: Tolerances requested by the AccuracyGoal and > PrecisionGoal options could not be achieved at k == 500.`. > > So I decided to decrease the StepSize (which means increasing the > number of grid points, right?) by > MaxStepSize->0.01 which results in the warnings: > > NDSolve::eerri: Warning: Estimated initial error on the specified > spatial grid in the direction of independent variable \[CurlyPhi] > exceeds prescribed error tolerance > NDSolve::ndtol: Tolerances requested by the AccuracyGoal and > PrecisionGoal options could not be achieved at k == 500.` > > Could someone please explain to me what is a meaningful strategy in > such a case? > A further question: does MaxStepSize change the number of grid points > used in the computation? How can I tell Mathematica how much > GridPoints I want to use? > > Here's the concrete example (copy- and paste-able into notebook): > > > T = 45 > mu = 254 > g = 3.2 > > sol = NDSolve[{k*D[U[k, \[CurlyPhi]], k] == > k^5/(12*\[Pi]^2)*(3/Sqrt[ > k^2 + 2*D[U[k, \[CurlyPhi]], \[CurlyPhi]]]* > Coth[Sqrt[k^2 + 2*D[U[k, \[CurlyPhi]], \[CurlyPhi]]]/(2*T)] + > 1/Sqrt[k^2 + 2*D[U[k, \[CurlyPhi]], \[CurlyPhi]] + > 4*\[CurlyPhi]*D[U[k, \[CurlyPhi]], {\[CurlyPhi], 2}]]* > Coth[Sqrt[ > k^2 + 2*D[U[k, \[CurlyPhi]], \[CurlyPhi]] + > 4*\[CurlyPhi]*D[U[k, \[CurlyPhi]], {\[CurlyPhi], 2}]]/( > 2*T)] - (2*3*2)/Sqrt[ > k^2 + g^2*\[CurlyPhi]]*(Tanh[( > Sqrt[k^2 + g^2*\[CurlyPhi]] - mu)/(2*T)] + > Tanh[(Sqrt[k^2 + g^2*\[CurlyPhi]] + mu)/(2*T)])), > U[500, \[CurlyPhi]] == 10/4*\[CurlyPhi]^2}, > U, {k, 1, 500}, {\[CurlyPhi], 1600, 2500}, PrecisionGoal -> 18, > AccuracyGoal -> 10] > > > Thank you, > Martin > > Some general comments: Have a look in the tutorial/NDSolvePDE that has a section on Controlling the Spatial Grid Selection. That might be helpful. Also you could change your g = 3.2 to g = 16/5; There is also a message about insufficient boundary conditions. Adding some U[k,1600] and U[k,2500] would be good. I hope this gets you started. Oliver
- References:
- Options for DSolve
- From: Martin <mgrahl@gmx.net>
- Options for DSolve