# Revision history [back]

Here is a sample code that find such a representation for a given polynomial pol:

from sage.combinat.sf.ns_macdonald import E

def repM(pol):
k = pol.degree()
n = len( pol.variables() )
E2a = { E(a):a for a in IntegerVectors(k, n) }
J = ideal( list(E2a.keys()) )
gens = J.gens()
return { E2a[g]:c for g,c in zip(gens, pol.change_ring(J.base_ring()).lift(gens)) if c }


It return a dict where each $\alpha$ is mapped to the corresponding coefficient (a function in $q,t$) of $E_\alpha$, omitting zero coefficients. For example, running it on elementary symmetric polynomial $e_{2,1}$ in 3 variables:

e = SymmetricFunctions(QQ).elementary()
repM(e[2,1].expand(3))


returns

{[2, 1, 0]: (q^4*t^4 - 2*q^3*t^4 + q^2*t^4 - q^2*t^3 + 2*q*t^3 - t^3)/(q^4*t^4 - 2*q^3*t^3 + 2*q*t - 1),
[2, 0, 1]: (q^3*t^3 - q^2*t^3 - q*t^2 + t^2)/(q^3*t^3 - q^2*t^2 - q*t + 1),
[1, 2, 0]: (q^3*t^3 - q^2*t^3 - q*t^2 + t^2)/(q^3*t^3 - q^2*t^2 - q*t + 1),
[1, 1, 1]: (q*t^2 + q*t - t^2 + q - t - 1)/(q*t^2 - 1),
[1, 0, 2]: (q*t - t)/(q*t - 1),
[0, 2, 1]: (q*t - t)/(q*t - 1),
[0, 1, 2]: 1}