0
$\begingroup$

I know that in order to find the equivalence of say $ a+b $ and $ b+a $, then:

FullSimplify[a + b == b + a]

is sufficient. However, suppose I want to compare without simplifying, and simply determine the equivalence of two algebraic statements regardless of the ordering of terms? For example, $ a+b = b+a $, but $ \frac{(a+b)^2}{a+b} \neq a+b $.

Edit:

I want Mathematica to tell me commutative equivalence ONLY between two expressions. Consider another example:

$$s_1 = 3 - \sqrt{2}$$ $$s_2 = - \sqrt{2} + 3$$ $$s_3 = 3 - \sqrt{\sqrt{2}}^2$$

I want some function or procedure to tell me that $s_1 = s_2$ but $s_1 \neq s_3$.

$\endgroup$

closed as unclear what you're asking by Daniel Lichtblau, m_goldberg, Henrik Schumacher, Michael E2, José Antonio Díaz Navas Jan 8 at 21:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ I don't know what you mean. a + b == b + a evaluates to True because Plus has Attribute Orderless. $\endgroup$ – Henrik Schumacher Jan 5 at 9:43
  • 2
    $\begingroup$ In addition to what Henrik said: (a+b)^2/(a+b) also automatically evaluates to a+b, so it's not really possible to do what you are asking for. One trick to work around it is Reduce[{x/(a + b) == a + b, x == (a + b)^2}] or Reduce[{x/(a + b) == a + b, x == (a + b)^2}, x]. Reduce will try to generate complete conditions. In this case it will say that this is true only if a+b != 0. $\endgroup$ – Szabolcs Jan 5 at 10:36
  • $\begingroup$ In order to asnwer this question, you have to tell us exactly what yuo mean by "algebraic expression" and your exactt definition of "equivalence". $\endgroup$ – Somos Jan 5 at 15:15
  • $\begingroup$ I have added further details to (hopefully) better explain my question $\endgroup$ – akkp Jan 5 at 21:42
  • $\begingroup$ Re your second, the simplification of the LHS is automatic -- Related: mathematica.stackexchange.com/questions/57489/… $\endgroup$ – Michael E2 Jan 6 at 2:49
0
$\begingroup$
s1 = Hold[3 - Sqrt[2]]; s2 = Hold[-Sqrt[2] + 3]; s3 = Hold[3 - Sqrt[Sqrt[2]^2]];
eq[x_, y_] := x === y || x === Reverse[y, 2]; {eq[s1, s2], eq[s1, s3]};

returns {True, False}. You need the Hold[] because Plus[] is Orderless.

$\endgroup$
  • $\begingroup$ Not exactly what I need, but it points me in the right direction. Thanks $\endgroup$ – akkp Jan 6 at 5:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.