1 | initial version |
A function to get a list of monomials of specified degree would be good to have in sage. Perhaps it is already by now. Otherwise it's not hard to define once you know which primitives to use:
def monomials_of_degree(P,n):
V=[P({tuple(a):1}) for a in WeightedIntegerVectors(n,[1]*P.ngens())]
return V
With this you can do:
R=PolynomialRing(QQ,'p',3)
M=[h(R.gens()+(1,)) for h in m]
2 | No.2 Revision |
A function to get a list of monomials of specified degree would be good to have in sage. Perhaps it is already by now. Otherwise it's not hard to define once you know which primitives to use:
def monomials_of_degree(P,n):
V=[P({tuple(a):1}) for a in WeightedIntegerVectors(n,[1]*P.ngens())]
return V
With this you can do:
m=monomials_of_degree(PolynomialRing(QQ,'P',4),3)
R=PolynomialRing(QQ,'p',3)
M=[h(R.gens()+(1,)) for h in m]