Re: Bug with Hypergeometric2F1?
- To: mathgroup at smc.vnet.net
- Subject: [mg99422] Re: [mg99384] Bug with Hypergeometric2F1?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 5 May 2009 05:43:41 -0400 (EDT)
- Reply-to: hanlonr at cox.net
It is a numerical precision problem
vol1[n_, k_] = Sum[Binomial[n, i], {i, 0, k}]
2^n - Binomial[n, k + 1]*Hypergeometric2F1[1, k - n + 1, k + 2,
-1]
vol1 @@@ {{1000, 1}, {1000, 1.}, {1000., 1}, {1000., 1.}}
{1001, 5.28426328596665*^288, 5.28426328596665*^288,
5.28426328596665*^288}
Increase the numerical precision of the input
vol1 @@@ {{1000, 1}, {1000, 1.`400},
{1000.`400, 1}, {1000.`400, 1.`400}} // Round
{1001,1001,1001,1001}
Or change the function definition to force precision
vol1[n_, k_] := Sum[Binomial[Rationalize[n, 0], i],
{i, 0, Rationalize[k, 0]}]
vol1 @@@ {{1000, 1}, {1000, 1.}, {1000., 1}, {1000., 1.}}
{1001,1001,1001,1001}
Bob Hanlon
---- irchans <infinitgames at yahoo.com> wrote:
=============
When I run this code:
vol1[n_, k_] = Sum[ Binomial[n, i], {i, 0, k}]
vol1[1000, 1]
vol1[1000, 1.]
I get
Out[1] = 1001
Out[2] = 7.12935*10^288
I am running Mathematica 7.0.0 on windows 2000. Does anyone else have
this problem?
- Follow-Ups:
- Re: Re: Bug with Hypergeometric2F1?
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Bug with Hypergeometric2F1?