Structure maps for number fields

This module provides isomorphisms between relative and absolute presentations, to and from vector spaces, name changing maps, etc.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: L.<cuberoot2, zeta3> = CyclotomicField(3).extension(x^3 - 2)
sage: K = L.absolute_field('a')
sage: from_K, to_K = K.structure()
sage: from_K
Isomorphism map:
  From: Number Field in a with defining polynomial
        x^6 - 3*x^5 + 6*x^4 - 11*x^3 + 12*x^2 + 3*x + 1
  To:   Number Field in cuberoot2 with defining polynomial
        x^3 - 2 over its base field
sage: to_K
Isomorphism map:
  From: Number Field in cuberoot2 with defining polynomial
        x^3 - 2 over its base field
  To:   Number Field in a with defining polynomial
        x^6 - 3*x^5 + 6*x^4 - 11*x^3 + 12*x^2 + 3*x + 1
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> L = CyclotomicField(Integer(3)).extension(x**Integer(3) - Integer(2), names=('cuberoot2', 'zeta3',)); (cuberoot2, zeta3,) = L._first_ngens(2)
>>> K = L.absolute_field('a')
>>> from_K, to_K = K.structure()
>>> from_K
Isomorphism map:
  From: Number Field in a with defining polynomial
        x^6 - 3*x^5 + 6*x^4 - 11*x^3 + 12*x^2 + 3*x + 1
  To:   Number Field in cuberoot2 with defining polynomial
        x^3 - 2 over its base field
>>> to_K
Isomorphism map:
  From: Number Field in cuberoot2 with defining polynomial
        x^3 - 2 over its base field
  To:   Number Field in a with defining polynomial
        x^6 - 3*x^5 + 6*x^4 - 11*x^3 + 12*x^2 + 3*x + 1
class sage.rings.number_field.maps.MapAbsoluteToRelativeNumberField(A, R)[source]

Bases: NumberFieldIsomorphism

See MapRelativeToAbsoluteNumberField for examples.

class sage.rings.number_field.maps.MapNumberFieldToVectorSpace(K, V)[source]

Bases: Map

A class for the isomorphism from an absolute number field to its underlying \(\QQ\)-vector space.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: L.<a> = NumberField(x^3 - x + 1)
sage: V, fr, to = L.vector_space()
sage: type(to)
<class 'sage.rings.number_field.maps.MapNumberFieldToVectorSpace'>
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> L = NumberField(x**Integer(3) - x + Integer(1), names=('a',)); (a,) = L._first_ngens(1)
>>> V, fr, to = L.vector_space()
>>> type(to)
<class 'sage.rings.number_field.maps.MapNumberFieldToVectorSpace'>
class sage.rings.number_field.maps.MapRelativeNumberFieldToRelativeVectorSpace(K, V)[source]

Bases: NumberFieldIsomorphism

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^3 - x + 1, x^2 + 23])
sage: V, fr, to = K.relative_vector_space()
sage: type(to)
<class 'sage.rings.number_field.maps.MapRelativeNumberFieldToRelativeVectorSpace'>
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField([x**Integer(3) - x + Integer(1), x**Integer(2) + Integer(23)], names=('a', 'b',)); (a, b,) = K._first_ngens(2)
>>> V, fr, to = K.relative_vector_space()
>>> type(to)
<class 'sage.rings.number_field.maps.MapRelativeNumberFieldToRelativeVectorSpace'>
class sage.rings.number_field.maps.MapRelativeNumberFieldToVectorSpace(L, V, to_K, to_V)[source]

Bases: NumberFieldIsomorphism

The isomorphism from a relative number field to its underlying \(\QQ\)-vector space. Compare MapRelativeNumberFieldToRelativeVectorSpace.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^8 + 100*x^6 + x^2 + 5)
sage: L = K.relativize(K.subfields(4)[0][1], 'b'); L
Number Field in b with defining polynomial x^2 + a0 over its base field
sage: L_to_K, K_to_L = L.structure()

sage: V, fr, to = L.absolute_vector_space()
sage: V
Vector space of dimension 8 over Rational Field
sage: fr
Isomorphism map:
  From: Vector space of dimension 8 over Rational Field
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
sage: to
Isomorphism map:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Vector space of dimension 8 over Rational Field
sage: type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapVectorSpaceToRelativeNumberField'>,
 <class 'sage.rings.number_field.maps.MapRelativeNumberFieldToVectorSpace'>)

sage: v = V([1, 1, 1, 1, 0, 1, 1, 1])
sage: fr(v), to(fr(v)) == v
((-a0^3 + a0^2 - a0 + 1)*b - a0^3 - a0 + 1, True)
sage: to(L.gen()), fr(to(L.gen())) == L.gen()
((0, 1, 0, 0, 0, 0, 0, 0), True)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(8) + Integer(100)*x**Integer(6) + x**Integer(2) + Integer(5), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.relativize(K.subfields(Integer(4))[Integer(0)][Integer(1)], 'b'); L
Number Field in b with defining polynomial x^2 + a0 over its base field
>>> L_to_K, K_to_L = L.structure()

>>> V, fr, to = L.absolute_vector_space()
>>> V
Vector space of dimension 8 over Rational Field
>>> fr
Isomorphism map:
  From: Vector space of dimension 8 over Rational Field
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
>>> to
Isomorphism map:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Vector space of dimension 8 over Rational Field
>>> type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapVectorSpaceToRelativeNumberField'>,
 <class 'sage.rings.number_field.maps.MapRelativeNumberFieldToVectorSpace'>)

>>> v = V([Integer(1), Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)])
>>> fr(v), to(fr(v)) == v
((-a0^3 + a0^2 - a0 + 1)*b - a0^3 - a0 + 1, True)
>>> to(L.gen()), fr(to(L.gen())) == L.gen()
((0, 1, 0, 0, 0, 0, 0, 0), True)
class sage.rings.number_field.maps.MapRelativeToAbsoluteNumberField(R, A)[source]

Bases: NumberFieldIsomorphism

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^6 + 4*x^2 + 200)
sage: L = K.relativize(K.subfields(3)[0][1], 'b'); L
Number Field in b with defining polynomial x^2 + a0 over its base field
sage: fr, to = L.structure()
sage: fr
Relative number field morphism:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Number Field in a with defining polynomial x^6 + 4*x^2 + 200
  Defn: b |--> a
        a0 |--> -a^2
sage: to
Ring morphism:
  From: Number Field in a with defining polynomial x^6 + 4*x^2 + 200
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
  Defn: a |--> b
sage: type(fr), type(to)
(<class 'sage.rings.number_field.homset.RelativeNumberFieldHomset_with_category.element_class'>,
 <class 'sage.rings.number_field.homset.NumberFieldHomset_with_category.element_class'>)

sage: M.<c> = L.absolute_field(); M
Number Field in c with defining polynomial x^6 + 4*x^2 + 200
sage: fr, to = M.structure()
sage: fr
Isomorphism map:
  From: Number Field in c with defining polynomial x^6 + 4*x^2 + 200
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
sage: to
Isomorphism map:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Number Field in c with defining polynomial x^6 + 4*x^2 + 200
sage: type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapAbsoluteToRelativeNumberField'>,
 <class 'sage.rings.number_field.maps.MapRelativeToAbsoluteNumberField'>)
sage: fr(M.gen()), to(fr(M.gen())) == M.gen()
(b, True)
sage: to(L.gen()), fr(to(L.gen())) == L.gen()
(c, True)
sage: (to * fr)(M.gen()) == M.gen(), (fr * to)(L.gen()) == L.gen()
(True, True)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(6) + Integer(4)*x**Integer(2) + Integer(200), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.relativize(K.subfields(Integer(3))[Integer(0)][Integer(1)], 'b'); L
Number Field in b with defining polynomial x^2 + a0 over its base field
>>> fr, to = L.structure()
>>> fr
Relative number field morphism:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Number Field in a with defining polynomial x^6 + 4*x^2 + 200
  Defn: b |--> a
        a0 |--> -a^2
>>> to
Ring morphism:
  From: Number Field in a with defining polynomial x^6 + 4*x^2 + 200
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
  Defn: a |--> b
>>> type(fr), type(to)
(<class 'sage.rings.number_field.homset.RelativeNumberFieldHomset_with_category.element_class'>,
 <class 'sage.rings.number_field.homset.NumberFieldHomset_with_category.element_class'>)

>>> M = L.absolute_field(names=('c',)); (c,) = M._first_ngens(1); M
Number Field in c with defining polynomial x^6 + 4*x^2 + 200
>>> fr, to = M.structure()
>>> fr
Isomorphism map:
  From: Number Field in c with defining polynomial x^6 + 4*x^2 + 200
  To:   Number Field in b with defining polynomial x^2 + a0 over its base field
>>> to
Isomorphism map:
  From: Number Field in b with defining polynomial x^2 + a0 over its base field
  To:   Number Field in c with defining polynomial x^6 + 4*x^2 + 200
>>> type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapAbsoluteToRelativeNumberField'>,
 <class 'sage.rings.number_field.maps.MapRelativeToAbsoluteNumberField'>)
>>> fr(M.gen()), to(fr(M.gen())) == M.gen()
(b, True)
>>> to(L.gen()), fr(to(L.gen())) == L.gen()
(c, True)
>>> (to * fr)(M.gen()) == M.gen(), (fr * to)(L.gen()) == L.gen()
(True, True)
class sage.rings.number_field.maps.MapRelativeVectorSpaceToRelativeNumberField(V, K)[source]

Bases: NumberFieldIsomorphism

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: L.<b> = NumberField(x^4 + 3*x^2 + 1)
sage: K = L.relativize(L.subfields(2)[0][1], 'a'); K
Number Field in a with defining polynomial x^2 - b0*x + 1 over its base field
sage: V, fr, to = K.relative_vector_space()
sage: V
Vector space of dimension 2 over Number Field in b0 with defining polynomial x^2 + 1
sage: fr
Isomorphism map:
  From: Vector space of dimension 2
        over Number Field in b0 with defining polynomial x^2 + 1
  To:   Number Field in a
        with defining polynomial x^2 - b0*x + 1 over its base field
sage: type(fr)
<class 'sage.rings.number_field.maps.MapRelativeVectorSpaceToRelativeNumberField'>

sage: a0 = K.gen(); b0 = K.base_field().gen()
sage: fr(to(a0 + 2*b0)), fr(V([0, 1])), fr(V([b0, 2*b0]))
(a + 2*b0, a, 2*b0*a + b0)
sage: (fr * to)(K.gen()) == K.gen()
True
sage: (to * fr)(V([1, 2])) == V([1, 2])
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> L = NumberField(x**Integer(4) + Integer(3)*x**Integer(2) + Integer(1), names=('b',)); (b,) = L._first_ngens(1)
>>> K = L.relativize(L.subfields(Integer(2))[Integer(0)][Integer(1)], 'a'); K
Number Field in a with defining polynomial x^2 - b0*x + 1 over its base field
>>> V, fr, to = K.relative_vector_space()
>>> V
Vector space of dimension 2 over Number Field in b0 with defining polynomial x^2 + 1
>>> fr
Isomorphism map:
  From: Vector space of dimension 2
        over Number Field in b0 with defining polynomial x^2 + 1
  To:   Number Field in a
        with defining polynomial x^2 - b0*x + 1 over its base field
>>> type(fr)
<class 'sage.rings.number_field.maps.MapRelativeVectorSpaceToRelativeNumberField'>

>>> a0 = K.gen(); b0 = K.base_field().gen()
>>> fr(to(a0 + Integer(2)*b0)), fr(V([Integer(0), Integer(1)])), fr(V([b0, Integer(2)*b0]))
(a + 2*b0, a, 2*b0*a + b0)
>>> (fr * to)(K.gen()) == K.gen()
True
>>> (to * fr)(V([Integer(1), Integer(2)])) == V([Integer(1), Integer(2)])
True
class sage.rings.number_field.maps.MapVectorSpaceToNumberField(V, K)[source]

Bases: NumberFieldIsomorphism

The map to an absolute number field from its underlying \(\QQ\)-vector space.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^4 + 3*x + 1)
sage: V, fr, to = K.vector_space()
sage: V
Vector space of dimension 4 over Rational Field
sage: fr
Isomorphism map:
  From: Vector space of dimension 4 over Rational Field
  To:   Number Field in a with defining polynomial x^4 + 3*x + 1
sage: to
Isomorphism map:
  From: Number Field in a with defining polynomial x^4 + 3*x + 1
  To:   Vector space of dimension 4 over Rational Field
sage: type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapVectorSpaceToNumberField'>,
 <class 'sage.rings.number_field.maps.MapNumberFieldToVectorSpace'>)

sage: fr.is_injective(), fr.is_surjective()
(True, True)

sage: fr.domain(), to.codomain()
(Vector space of dimension 4 over Rational Field,
 Vector space of dimension 4 over Rational Field)
sage: to.domain(), fr.codomain()
(Number Field in a with defining polynomial x^4 + 3*x + 1,
 Number Field in a with defining polynomial x^4 + 3*x + 1)
sage: fr * to
Composite map:
  From: Number Field in a with defining polynomial x^4 + 3*x + 1
  To:   Number Field in a with defining polynomial x^4 + 3*x + 1
  Defn:   Isomorphism map:
          From: Number Field in a with defining polynomial x^4 + 3*x + 1
          To:   Vector space of dimension 4 over Rational Field
        then
          Isomorphism map:
          From: Vector space of dimension 4 over Rational Field
          To:   Number Field in a with defining polynomial x^4 + 3*x + 1
sage: to * fr
Composite map:
  From: Vector space of dimension 4 over Rational Field
  To:   Vector space of dimension 4 over Rational Field
  Defn:   Isomorphism map:
          From: Vector space of dimension 4 over Rational Field
          To:   Number Field in a with defining polynomial x^4 + 3*x + 1
        then
          Isomorphism map:
          From: Number Field in a with defining polynomial x^4 + 3*x + 1
          To:   Vector space of dimension 4 over Rational Field

sage: to(a), to(a + 1)
((0, 1, 0, 0), (1, 1, 0, 0))
sage: fr(to(a)), fr(V([0, 1, 2, 3]))
(a, 3*a^3 + 2*a^2 + a)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(4) + Integer(3)*x + Integer(1), names=('a',)); (a,) = K._first_ngens(1)
>>> V, fr, to = K.vector_space()
>>> V
Vector space of dimension 4 over Rational Field
>>> fr
Isomorphism map:
  From: Vector space of dimension 4 over Rational Field
  To:   Number Field in a with defining polynomial x^4 + 3*x + 1
>>> to
Isomorphism map:
  From: Number Field in a with defining polynomial x^4 + 3*x + 1
  To:   Vector space of dimension 4 over Rational Field
>>> type(fr), type(to)
(<class 'sage.rings.number_field.maps.MapVectorSpaceToNumberField'>,
 <class 'sage.rings.number_field.maps.MapNumberFieldToVectorSpace'>)

>>> fr.is_injective(), fr.is_surjective()
(True, True)

>>> fr.domain(), to.codomain()
(Vector space of dimension 4 over Rational Field,
 Vector space of dimension 4 over Rational Field)
>>> to.domain(), fr.codomain()
(Number Field in a with defining polynomial x^4 + 3*x + 1,
 Number Field in a with defining polynomial x^4 + 3*x + 1)
>>> fr * to
Composite map:
  From: Number Field in a with defining polynomial x^4 + 3*x + 1
  To:   Number Field in a with defining polynomial x^4 + 3*x + 1
  Defn:   Isomorphism map:
          From: Number Field in a with defining polynomial x^4 + 3*x + 1
          To:   Vector space of dimension 4 over Rational Field
        then
          Isomorphism map:
          From: Vector space of dimension 4 over Rational Field
          To:   Number Field in a with defining polynomial x^4 + 3*x + 1
>>> to * fr
Composite map:
  From: Vector space of dimension 4 over Rational Field
  To:   Vector space of dimension 4 over Rational Field
  Defn:   Isomorphism map:
          From: Vector space of dimension 4 over Rational Field
          To:   Number Field in a with defining polynomial x^4 + 3*x + 1
        then
          Isomorphism map:
          From: Number Field in a with defining polynomial x^4 + 3*x + 1
          To:   Vector space of dimension 4 over Rational Field

>>> to(a), to(a + Integer(1))
((0, 1, 0, 0), (1, 1, 0, 0))
>>> fr(to(a)), fr(V([Integer(0), Integer(1), Integer(2), Integer(3)]))
(a, 3*a^3 + 2*a^2 + a)
class sage.rings.number_field.maps.MapVectorSpaceToRelativeNumberField(V, L, from_V, from_K)[source]

Bases: NumberFieldIsomorphism

The isomorphism to a relative number field from its underlying \(\QQ\)-vector space. Compare MapRelativeVectorSpaceToRelativeNumberField.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: L.<a, b> = NumberField([x^2 + 3, x^2 + 5])
sage: V, fr, to = L.absolute_vector_space()
sage: type(fr)
<class 'sage.rings.number_field.maps.MapVectorSpaceToRelativeNumberField'>
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> L = NumberField([x**Integer(2) + Integer(3), x**Integer(2) + Integer(5)], names=('a', 'b',)); (a, b,) = L._first_ngens(2)
>>> V, fr, to = L.absolute_vector_space()
>>> type(fr)
<class 'sage.rings.number_field.maps.MapVectorSpaceToRelativeNumberField'>
class sage.rings.number_field.maps.NameChangeMap(K, L)[source]

Bases: NumberFieldIsomorphism

A map between two isomorphic number fields with the same defining polynomial but different variable names.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^2 - 3)
sage: L.<b> = K.change_names()
sage: from_L, to_L = L.structure()
sage: from_L
Isomorphism given by variable name change map:
  From: Number Field in b with defining polynomial x^2 - 3
  To:   Number Field in a with defining polynomial x^2 - 3
sage: to_L
Isomorphism given by variable name change map:
  From: Number Field in a with defining polynomial x^2 - 3
  To:   Number Field in b with defining polynomial x^2 - 3
sage: type(from_L), type(to_L)
(<class 'sage.rings.number_field.maps.NameChangeMap'>,
 <class 'sage.rings.number_field.maps.NameChangeMap'>)
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(2) - Integer(3), names=('a',)); (a,) = K._first_ngens(1)
>>> L = K.change_names(names=('b',)); (b,) = L._first_ngens(1)
>>> from_L, to_L = L.structure()
>>> from_L
Isomorphism given by variable name change map:
  From: Number Field in b with defining polynomial x^2 - 3
  To:   Number Field in a with defining polynomial x^2 - 3
>>> to_L
Isomorphism given by variable name change map:
  From: Number Field in a with defining polynomial x^2 - 3
  To:   Number Field in b with defining polynomial x^2 - 3
>>> type(from_L), type(to_L)
(<class 'sage.rings.number_field.maps.NameChangeMap'>,
 <class 'sage.rings.number_field.maps.NameChangeMap'>)
class sage.rings.number_field.maps.NumberFieldIsomorphism[source]

Bases: Map

A base class for various isomorphisms between number fields and vector spaces.

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^4 + 3*x + 1)
sage: V, fr, to = K.vector_space()
sage: isinstance(fr, sage.rings.number_field.maps.NumberFieldIsomorphism)
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(4) + Integer(3)*x + Integer(1), names=('a',)); (a,) = K._first_ngens(1)
>>> V, fr, to = K.vector_space()
>>> isinstance(fr, sage.rings.number_field.maps.NumberFieldIsomorphism)
True
is_injective()[source]

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^4 + 3*x + 1)
sage: V, fr, to = K.vector_space()
sage: fr.is_injective()
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(4) + Integer(3)*x + Integer(1), names=('a',)); (a,) = K._first_ngens(1)
>>> V, fr, to = K.vector_space()
>>> fr.is_injective()
True
is_surjective()[source]

EXAMPLES:

sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^4 + 3*x + 1)
sage: V, fr, to = K.vector_space()
sage: fr.is_surjective()
True
>>> from sage.all import *
>>> x = polygen(ZZ, 'x')
>>> K = NumberField(x**Integer(4) + Integer(3)*x + Integer(1), names=('a',)); (a,) = K._first_ngens(1)
>>> V, fr, to = K.vector_space()
>>> fr.is_surjective()
True