MaxSteps
Examples
open all close allBasic Examples (2)
Stop integration after 25 steps:
sol = NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, 0, ∞}, MaxSteps -> 25]Allow integration to go to completion without any restriction on the number of steps:
sol = NDSolve[{y''[x] + x y[x] == 0, y[0] == 1, y'[0] == 0}, y, {x, 0, 200}, MaxSteps -> ∞]Plot the solution in the phase plane:
ParametricPlot[Evaluate[{y[x], y'[x]} /. First[sol]], {x, 0, 200}, ColorFunctionScaling -> False, ColorFunction -> Function[Hue[#3 / 200]], AspectRatio -> 1]Applications (1)
See how method order affects integration interval with a limited number of steps:
TableForm[Quiet[Table[sol = First[x /. NDSolve[{x''[t] + x[t] == 0, x[0] == 1, x'[0] == 0}, x, {t, ∞}, MaxSteps -> 1000, Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> order}]];
end = sol[[1, 1, 2]];
{order, end, sol[end] - Cos[end]}, {order, 3, 8}]], TableHeadings -> {{}, {"Method order", "Interval Length", "Error"}}]Properties & Relations (1)
MaxSteps is roughly equivalent to an event with a step counter:
esol = Block[{evals = 0}, NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, 0, ∞}, Method -> {"EventLocator", "Event" :> ++evals - 28, "EventLocationMethod" -> "StepEnd"}]]The event function is evaluated a few extra times during initialization:
sol = NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, 0, ∞}, MaxSteps -> 25]History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), MaxSteps, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxSteps.html.
CMS
Wolfram Language. 1991. "MaxSteps." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MaxSteps.html.
APA
Wolfram Language. (1991). MaxSteps. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxSteps.html
BibTeX
@misc{reference.wolfram_2026_maxsteps, author="Wolfram Research", title="{MaxSteps}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/MaxSteps.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_maxsteps, organization={Wolfram Research}, title={MaxSteps}, year={1991}, url={https://reference.wolfram.com/language/ref/MaxSteps.html}, note=[Accessed: 12-June-2026]}