This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Functional Programming  /

  • 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 always returns the last result it gets.
  • The option SameTest -> comp allows you to specify a comparison function to apply to successive pairs of results to determine whether a fixed point has been reached.
  • You can use Throw to exit from FixedPoint before it is finished.
  • See the Mathematica book: Section 2.2.2.
  • See also: FixedPointList, Nest, ReplaceRepeated.

    Further Examples

    This finds a fixed point of the cosine function.





    Although the function has a fixed point at zero (), it converges to this point very slowly. You can control the behavior of FixedPoint in this type of situation by relaxing the conditions under which it will terminate. In this example, FixedPoint will terminate after two successive results differ by less than 0.0001.



    With FixedPoint you can implement Newton's method in one line.





    The default stopping criterion for FixedPoint measures the closeness of successive approximations to one another, whereas the tests built into FindRoot (via the AccuracyGoal option) measure the closeness of the function evaluation to zero. By setting the SameTest option you could imitate the criterion of FindRoot. (The SameTest function doesn't have to be a comparision of two iterations: it can just test the most recent one for some property.)