0

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$.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
akkp
  • 67
  • 4
  • 3
    I don't know what you mean. a + b == b + a evaluates to True because Plus has Attribute Orderless. – Henrik Schumacher Jan 05 '19 at 09:43
  • 2
    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. – Szabolcs Jan 05 '19 at 10:36
  • In order to asnwer this question, you have to tell us exactly what yuo mean by "algebraic expression" and your exactt definition of "equivalence". – Somos Jan 05 '19 at 15:15
  • I have added further details to (hopefully) better explain my question – akkp Jan 05 '19 at 21:42
  • Re your second, the simplification of the LHS is automatic -- Related: https://mathematica.stackexchange.com/questions/57489/why-does-mathematica-simplify-x-x-to1 – Michael E2 Jan 06 '19 at 02:49

1 Answers1

0
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.

Somos
  • 4,897
  • 1
  • 9
  • 15