# commutative matching

I've been doing some work that results in the creation of hundreds or thousands of equations with the same answer. To prevent them from collapsing to their simple answers, each has been passed through HoldForm[]. Some of these solutions are, from my point of view, redundant, and I'm trying to figure out how to tell Mathematica to elminate these.

For my purposes, two solutions are identical if they differ only by the order of the operands. Thus,

(1 - 9)*(1 - 4) == (1 - 4)*(1 - 9)


and

2^(2+3+1) == 2^(3+2+1)


but

(1 - 9)*(1 - 4) != (3 + 3)*(2 + 2)


and

2^(2+3+1) != 2^(4+1+1)


I have a list of equations and want Mathematica to strip out "redundant" solutions by this standard, how might I identify them to SameTest-> ?

• You must be extremely clear in what you mean by "redundant," and your examples are insufficient. Is ((1+1)+2)==4 "redundant" to (2+2)==4, for example? – David G. Stork Sep 30 '15 at 15:27
• Also, what is the format of the left and right hand sides? They obviously can't be expressions because the equations as you have them would evaluate to True. – march Sep 30 '15 at 15:37
• @march expressions passed through HoldForm[] – Michael Stern Sep 30 '15 at 16:06
• @David G. Stork I have tried to clarify. All the solutions being compared are composed of the same four integers arranged differently with different mathematical operators. Any change in operator = not identical. Any change in "grouping" = not identical. However if the operator is constant and operands are identical but their order differs, that = redundant. I can provide more examples if needed. – Michael Stern Sep 30 '15 at 16:12