MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NestList

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50570] Re: NestList
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Fri, 10 Sep 2004 04:06:33 -0400 (EDT)
  • References: <chpa26$jt6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You need to carry the counter along as part of the nesting process.

For instance

NestList[{#1[[1]] + 1, function[#1[[2]]]} & , {0, expr}, 5]

gives

{{0, expr},{1, function[expr]}, {2, function[function[expr]]}, {3, 
function[function[function[expr]]]}, {4,
function[function[function[function[expr]]]]}, {5, 
function[function[function[function[ function[expr]]]]]}}

Steve Luttrell

"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
> 



  • Prev by Date: Re: NestList
  • Next by Date: Re: NestList
  • Previous by thread: Re: NestList
  • Next by thread: Re: NestList