ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Jun 2016 02:00:54 -0500Can I define a graded ring in sage?http://ask.sagemath.org/question/33864/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?
Mon, 20 Jun 2016 14:40:28 -0500http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/Answer by B r u n o for <p>I can define a custom grading on a polynomial ring in Macaulay2 with the command</p>
<pre><code>S = QQ[x,y, Degrees => {{1},{2}}]
</code></pre>
<p>Can I define this ring in sage?</p>
http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?answer=33867#post-id-33867If 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.
[1] http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/term_order.htmlTue, 21 Jun 2016 01:38:33 -0500http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?answer=33867#post-id-33867Comment by B r u n o for <p>If I correctly understand the Macaulay2 command you provide, you can mimick the same behavior in SageMath as follows:</p>
<pre><code>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
</code></pre>
<p>You can find more informations on term orders in the documentation [1]. Several weighted term orders are available.</p>
<p>[1] <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/term_order.html">http://doc.sagemath.org/html/en/refer...</a></p>
http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33882#post-id-33882Well, 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.Wed, 22 Jun 2016 02:00:54 -0500http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33882#post-id-33882Comment by B r u n o for <p>If I correctly understand the Macaulay2 command you provide, you can mimick the same behavior in SageMath as follows:</p>
<pre><code>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
</code></pre>
<p>You can find more informations on term orders in the documentation [1]. Several weighted term orders are available.</p>
<p>[1] <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/term_order.html">http://doc.sagemath.org/html/en/refer...</a></p>
http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33881#post-id-33881I do not think so. I urge you to propose a ticket on http://trac.sagemath.org to implement this kind of term orders.Wed, 22 Jun 2016 01:47:59 -0500http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33881#post-id-33881Comment by done_with_fish for <p>If I correctly understand the Macaulay2 command you provide, you can mimick the same behavior in SageMath as follows:</p>
<pre><code>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
</code></pre>
<p>You can find more informations on term orders in the documentation [1]. Several weighted term orders are available.</p>
<p>[1] <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/term_order.html">http://doc.sagemath.org/html/en/refer...</a></p>
http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33873#post-id-33873Ahh great! Also, is it possible to define a bidegree? TermOrder('wdeglex', ((1,0),(2,2))) returns a TypeErrorTue, 21 Jun 2016 11:50:07 -0500http://ask.sagemath.org/question/33864/can-i-define-a-graded-ring-in-sage/?comment=33873#post-id-33873