ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 30 Jul 2019 01:31:08 +0200How can I assign different degrees to the variables of a polynomial ring?https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/ In defining a polynomial ring, is there any way to assign varying degrees to the variables?
For example I want to define the polynomial ring Q[x, y, z] but I want x to be of degree 1, y to be degree 2, and z to be degree 3. I am looking for a way to do this in general not just for a small number of variables.
Mon, 29 Jul 2019 07:07:55 +0200https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/Answer by John Palmieri for <p>In defining a polynomial ring, is there any way to assign varying degrees to the variables?</p>
<p>For example I want to define the polynomial ring Q[x, y, z] but I want x to be of degree 1, y to be degree 2, and z to be degree 3. I am looking for a way to do this in general not just for a small number of variables. </p>
https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?answer=47307#post-id-47307You can use "weights":
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',(1,2,3)))
sage: x.degree()
1
sage: z.degree()
3
I think this is not documented very well, or at least I didn't discover it easily. See http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/multi_polynomial.html#sage.rings.polynomial.multi_polynomial.MPolynomial.weighted_degree and http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/term_order.html.Mon, 29 Jul 2019 19:26:04 +0200https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?answer=47307#post-id-47307Comment by Laughematician760 for <p>You can use "weights":</p>
<pre><code>sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',(1,2,3)))
sage: x.degree()
1
sage: z.degree()
3
</code></pre>
<p>I think this is not documented very well, or at least I didn't discover it easily. See <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/multi_polynomial.html#sage.rings.polynomial.multi_polynomial.MPolynomial.weighted_degree">http://doc.sagemath.org/html/en/refer...</a> and <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>
https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?comment=47308#post-id-47308Was there something else you intended to include or was that third and a mistake?Mon, 29 Jul 2019 20:41:32 +0200https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?comment=47308#post-id-47308Comment by John Palmieri for <p>You can use "weights":</p>
<pre><code>sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdeglex',(1,2,3)))
sage: x.degree()
1
sage: z.degree()
3
</code></pre>
<p>I think this is not documented very well, or at least I didn't discover it easily. See <a href="http://doc.sagemath.org/html/en/reference/polynomial_rings/sage/rings/polynomial/multi_polynomial.html#sage.rings.polynomial.multi_polynomial.MPolynomial.weighted_degree">http://doc.sagemath.org/html/en/refer...</a> and <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>
https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?comment=47309#post-id-47309A mistake. I was going to give the links in the other order and then decided that I preferred this order instead.Tue, 30 Jul 2019 01:31:08 +0200https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/?comment=47309#post-id-47309