[SciPy-user] Can SciPy compute ln(640320**3 + 744)/163**.5 to 30 places?
fperez.net at gmail.com
Sat Jan 13 15:21:29 CST 2007
On 1/13/07, Dick Moores <rdmoores at gmail.com> wrote:
> On 1/13/07, A. M. Archibald <peridot.faceted at gmail.com> wrote:
> > It sounds like what you want is arbitrary-precision arithmetic, which
> > is not what scipy is for (see instead packages like clnum or dmath).
> OK, I tracked down clnum and installed it in Python 2.5. But it
> doesn't look as if I can use it for logarithms or non-integer
> exponents. Or can I? The only manual I could find is
> <http://calcrpnpy.sourceforge.net/clnumManual.html>. I was able to
> execute all the examples and got the same results, but...
MPFR is better than clnum for certain things (at least as of Feb'06,
when the SAGE guys did some detailed comparisons) but it's certainly a
very usable library, which I like a lot. Using it, your computation
can be easily done (here I requested 50 digits, clnum gives a few more
probably because the inputs are exact integers):
In : import clnum as n
In : n.set_default_precision(50)
In : n.log(640320**3 + 744)/n.sqrt(163)
Below is Mathematica's value for reference:
Mathematica 5.2 for Linux
Copyright 1988-2005 Wolfram Research, Inc.
-- Motif graphics initialized --
That looks pretty good to me.
Here's a comparison of the approximate formula with Pi itself:
Indeed, they match on the first 30 digits.
More information about the SciPy-user