## `fp::nest` -- repeated composition of function

#### Introduction

`fp::nest``(f,n)` returns the `n`-fold repeated composition of the function `f`.

#### Call(s)

`fp::nest(f, n)`

#### Parameters

`f` | - | function
`n` | - | nonnegative integer

#### Returns

A function.

#### Related Functions

`_fconcat`, `_fnest`, `fp::nestvals`

#### Details

- `fp::nest``(f,n)` returns the `n`-fold repeated composition of the function `f`.
- Thus, given the function `f`, `fp::nest` returns the identity function `id` if `n` is 0 and otherwise the function

      f @ f @...@ f

  `n`-fold repeated.
- Note that `fp::nest` is obselete, one should use the `@@` operator or its functional form `_fnest` instead. It is only supported for compatibility with former versions of MuPAD.

#### Example 1

Apply the 3-fold repeated composition of `f` to `x`:

    >> fp::nest(f, 3)(x)

                                    f(f(f(x)))

#### Example 2

Numerically finding a fixed point of the function `cos` by repeated application:

    >> p :=fp::nest(cos, 100)(1.0):
       p, cos(p)

                            0.7390851332, 0.7390851332

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000