[Python-ideas] Complex rationals in Python.
Rocco Orlando Rossi
rocco.rossi at gmail.com
Mon Nov 24 21:01:15 CET 2008
I appreciate the inclusion of the fractions module in Python 2.6 and
therefore in Python 3.0. But I feel there's something missing: no
possibility for complex rationals (or arbitrary precision) integers. I
was just checking the complex number support in Python, compared, for
instance, to Common Lisp and Scheme, and I realized that there was
this subtle omission. The inclusion of rationals and arbitrary
integers is cool, but the numeric tower (say, compared to Scheme) is
not complete. I don't think there would be a performance hit if
complex rationals were provided. Ordinary operations on complex
floats, in theory, should not be affected and handled separately. But
it would be nice to be able to do:
(3/4 + 1/2j) * (1/4 - j) = 11/16 - 5/8j
with no loss of precision.
Python is heavily used in math and science all over the world. We've
even got a recent symbolic math project (sympy) that looks very
promising, so I guess this could be an important issue.
Note: there exists a library that implements what I'm talking about:
but still I personally would have liked to see this stuff included
natively in the new Python 3.0.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas