Tuesday, April 27, 2010

One way to use vector valued functions in Mathematica

Struggling with some homework recently, I needed to do iteration on vector valued functions to find fix points. One way to do this is to pass a list/vector with the components as function arguments, and return the list/vector valued result.

For example:

f[{x_, y_}] := {1.01 x - 3*10^-5*x*y, 0.98 y + 10^-5*x*y}


The fix point iteration can then be handled by FixedPointList:


FixedPointList[f, {1000, 100}, 1000]


Plotting the result componentwise:


ListLinePlot[{%%[[All, 1]], %%[[All, 2]]}]