Re: question about nest
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1942] Re: question about nest
- From: Albright <albright at physics.ucla.edu>
- Date: Wed, 23 Aug 1995 22:33:38 -0400
- Organization: UCLA Department of Physics and Astronomy
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 > > Hi. You might try something like: h[n_] := Nest[g,x,n] //. g[x_] -> f[x,a] For example: In[1]:= h[n_] := Nest[g,x,n] //. g[x_] -> f[x,a] In[2]:= h[3] Out[2]:= f[f[f[x,a],a],a] Regards. -Brian Brian J. Albright Department of Physics and Astronomy, UCLA albright at physics.ucla.edu http://bohm.physics.ucla.edu/~albright