Re: Simple Recursive Map
- To: mathgroup at smc.vnet.net
- Subject: [mg35434] Re: [mg35398] Simple Recursive Map
- From: Murray Eisenberg <murraye at attbi.com>
- Date: Fri, 12 Jul 2002 04:28:53 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200207110924.FAA02123@smc.vnet.net>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
You program it essentially the way you said it, just converting to Mathematica notation for everything and using n on the left-hand sides of the recurrence relations instead of n + 1: Clear[x, y] x[n_] := x[n] = y[n - 1] - a x[n - 1]^2 - 1 y[n_] := y[n] = b x[n - 1] x[0] = 1.; y[0] = -1.; a = 0.02; b = 1/3.; {x[49], y[49]} {-1.57436, -0.524786} Notice the (highly recommended) use of "caching" the values -- the subexpressions x[n_] := x[n] = and similarly for y -- in the recurrence relations in order to speed up the calculations. Without that, Mathematica doesn't "remember" the values of x and y when it calculates them and has to re-calculate them for each subsequent evaluation. Reuben wrote: > > I have the map > > x_n+1=y_n-a*(x_n)^2 - 1 > y_n+1=b*x_n > > If I specify a,b, x_0 and y_0, how can I make Mathematica iterate > through this numerically to give me x_50 and y_50? > > Thanks > Reuben -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street Amherst, MA 01375
- References:
- Simple Recursive Map
- From: Reuben <reubengann@hotmail.com>
- Simple Recursive Map