I want Mathematica to simplify my expression using MySymmetricFunction[x,y] = MySymmetricFunction[y,x], so that

expr = MySymmetricFunction[x,y]-MySymmetricFunction[y,x];

yields 0.

I tried

MySymmetricFunction[x_, y_] = MySymmetricFunction[y,x] 

but here Mathematica assumes recursion.

Please note, that I don't want to implement an explicit version of MySymmetricFunction[x,y] as of yet.

As a follow up question:
Why does this give zero

SetAttributes[MySymmetricFunction, Orderless]

But this does not:

SetAttributes[MySymmetricFunction, Orderless]
Simplify[MySymmetricFunction[pResonance, pRho]*FV[NucleonOut, m] - MySymmetricFunction[pRho, pResonance]*FV[pNucleonOut, m]]

edit2 Thanks to @QuantomDot for pointing out my silly spelling mistake.

  • 3
    $\begingroup$ Could you give MySymmetricFunction the Orderless attribute? $\endgroup$
    – Carl Woll
    Mar 23, 2018 at 0:17
  • 2
    $\begingroup$ Set[MySymmetricFunction, Orderless] is a complete solution. $\endgroup$
    – evanb
    Mar 23, 2018 at 0:18
  • 3
    $\begingroup$ @evanb you mean SetAttributes. $\endgroup$
    – b3m2a1
    Mar 23, 2018 at 0:20
  • 1
    $\begingroup$ Orderless has interesting effects on pattern matching. $\endgroup$
    – rcollyer
    Mar 23, 2018 at 0:21
  • 3
    $\begingroup$ NucleonOut is not the same as pNucleonOut. $\endgroup$
    – QuantumDot
    Mar 23, 2018 at 0:33

1 Answer 1

SetAttributes[msf, Orderless]
msf[x, y] - msf[y, x]
(* 0 *)
  • $\begingroup$ Yes, this works, but please see my follow up question $\endgroup$ Mar 23, 2018 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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