Re: Bug with Hypergeometric2F1?
- To: mathgroup at smc.vnet.net
- Subject: [mg99544] Re: Bug with Hypergeometric2F1?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 7 May 2009 06:38:57 -0400 (EDT)
On 5/6/09 at 5:21 AM, akoz at mimuw.edu.pl (Andrzej Kozlowski) wrote:
>On 5 May 2009, at 18:40, Bill Rowe wrote:
>
>>If you want to use machine precision numbers you should be using
>>NSum rather than Sum. That is:
>>In[4]:= f[n_, k_] := NSum[Binomial[n, i], {i, 0, k}]
>>In[5]:= f[1000, 1.]
>>Out[5]= 1001.
>The supposed advantage of NSUm over Sum in this particular case is a
>mere illusion.
>g[n_, k_] := Sum[Binomial[n, i], {i, 0, k}]
>g[1000, 1.]
>1001
>Note that you are using SetDelayed while the original post has Set;
>hence the difference.
I don't believe your interpretation of what occurs is correct. I
am reasonably certain when you use Sum with machine precision
numbers a numerical estimate is made using the same code used by
NSum. That is, I believe the effect of using machine precision
numbers is to call NSum.
I used SetDelayed since Set cannot be used with NSum in this
example. With Set, Mathematica tries to evaluate the right hand
side which cannot be done since n and k are not defined at this point.
- Follow-Ups:
- Re: Re: Bug with Hypergeometric2F1?
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Bug with Hypergeometric2F1?