2
$\begingroup$

I apologize if this question has been asked already. I did some research and found some solutions but none of them was general enough for what I need.

So, I defined the following function:

g[i_][a_, b_, c_] := Subsuperscript[g, {a, b, c}, {i}]

and now I would like to specify that if the variable i is equal to 8 then the function is Orderless (symmetric) with respect to the variables a and b.

Is there any way of doing that?

Thanks a lot!

$\endgroup$
1
  • $\begingroup$ Something like g[8][b_, a_, c_] /; ! OrderedQ[{b, a}] := Subsuperscript[g, {a, b, c}, {8}]? $\endgroup$
    – J. M.'s torpor
    Apr 25 '20 at 14:34
1
$\begingroup$
ClearAll[g]

g[8][OrderlessPatternSequence[a_, b_], c_] :=  Subsuperscript[g, {a, b, c}, {8}]

g[i_][a_, b_, c_] := Subsuperscript[g, {a, b, c}, {i}]

Examples:

{g[2][y, x, z], g[8][y, x, z], g[8][5, 1, u], g[8][3, 2, 1]}

enter image description here

$\endgroup$
1
  • $\begingroup$ This works, thank you very much! $\endgroup$
    – Einj
    Apr 26 '20 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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