mpmath puzzle
Fredrik Johansson
fredrik.johansson at gmail.com
Wed Nov 14 14:45:43 EST 2007
On Nov 14, 2007 8:21 PM, <kyosohma at gmail.com> wrote:
> You could also use the Decimal module to keep things accurate. Some
> people like numpy or scipy for the more complex math problems they do.
Unlike mpmath, the decimal module doesn't support non-integer powers
(except for square roots), and nor does gmpy (though you can do them
indirectly as mensanator showed earlier in the thread). And numpy /
scipy don't support arbitrary-precision floats.
Now, if you really want exact arithmetic, SymPy is the winner:
>>> from sympy import *
>>> x = 1234 ** Rational('10.9')
>>> x
8187505353567209228244052427776*1234**(9/10)
>>> x / 1234**10
1234**(9/10)
>>> x.evalf()
4.958327864815504147741523444E+33
Fredrik
More information about the Python-list
mailing list