SageMath: Embed all roots of a polynomial

1.9k Views Asked by At

I have a polynomial, and I would like to make a number field in Sage that would contain all roots of this polynomial. I have tried the following code but it throws an error:

R.<X>=QQ['X']
p=X^3+X^2+X-1

# extract the complex roots of `p`
pRoots=p.complex_roots();
for x in pRoots:
    if x.imag()>0.01:
        gamma = x
    if x.imag()<-0.01:
        gammabar = x

# mathematically: `K = Q(gamma)`
K.<g> = NumberField(p, embedding=gamma)
# mathematically: `L = K(gammabar) = Q(gamma,gammabar)`
L.<gg> = K.extension(p, embedding=gammabar)

The error says:

NotImplementedError: Embeddings not implemented for relative number fields

I obviously need embeddings since the minimal polynomial is the same for both gamma and gammabar

1

There are 1 best solutions below

1
On BEST ANSWER

I adapted the Sage commands from that Gmane thread and got these results from an online Sage notebook:

sage: Zx.<x> = ZZ[]
sage: f = x^3 + x^2 + x - 1
sage: K.<a> = f.root_field()
sage: K
     Number Field in a with defining polynomial x^3 + x^2 + x - 1
sage: L.<b> = K.galois_closure()
sage: L
     Number Field in b with defining polynomial
          x^6 - 2*x^5 + 11*x^4 + 12*x^3 + 3*x^2 + 110*x + 517

I also verified the irreducibility of the polynomial:

sage: f.factor()
          x^3 + x^2 + x - 1

Note that the degree of the extension L over $\mathbb{Q}$ is six, and that since this is a splitting field for f, the Galois group of L over $\mathbb{Q}$ is order 6 as well.

While f has only root a in K (with multiplicity 1):

sage: f.roots(K)
     [(a, 1)]

we get three roots of f in L (each with multiplicity 1):

sage: f.roots(L)
     [(10/11103*b^5 - 311/22206*b^4 + 274/11103*b^3 
        - 334/3701*b^2 + 2134/11103*b - 9739/22206, 1),
      (5/11103*b^5 - 311/44412*b^4 + 137/11103*b^3
        - 167/3701*b^2 - 8969/22206*b - 9739/44412, 1),
      (-5/3701*b^5 + 311/14804*b^4 - 137/3701*b^3
        + 501/3701*b^2 + 1567/7402*b - 5065/14804, 1)]

I think there's freedom in identifying two of these with your $\gamma$ and $\overline{\gamma}$, but let me think about it more.