({{, (RefLink[MaxStepSize, paclet:ref/MaxStepSize]) 
is an option to functions like (RefLink[NDSolve, paclet:ref/NDSolve]) that specifies the maximum size of a single step used in generating a result.}})

OpenersNotesSection(Spacer1)Details

(RefLink[MaxStepSize, paclet:ref/MaxStepSize])->(RefLink[Infinity, paclet:ref/Infinity]) allows an unlimited step size.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Keep the largest step taken by (RefLink[NDSolve, paclet:ref/NDSolve]) to be 0.01:

NDSolve[{x''[t]+x[t]==Exp[-1000(t-π)^2],x[0]==x'[0]==0},x,{t,0,20},MaxStepSize->0.01]

Plot[Evaluate[First[x[t]/.%]],{t,0,20}]

OpenersExampleSection2(Spacer1)Applications  (2)

The default step control may miss a suddenly varying feature:

Plot[Evaluate[(y[x]/.NDSolve[{y''[x]+(1+Sech[1000 (x-Pi)]) y[x]==0,y[0]==1,y'[0]==0},y,{x,0,10}])-Cos[x]],{x,0,10}]

A smaller (RefLink[MaxStepSize, paclet:ref/MaxStepSize]) setting ensures that (RefLink[NDSolve, paclet:ref/NDSolve]) catches the feature:

Plot[Evaluate[(y[x]/.NDSolve[{y''[x]+(1+Sech[1000 (x-Pi)]) y[x]==0,y[0]==1,y'[0]==0},y,{x,0,10},MaxStepSize->0.01])-Cos[x]],{x,0,10}]

Attempting to compute the number of positive integers less than (e^5) misses several events:

Block[{n=0},NDSolve[{y'[t]==y[t],y[-1]==(E^(-1))},y,{t,5},Method->{"EventLocator","Event"->Sin[π y[t]],"EventAction":>n++}];n]

Setting a small enough (RefLink[MaxStepSize, paclet:ref/MaxStepSize]) ensures that none of the events are missed:

Block[{n=0},NDSolve[{y'[t]==y[t],y[-1]==(E^(-1))},y,{t,5},
MaxStepSize->0.001,Method->{"EventLocator","Event"->Sin[π y[t]],"EventAction":>n++}];n]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

For a length l, (RefLink[MaxStepFraction, paclet:ref/MaxStepFraction])->f is equivalent to (RefLink[MaxStepSize, paclet:ref/MaxStepSize])->(f l):

msf=NDSolve[{y''[x]+(1+Sech[1000 (x-Pi)]) y[x]==0,y[0]==1,y'[0]==0},y,{x,0,10},MaxStepFraction->1/1000]

mss=NDSolve[{y''[x]+(1+Sech[1000 (x-Pi)]) y[x]==0,y[0]==1,y'[0]==0},y,{x,0,10},MaxStepSize->10 1/1000]

msf===mss

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[MaxStepFraction, paclet:ref/MaxStepFraction])  ▪  (RefLink[NDSolve, paclet:ref/NDSolve])  ▪  (RefLink[MaxSteps, paclet:ref/MaxSteps])}})}})