Ask Your Question

Revision history [back]

These objects created by SageMath are iterable in a nice way, containing exactly the information you need:

sage: P(Schur([2,1,1]))
p[1, 1, 1, 1] - p[2, 1, 1] - 2*p[2, 2] - 2*p[3, 1] + 4*p[4]
sage: list(P(Schur([2,1,1])))
[([2, 1, 1], -1), ([3, 1], -2), ([2, 2], -2), ([4], 4), ([1, 1, 1, 1], 1)]

So you can do e.g. the following:

sage: var('h')
sage: sum(coeff*prod(var('p_{}'.format(k))/h for k in partition) for partition, coeff in P(Schur([2,1,1])))
p_1^4/h^4 - p_1^2*p_2/h^3 - 2*p_2^2/h^2 - 2*p_1*p_3/h^2 + 4*p_4/h

Or e.g. with generators of a polynomial ring:

sage: P_ring = PolynomialRing(QQ, names=['p_{}'.format(k+1) for k in range(4)] + ['h'])
sage: p = P_ring.gens()[:-1]
sage: h = P_ring.gens()[-1]
sage: sum(coeff*prod(p[k-1]/h for k in partition) for partition, coeff in P(Schur([2,1,1])))
(p_1^4 - p_1^2*p_2*h - 2*p_2^2*h^2 - 2*p_1*p_3*h^2 + 4*p_4*h^3)/h^4