Ask Your Question
1

Checking if two inequalities are equivalent

asked 2016-03-13 14:06:41 +0100

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 21:28:09 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2016-03-14 01:33:01 +0100

tmonteil gravatar image

updated 2016-03-14 01:34:17 +0100

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 18:04:02 +0100 )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 14:06:41 +0100

Seen: 297 times

Last updated: Mar 14 '16