# Evaluating a function on permutations of its arguments

Say I have a function "temp" of $n+1$ variables, $y,z1,z2,z3,...,zn$. I want to test if my function has certain symmetries like swapping $y$ with square of any $z$, swapping any two of the zs, replacing any z by its inverse, swapping any two zs by each other's inverse etc.

As of now I am having to type all of these cases explicitly by hand like for $n=3$ I am asking Mathematica to compute these differences for me (..if the symmetry exists then the answer would be 0..)

 Print[FullSimplify[temp[y, z1, z2, z3] - temp[z1^2, y^(1/2), z2, z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[z2^2, z1, y^(1/2), z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[z3^2, z1, z2, y^(1/2)]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z2, z1, z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z3, z2, z1]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z1, z3, z2]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, 1/z2, 1/z1, z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z1, 1/z3, 1/z2]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, 1/z3, z2, 1/z1]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, 1/z1, z2, z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z1, 1/z2, z3]]];
Print[FullSimplify[temp[y, z1, z2, z3] - temp[y, z1, z2, 1/z3]]];


Clearly doing the same with a large value of $n$ would get quite out of hand! I would like to know if there is a way to automate this.

• In general I would like to say have a $n \times n$ matrix acting on the zs (..thought of like a column n-vector..) and be able to test whether the function "temp" remains invariant under it.

I wonder if Mathematica can generate representation matrices for groups. Like if I want to actually test that "temp" is invariant under a fundamental/vector action of the group $U(n)$ on the zs then I would like in the above case the $n\times n$ matrix to be that representation of the $U(n)$ group.

-
maybe temp @@ # & /@ Permutations[z /@ Range[3], {3}] is useful –  acl Dec 15 '12 at 0:36
Related to your group invariants question math.stackexchange.com/questions/157993/… –  belisarius Dec 15 '12 at 17:46

Say your function temp is

    x[1]^2 x[2]^2 x[3] x[4]+x[1]^2 x[2] x[3]^2 x[4]+x[1] x[2]^2 x[3]^2 x[4]+x[1]^2 x[2] x[3] x[4]^2+x[1] x[2]^2 x[3] x[4]^2+x[1] x[2] x[3]^2 x[4]^2


then use SymmetricReduction[temp, Array[x, 4]] to get

    {x[1] x[2] x[3] x[4] (x[1] x[2] + x[1] x[3] + x[2] x[3] + x[1] x[4] + x[2] x[4] +
x[3] x[4]) ,  0}


The second list element is zero, and that proves your function temp to be symmetrical; See the help file for SymmetricReduction[].

-