FixedPoint[f,expr]
starts with expr, then applies f repeatedly until the result no longer changes.
FixedPoint[f,expr,n]
stops after at most n steps.
FixedPoint
FixedPoint[f,expr]
starts with expr, then applies f repeatedly until the result no longer changes.
FixedPoint[f,expr,n]
stops after at most n steps.
Details and Options
- FixedPoint always returns the last result it gets.
- You can use Throw to exit from FixedPoint before it is finished.
- FixedPoint[f,expr] applies SameQ to successive pairs of results to determine whether a fixed point has been reached.
- FixedPoint[f,expr,…,SameTest->s] applies s to successive pairs of results.
Examples
open all close allBasic Examples (3)
FixedPoint[(# + 2 / #) / 2&, 1.]Sqrt[2.]Fixed point of an integer-valued function:
NestList[1 + Floor[# / 2]&, 1000, 20]FixedPoint[1 + Floor[# / 2]&, 1000]Repeated application of a rule until the result no longer changes:
FixedPoint[# /. {a_, b_} /; b ≠ 0 -> {b, Mod[a, b]}&, {28, 21}]GCD[28, 21]Scope (2)
Generalizations & Extensions (1)
Options (2)
SameTest (2)
Stop as soon as successive iterations differ by less than
:
FixedPoint[(# + 2 / # ) / 2&, 1`20, SameTest -> (Abs[#1 - #2] < 1*^-10&)]FixedPoint[(# + 2 / # ) / 2&, 1, SameTest -> (Abs[#1 - #2] < 1*^-10&)]Perform exact arithmetic, but use a numerical comparison function:
FixedPoint[(# + 2 / #) / 2&, 1, SameTest -> (Equal[N[#1], N[#2]]&)]Applications (8)
FixedPoint[(# + 2 / # ) / 2&, 1.0]Fixed point of a complex iteration:
FixedPoint[Log, 1.0 + I]Matrix-multiplication convergence:
MatrixForm[FixedPoint[{{0.51, 0.49}, {0.49, 0.51}}.#&, {{1, 0}, {0, 1}}]]Root of the current directory tree (the result will depend on computer system):
FixedPoint[ParentDirectory, Directory[]]FixedPoint[D[#, x]&, x ^ 10]Find the minimum of
with the steepest-descent method (vector notation):
With[{ϵ = 0.1}, FixedPoint[Function[xy, {2ϵ, 0} + {{1 - 2ϵ, 0}, {0, 1 - 2ϵ}}.xy], {1.0, 1.0}]]With[{ϵ = 0.1}, FixedPoint[Function[{x, y}, {x + 2 ϵ - 2 x ϵ, y - 2 y ϵ}]@@#&, {1.0, 1.0}, SameTest -> (Norm[Abs[#1 - #2]] < 10*^-10&)]]Evaluate combinators [more info]:
FixedPoint[# /. {s[x_][y_][z_] -> x[z][y[z]], k[x_][y_] -> x}&, s[s[s[s][s]]][s][s][k]]Connected components in a graph:
ConnectedNodes[list_, i_] := FixedPoint[Union[Flatten[{#, list[[#]]}]]&, {i}]ConnectedNodes[{{3, 2}, {4, 3}, {5, 4}, {1, 5}, {2, 1}}, 1]Properties & Relations (3)
FixedPoint gives the last element of FixedPointList:
FixedPointList[Function[x, (x + 2 / x) / 2], 1.0]FixedPoint[Function[x, (x + 2 / x) / 2], 1.0]Apply rules repeatedly until the result no longer changes using ReplaceRepeated (//.):
FixedPoint[# /. {a -> b, b -> c, c -> d}&, a ^ 2 + c ^ 3]a ^ 2 + c ^ 3 /. {a -> b, b -> c, c -> d}a ^ 2 + c ^ 3 //. {a -> b, b -> c, c -> d}FixedPoint is equivalent to a particular choice of arguments of NestWhile:
NestWhile[Function[x, (x + 2 / x) / 2], 1.0, UnsameQ, 2]Possible Issues (2)
Calculations may not converge in a finite number of steps:
TimeConstrained[FixedPoint[# / 3 + 1 / 4&, Interval[{0, 1}]], 1]Providing a maximum number of iterations will guarantee termination:
FixedPoint[# / 3 + 1 / 4&, Interval[{0, 1}], 50]Using a numerical test for convergence works in this case as well:
FixedPoint[# / 3 + 1 / 4&, Interval[{0, 1}], SameTest -> (SameQ[N[#1], N[#2]]&)]Convergence may fail in machine-precision computations due to oscillations in the final digits. Use a test function with a larger tolerance than SameQ to resolve this:
FixedPoint[Cos, 0.5, SameTest -> Equal]Tech Notes
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0)
Text
Wolfram Research (1988), FixedPoint, Wolfram Language function, https://reference.wolfram.com/language/ref/FixedPoint.html (updated 1996).
CMS
Wolfram Language. 1988. "FixedPoint." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/FixedPoint.html.
APA
Wolfram Language. (1988). FixedPoint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FixedPoint.html
BibTeX
@misc{reference.wolfram_2026_fixedpoint, author="Wolfram Research", title="{FixedPoint}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/FixedPoint.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_fixedpoint, organization={Wolfram Research}, title={FixedPoint}, year={1996}, url={https://reference.wolfram.com/language/ref/FixedPoint.html}, note=[Accessed: 13-June-2026]}