# Can I define a graded ring in sage?

I can define a custom grading on a polynomial ring in Macaulay2 with the command

```
S = QQ[x,y, Degrees => {{1},{2}}]
```

Can I define this ring in sage?

Can I define a graded ring in sage?

I can define a custom grading on a polynomial ring in Macaulay2 with the command

```
S = QQ[x,y, Degrees => {{1},{2}}]
```

Can I define this ring in sage?

add a comment

1

If I correctly understand the Macaulay2 command you provide, you can mimick the same behavior in SageMath as follows:

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

You can find more informations on term orders in the documentation [1]. Several weighted term orders are available.

Ahh great! Also, is it possible to define a bidegree? TermOrder('wdeglex', ((1,0),(2,2))) returns a TypeError

I do not think so. I urge you to propose a ticket on http://trac.sagemath.org to implement this kind of term orders.

Well, thinking a bit more about this, you can use matrix term orders:

```
sage: S = TermOrder('M(2,3,0,1)')
sage: S
Matrix term order with matrix
[2 3]
[0 1]
```

In such a way, the first variable will have weight `(2,0)`

and the second `(3,1)`

. This order is used when you compare monomials. Unfortunately, the method `degree`

only returns the degree with respect with the first weight of each variable rather than a tuple. I do not know how one can get the tuple.

Asked: **
2016-06-20 14:40:28 -0500
**

Seen: **136 times**

Last updated: **Jun 21 '16**

Multivariate rational function field of rank 3 over Rational Field

Solving system of polynomial equation over finite field

Create new structure class and define its element

Defining AES MixColumns in Sage

Tensor product of polynomial algebras

Creating a polynomial ring where the variables are code generated

Is there a way to create the ring of multi-variable polynomials over a field?

Reducing a Set of Polynomial Equations to Minimal Variables and Equations

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

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.