Re: Beginners Question - Series list problem
- To: mathgroup at smc.vnet.net
- Subject: [mg35681] Re: [mg35636] Beginners Question - Series list problem
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Thu, 25 Jul 2002 04:46:36 -0400 (EDT)
- References: <200207240605.CAA28634@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I wish you could be more specific about the dependency between succesive members of the list. But, suppose there is a function, say f, such that x(n), the n-th element, is equal to f[x(n-1)] for each n. Then, given x(1), the element x(n) is obtained with a function called Nest (see The Book or the on-line Help). In other words, if the situation is such that (using ordinary notation) x(2) = f[x(1)]; x(3) = f[x(2)] = f[f[(x1)]]; ... x(n) = f[f[...f[x(1)]...] , then in Mathematica notation (assume x1 = x(1)): xn = Nest[f, x1, n] If you want to show all the elements, use NestList. If, on the other hand, the function depends on n, use Fold or FoldList (q.v.). These are extremely important and powerful concepts which belong to the realm of functional programming, and you'd be well advised to devote a few hours to become familiar with them. Tomas Garza Mexico City ----- Original Message ----- From: "Baz" <bazcor at tiscali.co.uk> To: mathgroup at smc.vnet.net Subject: [mg35681] [mg35636] Beginners Question - Series list problem > I am trying to generate a list of numbers where the number being > calculated is dependant on the previous list member. > > What I (think I) need is a function, like > SeriesTable[expr,{InitialValue,imax}] where IntitialValue will be the > first value in the list and expr will be evaluated on this value to > form the second value and so on Imax times. > > > My attempts to write such a function have failed miserably. Please > help ... Barry >
- References:
- Beginners Question - Series list problem
- From: Baz <bazcor@tiscali.co.uk>
- Beginners Question - Series list problem