Re: NestList

*To*: mathgroup at smc.vnet.net*Subject*: [mg61462] Re: NestList*From*: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>*Date*: Wed, 19 Oct 2005 02:17:23 -0400 (EDT)*Organization*: Uni Leipzig*References*: <dj264l$b6h$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, and something like f[Sequence @@ Reverse[Take[l1,-2]]] will not do it ?? Regards Jens "Dr A.H. Harker" <a.harker at ucl.ac.uk> schrieb im Newsbeitrag news:dj264l$b6h$1 at smc.vnet.net... | Dear All, | | I suspect I have missed something, but what I would really like is | a function similar to NestList, but where I can specify a function f that | takes more than one argument. Then, if at any step of the new function the | list of previous results is ll, whereas NestList will append to ll | f[ll[[-1]]], the new function would return f[ll[[-1]],ll[[-2]]...]. | | Of course I can do this with the existing NestList, but as far as I can | see only by defining my f to work with a list {last,lastbutone,...}, in | which case I end up storing a lot of duplicate information in the | accumulated list. | | The particular application I have in mind is a simple finite difference | solution of the wave equation, where I might want to use NestList rather | than Nest so that I can animate the results. If the simulation involves two | spatial dimensions, storing duplicate copies of the information is a | significant problem. In fact in my application it's better to collect the | animation frames at rather lower frequency than they are calculated, to get | a reasonable compromise between accuracy and visual impact, so I tend not to | use NestList, but might this extension be useful in other areas. Or have I | just missed a clever trick? | | Tony Harker | Department of Physics and Astronomy | University College London | Gower Street | LONDON | WC1E 6BT | (44)(0)207 679 3404 | a.harker at ucl.ac.uk | | |