I want to define a function, the input are a permutation sigma belonging to Sn, and a multivariate polynomial f=f(x1,x2,...,xn) over Q, and the output is a multivariate polynomial f=f(x(sigma(1)),x(sigma(2)),...,x(sigma(n))), for example, if sigma=(3,1,2),f=x1+x2x3, then the output should be f=x3+x1x2. It is worth mentioning that this should work for any n not just when n=3. How should I do that?