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:


# extract the complex roots of `p`
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

  • $\begingroup$ You want the splitting field of the polynomial over $\mathbb{Q}$? $\endgroup$
    – hardmath
    Nov 18, 2013 at 18:22
  • $\begingroup$ I don't know what you mean by "splitting", but yes, I obviously need to work over $\mathbb Q$, since I basically want to express $\mathbb Q(\gamma, \overline\gamma)$ as $\mathbb Q(\alpha)$ for some $\alpha$. $\endgroup$
    – yo'
    Nov 18, 2013 at 19:10
  • $\begingroup$ The splitting field of a polynomial is precisely the smallest field extension that contains the roots of that polynomial, i.e. the smallest field in which the polynomial "splits" into linear factors. There's a discussion at Gmane of ways to do this in a slightly indirect way. $\endgroup$
    – hardmath
    Nov 18, 2013 at 19:15
  • $\begingroup$ Okay, I thought about it: we don't get $\overline{\gamma}$ just by adjoining $\gamma$ to the rationals $\mathbb{Q}$. If we did, then complex conjugation would be an automorphism of $\mathbb{Q}(\gamma)$ fixing $\mathbb{Q}$, but $\mathbb{Q}(\gamma)$ is dimension 3 over $\mathbb{Q}$, and 2 does not divide 3. $\endgroup$
    – hardmath
    Nov 18, 2013 at 21:30
  • $\begingroup$ @hardmath I asked a question exactly about it just before asking this one. However, your explanation doesn't seem to be enough, since I don't see why complex conjugation cannot fix a non-real field of degree $3$. $\endgroup$
    – yo'
    Nov 18, 2013 at 22:13

1 Answer 1


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.

  • 1
    $\begingroup$ You can identify the roots in another way. You may do qRoot=L.polynomial().complex_roots()[0] and redefine L as L.<gg> = NumberField(q, embedding=qRoot). Then f.roots(L) give 3 roots, and when you .N() them, you see that they are gamma, gammabar and the real root in some order. They will permute depending on which qRoot you choose. $\endgroup$
    – yo'
    Nov 18, 2013 at 23:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .