Re: NestList
- To: mathgroup at smc.vnet.net
- Subject: [mg50583] Re: NestList
- From: p-valko at tamu.edu (Peter Valko)
- Date: Sat, 11 Sep 2004 06:44:33 -0400 (EDT)
- References: <chpa26$jt6$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nemrata, I am suggesting a solution: fun1[x_,n_]:=(Print["now I know that n=",n];fun[x]); Last[FoldList[fun1,x,Range[3]]] now I know that n= 1 now I know that n= 2 now I know that n= 3 fun[fun[fun[x]]] Peter Namrata Khemka <namrata.khemka at gmail.com> wrote in message news:<chpa26$jt6$1 at smc.vnet.net>... > Hello everyone, > > I have a question regarding NestList function. > > I am applying a function on the expression n times. > > NestList [function, expr, n] > > However in my function I would like to know what is the current value > of n. In other words I would like to know what iteration it is on. > > Is this possible? > > Thanks in advance. > > Namrata Khemka