# Expressing a symmetric polynomial in terms of elementary symmetric polynomials

Given a symmetric polynomial $P$ in $n$ variables, I'm trying to write code to express $P$ as a polynomial in the elementary symmetric polynomials in $n$ variables. My understanding is that SymmetricFunctions can be used for this, but it's not clear to me how this works. Below is the code for one simple example.

```
R.<x,y> = PolynomialRing(QQ)
e = SymmetricFunctions(QQ).elementary()
e.from_polynomial(x^2*y^2)
```

The output I get is

```
e[2, 2] - 2*e[3, 1] + 2*e[4],
```

which does not make sense to me; the expression should be e[2,2], I believe. Can anybody point out what I'm doing wrong?

Possibly related questions (including the present one):

Documentation and tutorials: