MathGroup Archive 1998

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

Search the Archive

Re: Question on Nest[]


Wagner,
I think a lot depends on what you need (and what you mean by efficient).
Since you obviously want numerical results, the first choice for me
would be to use NSum. It's not very fast but has checks built in which
make you feel better than trying to invent your own formula. If this
turns out to lame for your needs, try FunctionInterpolation (you better
define f by something like f[m_?NumericQ]:=...). I checked it for the
interval [0,2] and it was good for some 5 digits. If this is too low in
precision, use the options on NSum and on FunctionInterpolation. 

Jurgen


Wagner Truppel wrote:
> 
> Howdy,
> 
> 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??
> 
> Thanks in advance for any help.
> 
> Wagner



  • Prev by Date: Re: nice Gotcha!
  • Next by Date: Re: What's wrong in this plot?
  • Previous by thread: Question on Nest[]
  • Next by thread: Re: Question on Nest[]