Comment #3 on issue 2357 by [email protected]: bugs in
PythonRationalType
http://code.google.com/p/sympy/issues/detail?id=2357
Hi Mateusz,
Several bugs mentioned here are actually design decisions, e.g.:
print PythonRationalType(3)
3/1
PythonRationalType is meant for internal purpose of sympy.polys, not for
user convenience or looking good (Rational is for this).
In https://github.com/sympy/sympy/pull/295 I reduced the changes in
PythonRationalType with respect to master;
I gave up about having 3 instead of 3/1;
the only change is in __init__(self,p,q) when q is None, so the impact to
performance should be very small, since nothing changes in the most
frequent calls
self.__class__(p, q) with q not None.
I find the QQ type to be very useful.
This is a bit off-topic, but
it would be nice if there where in Sympy other types like QQ, which have a
fast implementation if available, otherwise a Python type.
They should have some common properties, like if F is the constructor
a = F(a) if a does; F(1) is the multiplication identity in the ring, etc.
so that one can write algorithms working with generic rings.
For instance for finite fields it could work as in Sage
sage: F = GF(7)
sage: a = F(4)
sage: a + 3
0
(or is there in Sympy and I missed it?)
and with matrices
sage: M = MatrixSpace(QQ,2,2)
sage: M(1)
[1 0]
[0 1]
Mario
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.