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.Mon, 06 Dec 2021 20:26:18 +0100Polynomial ring with complex elements.https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/I am trying to define the polynomial ring $\Bbb{Z}[j]$ where $j$ is a primitive 3rd root of unity, i.e. $j = e^{\frac{2}{3} \pi i} \in \Bbb C$.
I tried this:
P.<x> = PolynomialRing(QQ)
j = exp((2/3)*pi*i)
P[j]
But I get the error:
NotImplementedError: ring extension with prescribed embedding is not implementedMon, 06 Dec 2021 15:51:03 +0100https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/Answer by slelievre for <p>I am trying to define the polynomial ring $\Bbb{Z}[j]$ where $j$ is a primitive 3rd root of unity, i.e. $j = e^{\frac{2}{3} \pi i} \in \Bbb C$.</p>
<p>I tried this:</p>
<pre><code>P.<x> = PolynomialRing(QQ)
j = exp((2/3)*pi*i)
P[j]
</code></pre>
<p>But I get the error:</p>
<pre><code>NotImplementedError: ring extension with prescribed embedding is not implemented
</code></pre>
https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?answer=60117#post-id-60117The ring you need is the ring of Eisenstein integers.
It is implemented in Sage as `EisensteinIntegers()`.
Try this:
sage: P.<j> = EisensteinIntegers()
sage: P
Eisenstein Integers in Number Field in j with defining polynomial x^2 + x + 1 with j = -0.50000000000000000? + 0.866025403784439?*I
sage: j
j
sage: j^2
-j - 1
sage: j^3
1
sage: 1 + j + j^2
0
Mon, 06 Dec 2021 16:25:28 +0100https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?answer=60117#post-id-60117Comment by Max Alekseyev for <p>The ring you need is the ring of Eisenstein integers.</p>
<p>It is implemented in Sage as <code>EisensteinIntegers()</code>.</p>
<p>Try this:</p>
<pre><code>sage: P.<j> = EisensteinIntegers()
sage: P
Eisenstein Integers in Number Field in j with defining polynomial x^2 + x + 1 with j = -0.50000000000000000? + 0.866025403784439?*I
sage: j
j
sage: j^2
-j - 1
sage: j^3
1
sage: 1 + j + j^2
0
</code></pre>
https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?comment=60123#post-id-60123What is $\frac{\mathbb Z[j]}{2-5j}$ ?Mon, 06 Dec 2021 20:26:18 +0100https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?comment=60123#post-id-60123Comment by kev for <p>The ring you need is the ring of Eisenstein integers.</p>
<p>It is implemented in Sage as <code>EisensteinIntegers()</code>.</p>
<p>Try this:</p>
<pre><code>sage: P.<j> = EisensteinIntegers()
sage: P
Eisenstein Integers in Number Field in j with defining polynomial x^2 + x + 1 with j = -0.50000000000000000? + 0.866025403784439?*I
sage: j
j
sage: j^2
-j - 1
sage: j^3
1
sage: 1 + j + j^2
0
</code></pre>
https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?comment=60118#post-id-60118Thanks! Is it possible to express $\frac{\Bbb{Z}[j]}{(2-5j)}$ as well? I tried `P.quotient((2-5*j))`, but I am getting `IndexError: the number of names must equal the number of generators`.Mon, 06 Dec 2021 17:54:43 +0100https://ask.sagemath.org/question/60115/polynomial-ring-with-complex-elements/?comment=60118#post-id-60118