Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaurentPolynomialRing define the zero polynomial to have degree -1 which is ambiguous #37491

Closed
2 tasks done
GiacomoPope opened this issue Feb 27, 2024 · 1 comment · Fixed by #37513
Closed
2 tasks done

Comments

@GiacomoPope
Copy link
Contributor

GiacomoPope commented Feb 27, 2024

Steps To Reproduce

sage: R = LaurentPolynomialRing(QQ, 3, 'x')
sage: x0, x1, x2 = R.gens()
sage: R.zero().degree()
-1
sage: R.zero().degree(x0)
-1
sage: R.zero().degree(x1)
-1
sage: R.zero().degree(x2)
-1
sage: (1/x0).degree(x0)
-1
sage: (1/x0).degree()
-1

Expected Behavior

The degree of 0 should be distinct from polynomials we can construct

Actual Behavior

The degree of 0 is -1, the same as 1/x0 or other similar polynomials.

Additional Information

For standard univariate and multivariate polynomial rings, the degree being -1 is essentially a nice trick in place of $-\infty$, but for Laurent polynomial rings where negative degree makes total sense, this ambiguity with zero is confusing.

One idea would be to instead have it return - infinity.

Environment

- **Sage Version**: SageMath version 10.3.rc0, Release Date: 2024-02-25

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@GiacomoPope GiacomoPope changed the title Multivariate Polynomial Rings compute the incorrect degree for the zero polynomial Multivariate Polynomial Rings define the zero polynomial to have degree -1 (maybe not bug?) Feb 27, 2024
@GiacomoPope GiacomoPope changed the title Multivariate Polynomial Rings define the zero polynomial to have degree -1 (maybe not bug?) LaurentPolynomialRing define the zero polynomial to have degree -1 which is ambiguous Feb 27, 2024
@GiacomoPope GiacomoPope reopened this Feb 27, 2024
@GiacomoPope
Copy link
Contributor Author

GiacomoPope commented Feb 28, 2024

Some further context, we also have:

sage: R.<x> = LaurentSeriesRing(QQ)
sage: R.zero().valuation()
+Infinity
sage: R.zero().degree()
-1
sage:
sage: R.<x> = LaurentPolynomialRing(QQ)
sage: R.zero().valuation()
+Infinity
sage: R.zero().degree()
-1
sage:
sage: R.<x> = LazyLaurentSeriesRing(QQ)
sage: R.zero().valuation()
+Infinity
sage: R.zero().degree()
# Errors

So the valuation seems to have been written with this in mind but the degree is picking up the result from the underlying polynomial ring? Makes me lean towards a patch giving -Infinity for the zero polynomial

Discussion: https://groups.google.com/g/sage-devel/c/XVz-4kqWuuo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants