Convert a symmetric function into a polynomial on elementary symmetric functions

The following is a variant of a previous question (32569). What command fills in the blank?

sage: e = SymmetricFunctions(QQ).e()
sage: u = e(e)
sage: u
e[3, 3] + e[4, 1, 1] - 2*e[4, 2] - e[5, 1] + e
sage: R.<e1,e2,e3,e4,e5,e6> = PolynomialRing(QQ, 6)
sage: p = _the_blank_() # What command goes here?
sage: p
e1^2*e4 + e3^2 - 2*e2*e4 - e1*e5 + e6

edit retag close merge delete

Sort by » oldest newest most voted

You can access the parts of u (or iterate over them, in particular make a sum from them):

sage: list(u)
[([3, 3], 1), ([4, 1, 1], 1), ([4, 2], -2), ([5, 1], -1), (, 1)]


Each element is a pair ([partition], coefficient). For each partition, you want to susbtitute the integer i by the monomial ei and then multiply them (together with the coefficient). You can get the list (actually a tuple) of ei as follows:

sage: R.gens()
(e1, e2, e3, e4, e5, e6)


So that you can recover ei from i as follows (note the shift by 1):

sage: R.gens()
e1
sage: R.gens()
e2
sage: R.gens()
e3


Mixing all those ingredients together, you get the following one-liner:

sage: sum(c*prod(R.gens()[i-1] for i in P) for P,c in u)
e1^2*e4 + e3^2 - 2*e2*e4 - e1*e5 + e6

more