You can apply a permutation to a tuple, in particular to the tuple of generators of the polynomial ring.
You can then apply the function to the permuted variables.

Here is an example, from which you could build a function `permute_variables(sigma,f)`

(left as an exercise).

```
sage: version() # just for reference
'Sage Version 6.3.beta5, Release Date: 2014-07-01'
sage: R = PolynomialRing(ZZ,n,'x')
sage: R
Multivariate Polynomial Ring in x0, x1, x2, x3, x4 over Integer Ring
sage: Sn = SymmetricGroup(range(n))
sage: f = R.random_element()
sage: f
x1*x2 - x3^2 + x2*x4 + 3*x1 - 1
sage: sigma = Sn.random_element()
sage: sigma
(0,2,4)
sage: R.gens()
(x0, x1, x2, x3, x4)
sage: sigma(R.gens())
(x2, x1, x4, x3, x0)
sage: f(*sigma(R.gens()))
-x3^2 + x0*x4 + x1*x4 + 3*x1 - 1
```

Rather than a random permutation, you probably prefer to input it yourself. For this, you need to define `x0`

etc. and make them point to the variables of polynomials in `R`

. This is done with `R.inject(variables)`

. And to input permutations as products of cycles, use something like `Sn('(0,1)(2,3)')`

.
An example where you input the polynomial and the permutation yourself:

```
sage: n = 5
sage: R = PolynomialRing(ZZ,n,'x')
sage: R.inject_variables()
Defining x0, x1, x2, x3, x4
sage: Sn = SymmetricGroup(range(n))
sage: f = x1 + x2
sage: sigma = Sn((1,2,3))
sage: sigma
(1,2,3)
sage: f(*sigma(R.gens()))
x2 + x3
sage: sigma = Sn('(0,1)(2,3)')
sage: f(*sigma(R.gens()))
x0 + x3
```

Be careful: If you define the permutation group as SymmetricGroup(5), they are indexed from 1 to n, so it's tricky to follow what goes on when you let them act on the generators of $R$, which are indexed from 0 to n-1 (you have to offset your indices by one, then apply the permutation, then undo the offset). In particular the permutation $(1,2,3)$ of $S_5$, would then act on $(x_0, x_1, x_2, x_3, x_4)$, acts as the cyclic permutation $(x_0, x_1, x_2)$.

Please correct the typo in the title.