On 24 March 2013 15:52, David Roe <
roed...@gmail.com> wrote:
> I don't see an easier way; RXYZ.monomials(degree=4) sounds good to me.
> David
--but surely there's a better implementation which goes straight to
the dict for of the polynomials? I found that there is a top-level
general fcuntion monomials():
sage: RXYZ.<X,Y,Z> = QQ[]
sage: [m for m in monomials(RXYZ.gens(),[4]*3) if m.degree()==3]
[Z^3, Y*Z^2, Y^2*Z, Y^3, X*Z^2, X*Y*Z, X*Y^2, X^2*Z, X^2*Y, X^3]
which allows to specify a maximum degree for each variable but has no
flag for total degree / homogeneity. And I spent ages browsing all
the combinatorial variations on Partitions but they do not allow 0
parts.
For higher degree, expanding (X+Y+Z)^d just to extract its monomials
would be inefficient. So far I have needed this for d=39.
John