MathGroup Archive 1995

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

Search the Archive

Re: Re: question about nest

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1973] Re: [mg1961] Re: question about nest
  • From: Lou Talman <me at talmanl.mscd.edu>
  • Date: Wed, 30 Aug 1995 01:51:02 -0400

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

Seems to me the easiest thing to do is:

Clear[f, a, x]
f[x_] := a x (1 - x)

The use of SetDelayed in the definition of the function 'f' assures that  
the current value of 'a' will always be used when 'f[x]' is evaluated.   
Now assign the desired value to the variable 'a' and apply Nest or
NestList:

NestList[f, x, n]

--Lou Talman


  • Prev by Date: how to use ListDensityPlot
  • Next by Date: Re: Plotting Piecewise Functions with Discontinuites
  • Previous by thread: Re: question about nest
  • Next by thread: Bug in NonlinearFit.m