#9752 closed defect (duplicate)
sorting of number field elements is broken
Reported by: | was | Owned by: | davidloeffler |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | number fields | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | William Stein | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The design of number field elements (and other aspects of sage) assumes that cmp defines a total ordering, which of course doesn't respect the algebraic field structure. Unfortunately, the actual implementation (in number_field_element.pyx) is buggy and doesn't define a total ordering. Look at the code and you'll see. Or just look at this example:
sage: L.<b> = NumberField(x^3-10001) sage: b+1 < L(1667) False sage: L(1667) < b+1 False
I think the best correct implementation of cmp should be one that is efficient and *also* agrees with the lexicographic ordering of elements based on their representation as a polynomial in the generator of the number field. I did implement this as part of the patch bomb #9541. The point of the present ticket is to "backport" something like this out of #9541, or implement a new fix from scratch. This is motivated by #9400.
Change History (3)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
- Resolution set to duplicate
- Status changed from new to closed
I'm closing this as a dup of #6132.
comment:3 Changed 7 years ago by
- Milestone changed from sage-4.7 to sage-duplicate/invalid/wontfix
- Reviewers set to William Stein
See also #6132, there is some code to compare number field elements.