Re: question about nest
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1961] Re: question about nest
- From: Scott.A.Hill at williams.edu (Lancelot)
- Date: Sun, 27 Aug 1995 23:23:49 -0400
- Organization: Williams College, Williamstown MA
In article <DDsGrD.Gy6 at wri.com>, ORLANDO LUIS GOULART PERES <orlando at axp.ift.unesp.br> wrote: >Dear Wizards > >I have a function with two variables >f[x_,a_]:=a*x*(1-x) >And I need the n-compose function >Nest[f,x,n] >But Mathematica look for a function f[x] and not f[x,a] >Is this possible to use Nest with this two variable function? >For example, I need >f[x,a], f[f[x,a],a], f[f[f[x,a],a],a] . >Later I will put many values for "a" . >Regards >Orlando Peres This is inelegant, but the easiest way I see to do it is with the following: Nest[(g[x_]:=f[x,a];g),x,n] Be sure to Clear and Remove g when you are done with it, of course. I'll leave it to the real wizards to develop a more elegant solution. (Probably using Cases, Select, and MapIndexed, no doubt.:) / :@-) Scott \