upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

betainc broken with high precision #199

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

example with ipython:
In [92]: import mpmath
In [93]: mpmath.betainc(206, 385, 0, 0.45, True)
Out[93]: mpf('0.99999973625260485')
In [94]: mpmath.betainc(206, 385, 0, 0.55, True)
Out[94]: mpf('1.0')
In [95]: mpmath.mp.prec=150
In [96]: mpmath.betainc(206, 385, 0, 0.55, True)
Out[96]: mpf('0.0')

What version of the product are you using? On what operating system?

mpmath 0.15, MacOSX 10.6.4, Python 2.6.4, gmp 5.0.1

Original issue reported on code.google.com by thomas.t...@gmail.com on 29 Aug 2010 at 11:24

GoogleCodeExporter commented 9 years ago
Thanks a lot for the bug report! I've tracked this down (probably) to a typo in 
the hypergeometric summation code that causes the wrong precision to be tested 
for. Fixing it breaks some tests, so I will have to do further checks before I 
can commit a fix.

Original comment by fredrik....@gmail.com on 30 Aug 2010 at 6:21

GoogleCodeExporter commented 9 years ago
Ok, the origin of this bug should be fixed in r1188. In particular:

>>> mpmath.mp.prec=150
>>> mpmath.betainc(206, 385, 0, 0.55, True)
mpf('0.99999999999999999999996570910644857895771110663')

Original comment by fredrik....@gmail.com on 30 Aug 2010 at 6:50