How to do operations that change a relation?

For example, given a < b, we know that if we multiply both sides with -1, we will get -a > -b.

But in sage, if I try this:

var('a b')
exp=a>b
exp*-1


I get:

  −a>−b


The > did not get flip (the same also happens if we take the reciprocal).

Are the functions in Sage that can perform the multiplication with properly handle the inequality as well? Otherwise, what is the recommended way to do this manually?

edit retag close merge delete

Sort by » oldest newest most voted

This is being discussed and worked on by developers in trac ticket #7660 .

If you have a complicated relation r=...<... you can say

sage: new_r = -r.lhs() > -r.rhs()

more