question about nest
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1947] question about nest
- From: Bob Hanlon <hanlonbo at sgate.com>
- Date: Sat, 26 Aug 1995 00:09:03 -0400
I recommend that you use a pure function.
Bob Hanlon
_______________
Table[ Nest[ g[#, a]&, x, n], {n, 0, 4} ] // TableForm
x
g[x, a]
g[g[x, a], a]
g[g[g[x, a], a], a]
g[g[g[g[x, a], a], a], a]
f[x_, a_] := a * x * (1 - x);
f[x_, a_, n_Integer] := Nest[ f[#, a]&, x, n ];
Table[ f[x, a, n], {n, 0, 4} ] // TableForm
x
a (1 - x) x
2
a (1 - x) x (1 - a (1 - x) x)
3 2
a (1 - x) x (1 - a (1 - x) x) (1 - a (1 - x) x (1 - a (1 - x) x))
4 2
a (1 - x) x (1 - a (1 - x) x) (1 - a (1 - x) x (1 - a (1 - x) x))
3
(1 - a (1 - x) x (1 - a (1 - x) x)
2
(1 - a (1 - x) x (1 - a (1 - x) x)))
> Newsgroups: comp.soft-sys.math.mathematica
> From: ORLANDO LUIS GOULART PERES <orlando at axp.ift.unesp.br>
> Subject: question about nest
> Message-ID: <DDsGrD.Gy6 at wri.com>
> Date: Thu, 24 Aug 1995 00:16:24 GMT
>
> 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