FixedPoint

FixedPoint[f,expr]

starts with expr, then applies f repeatedly until the result no longer changes.

Details and Options

  • FixedPoint[f,expr,n] stops after at most n steps.
  • 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 allclose all

Basic Examples  (3)

Find a value such that :

Fixed point of an integer-valued function:

Repeated application of a rule until the result no longer changes:

Scope  (2)

Numerical fixed point of a function:

Fixed point of a repeated transformation:

Generalizations & Extensions  (1)

Stop after at most 10 steps:

Options  (2)

SameTest  (2)

Stop as soon as successive iterations differ by less than :

Perform exact arithmetic, but use a numerical comparison function:

Applications  (8)

Find using Newton's method:

Fixed point of a complex iteration:

Matrix-multiplication convergence:

Root of the current directory tree (the result will depend on computer system):

Repeated differentiation:

Find the minimum of with the steepest-descent method (vector notation):

Component notation:

Evaluate combinators [more info]:

Connected components in a graph:

Properties & Relations  (3)

FixedPoint gives the last element of FixedPointList:

Apply rules repeatedly until the result no longer changes using ReplaceRepeated (//.):

FixedPoint is equivalent to a particular choice of arguments of NestWhile:

Possible Issues  (2)

Calculations may not converge in a finite number of steps:

Providing a maximum number of iterations will guarantee termination:

Using a numerical test for convergence works in this case as well:

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:

Introduced in 1988
 (1.0)
 |
Updated in 1996
 (3.0)