options in NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg46217] options in NDSolve
- From: Guibout <guibout at ifrance.com>
- Date: Thu, 12 Feb 2004 07:15:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I use NDSolve several times in one of my programs and therefore I want
to define a variable called method that stores the options I want to
use. Here is what I did:
option = MidPoint;
Choose[option,
"MidPoint", method = {Method -> {"FixedStep", Method ->
LinearlyImplicitMidpoint}, StartingStepSize -> 0.01, MaxSteps -> Infinity},
"IRK", method = {Method -> ImplicitRungeKutta, MaxSteps -> Infinity},
"IRK4", method = {Method -> {"ImplicitRungeKutta", DifferenceOrder ->
4}, StartingStepSize -> 0.01, MaxSteps -> Infinity},
"ERK", method = {Method -> {"ExplicitRungeKutta", DifferenceOrder ->
4}, MaxSteps -> Infinity},
"Standard", method = {MaxSteps -> Infinity, MaxStepSize -> 0.1}];
solution=NDSolve[equations,variables,method];
You can copy and paste this code and you will see that it does not work.
Indeed, method does not contain what I expect:
In[3]:= method
Out[3]={MaxSteps->Infinity, MaxStepSize->0.1}
Mathematica seems to combine StartingStepSize->0.01 and FixedStep to
obtain MaxStepSize->0.1 and drop Method->LinearlyImplicitMidPoint.
Why does mathematica behave like that? Is there another way to do what I
want to do?
Thanks in advance,
Vincent