These are chat archives for symengine/symengine
0. I'll ask on the the SymPy gitter
Out: (Poly(2*x, x, domain='ZZ'), Poly(x**2, x, domain='ZZ'))
5x**2 = (0 * 2x) + 5x**2, while I feel expected should be
5x**2 = (2x * 2x) + x**2
sage: R, t = ZZ['t'].objgen() sage: p = 5*t**2 sage: q = 2*t sage: p.quo_rem(q) (2*t, t^2)
quo_remis mathematically well defined only in so-called Euclidean domains. They are principal ideal domains (PIDs) equipped with a 'Euclidean function.
ZZ[t]is not a PID, so there is no universal agreement on how
quo_remshould be defined. I think that there are some appealing features in the way it is defined in sage, but one cannot say that SymPy's way would be wrong, either.
quo_remin non-Euclidean domains is for testing if an element is divisible by another. That happens when the remainder vanishes. Both ways of defining
ZZ[t]can be used to decide this.
quo_remis as you mentioned, testing divisibility, it does not make a difference. But the problem for SymEngine is that, we have two types of Polynomial classes
UIntPoly(symengine's implementation) and
UIntPolyFlint(the flint poly wrapper). When calling
quo_remon two (same) polys of both types, a user should get the same answer (and he would be expecting the same too). As a library I feel there must be this consistency.
quo_remis as above, can we just skip
upoly_div? Piranha also doesn't give an answer to it.