Ask Your Question

Checking if two inequalities are equivalent

asked 2016-03-13 08:06:41 -0500

Erel Segal-Halevi gravatar image

I ask:

var("x y")
print (x>y)==(y<x)
print (x>y)==(x-y>0)

and get:


So Sage recognizes the equivalence in the first pair but not in the second pair. Is there a way to handle this?

edit retag flag offensive close merge delete


Maybe rather use the Polyhedron class. Symbolic ring is a big mess.

FrédéricC gravatar imageFrédéricC ( 2016-03-13 15:28:09 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2016-03-13 19:33:01 -0500

tmonteil gravatar image

updated 2016-03-13 19:34:17 -0500

You should better use the optional package qepcadwhich is much more reliable than the symbolic ring. See

You can install it by typing (in a terminal) sage -i qepcad

Then you can do (in Sage):

sage: x,y = var('x, y')
sage: qf = qepcad_formula
sage: qf.iff(x>y,x-y>0)
[x > y <==> x - y > 0]
sage: F = qf.iff(x>y,x-y>0)
sage: qepcad(F)
edit flag offensive delete link more


So I have to tell it explicitly that $x>y$ is equivalent to $x-y>0$? And then tell it again that $y>z$ is equivalent to $y-z>0$, etc.?

Erel Segal-Halevi gravatar imageErel Segal-Halevi ( 2016-03-16 12:04:02 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2016-03-13 08:06:41 -0500

Seen: 60 times

Last updated: Mar 13 '16