How to eliminate == sign from the solution?
a + b == ab - c + d
is stored internally as Equal[a + b, ab - c + d]
.
And what you want instead is Subtract[a + b, ab - c + d]
.
You can get there by replacing Equal
with Subtract
by doing this:
f = Apply[Subtract, a + b == ab - c + d]
which gives you a-ab+b+c-d
, but that is the same as what you asked for, just with Mathematica sorting the variables into the order it wants.
one way might be to make a lhs() and rhs() functions.
ClearAll[a, b, c, d, x, y, lhs, rhs]
lhs[eq_] := eq /. (x_) == (y_) -> x;
rhs[eq_] := eq /. (x_) == (y_) -> y;
Now you can write
eq = a + b == a b - c + d;
f = lhs[eq] - rhs[eq]
This will work only for input of form x==y
of course.