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.Thu, 03 Sep 2015 12:06:19 -0500Can't construct automorphisms of p-adic fieldshttps://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/ I'm trying to construct automorphisms of finite extensions of $\mathbb Q_p$ and getting a funny error. Here's a prototypical example:
Evaluating the cyclotomic polynomial $x^4 + x^3 + x^2 + x + 1$ at $x+1$ gives an Eisenstein polynomial for the prime $p=5$. If $\pi$ is a root of $(x+1)^4 + (x+1)^3 + (x+1)^2 + (x+1) + 1$ then $\pi+1$ will be a primitive 5th root of unity.
K.<pi> = Qp(5).ext(sum((1+x)^i for i in range(5)))
So $K=\mathbb Q_p(\zeta_5)$ with uniformizer $\pi=\zeta_5-1$. Now I want to define the automorphism $\tau:\zeta_5\mapsto\zeta_5^2$. We have $\tau(\pi)=(1+\pi)^2-1=2\pi+\pi^2$. But the following
tau = K.hom([2*pi+pi^2])
results in the error `TypeError: images do not define a valid homomorphism`. What's going on? Are `hom`'s of $p$-adic fields not really implemented yet or am I doing something wrong?Wed, 02 Sep 2015 17:40:36 -0500https://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/Answer by nbruin for <p>I'm trying to construct automorphisms of finite extensions of $\mathbb Q_p$ and getting a funny error. Here's a prototypical example:</p>
<p>Evaluating the cyclotomic polynomial $x^4 + x^3 + x^2 + x + 1$ at $x+1$ gives an Eisenstein polynomial for the prime $p=5$. If $\pi$ is a root of $(x+1)^4 + (x+1)^3 + (x+1)^2 + (x+1) + 1$ then $\pi+1$ will be a primitive 5th root of unity.</p>
<pre><code>K.<pi> = Qp(5).ext(sum((1+x)^i for i in range(5)))
</code></pre>
<p>So $K=\mathbb Q_p(\zeta_5)$ with uniformizer $\pi=\zeta_5-1$. Now I want to define the automorphism $\tau:\zeta_5\mapsto\zeta_5^2$. We have $\tau(\pi)=(1+\pi)^2-1=2\pi+\pi^2$. But the following</p>
<pre><code>tau = K.hom([2*pi+pi^2])
</code></pre>
<p>results in the error <code>TypeError: images do not define a valid homomorphism</code>. What's going on? Are <code>hom</code>'s of $p$-adic fields not really implemented yet or am I doing something wrong?</p>
https://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/?answer=29395#post-id-29395You're correct. In your example you end up executing:
sage: sage.rings.morphism.RingHomomorphism_im_gens(K.Hom(K), [2*pi+pi^2], check=true)
NotImplementedError: Verification of correctness of homomorphisms from Eisenstein Extension of 5-adic Field with capped relative precision 20 in pi defined by (1 + O(5^20))*x^4 + (5 + O(5^20))*x^3 + (2*5 + O(5^20))*x^2 + (2*5 + O(5^20))*x + (5 + O(5^20)) not yet implemented.
but then this error gets caught in wrapping code and recast as a less informative error. (rant: this is a general problem in Python: people think they make code robust by putting try/except statements in but in reality they just reduce the ability of the code to properly report the problem)
Once you know the problem, the workaround is easy:
sage: tau = K.hom([2*pi+pi^2],check=false)
sage: tau
Ring endomorphism of Eisenstein Extension of 5-adic Field with capped relative precision 20 in pi defined by (1 + O(5^20))*x^4 + (5 + O(5^20))*x^3 + (2*5 + O(5^20))*x^2 + (2*5 + O(5^20))*x + (5 + O(5^20))
Defn: pi + O(pi^77) |--> 2*pi + pi^2 + O(pi^77)
Thu, 03 Sep 2015 11:11:38 -0500https://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/?answer=29395#post-id-29395Comment by siggytm for <p>You're correct. In your example you end up executing:</p>
<pre><code>sage: sage.rings.morphism.RingHomomorphism_im_gens(K.Hom(K), [2*pi+pi^2], check=true)
NotImplementedError: Verification of correctness of homomorphisms from Eisenstein Extension of 5-adic Field with capped relative precision 20 in pi defined by (1 + O(5^20))*x^4 + (5 + O(5^20))*x^3 + (2*5 + O(5^20))*x^2 + (2*5 + O(5^20))*x + (5 + O(5^20)) not yet implemented.
</code></pre>
<p>but then this error gets caught in wrapping code and recast as a less informative error. (rant: this is a general problem in Python: people think they make code robust by putting try/except statements in but in reality they just reduce the ability of the code to properly report the problem)</p>
<p>Once you know the problem, the workaround is easy:</p>
<pre><code>sage: tau = K.hom([2*pi+pi^2],check=false)
sage: tau
Ring endomorphism of Eisenstein Extension of 5-adic Field with capped relative precision 20 in pi defined by (1 + O(5^20))*x^4 + (5 + O(5^20))*x^3 + (2*5 + O(5^20))*x^2 + (2*5 + O(5^20))*x + (5 + O(5^20))
Defn: pi + O(pi^77) |--> 2*pi + pi^2 + O(pi^77)
</code></pre>
https://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/?comment=29396#post-id-29396Thank you! That's a nice easy workaround.Thu, 03 Sep 2015 12:06:19 -0500https://ask.sagemath.org/question/29390/cant-construct-automorphisms-of-p-adic-fields/?comment=29396#post-id-29396