# Problem outputting inequalities

The following code :

x, y, z = var('x, y, z')
x < y < z


outputs :

x < y


but the "< z" seems to be taken into account, as in :

x, y, z = var('x, y, z')
x = 1; y = 2; z = 0
x < y < z


which prints "False".

Analogous behavior with :

x, y, z = var('x, y, z')
# x = 1; y = 0; z = 0;
x < y or x < z


Is there a way to make Sage prints the entire expression ? It seems like a bug when printing expression containing multiple inequalities.

edit retag close merge delete

Sort by ยป oldest newest most voted

Hi,

An expression is made of an operator and a sequence of expressions as in

sage: var('x,y,z')
sage: E = x + y + z
sage: E.operator()
sage: E.operands()
[x, y, z]


Now, x < y < z is just a writing convention: it is equivalent to neither (x < y) < z or x < (y < z). It hence does not make sense to consider it as an expression from the computer point of vue. But, you are right when we write such thing in math we would like (x < y) AND (y < z) which should be a valid expression. But it seems that Sage does not support the logical and as an expression... this is a pitty !

more