is an option that specifies the maximum number of iterations that should be tried in various built-in functions and algorithms.
MaxIterations
is an option that specifies the maximum number of iterations that should be tried in various built-in functions and algorithms.
Details
- MaxIterations->Infinity specifies that there should be no limit.
Examples
open all close allBasic Examples (2)
Scope (2)
MaxIterations can be infinite:
TimeConstrained[ReplaceRepeated[x, x -> x + 1, MaxIterations -> Infinity], 1]Limit or increase the number of steps taken with MaxIterations:
FindRoot[Exp[1 / (x ^ 2 - 1)] - 10 ^ -8, {x, .1}, MaxIterations -> 10]The default number of iterations for FindRoot is 100:
FindRoot[Exp[1 / (x ^ 2 - 1)], {x, .1}]Eventually the algorithm stalls out since this mollifier function has all derivatives 0 at
:
FindRoot[Exp[1 / (x ^ 2 - 1)], {x, .1}, MaxIterations -> 1000]Applications (1)
Use a limited number of iterations to select candidates for a global minimum:
f[x_, y_] = Exp[Sin[50x]] + Sin[60Exp[y]] + Sin[70Sin[x]] + Sin[Sin[80y]] - Sin[10(x + y)] + (1/4)(x^2 + y^2);{b, bxy} = Quiet[First[Sort[MapThread[FindMinimum[f[x, y], {{x, #1}, {y, #2}}, MaxIterations -> 10]&, RandomReal[{-1, 1}, {2, 250}]]]]]Find the minimum to 10 digits using arbitrary-precision arithmetic:
FindMinimum[f[x, y], {{x, x /. bxy}, {y, y /. bxy}}, WorkingPrecision -> 20]This can be done automatically with NMinimize:
NMinimize[f[x, y], {x, y}, Method -> {"RandomSearch", "SearchPoints" -> 250}, WorkingPrecision -> 20]History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), MaxIterations, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxIterations.html.
CMS
Wolfram Language. 1988. "MaxIterations." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MaxIterations.html.
APA
Wolfram Language. (1988). MaxIterations. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxIterations.html
BibTeX
@misc{reference.wolfram_2026_maxiterations, author="Wolfram Research", title="{MaxIterations}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/MaxIterations.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_maxiterations, organization={Wolfram Research}, title={MaxIterations}, year={1988}, url={https://reference.wolfram.com/language/ref/MaxIterations.html}, note=[Accessed: 13-June-2026]}