# How can I define a field of numbers by hitting to the field of rationals two roots of the same polynomial ?

I tried:

sage: alpha=sqrt(-11/2 + sqrt(11^2-4(11))/2)
sage: alpha=sqrt(-11/2 - sqrt(11^2-4(11))/2)
sage: K=QQ[alpha,beta]

edit retag close merge delete

When posting code you should "format" it as code, either by indenting it 4 spaces, or highlighting it and entering Ctrl-K or using the WSIWYG toolbar and the "code" button. I've fixed it for you for now.

Sort by » oldest newest most voted Note number fields in SageMath are abstract extensions of $\mathbb{Q}$; they come with several embeddings into $\mathbb{C}$; see below.

Option 1 (number field from algebraic numbers):

sage: K, [A,B], emb = number_field_elements_from_algebraics([alpha,beta], minimal=True)
sage: K
Number Field in a with defining polynomial y^8 + 4*y^6 + 358*y^4 + 708*y^2 + 529
sage: A
-1/80*a^6 - 3/80*a^4 - 359/80*a^2 - 357/80
sage: B
1/920*a^7 + 1/230*a^5 + 381/920*a^3 + 607/460*a
sage: emb(A) == QQbar(alpha), emb(B) == QQbar(beta)
(True, True)


For other options, let's first find what polynomial we are talking about:

sage: f = alpha.minpoly(); f
x^4 + 11*x^2 + 11


Option 2 (splitting field):

sage: K.<c> = f.splitting_field()
sage: f_roots = f.roots(K, multiplicities=False)
sage: emb = K.embeddings(QQbar)
sage: map(emb, f_roots)
[0.?e-16 + 1.054759596450271?*I,
0.?e-16 - 1.054759596450271?*I,
0.?e-16 - 3.144436705309246?*I,
0.?e-16 + 3.144436705309246?*I]
sage: QQbar(alpha), QQbar(beta)
(1.054759596450272?*I, 3.144436705309246?*I)
sage: a = f_roots; b = f_roots
sage: emb(a) == QQbar(alpha), emb(b) == QQbar(beta)
(True, True)


Option 3 (successive extensions):

sage: K.<a> = NumberField(x^4 + 11*x^2 + 11)
sage: R.<y> = PolynomialRing(K)
sage: R(f).factor()
(y - a) * (y + a) * (y^2 + a^2 + 11)
sage: g = y^2 + a^2 + 11
sage: L.<b> = K.extension(g)
sage: f.change_ring(L).factor()
(x - b) * (x - a) * (x + a) * (x + b)
sage: emb = L.embeddings(QQbar)
sage: emb(a) == QQbar(alpha), emb(b) == QQbar(beta)
(True, True)


You can also make an absolute extension from the relative one:

sage: M.<c> = L.absolute_field(); M
Number Field in c with defining polynomial x^8 + 110*x^6 + 3839*x^4 + 44770*x^2 + 43681
sage: from_M, to_M = M.structure()
sage: to_M(a)
7/2508*c^7 + 145/627*c^5 + 509/114*c^3 + 421/76*c
sage: to_M(b)
7/1254*c^7 + 290/627*c^5 + 509/57*c^3 + 459/38*c
sage: emb = M.embeddings(QQbar)
sage: emb(to_M(a)) == QQbar(alpha), emb(to_M(b)) == QQbar(beta)
(True, True)

more