Giter Club home page Giter Club logo

Comments (10)

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

pernici avatar pernici commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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.

pernici avatar pernici commented on May 18, 2024
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.

fredrik-johansson avatar fredrik-johansson commented on May 18, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.