Previous Page Next Page Contents

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

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




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000