@@ -1380,9 +1380,15 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1380
1380
sage: mons = R. monomials_of_degree( 2)
1381
1381
sage: mons
1382
1382
[z^2, y*z, x*z, y^2, x*y, x^2 ]
1383
- sage: P = PolynomialRing( QQ, 3, 'x,y, z', order=TermOrder( 'wdeglex', [1,2, 1 ]))
1383
+ sage: P = PolynomialRing( QQ, 3, 'x, y, z', order=TermOrder( 'wdeglex', [1, 2, 1 ]))
1384
1384
sage: P. monomials_of_degree( 2)
1385
- [y, z^2, x*z, x^2 ]
1385
+ [z^2, y, x*z, x^2 ]
1386
+ sage: P = PolynomialRing( QQ, 3, 'x, y, z', order='lex')
1387
+ sage: P. monomials_of_degree( 3)
1388
+ [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 ]
1389
+ sage: P = PolynomialRing( QQ, 3, 'x, y, z', order='invlex')
1390
+ sage: P. monomials_of_degree( 3)
1391
+ [x^3, x^2*y, x*y^2, y^3, x^2*z, x*y*z, y^2*z, x*z^2, y*z^2, z^3 ]
1386
1392
1387
1393
The number of such monomials equals `\b inom{n+ k-1}{k}`
1388
1394
where `n` is the number of variables and `k` the degree::
@@ -1392,7 +1398,9 @@ cdef class MPolynomialRing_base(sage.rings.ring.CommutativeRing):
1392
1398
"""
1393
1399
deg_of_gens = [x.degree() for x in self .gens()]
1394
1400
from sage.combinat.integer_vector_weighted import WeightedIntegerVectors
1395
- return [self .monomial(* a) for a in WeightedIntegerVectors(degree, deg_of_gens)]
1401
+ mons = [self .monomial(* a) for a in WeightedIntegerVectors(degree, deg_of_gens)]
1402
+ mons.sort() # This could be implemented in WeightedIntegerVectors instead
1403
+ return mons
1396
1404
1397
1405
def _macaulay_resultant_getS (self , mon_deg_tuple , dlist ):
1398
1406
r """
0 commit comments