Open user202729 opened 1 year ago
The problem comes from the method PolyDict.rich_compare
(from sage.rings.polynomial.polydict
) that does not take care of constant polynomials.
Note that comparison of polynomials behaves strangely anyway
sage: R.<x,y> = ZZ[]
sage: -3*x > -1*x
False
sage: -3*x > 0*x
True
sage: -3*x > 1*x
False
Reading the source code it looks like it compares by the leading term of the difference and assume omitted/zero coefficient = smallest. Maybe it's better to explicitly compare the coefficient with 0
instead?
The current situation is such that x^2>x and -x^2>x (as well as x^2>-x etc.) are both true (in all fields and univariate/multivariate cases).
Currently SageMath is implemented such that elements of GF(p) is comparable and so are elements of GF(p)[x]. (probably for ordered set etc.). It's not a field ordering however.
Is there an existing issue for this?
Did you read the documentation and troubleshoot guide?
Environment
Steps To Reproduce
Expected Behavior
All assertions pass.
Actual Behavior
The last assertion does not pass.
Additional Information
No response