About Rational Number (PEP 239/PEP 240)

Fredrik Johansson fredrik.johansson at gmail.com
Sat Dec 15 16:55:49 EST 2007


On Dec 15, 2007 10:05 PM, Lie <Lie.1296 at gmail.com> wrote:
> Random ramble past here:
> Actually, my vision would be not only fractions, but also rooted
> number (square root, cube root, etc), it could be possible to
> implement a type where a number consist of a rooted number times a
> multiplier plus a variable [a + b * root(c, d)]. But I guess this
> would be extremely complex and it requires nesting, probably very slow
> if implementation isn't good. The advantage of using such is much
> faster operations, as long as str() is not called. This actually
> reflects my way of doing paper math, I save the lossy operations
> (float division, root, trigonometric function) until the very end of
> calculation (I'm not fundamentalist though, so compromise sometimes is
> done here and there).

You're looking for a computer algebra system. Try sympy:
http://code.google.com/p/sympy/

Fredrik



More information about the Python-list mailing list