Help with sympy, please
Dick Moores
rdm at rcblue.com
Sun Nov 18 20:23:35 EST 2007
At 04:26 PM 11/18/2007, Fredrik Johansson wrote:
>Basically, sympy.numerics is an old version of mpmath. The
>sympy.numerics module is not very well integrated in SymPy, slower
>than mpmath, and has a couple bugs that have subsequently been fixed
>in mpmath. In sympycore (http://code.google.com/p/sympycore/), we're
>using the latest version of mpmath and integrating it directly into
>the symbolic engine; it will be much more robust and user-friendly. It
>will hopefully not be long until we merge the improvements we've done
>in the sympycore project with the main SymPy branch.
>
>Fredrik
OK, I tried mpmath again, and to my surprise, it went well!
===================================
#!/usr/bin/env python
#coding=utf-8
from mpmath import *
mpf.dps = 50
n = 1
k = 0
prod = mpf(1)
while k < 100000:
k += 1
term = exp(1.0/n)/exp(1.0/(n+1))
prod *= term
n += 2
print prod, term
======================================
Output:
1.9999950000187499635016028080844735182389158683797
1.0000000000250001250004074790133889386806610626172
Thanks,
Dick
More information about the Python-list
mailing list