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.Sat, 29 Apr 2017 15:42:59 +0200Chain of fields in sagehttps://ask.sagemath.org/question/37458/chain-of-fields-in-sage/I would like to construct the field Fp(alpha,beta) where alpha is a root of x^p-x-1 (over Fp[x]) and beta is a root of the polynomial x^p-x-alpha^(p-1) (over Fp(alpha)[x]).
I have tried the following
F0.<x>=GF(p)['x']
f1=x^p-x-1
R1.<alpha1>=F0.quotient(f1)['alpha1']
F1.<x>=Frac(R1)
f2=x^p-x-alpha1^(p-1)
R2.<alpha2>=F1.quotient(f2)['alpha2']
F2.<x>=Frac(R2)
but I think it creates the field F1 well, but it goes wrong for R2... It also feels like there should be a much more straightforward way to do this in sage. What would be the proper way to do this ?Fri, 28 Apr 2017 21:46:46 +0200https://ask.sagemath.org/question/37458/chain-of-fields-in-sage/Answer by dan_fulea for <p>I would like to construct the field Fp(alpha,beta) where alpha is a root of x^p-x-1 (over Fp[x]) and beta is a root of the polynomial x^p-x-alpha^(p-1) (over Fp(alpha)[x]).</p>
<p>I have tried the following </p>
<pre><code> F0.<x>=GF(p)['x']
f1=x^p-x-1
R1.<alpha1>=F0.quotient(f1)['alpha1']
F1.<x>=Frac(R1)
f2=x^p-x-alpha1^(p-1)
R2.<alpha2>=F1.quotient(f2)['alpha2']
F2.<x>=Frac(R2)
</code></pre>
<p>but I think it creates the field F1 well, but it goes wrong for R2... It also feels like there should be a much more straightforward way to do this in sage. What would be the proper way to do this ?</p>
https://ask.sagemath.org/question/37458/chain-of-fields-in-sage/?answer=37461#post-id-37461Please let me use $u$ and $v$ for the elements of the fields involved.
First solution:
p = 13
R.<U> = PolynomialRing( GF(p) )
F.<u> = GF( p^p, modulus = U^p - U - 1 )
RF.<V> = PolynomialRing( F )
FF.<v> = F.extension( V^p - V - u^(p-1) )
Then `FF` is the required field.
Second solution.
We can try to construct the last field at once.
Let us observe, that the minimal equation satisfied by $x=u^{p-1}=1+1/u$ is:
$$
x^p+\dots+x^2+x-1 =0\ .
$$
For instance:
sage: (u^(p-1)) . minpoly()
x^13 + x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 12
(This is my reason for avoiding $x$.)
Indeed:
$$ \sum_{1\le k\le p}\left(1+\frac 1u\right)^k
= \left(1+\frac 1u\right)\frac{\left(1+\frac 1u\right)^p-1}{\left(1+\frac 1u\right)-1}
=\underbrace{\left(1+\frac 1u\right)}_{u^{p-1}}\frac{\left(1^p+\frac 1{u^p}\right)-1}{\left(1+\frac 1u\right)-1}
=\frac{u^{p-1}}{u^{p-1}}=1\ .
$$
So the code would be:
p = 13
R.<V> = PolynomialRing( GF(p) )
FF.<v> = GF( p^(p*p), modulus = sum( [ (V^p-V)^k for k in [1..p] ] ) - 1 )
u = 1/(v^p-v-1)
u.minpoly()
The last two lines recover $u$ in the constructed field, we have:
sage: u.minpoly()
x^13 + 12*x + 12
Fri, 28 Apr 2017 23:22:33 +0200https://ask.sagemath.org/question/37458/chain-of-fields-in-sage/?answer=37461#post-id-37461Comment by gelatine1 for <p>Please let me use $u$ and $v$ for the elements of the fields involved.</p>
<p>First solution:</p>
<pre><code>p = 13
R.<U> = PolynomialRing( GF(p) )
F.<u> = GF( p^p, modulus = U^p - U - 1 )
RF.<V> = PolynomialRing( F )
FF.<v> = F.extension( V^p - V - u^(p-1) )
</code></pre>
<p>Then <code>FF</code> is the required field.</p>
<p>Second solution.</p>
<p>We can try to construct the last field at once.
Let us observe, that the minimal equation satisfied by $x=u^{p-1}=1+1/u$ is:
$$
x^p+\dots+x^2+x-1 =0\ .
$$
For instance:</p>
<pre><code>sage: (u^(p-1)) . minpoly()
x^13 + x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 12
</code></pre>
<p>(This is my reason for avoiding $x$.)</p>
<p>Indeed:
$$ \sum_{1\le k\le p}\left(1+\frac 1u\right)^k
= \left(1+\frac 1u\right)\frac{\left(1+\frac 1u\right)^p-1}{\left(1+\frac 1u\right)-1}
=\underbrace{\left(1+\frac 1u\right)}_{u^{p-1}}\frac{\left(1^p+\frac 1{u^p}\right)-1}{\left(1+\frac 1u\right)-1}
=\frac{u^{p-1}}{u^{p-1}}=1\ .
$$
So the code would be:</p>
<pre><code>p = 13
R.<V> = PolynomialRing( GF(p) )
FF.<v> = GF( p^(p*p), modulus = sum( [ (V^p-V)^k for k in [1..p] ] ) - 1 )
u = 1/(v^p-v-1)
u.minpoly()
</code></pre>
<p>The last two lines recover $u$ in the constructed field, we have:</p>
<pre><code>sage: u.minpoly()
x^13 + 12*x + 12
</code></pre>
https://ask.sagemath.org/question/37458/chain-of-fields-in-sage/?comment=37466#post-id-37466I have to construct a chain like that, with 5 different elements. When i use the extend function for the 4th time it gives "NotImplementedError"...Sat, 29 Apr 2017 15:42:59 +0200https://ask.sagemath.org/question/37458/chain-of-fields-in-sage/?comment=37466#post-id-37466