Ask Your Question

# 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[1]^3;
m2:=p-->p[1]^2p;
m3:=p-->p[1]^2
p[3];
m4:=p-->p[1]^2;
m5:=p-->p[1]p[2]^2;
m6:=p-->p[1]
p[2]p[3];
m7:=p-->p[1]
p[2];
m8:=p-->p[1]p[3]^2;
m9:=p-->p[1]
p[3];
m10:=p-->p[1];
m11:=p-->p[2]^3;
m12:=p-->p[2]^2p[3];
m13:=p-->p[2]^2;
m14:=p-->p[2]
p[3]^2;
m15:=p-->p[2]*p[3];
m16:=p-->p[2]; m17:=p-->p[3]^3;
m18:=p-->p[3]^2;
m19:=p-->p[3];
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

## 1 Answer

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

more

## Comments

Lovely, thank you so much for the help!

( 2020-02-27 21:56:23 +0200 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2020-02-26 22:41:38 +0200

Seen: 220 times

Last updated: Feb 27 '20