Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Programming / Functional Programming  /
Nest

  • 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.

    In[1]:=

    Out[1]=

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

    In[2]:=

    Out[2]=

    See the Further Examples for NestList.


    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.