First time here? Check out the FAQ!

Ask Your Question
0

Problem outputting inequalities

asked 11 years ago

Eric Gaul gravatar image

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 11 years ago

vdelecroix gravatar image

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()
<function operator.add>
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 !

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 227 times

Last updated: Oct 21 '13