ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 10 Aug 2016 06:17:42 -0500Equivalent to Singular's minpoly?https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/Hello everyone
In Singular, one can define a ring such as
ring r = (0,i),(x,y),dp;
minpoly = i2+1;
in order to specify that the parameter *i* verifies *i²+1=0*. Can I do this, or is it at all needed to work with *Q(i)*, in Sage?
As of now, I have defined a ring
K.<x,y,I>=QQ[]
but I don't know if defining *I* as a parameter of the ring in Sage is needed, neither how could I define the minimal polynomial for *K*.
Thank you.
**Edit:** I discovered I can simplify each polynomial using `.mod(I^2+1)` but I guess there has to be a more general solution that applies this to the ring itself.Wed, 10 Aug 2016 03:21:55 -0500https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/Answer by tmonteil for <p>Hello everyone</p>
<p>In Singular, one can define a ring such as</p>
<pre><code>ring r = (0,i),(x,y),dp;
minpoly = i2+1;
</code></pre>
<p>in order to specify that the parameter <em>i</em> verifies <em>i²+1=0</em>. Can I do this, or is it at all needed to work with <em>Q(i)</em>, in Sage?</p>
<p>As of now, I have defined a ring</p>
<pre><code>K.<x,y,I>=QQ[]
</code></pre>
<p>but I don't know if defining <em>I</em> as a parameter of the ring in Sage is needed, neither how could I define the minimal polynomial for <em>K</em>.</p>
<p>Thank you.</p>
<p><strong>Edit:</strong> I discovered I can simplify each polynomial using <code>.mod(I^2+1)</code> but I guess there has to be a more general solution that applies this to the ring itself.</p>
https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?answer=34403#post-id-34403Is this what you need ?
sage: R.<I> = QQ[I]
sage: R
Number Field in I with defining polynomial x^2 + 1
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Number Field in I with defining polynomial x^2 + 1
sage: P = x+I*y
sage: P^2
x^2 + (2*I)*x*y - y^2
**EDIT**: For GF(5), you can do similarly, but you have to define the quotient by yourself:
sage: S.<i> = GF(5)[]
sage: S
Univariate Polynomial Ring in i over Finite Field of size 5
sage: R.<I> = S.quotient(i^2+1)
sage: R
Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: I
I
sage: I^2
4
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: P = x+I*3*y
sage: P
x + 3*I*y
sage: P^2
x^2 + I*x*y + y^2
Wed, 10 Aug 2016 03:45:35 -0500https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?answer=34403#post-id-34403Comment by tmonteil for <p>Is this what you need ?</p>
<pre><code>sage: R.<I> = QQ[I]
sage: R
Number Field in I with defining polynomial x^2 + 1
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Number Field in I with defining polynomial x^2 + 1
sage: P = x+I*y
sage: P^2
x^2 + (2*I)*x*y - y^2
</code></pre>
<p><strong>EDIT</strong>: For GF(5), you can do similarly, but you have to define the quotient by yourself:</p>
<pre><code>sage: S.<i> = GF(5)[]
sage: S
Univariate Polynomial Ring in i over Finite Field of size 5
sage: R.<I> = S.quotient(i^2+1)
sage: R
Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: I
I
sage: I^2
4
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: P = x+I*3*y
sage: P
x + 3*I*y
sage: P^2
x^2 + I*x*y + y^2
</code></pre>
https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?comment=34405#post-id-34405I updated my answer.Wed, 10 Aug 2016 06:17:42 -0500https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?comment=34405#post-id-34405Comment by osr for <p>Is this what you need ?</p>
<pre><code>sage: R.<I> = QQ[I]
sage: R
Number Field in I with defining polynomial x^2 + 1
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Number Field in I with defining polynomial x^2 + 1
sage: P = x+I*y
sage: P^2
x^2 + (2*I)*x*y - y^2
</code></pre>
<p><strong>EDIT</strong>: For GF(5), you can do similarly, but you have to define the quotient by yourself:</p>
<pre><code>sage: S.<i> = GF(5)[]
sage: S
Univariate Polynomial Ring in i over Finite Field of size 5
sage: R.<I> = S.quotient(i^2+1)
sage: R
Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: I
I
sage: I^2
4
sage: K.<x,y> = PolynomialRing(R)
sage: K
Multivariate Polynomial Ring in x, y over Univariate Quotient Polynomial Ring in I over Finite Field of size 5 with modulus i^2 + 1
sage: P = x+I*3*y
sage: P
x + 3*I*y
sage: P^2
x^2 + I*x*y + y^2
</code></pre>
https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?comment=34404#post-id-34404That is exactly what I needed, thank you!
Just one follow-up question, how would I do this for a finite field like GF(5) instead of QQ?Wed, 10 Aug 2016 04:06:26 -0500https://ask.sagemath.org/question/34402/equivalent-to-singulars-minpoly/?comment=34404#post-id-34404