Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

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?




  • Prev by Date: Re: problems with DSolve
  • Next by Date: Re: why does DownValues not return all downvalues for a
  • Previous by thread: Re: Bug with Hypergeometric2F1?
  • Next by thread: Re: Re: Bug with Hypergeometric2F1?