# Can sage compute a basis for the graded parts of a graded ring?

We can define a graded ring

```
sage: T = TermOrder("wdeglex", (1,2))
sage: S = PolynomialRing(QQ, 'x,y', order=T)
sage: S
Multivariate Polynomial Ring in x, y over Rational Field
sage: x,y = S.gens()
sage: (x*y).degree()
3
```

I want to find all monomials in `S`

of a given degree `d`

. Can this be done in sage?

This can be done in Macaulay2 with

```
i1 : QQ[x, y, Degrees => {{1}, {2}}]
o1 = S
o1 : PolynomialRing
i2 : basis(4, S)
o2 = | x4 x2y y2 |
1 3
o2 : Matrix S <--- S
```