Function iteration

• To: mathgroup at christensen.cybernetics.net
• Subject: Function iteration
• From: seligjm at vax.sbu.ac.uk
• Date: Wed, 02 Nov 1994 10:17:14 BST

```Andrew Laska writes:

>I need help with a table of iterated results.
>I have three discrete functions...
>x   =f(x ,y ,z )
> n+1    n  n  n

>y   =g(x ,y ,z )
> n+1    n  n  n

>z   =h(x ,y ,z )
> n+1    n  n  n

>I wish to iterate these functions such that I get a list that looks >like
>{x1,y1,z1},{x2,y2,z2},...{xn,yn,zn} where x1,y1,...,zn are the >numerical answers.

An easy way to do this is to define a "vector functinon" :

vf[q_]:={f@@q,g@@q,h@@q}

The requires result is now given by:

NestList[vf,{x0,y0,z0},n]

Using his example:
f[x_,y_]:=  1 - 1.4 * (x )^2 + y
g[x_,y_]:= .3 * x
then
vf[q_]:={f@@q,g@@q}
and finally:
NestList[vf,{0,0},10]

Out[4]= {{0, 0}, {1, 0}, {-0.4, 0.3}, {1.076, -0.12},
{-0.740886, 0.3228}, {0.554322, -0.222266},
{0.347552, 0.166297}, {0.997188, 0.104265},
{-0.287871, 0.299156}, {1.18314, -0.0863614},
{-1.0461, 0.354942}}

Jon Selig

```

• Next by Date: Mathematica materials for Chemistry
• Next by thread: Mathematica materials for Chemistry