Ask Your Question
1

Checking if two inequalities are equivalent

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

Erel Segal-Halevi gravatar image

I ask:

var("x y")
assume(x,'integer')
assume(y,'integer')
print (x>y)==(y<x)
print (x>y)==(x-y>0)

and get:

True
False

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

Comments

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 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

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

tmonteil gravatar image

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

You should better use the optional package qepcadwhich is much more reliable than the symbolic ring. See http://doc.sagemath.org/html/en/refer...

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)
TRUE
edit flag offensive delete link more

Comments

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 -0600 )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

Stats

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

Seen: 58 times

Last updated: Mar 13 '16