The usual way to do this is to derive an equation from them and check if it is True or False .
sage: e4 == e5 x*(y + 1) == x*y + x sage: bool(_) True
However, keep in mind that Sage will return False if it cannot prove that it is True , which is not the same as a lie. The equivalence test of two arbitrary expressions can be arbitrarily long, and a crazy sequence of extensions / 'simplifications' may be required that the computer cannot predict.
This is the answer to another question:
sage: e1 is e2 False
This is Python, and it is a very strong condition that two things are the same "object", which in this case is not.
sage: a = 1 sage: b = 1 sage: a is b False sage: a = 1 sage: b = a sage: a is b True
source share