Ask Your Question

Revision history [back]

I think the analysis of @kcrisman is the right one (i.e. full_simplify() works on each side of the equality). Along those lines, it is possible to transform the equation back to an equation as follows:

sage: eq_simplify = lambda eq : ((eq.rhs() - eq.lhs()).full_simplify() == 0)
sage: eq_simplify(a + b == a + c)
-b + c == 0

sage: simplify(cos(a)^2 == b - sin(a)^2)
cos(a)^2 == -sin(a)^2 + b
sage: eq_simplify(cos(a)^2 == b - sin(a)^2)
b - 1 == 0

I think the analysis of @kcrisman is the right one (i.e. full_simplify() works on each side of the equality). Along those lines, it is possible to transform the equation back to an equation as follows:

sage: eq_simplify = lambda eq : ((eq.rhs() - eq.lhs()).full_simplify() == 0)
sage: eq_simplify(a + b == a + c)
-b + c == 0

sage: simplify(cos(a)^2 == b - sin(a)^2)
cos(a)^2 == -sin(a)^2 + b
sage: eq_simplify(cos(a)^2 == b - sin(a)^2)
b - 1 == 0

Or, if we do not want to deal with equalities separately:

sage: new_simplify = lambda expr : ((expr.rhs() - expr.lhs()).full_simplify() == 0) if expr.operator() == operator.eq else expr.full_simplify()
sage: new_simplify(cos(a)^2 == b - sin(a)^2)
b - 1 == 0
sage: new_simplify(cos(a)^2 + sin(a)^2)
1