While chasing various bugs which appeared in the CI, I ended up adding a 
small method for computing random elements for the LaurentPolynomialRing 
class.

When writing randomised testing I got myself confused about the degree of 
the zero polynomial. For the univariate and multivariate polynomial rings, 
we currently use that the degree for 0 (both R(0).degree() as well as 
R(0).degree(x)) is -1. This is unambiguous for the case of these types.

However for the LaurentPolynomialRings, a polynomial with negative 
valuation is very natural. For example the following code snippet shows the 
ambiguity.

sage: L.<x> = LaurentPolynomialRing(QQ)
sage: f = (1/x); f
x^-1
sage: f.degree()
-1
sage: L.zero().degree()
-1

I don't feel familiar enough with the mathematics here and the usual use 
cases in sage to offer a PR "fixing" this, or whether it even needs fixing. 
However, I got confused so I thought maybe others might get confused and 
someone on this list might have a suggestion.

I think the "usual" suggestion would be to have the degree as -infty, but 
then there's a question about whether this should be done for other 
polynomial rings...

I made an issue for this on GitHub too:

https://github.com/sagemath/sage/issues/37491

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/0efa0dd8-b322-4896-b9af-a88effeaa195n%40googlegroups.com.

Reply via email to