fp::nest -- repeated composition of
function
Introductionfp::nest(f,n) returns the
n-fold repeated composition of the function
f.
Call(s)fp::nest(f, n)
Parametersf |
- | function |
n |
- | nonnegative integer |
ReturnsA function.
Related
Functions_fconcat, _fnest, fp::nestvals
Detailsfp::nest(f,n) returns the
n-fold repeated composition of the function
f.f, fp::nest
returns the identity function id if n is 0 and otherwise
the function
f @ f @...@ f
n-fold repeated.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
1Apply the 3-fold repeated composition of f
to x:
>> fp::nest(f, 3)(x)
f(f(f(x)))
Example
2Numerically 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