Dear Sage folks,
In a recent thread, Dima Pasechnik pointed out to me an example in which
sorting lists of elements of cyclotomic fields was behaving in a weird
way.
Here is a stripped-down version:
{{{
----------------------------------------------------------------------
| Sage Version 4.3.1, Release Date: 2010-01-20 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: K.<zeta> = CyclotomicField(8)
sage: one = K(1)
sage: two = K(2)
sage: one < two
False
sage: one > two
True
sage: two < one
False
sage: two > one
True
}}}
For lack of a more appropriate sentiment: this sucks. I would already
be much happier if this comparison behaved like
{{{
sage: str(one) < str(two)
True
sage: str(two) < str(one)
False
sage: str(one) > str(one)
False
sage: str(two) > str(one)
True
}}}
However, note that
{{{
sage: str(K(11)) < str(two)
True
}}}
which some might frown at. So another possibility would be this: given
x and y, first compare the norms of x and y; if the norms are equal,
compare str(x) and str(y). I think this would make as much mathematical
sense as possible given the circumstances.
Reactions?
Best,
Alex
--
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org