first X digits of pi
Jabba Laci
jabba.laci at gmail.com
Fri Apr 13 15:34:06 EDT 2012
Hi,
Thanks for the answers. Gibbons' algorithm (from 2006) is a nice way
to generate the digits one after the other. However, it can get slow.
The mpmath approach is very fast, I think I will use that one. In a
script you can get the value of pi as a string with
str(mp.pi)
Best,
Laszlo
On Fri, Apr 13, 2012 at 15:56, Emanuel Woiski <woiski at gmail.com> wrote:
> Easy. Use mpmath (alone or under sympy):
>
>>>> from sympy.mpmath import mp
>>>> mp.dps = 200000
>>>> +mp.pi
>
> ... and there you are: 200000 digits of pi :)
>
> regards
> woiski
>
>
More information about the Python-list
mailing list