You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're welcome to try. Just a heads up, I don't think that the test case I reported in this issue report covers all instances of this bug as there are few variants of the divisor type and I'm not sure where the fix needs to be implemented.
In fact, I think this is actually a bug in FormalSum comparison, which divisors inherit from. Here's an example with FormalSum:
f1=FormalSum([(1, 'a'), (2, 'b')])
f2=FormalSum([(3, 'a')])
f2>f1# False, but should be Truef2-f1>0# True, which is correct and contradicts that f2 > f1 currently returns False
My guess for how to fix it would be to change _richcmp_ in src/sage/structure/formal_sum.py to account for comparing a FormalSum that doesn't have a particular term to a FormalSum that has that term with a negative coefficient.
@tscrim since you reviewed #37972 in which I made changes to FormalSum comparison, and I remember there were some coercion-related subtleties to that fix: is there anything you think @AdityaK1729 should be aware of before attempting to fix this?
vincentmacri
changed the title
Incorrect element comparison for places/divisors
Incorrect element comparison for places/divisors/formal sum
Jan 31, 2025
vincentmacri
changed the title
Incorrect element comparison for places/divisors/formal sum
Incorrect element comparison for places/divisors/FormalSum
Jan 31, 2025
Steps To Reproduce
In Sage 10.5, run:
Expected Behavior
This should print
True True
.Actual Behavior
This prints
False False
.Additional Information
No response
Environment
Checklist
The text was updated successfully, but these errors were encountered: