# i want to define field \mathbb Q (\sqrt 2,\sqrt 3) what command should use?

i tried doing it by spiliting field comand but it is not working ,if possible let me know about spliting field commands also

edit retag close merge delete

Sort by ยป oldest newest most voted

You can do the following:

R.<x> = PolynomialRing(QQ)
f = (x^2-2)*(x^2-3)
K.<a> = f.splitting_field()


Note that f.splitting_field() requires a name for the primitive element of the field (a here), which is passed here by using the shorthand notation, as shown in the documentation.

To identify the elements of the splitting field K which correspond to the roots of f you can do e.g.

f.change_ring(K).roots()


or in this case also something like

sqrt(K(3))

more

The most natural way is probably as follows.

sage: K = QQ[sqrt(2), sqrt(3)]
sage: K.inject_variables()
Defining sqrt2, sqrt3
sage: (sqrt2 + sqrt3)^2
2*sqrt3*sqrt2 + 5


The case of adjoining two algebraic numbers with the same minimal polynomial is more involved, see:

more

Alternatively, you can do:

sage: number_field_elements_from_algebraics([QQbar(2).sqrt(), QQbar(3).sqrt()],minimal=True, same_field=True)
(Number Field in a with defining polynomial y^4 - 4*y^2 + 1,
[-a^3 + 3*a, -a^2 + 2],
Ring morphism:
From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
To:   Algebraic Field
Defn: a |--> 0.5176380902050415?)

more