I am currently experiencing some problems when comparing elements of a
QuadraticField. See below.
sage: Q.<sqrt3> = QuadraticField(3)
sage: 0 < sqrt3
False
sage: RR(sqrt3)
1.73205080756888
The operator < and > do not correspond :
sage: sqrt3 > Q.zero()
True
sage: Q.zero() < sqrt3 #not ok
False
Other similar behavior :
sage: -sqrt3 > Q.zero() #not ok
True
sage: -sqrt3 < Q.zero()
False
sage: sqrt3 < Q.zero()
False
sage: sqrt3 < -sqrt3 #not ok
False
sage: sqrt3 > -sqrt3
True
sage: -sqrt3 > sqrt3 #not ok
True
sage: -sqrt3 < sqrt3
False
Is this known?
Sébastien Labbé
> I am currently experiencing some problems when comparing elements of a
> QuadraticField. See below.
I'm not sure this is exactly the same but I think Nicolas (the little) is
working on this:
Ticket #8347 Test the positivity of a number field element
Florent
> Hi Sage-devel,
>
> I am currently experiencing some problems when comparing elements of a
> QuadraticField. See below.
>
> sage: Q.<sqrt3> = QuadraticField(3)
> sage: 0 < sqrt3
> False
> sage: RR(sqrt3)
> 1.73205080756888
[...]
> Is this known?
Yes, cmp() for number field elements is arbitrary, as they don't have
(canonical) real embeddings in general. There are a couple of tickets
to address this.
- Robert
On Mar 2, 3:10 am, Robert Bradshaw <rober...@math.washington.edu>
wrote:
But for the QuadraticField this is unique, if the embedding is
specified:
sage: QuadraticField?
....
Unless otherwise specified, it has an embedding into RR or CC
by sending
the generator to the positive root.
....
So if should be working, if the documentation does not lie....
Dima
>
> - Robert