Dear all,

I am cleaning the Laurent polynomial in Sage in ticket #25524
(https://trac.sagemath.org/ticket/25524). One issue concerns
the following behaviour

{{{
sage: L.<q> = LaurentPolynomialRing(ZZ)
sage: parent(L(q) / L(1))
Univariate Laurent Polynomial Ring in q over Integer Ring
sage: parent(L(1) / L(2))
Univariate Laurent Polynomial Ring in q over Rational Field
sage: parent(L(1) / L(q))
Univariate Laurent Polynomial Ring in q over Integer Ring
sage: parent(L(1) / L(1 + q))
Fraction Field of Univariate Polynomial Ring in q over Integer Ring
}}}

That is, we have four different parents for a / b when both a
and b have the same given parent. While the reviewer is arguing
that Laurent polynomials are special enough to behave this way
I think that they would better follow the general rule

(R0)  The parent of a / b should only depend on the parents
      of a and b.

All other elements in Sage do follow this rule that is
sometimes invoked from "the principle of least surprise".

Note also that the current behavior is against the natural
inclusions

  Polynomials -> Laurent polynomials -> Rational fractions

as division of polynomials is always a rational fraction
{{{
sage: R.<x> = PolynomialRing(ZZ)
sage: parent(R(1) / R(1)) is R.fraction_field()
True
sage: parent(R(1) / R(x)) is R.fraction_field()
True
sage: parent(R(x) / R(1)) is R.fraction_field()
True
sage: parent(R(1) / R(1 + x)) is R.fraction_field()
True
}}}

I would like to gather opinion on whether

1) the current code is fine

2) Laurent polynomials should conform to the rule (R0) and a / b
should always be a rational fraction

3) something else?

In #25524, I made 2) happend and all tests pass in the Sage source
code. The main point being to replace `/` with `//` that is in many
places in Sage the internal division in a ring (extended to
Euclidean division when relevant).

Best
Vincent

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to