The key here is understanding exactly what x[0] is: it's not a
rational.  If you run your code (after adding the line
"set_random_seed(3)" at the start to make sure we're working with the
same matrices), you see:

sage: minx, maxx, miny, maxy
(+Infinity, (3), +Infinity, (21/5))

and the odd parentheses should hint at the problem:

sage: type(maxx), type(maxy)
(<type 'sage.modules.vector_rational_dense.Vector_rational_dense'>,
<type 'sage.modules.vector_rational_dense.Vector_rational_dense'>)
sage: x[0]
(5/7)
sage: type(x[0])
<type 'sage.modules.vector_rational_dense.Vector_rational_dense'>

We're not comparing the rational 5/7 with infinity, we're comparing
the *vector* (5/7,) -- comma inserted for clarity -- with infinity.
Anyway, comparisons between things which shouldn't be compared tend to
give weird results if they work:

sage: x = 5/7
sage: x < infinity # good
True
sage: x > infinity # good
False
sage: x = vector([5/7])
sage: x < infinity
False
sage: x > infinity
True
sage: 5/7 < vector([0.0])
True

If you replace x[0] by x[0][0], and x[1] by x[1][0], so that you're
comparing the entries and not the row vectors, it should do what you
expect.  (You could also use x = x.list() to coerce to a list and then
x[0] and x[1] will work, I guess, but that kind of hides what's going
on.)


Hope that helps,

Doug

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

Reply via email to