# Symmetric group action on polynomials

I am working with polynomials in several variables with the obvious action of $S_n$. That is, given a polynomial $f$ in the variables $x_1, \dots, x_n$, a permutation $\sigma \in S_n$ acts on $f$ by sending $x_i$ to $x_{\sigma(i)}$.

What I would like to do is to give Mathematica a polynomial, for example

$x_1^2x_2 + x_3$

and have it compute the image of this under the action of a particular element. For example, if I gave it $(123)$ it would output

$x_2^2x_3 + x_1$.

Thanks!

• Have you tried anything? This is basic and intrinsic functionality... – ciao Apr 8 '15 at 2:57
• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Apr 8 '15 at 3:03

This should be a start.

groupElementAction[expr_, vars_, perm_] /;

Length[perm] == Length[vars] && PermutationListQ[perm] :=

expr /. Thread[vars -> Permute[vars, perm]]


That example:

groupElementAction[x1^2*x2 + x3, {x1, x2, x3}, {2, 3, 1}]

(* Out[131]= x2 + x1 x3^2 *)


With some tweaking it can be made to handle the explicit cycle form of permutation group elements.

• Thank you very much. This has been very helpful. I changed the last line to be "...Permute[vars,Cycles[{perm}]]" and that seems to accept cycle notation – user27584 Apr 8 '15 at 3:40