Re: Question on Nest[]
- To: mathgroup at smc.vnet.net
- Subject: [mg15033] Re: [mg15006] Question on Nest[]
- From: BobHanlon at aol.com
- Date: Wed, 9 Dec 1998 04:12:19 -0500
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 12/5/98 3:09:50 AM, wtruppel at uci.edu writes:
>I'm (still) trying to evaluate the sum
>
>f[m_] := E^(-m) Sum[ m^i Sqrt[i] / i!, { i, 1.0, Infinity } ]
>
>in an efficient way. I tried compiling this expression, but Mathematica
>
>refused to compile i!. I then replaced i! by Gamma[i+1.0], but then I
>get compilation errors due to the arbitrary precision nature of the
>computation. Finally, I decided to try someting based on the identity:
>
>Sum[ m^i Sqrt[i] / i!, { i, 1.0, n } ] = m/1 ( Sqrt[1] + m/2 ( Sqrt[2]
>+
>m/3 ( Sqrt[3] + ... + Sqrt[n] ) ) ) )
>
>So I tried
>
>i = 0.0;
>Expand[ Nest[ ( i++; m/i ( Sqrt[i] + # ) )&, 0, n ] ]
>
>but it doesn't produce the correct polynomial in m. What am I missing??
>
Wagner,
For the alternate expansion, the series needs to be built from the other
direction.
f[m_, n_:10] := Module[{i = n + 1},
E^-m Nest[( i--; m/i (Sqrt[i] + # ))&, 0, n]]
And @@ (Table[f[m, n] == E^-m Sum[m^i Sqrt[i]/i!,
{i, n}], {n, 10}]//Simplify)
True
Bob Hanlon