Comments (10)
Forgot to add: The call to the gamma function works on an Intel Centrino Duo Ubuntu
system (2.6.22-14-generic). I can't tell if the diffc test passes on the ubuntu
system, since it fails on the double_compatibility test.
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c1
Original author: https://code.google.com/u/110354057086964594182/
from mpmath.
The error in both cases occurs in the computation of coefficients for Spouge's approximation, but the problem seems to occur on a lower level.
Could you try running the tests with py.test? ( http://codespeak.net/py/ )
Also, could you try inserting the following modification into specfun.py, compute gamma(0.25), and post the log? This might help locate the problem.
def _calc_spouge_coefficients(a, prec): floatprec = prec + int(a*1.4) oldprec = mp.prec mp.prec = floatprec print "prec", prec print "mp.prec", mp.prec c = [0] \* a b = exp(a-1) e = exp(1) print "b", repr(b) print "b._mpf_", b._mpf_ print "e", repr(e) c[0] = _fix(sqrt(2_pi), prec) print "c0", repr(c[0]) for k in range(1, a): print "\nk", k tmp1 = ((-1)__(k-1) \* (a-k)_*k) print "tmp1", tmp1 c[k] = _fix(tmp1 \* b / sqrt(a-k), prec) print "b before", b._mpf_ print "e_k", (e_k)._mpf_ b = b / (e \* k) print "b after", b._mpf_ mp.prec = oldprec return c
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c2
Original author: https://code.google.com/u/111502149103757882156/
from mpmath.
It seems like this is a bug in Python 2.4. See if it works with Python 2.5.
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c3
Original author: https://code.google.com/u/111502149103757882156/
from mpmath.
I found the same problem on Debian Linux 2.6.18-4-amd64 #1 SMP
It is a bug in the Python2.4 implementation (fixed in Python2.5) on this platform. The bug in question is that
> > > bctable[4503599627370496] > > > 0 > > > (also: > > > range(4)[4503599627370496] > > > 0 > > > ) > > > instead of throwing an IndexError, caught in fmuli to > > > execute bc += bitcount(n) - 4
Mario
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c4
Original author: https://code.google.com/u/107755593449647463741/
from mpmath.
Yes, thank you.
I've added a big notice about this on the front page. I'm probably going to close this issue with WontFix, as I really don't want to change the code in order to work around core bugs in Python. Who knows what other code this might break.
The best solution is to simply upgrade to Python 2.5.
However, further reports about this problem would still be useful (is Python 2.4 broken on all platforms or just this one)?
**Status:**
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c5
Original author: https://code.google.com/u/111502149103757882156/
from mpmath.
I have upgraded to python2.5, which fixes the bug for the Debian Linux (2.6.22-3-amd64 #1 SMP) system. The Ubuntu system I referenced in my appendix is also running python2.5. All tests now pass.
I should have included python version numbers in my original report, sorry!
Thanks for the very quick response!
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c8
Original author: https://code.google.com/u/110354057086964594182/
from mpmath.
Further testing on a Debian 2.6.15-1-k7 system, running Python 2.4.4. In this case,
the call to the gamma function works.
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c9
Original author: https://code.google.com/u/110354057086964594182/
from mpmath.
I have committed a simple test (changing the try-except to an if-else). Could someone with access to an affected system verify?
The question still remains, whether this ugly bug breaks any other code.
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c10
Original author: https://code.google.com/u/111502149103757882156/
from mpmath.
Now the tests pass on Debian 2.6.18-4-amd64.
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c11
Original author: https://code.google.com/u/107755593449647463741/
from mpmath.
Closing this issue, then.
**Status:** Fixed
Original comment: http://code.google.com/p/mpmath/issues/detail?id=26#c12
Original author: https://code.google.com/u/111502149103757882156/
from mpmath.
Related Issues (20)
- findpoly returning combination which is very far off HOT 2
- asinh returns incorrect results at complex infinities HOT 2
- Enhance autoprec function in mpmath library for precision control and early termination
- Better integration with numpy HOT 5
- Implement directed rounding in to_str()
- Random failures in CI on various PyPy versions: TypeError: expected some sort of stmt, but got <ast.Name/Load...
- Cross Product Function HOT 2
- Run mpmath as module (for interactive work)?
- log and log1p return incorrect results at complex infinities HOT 2
- sqrt returns incorrect results at complex infinities HOT 1
- Unable to compute mpmath.legenp(Even number, Odd number, 0) HOT 1
- mp.tanh and mp.tan return incorrect results at complex infinities HOT 2
- Manual zeta of Riemann diverges of "manual" implementation HOT 1
- mp.asin(z).imag and fp.asin(z).imag use inconsistent sign choices when z.real > 1 and z.imag==0 HOT 23
- mp.asin is inaccurate for small complex inputs HOT 3
- Poor result in log1p(complex) HOT 46
- mp.asin returns incorrect results at complex infinities HOT 8
- mpf shouldn't have __complex__ magic method
- mp.acot(cmath.infj) is mpc(real='nan', imag='nan'), should be 0
- Consider adding support for special numbers in almosteq()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpmath.