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[source]

Bases: NumberFieldHomomorphism_im_gens

class sage.rings.number_field.morphism.NumberFieldHomomorphism_im_gens[source]

Bases: RingHomomorphism_im_gens

preimage(y)[source]

Compute 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: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^2 - 7)
sage: L.<b> = NumberField(x^4 - 7)
sage: f = K.embeddings(L)[0]
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.
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(2) - Integer(7), names=('a',)); (a,) = K._first_ngens(1)
>>> L = NumberField(x**Integer(4) - Integer(7), names=('b',)); (b,) = L._first_ngens(1)
>>> f = K.embeddings(L)[Integer(0)]
>>> f.preimage(Integer(3)*b**Integer(2) - Integer(12)/Integer(7))
3*a - 12/7
>>> f.preimage(b)
Traceback (most recent call last):
...
ValueError: Element 'b' is not in the image of this homomorphism.

sage: # needs sage.libs.linbox
sage: F.<b> = QuadraticField(23)
sage: G.<a> = F.extension(x^3 + 5)
sage: f = F.embeddings(G)[0]
sage: f.preimage(a^3 + 2*b + 3)
2*b - 2
>>> from sage.all import *
>>> # needs sage.libs.linbox
>>> F = QuadraticField(Integer(23), names=('b',)); (b,) = F._first_ngens(1)
>>> G = F.extension(x**Integer(3) + Integer(5), names=('a',)); (a,) = G._first_ngens(1)
>>> f = F.embeddings(G)[Integer(0)]
>>> f.preimage(a**Integer(3) + Integer(2)*b + Integer(3))
2*b - 2
class sage.rings.number_field.morphism.RelativeNumberFieldHomomorphism_from_abs(parent, abs_hom)[source]

Bases: RingHomomorphism

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

abs_hom()[source]

Return the corresponding homomorphism from the absolute number field.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
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
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(3) + Integer(2), x**Integer(2) + x + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> 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()[source]

Return the images of the generators under this map.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^3 + 2, x^2 + x + 1])
sage: K.hom(a, K).im_gens()
[a, b]
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(3) + Integer(2), x**Integer(2) + x + Integer(1)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> K.hom(a, K).im_gens()
[a, b]