# Morphisms between number fields¶

This module provides classes to represent ring homomorphisms between number fields (i.e. field embeddings).

class sage.rings.number_field.morphism.CyclotomicFieldHomomorphism_im_gens
class sage.rings.number_field.morphism.CyclotomicFieldHomset(R, S, category=None)

Set of homomorphisms with domain a given cyclotomic field.

EXAMPLES:

sage: End(CyclotomicField(16))
Automorphism group of Cyclotomic Field of order 16 and degree 8

list()

Return a list of all the elements of self (for which the domain is a cyclotomic field).

EXAMPLES:

sage: K.<z> = CyclotomicField(12)
sage: G = End(K); G
Automorphism group of Cyclotomic Field of order 12 and degree 4
sage: [g(z) for g in G]
[z, z^3 - z, -z, -z^3 + z]
sage: L.<a, b> = NumberField([x^2 + x + 1, x^4 + 1])
sage: L
Number Field in a with defining polynomial x^2 + x + 1 over its base field
sage: Hom(CyclotomicField(12), L)
Ring morphism:
From: Cyclotomic Field of order 12 and degree 4
To:   Number Field in a with defining polynomial x^2 + x + 1 over its base field
Defn: zeta12 |--> -b^2*a
sage: list(Hom(CyclotomicField(5), K))
[]
sage: Hom(CyclotomicField(11), L).list()
[]

class sage.rings.number_field.morphism.NumberFieldHomomorphism_im_gens
preimage(y)

Computes a preimage of $$y$$ in the domain, provided one exists. Raises a ValueError if $$y$$ has no preimage.

INPUT:

• $$y$$ – an element of the codomain of self.

OUTPUT:

Returns the preimage of $$y$$ in the domain, if one exists. Raises a ValueError if $$y$$ has no preimage.

EXAMPLES:

sage: K.<a> = NumberField(x^2 - 7)
sage: L.<b> = NumberField(x^4 - 7)
sage: f = K.embeddings(L)
sage: f.preimage(3*b^2 - 12/7)
3*a - 12/7
sage: f.preimage(b)
Traceback (most recent call last):
...
ValueError: Element 'b' is not in the image of this homomorphism.

sage: F.<b> = QuadraticField(23)
sage: G.<a> = F.extension(x^3+5)
sage: f = F.embeddings(G)
sage: f.preimage(a^3+2*b+3)
2*b - 2

class sage.rings.number_field.morphism.NumberFieldHomset(R, S, category=None)

Set of homomorphisms with domain a given number field.

cardinality()

Return the order of this set of field homomorphism.

EXAMPLES:

sage: k.<a> = NumberField(x^2 + 1)
sage: End(k)
Automorphism group of Number Field in a with defining polynomial x^2 + 1
sage: End(k).order()
2
sage: k.<a> = NumberField(x^3 + 2)
sage: End(k).order()
1

sage: K.<a> = NumberField( [x^3 + 2, x^2 + x + 1] )
sage: End(K).order()
6

list()

Return a list of all the elements of self.

EXAMPLES:

sage: K.<a> = NumberField(x^3 - 3*x + 1)
sage: End(K).list()
[
Ring endomorphism of Number Field in a with defining polynomial x^3 - 3*x + 1
Defn: a |--> a,
Ring endomorphism of Number Field in a with defining polynomial x^3 - 3*x + 1
Defn: a |--> a^2 - 2,
Ring endomorphism of Number Field in a with defining polynomial x^3 - 3*x + 1
Defn: a |--> -a^2 - a + 2
]
sage: Hom(K, CyclotomicField(9)) # indirect doctest
Ring morphism:
From: Number Field in a with defining polynomial x^3 - 3*x + 1
To:   Cyclotomic Field of order 9 and degree 6
Defn: a |--> -zeta9^4 + zeta9^2 - zeta9


An example where the codomain is a relative extension:

sage: K.<a> = NumberField(x^3 - 2)
sage: L.<b> = K.extension(x^2 + 3)
sage: Hom(K, L).list()
[
Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To:   Number Field in b with defining polynomial x^2 + 3 over its base field
Defn: a |--> a,
Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To:   Number Field in b with defining polynomial x^2 + 3 over its base field
Defn: a |--> -1/2*a*b - 1/2*a,
Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To:   Number Field in b with defining polynomial x^2 + 3 over its base field
Defn: a |--> 1/2*a*b - 1/2*a
]

order()

Return the order of this set of field homomorphism.

EXAMPLES:

sage: k.<a> = NumberField(x^2 + 1)
sage: End(k)
Automorphism group of Number Field in a with defining polynomial x^2 + 1
sage: End(k).order()
2
sage: k.<a> = NumberField(x^3 + 2)
sage: End(k).order()
1

sage: K.<a> = NumberField( [x^3 + 2, x^2 + x + 1] )
sage: End(K).order()
6

class sage.rings.number_field.morphism.RelativeNumberFieldHomomorphism_from_abs(parent, abs_hom)

A homomorphism from a relative number field to some other ring, stored as a homomorphism from the corresponding absolute field.

abs_hom()

Return the corresponding homomorphism from the absolute number field.

EXAMPLES:

sage: K.<a, b> = NumberField( [x^3 + 2, x^2 + x + 1] )
sage: K.hom(a, K).abs_hom()
Ring morphism:
From: Number Field in a with defining polynomial x^6 - 3*x^5 + 6*x^4 - 3*x^3 - 9*x + 9
To:   Number Field in a with defining polynomial x^3 + 2 over its base field
Defn: a |--> a - b

im_gens()

Return the images of the generators under this map.

EXAMPLES:

sage: K.<a, b> = NumberField( [x^3 + 2, x^2 + x + 1] )
sage: K.hom(a, K).im_gens()
[a, b]

class sage.rings.number_field.morphism.RelativeNumberFieldHomset(R, S, category=None)

Set of homomorphisms with domain a given relative number field.

EXAMPLES:

We construct a homomorphism from a relative field by giving the image of a generator:

sage: L.<cuberoot2, zeta3> = CyclotomicField(3).extension(x^3 - 2)
sage: phi = L.hom([cuberoot2 * zeta3]); phi
Relative number field endomorphism of Number Field in cuberoot2 with defining polynomial x^3 - 2 over its base field
Defn: cuberoot2 |--> zeta3*cuberoot2
zeta3 |--> zeta3
sage: phi(cuberoot2 + zeta3)
zeta3*cuberoot2 + zeta3


In fact, this phi is a generator for the Kummer Galois group of this cyclic extension:

sage: phi(phi(cuberoot2 + zeta3))
(-zeta3 - 1)*cuberoot2 + zeta3
sage: phi(phi(phi(cuberoot2 + zeta3)))
cuberoot2 + zeta3

default_base_hom()

Pick an embedding of the base field of self into the codomain of this homset. This is done in an essentially arbitrary way.

EXAMPLES:

sage: L.<a, b> = NumberField([x^3 - x + 1, x^2 + 23])
sage: M.<c> = NumberField(x^4 + 80*x^2 + 36)
sage: Hom(L, M).default_base_hom()
Ring morphism:
From: Number Field in b with defining polynomial x^2 + 23
To:   Number Field in c with defining polynomial x^4 + 80*x^2 + 36
Defn: b |--> 1/12*c^3 + 43/6*c

list()

Return a list of all the elements of self (for which the domain is a relative number field).

EXAMPLES:

sage: K.<a, b> = NumberField([x^2 + x + 1, x^3 + 2])
sage: End(K).list()
[
Relative number field endomorphism of Number Field in a with defining polynomial x^2 + x + 1 over its base field
Defn: a |--> a
b |--> b,
...
Relative number field endomorphism of Number Field in a with defining polynomial x^2 + x + 1 over its base field
Defn: a |--> a
b |--> -b*a - b
]


An example with an absolute codomain:

sage: K.<a, b> = NumberField([x^2 - 3, x^2 + 2])
sage: Hom(K, CyclotomicField(24, 'z')).list()
[
Relative number field morphism:
From: Number Field in a with defining polynomial x^2 - 3 over its base field
To:   Cyclotomic Field of order 24 and degree 8
Defn: a |--> z^6 - 2*z^2
b |--> -z^5 - z^3 + z,
...
Relative number field morphism:
From: Number Field in a with defining polynomial x^2 - 3 over its base field
To:   Cyclotomic Field of order 24 and degree 8
Defn: a |--> -z^6 + 2*z^2
b |--> z^5 + z^3 - z
]