Hello,

I use elements in a totally real quadratic extension K of QQ.
I specify the embedding, so elements in K can be evaluated.
I want to use this to compare elements, but it gets confusing.
Apparently '>' always gives true, and '<' always gives False.

sage: var('u z')
sage: K.<u> = NumberField(x**2 - x - 1, embedding=1.6)
sage: u, u.n(), u > 0
(u, 1.61803398874989, True)
sage: -u, -u.n(), -u > 0
(-u, -1.61803398874989, True)
sage: u > -u
True
sage: -u > u
True
sage: u > 1
True
sage: 1 > u
True
sage: 1 < u
False
sage: u < 1
False
sage: z = -2*u+3
sage: z
-2*u + 3
sage: z.n()
-0.236067977499790
sage: RR(z)
-0.236067977499790
sage: z > 0
True
sage: z.n() > 0
False
sage: RR(z) > 0
False
sage: zz = 3*u - 5
sage: zz.n()
-0.145898033750315
sage: zz > 0
True

How does Sage compare elements of K?
Is 'RR(z) > 0' the recommended way to test whether z is positive?

Samuel

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to