       Specify Step Size in NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg44643] Specify Step Size in NDSolve
• From: andrea.knorr at engr.uconn.edu (Andrea)
• Date: Wed, 19 Nov 2003 04:59:09 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```I posted the following message Friday the 14th of November, but have
not yet seen it, so I apologize if you see this twice.

I am using NDSolve, and have run into an error with the step size it
is using.  I get errors at very small times.  Mathematica will
continue beyond this time point, but results are very inaccurate.

I have increased MaxSteps up to 10^7, and at this point my computer
runs out of memory and eventually calculations stop.  This option is
not useful if the step size Mathematica chooses is very small, no
matter how many steps you specify.  I have altered other step size
options (MaxStepSize, MaxStepFraction, StartingStepSize), but they
only let you choose the maximum step size or a starting step size.
Essentially, I want to do the opposite and specify a minimum step size
so that the step size does not decrease to a near-zero value and run
out of steps before reaching my final time point.  I have searched for

Below is some example code (vtime and ytime are lists of time points
specified elsewhere):

T=343824133;

titer[k_,delta_,n_,c_]:=

Module[{soln,y,v,valueslist,xtiter,ytiter},

soln=NDSolve[{
y'[t]== k v[t] T -delta y[t],
v'[t]== n delta y[t]-c v[t],
y==7016819, v== 2220151},
{y,v},{t,0,1500}, MaxSteps->{10^5}];

ytiter=Evaluate[y[ytime]/.soln];
vtiter=Evaluate[v[vtime]/.soln];

values=Table[Flatten[{ytiter, vtiter},1]];
values
];

calcs = titer[0.0297, 4.51, 46.38, 6.145]

NDSolve::mxst: Maximum number of steps reached at the point
t=0.3300736733965773

"InterpolatingFunction::dmval" Input value {26} lies outside the range
of data in the interpolating function. Extrapolation will be used.

Thanks,
Andrea Knorr