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!
Answer
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.
Comments
Post a Comment