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

  • Nest[ f , expr , n ] gives an expression with f applied n times to expr.
  • Example: Nest[f, x, 3].
  • You can use Throw to exit from Nest before it is finished.
  • See the Mathematica book: Section 2.2.2.
  • See also: Fold, Function, FixedPoint, Do.

    Further Examples

    This nests the function f four times starting with initial value x.



    This iteration provides evidence that the sine function approaches its fixed point at zero very slowly.



    See the Further Examples for NestList.