# 20 monomials of degree 3 in 4 variables in lexicographic ordering

Hey community, I've recently wanted to switch over to sage (very new) from Maple and I am having trouble understanding how to make monomials of degree 3 in 4 variables (hopefully in lexographic ordering think of the w coordinate as one). I am not very good at english, but this is for a Clebsch map up and down for a surface that I am studying.

These are the maps:
m1:=p-->p^3;
m2:=p-->p^2p;
m3:=p-->p^2
p;
m4:=p-->p^2;
m5:=p-->pp^2;
m6:=p-->p
pp;
m7:=p-->p
p;
m8:=p-->pp^2;
m9:=p-->p
p;
m10:=p-->p;
m11:=p-->p^3;
m12:=p-->p^2p;
m13:=p-->p^2;
m14:=p-->p
p^2;
m15:=p-->p*p;
m16:=p-->p; m17:=p-->p^3;
m18:=p-->p^2;
m19:=p-->p;
m20:=p-->1;
Then M:=[m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m20]

edit retag close merge delete

Sort by » oldest newest most voted

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,*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]

more