# The set of polynomials under the action by a symmetric group

Let $$f(x_1,x_2,x_3)=\frac{x_1^r x_2^r \left(1-x_1 x_3\right) \left(1-x_2 x_3\right)}{\left(1-\frac{x_2}{x_1}\right) \left(1-\frac{x_3}{x_1}\right)\left(1-\frac{x_3}{x_2}\right)},$$ where $$r$$ is a fixed nonnegative integer.

I would like Mathematica to compute the set $$\{ \sigma.f(x_1,x_2,x_3) : \sigma\in S_3 \}$$ of polynomials, where $$\sigma.f(x_1,x_2,x_3):= f(x_{\sigma^{-1}(1)}, x_{\sigma^{-1}(2)}, x_{\sigma^{-1}(3)} ),$$ as $$\sigma$$ runs over all the elements in the symmetric group $$S_3$$.

f[x1_, x2_, x3_] = (x1^r  x2^r (1 - x1 x3) (1 - x2 x3))/((1 - x2/x1) (1 - x3/x1) (1 - x3/x2))


I have a reference, which is along the lines of what I want but this code works only when the length of the permutation cycle equals the number of variables, and I have to specify each element in the symmetric group for the code in the link.

For $$n=3$$, i.e., when working with $$3$$ variables and with $$S_3$$, everything is doable by hand, but it is better to write a code for $$n=6,7,8$$. Any form of assistance is greatly appreciated.

Maybe something along these lines?

rat = (x1^r x2^
r (1 - x1 x3) (1 - x2 x3))/((1 - x2/x1) (1 - x3/x1) (1 - x3/x2));
vars = {x1, x2, x3};
subs = Map[Thread[vars -> #] &, Permutations[vars]]

(* Out[112]= {{x1 -> x1, x2 -> x2, x3 -> x3}, {x1 -> x1, x2 -> x3,
x3 -> x2}, {x1 -> x2, x2 -> x1, x3 -> x3}, {x1 -> x2, x2 -> x3,
x3 -> x1}, {x1 -> x3, x2 -> x1, x3 -> x2}, {x1 -> x3, x2 -> x2,
x3 -> x1}} *)


Now do the substitutions.

Map[rat /. # &, subs]

(* Out[109]= {(
x1^r x2^r (1 - x1 x3) (1 - x2 x3))/((1 - x2/x1) (1 - x3/x1) (1 - x3/
x2)), (x1^r (1 - x1 x2) x3^
r (1 - x2 x3))/((1 - x2/x1) (1 - x2/x3) (1 - x3/x1)), (
x1^r x2^r (1 - x1 x3) (1 - x2 x3))/((1 - x1/x2) (1 - x3/x1) (1 - x3/
x2)), (x2^r (1 - x1 x2) x3^
r (1 - x1 x3))/((1 - x1/x2) (1 - x1/x3) (1 - x3/x2)), (
x1^r (1 - x1 x2) x3^
r (1 - x2 x3))/((1 - x2/x1) (1 - x1/x3) (1 - x2/x3)), (
x2^r (1 - x1 x2) x3^
r (1 - x1 x3))/((1 - x1/x2) (1 - x1/x3) (1 - x2/x3))} *)

• Perfect. Thank you! Commented Jan 16, 2019 at 17:18

You can also use Permute using GroupElements[SymmetricGroup[3]]as the second arguments as follows:

ClearAll[f]
f[x1_, x2_, x3_] := (x1^r x2^r (1 - x1 x3) (1 - x2 x3))/((1 - x2/x1) (1 - x3/x1)(1 - x3/x2))

Permute[g @@ Array[Subscript[x, #] &, 3], #] & /@ GroupElements[SymmetricGroup[3]] /. g -> f


$$\begin{array}{l} \frac{\left(1-x_1 x_3\right) \left(1-x_2 x_3\right) x_1^r x_2^r}{\left(1-\frac{x_2}{x_1}\right) \left(1-\frac{x_3}{x_1}\right) \left(1-\frac{x_3}{x_2}\right)} \\ \frac{\left(1-x_1 x_2\right) \left(1-x_2 x_3\right) x_1^r x_3^r}{\left(1-\frac{x_2}{x_1}\right) \left(1-\frac{x_2}{x_3}\right) \left(1-\frac{x_3}{x_1}\right)} \\ \frac{\left(1-x_1 x_3\right) \left(1-x_2 x_3\right) x_1^r x_2^r}{\left(1-\frac{x_1}{x_2}\right) \left(1-\frac{x_3}{x_1}\right) \left(1-\frac{x_3}{x_2}\right)} \\ \frac{\left(1-x_1 x_2\right) \left(1-x_2 x_3\right) x_1^r x_3^r}{\left(1-\frac{x_2}{x_1}\right) \left(1-\frac{x_1}{x_3}\right) \left(1-\frac{x_2}{x_3}\right)} \\ \frac{\left(1-x_1 x_2\right) \left(1-x_1 x_3\right) x_2^r x_3^r}{\left(1-\frac{x_1}{x_2}\right) \left(1-\frac{x_1}{x_3}\right) \left(1-\frac{x_3}{x_2}\right)} \\ \frac{\left(1-x_1 x_2\right) \left(1-x_1 x_3\right) x_2^r x_3^r}{\left(1-\frac{x_1}{x_2}\right) \left(1-\frac{x_1}{x_3}\right) \left(1-\frac{x_2}{x_3}\right)} \\ \end{array}$$

Alternatively,

Permute[Array[Subscript[x, #] &, 3, 1, g], #] & /@ GroupElements[SymmetricGroup[3]] /. g -> f


same result