# 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?

edit retag close merge delete

( 2018-07-26 15:33:21 -0500 )edit

Documentation and tutorials:

( 2018-07-26 15:36:57 -0500 )edit

Sort by ยป oldest newest most voted

See the "monomial" basis and the "elementary" basis for symmetric functions.

See section "The classical bases" in the SageMath documentation page for symmetric functions.

sage: S = SymmetricFunctions(QQ)

sage: e = S.elementary()
sage: m = S.monomial()

sage: A = ['a', 'b', 'c', 'd']

sage: m22 = m[2, 2].expand(4, alphabet=A)
sage: m22
a^2*b^2 + a^2*c^2 + b^2*c^2 + a^2*d^2 + b^2*d^2 + c^2*d^2

sage: e22 = e[2, 2].expand(4, alphabet=A)
sage: e31 = e[3, 1].expand(4, alphabet=A)
sage: e4 = e[4].expand(4, alphabet=A)

sage: e22
a^2*b^2 + 2*a^2*b*c + 2*a*b^2*c + a^2*c^2 + 2*a*b*c^2
+ b^2*c^2 + 2*a^2*b*d + 2*a*b^2*d + 2*a^2*c*d + 6*a*b*c*d
+ 2*b^2*c*d + 2*a*c^2*d + 2*b*c^2*d + a^2*d^2 + 2*a*b*d^2
+ b^2*d^2 + 2*a*c*d^2 + 2*b*c*d^2 + c^2*d^2
sage: e31
a^2*b*c + a*b^2*c + a*b*c^2 + a^2*b*d + a*b^2*d
+ a^2*c*d + 4*a*b*c*d + b^2*c*d + a*c^2*d + b*c^2*d
+ a*b*d^2 + a*c*d^2 + b*c*d^2
sage: e4
a*b*c*d

sage: e22 - 2*e31 + 2*e4
a^2*b^2 + a^2*c^2 + b^2*c^2 + a^2*d^2 + b^2*d^2 + c^2*d^2

sage: e22 - 2*e31 + 2*e4 == m22
True


Other bases

sage: h = S.homogeneous()
sage: f = S.forgotten()
sage: p = S.powersum()
sage: s = S.schur()


sage: S.inject_shorthands()

more

It is not clear to me how this answer helps. I want to express a symmetric polynomial $P(x,y)$ in terms of $x+y$ and $xy$, the two elementary symmetric polynomials in $x$ and $y$. How can I modify my code to do this?

( 2018-07-10 21:37:21 -0500 )edit