Relative Number Fields

AUTHORS:

  • William Stein (2004, 2005): initial version
  • Steven Sivek (2006-05-12): added support for relative extensions
  • William Stein (2007-09-04): major rewrite and documentation
  • Robert Bradshaw (2008-10): specified embeddings into ambient fields
  • Nick Alexander (2009-01): modernize coercion implementation

This example follows one in the Magma reference manual:

sage: K.<y> = NumberField(x^4 - 420*x^2 + 40000)
sage: z = y^5/11; z
420/11*y^3 - 40000/11*y
sage: R.<y> = PolynomialRing(K)
sage: f = y^2 + y + 1
sage: L.<a> = K.extension(f); L
Number Field in a with defining polynomial y^2 + y + 1 over its base field
sage: KL.<b> = NumberField([x^4 - 420*x^2 + 40000, x^2 + x + 1]); KL
Number Field in b0 with defining polynomial x^4 - 420*x^2 + 40000 over its base field

We do some arithmetic in a tower of relative number fields:

sage: K.<cuberoot2> = NumberField(x^3 - 2)
sage: L.<cuberoot3> = K.extension(x^3 - 3)
sage: S.<sqrt2> = L.extension(x^2 - 2)
sage: S
Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field
sage: sqrt2 * cuberoot3
cuberoot3*sqrt2
sage: (sqrt2 + cuberoot3)^5
(20*cuberoot3^2 + 15*cuberoot3 + 4)*sqrt2 + 3*cuberoot3^2 + 20*cuberoot3 + 60
sage: cuberoot2 + cuberoot3
cuberoot3 + cuberoot2
sage: cuberoot2 + cuberoot3 + sqrt2
sqrt2 + cuberoot3 + cuberoot2
sage: (cuberoot2 + cuberoot3 + sqrt2)^2
(2*cuberoot3 + 2*cuberoot2)*sqrt2 + cuberoot3^2 + 2*cuberoot2*cuberoot3 + cuberoot2^2 + 2
sage: cuberoot2 + sqrt2
sqrt2 + cuberoot2
sage: a = S(cuberoot2); a
cuberoot2
sage: a.parent()
Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field

WARNING: Doing arithmetic in towers of relative fields that depends on canonical coercions is currently VERY SLOW. It is much better to explicitly coerce all elements into a common field, then do arithmetic with them there (which is quite fast).

TESTS:

sage: y = polygen(QQ,'y'); K.<beta> = NumberField([y^3 - 3, y^2 - 2])
sage: K(y^10)
27*beta0
sage.rings.number_field.number_field_rel.NumberField_extension_v1(base_field, poly, name, latex_name, canonical_embedding=None)

This is used in pickling relative fields.

EXAMPLES:

sage: from sage.rings.number_field.number_field_rel import NumberField_relative_v1
sage: R.<x> = CyclotomicField(3)[]
sage: NumberField_relative_v1(CyclotomicField(3), x^2 + 7, 'a', 'a')
Number Field in a with defining polynomial x^2 + 7 over its base field
class sage.rings.number_field.number_field_rel.NumberField_relative(base, polynomial, name, latex_name=None, names=None, check=True, embedding=None)

Bases: sage.rings.number_field.number_field.NumberField_generic

INPUT:

  • base – the base field
  • polynomial – must be defined in the ring K[x], where K is the base field.
  • name – variable name
  • latex_name – latex variable name
  • names – alternative to name
  • check – whether to check irreducibility of polynomial.

EXAMPLES:

sage: K.<a> = NumberField(x^3 - 2)
sage: t = polygen(K)
sage: L.<b> = K.extension(t^2+t+a); L
Number Field in b with defining polynomial x^2 + x + a over its base field
absolute_base_field()

Return the base field of this relative extension, but viewed as an absolute field over \QQ.

EXAMPLES:

sage: K.<a,b,c> = NumberField([x^2 + 2, x^3 + 3, x^3 + 2])
sage: K
Number Field in a with defining polynomial x^2 + 2 over its base field
sage: K.base_field()
Number Field in b with defining polynomial x^3 + 3 over its base field
sage: K.absolute_base_field()[0]
Number Field in a0 with defining polynomial x^9 + 3*x^6 + 165*x^3 + 1
sage: K.base_field().absolute_field('z')
Number Field in z with defining polynomial x^9 + 3*x^6 + 165*x^3 + 1
absolute_degree()

The degree of this relative number field over the rational field.

EXAMPLES:

sage: K.<a> = NumberFieldTower([x^2 - 17, x^3 - 2])
sage: K.absolute_degree()
6
absolute_different()

Return the absolute different of this relative number field L, as an ideal of L. To get the relative different of L/K, use L.relative_different().

EXAMPLES:

sage: K.<i> = NumberField(x^2 + 1)
sage: t = K['t'].gen()
sage: L.<b> = K.extension(t^4 - i)
sage: L.absolute_different()
Fractional ideal (8)
absolute_discriminant(v=None)

Return the absolute discriminant of this relative number field or if v is specified, the determinant of the trace pairing on the elements of the list v.

INPUT:

  • v (optional) – list of element of this relative number field.

OUTPUT: Integer if v is omitted, and Rational otherwise.

EXAMPLES:

sage: K.<i> = NumberField(x^2 + 1)
sage: t = K['t'].gen()
sage: L.<b> = K.extension(t^4 - i)
sage: L.absolute_discriminant()
16777216
sage: L.absolute_discriminant([(b + i)^j for j in range(8)])
61911970349056
absolute_field(names)

Return an absolute number field K that is isomorphic to this field along with a field-theoretic bijection from self to K and from K to self.

INPUT:

  • names – string; name of generator of the absolute field

OUTPUT: an absolute number field

Also, K.structure() returns from_K and to_K, where from_K is an isomorphism from K to self and to_K is an isomorphism from self to K.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: L.<xyz> = K.absolute_field(); L
Number Field in xyz with defining polynomial x^8 + 8*x^6 + 30*x^4 - 40*x^2 + 49
sage: L.<c> = K.absolute_field(); L
Number Field in c with defining polynomial x^8 + 8*x^6 + 30*x^4 - 40*x^2 + 49

sage: from_L, to_L = L.structure()
sage: from_L
Isomorphism map:
  From: Number Field in c with defining polynomial x^8 + 8*x^6 + 30*x^4 - 40*x^2 + 49
  To:   Number Field in a with defining polynomial x^4 + 3 over its base field
sage: from_L(c)
a - b
sage: to_L
Isomorphism map:
  From: Number Field in a with defining polynomial x^4 + 3 over its base field
  To:   Number Field in c with defining polynomial x^8 + 8*x^6 + 30*x^4 - 40*x^2 + 49
sage: to_L(a)
-5/182*c^7 - 87/364*c^5 - 185/182*c^3 + 323/364*c
sage: to_L(b)
-5/182*c^7 - 87/364*c^5 - 185/182*c^3 - 41/364*c
sage: to_L(a)^4
-3
sage: to_L(b)^2
-2
absolute_generator()

Return the chosen generator over \QQ for this relative number field.

EXAMPLES:

sage: y = polygen(QQ,'y')
sage: k.<a> = NumberField([y^2 + 2, y^4 + 3])
sage: g = k.absolute_generator(); g
a0 - a1
sage: g.minpoly()
x^2 + 2*a1*x + a1^2 + 2
sage: g.absolute_minpoly()
x^8 + 8*x^6 + 30*x^4 - 40*x^2 + 49
absolute_polynomial(*args, **kwds)

Return the polynomial over \QQ that defines this field as an extension of the rational numbers.

EXAMPLES:

sage: k.<a, b> = NumberField([x^2 + 1, x^3 + x + 1]); k
Number Field in a with defining polynomial x^2 + 1 over its base field
sage: k.absolute_polynomial()
x^6 + 5*x^4 - 2*x^3 + 4*x^2 + 4*x + 1
absolute_polynomial_ntl()

Return defining polynomial of this number field as a pair, an ntl polynomial and a denominator.

This is used mainly to implement some internal arithmetic.

EXAMPLES:

sage: NumberField(x^2 + (2/3)*x - 9/17,'a').polynomial_ntl()
([-27 34 51], 51)
absolute_vector_space()

Return vector space over \QQ of self and isomorphisms from the vector space to self and in the other direction.

EXAMPLES:

sage: K.<a,b> = NumberField([x^3 + 3, x^3 + 2]); K
Number Field in a with defining polynomial x^3 + 3 over its base field
sage: V,from_V,to_V = K.absolute_vector_space(); V
Vector space of dimension 9 over Rational Field
sage: from_V
Isomorphism map:
  From: Vector space of dimension 9 over Rational Field
  To:   Number Field in a with defining polynomial x^3 + 3 over its base field
sage: to_V
Isomorphism map:
  From: Number Field in a with defining polynomial x^3 + 3 over its base field
  To:   Vector space of dimension 9 over Rational Field
sage: c = (a+1)^5; c
7*a^2 - 10*a - 29
sage: to_V(c)
(-29, -712/9, 19712/45, 0, -14/9, 364/45, 0, -4/9, 119/45)
sage: from_V(to_V(c))
7*a^2 - 10*a - 29
sage: from_V(3*to_V(b))
3*b
automorphisms()

Compute all Galois automorphisms of self over the base field. This is different than computing the embeddings of self into self; there, automorphisms that do not fix the base field are considered.

EXAMPLES:

sage: K.<a, b> = NumberField([x^2 + 10000, x^2 + x + 50]); K
Number Field in a with defining polynomial x^2 + 10000 over its base field
sage: K.automorphisms()
[
Relative number field endomorphism of Number Field in a with defining polynomial x^2 + 10000 over its base field
  Defn: a |--> a
        b |--> b,
Relative number field endomorphism of Number Field in a with defining polynomial x^2 + 10000 over its base field
  Defn: a |--> -a
        b |--> b
]
sage: rho, tau = K.automorphisms()
sage: tau(a)
-a
sage: tau(b) == b
True

sage: L.<b, a> = NumberField([x^2 + x + 50, x^2 + 10000, ]); L
Number Field in b with defining polynomial x^2 + x + 50 over its base field
sage: L.automorphisms()
[
Relative number field endomorphism of Number Field in b with defining polynomial x^2 + x + 50 over its base field
  Defn: b |--> b
        a |--> a,
Relative number field endomorphism of Number Field in b with defining polynomial x^2 + x + 50 over its base field
  Defn: b |--> -b - 1
        a |--> a
]
sage: rho, tau = L.automorphisms()
sage: tau(a) == a
True
sage: tau(b)
-b - 1

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: K.automorphisms()
[
Relative number field endomorphism of Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: c |--> c
        a |--> a
        b |--> b,
Relative number field endomorphism of Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: c |--> -c
        a |--> a
        b |--> b
]
base_field()

Return the base field of this relative number field.

EXAMPLES:

sage: k.<a> = NumberField([x^3 + x + 1])
sage: R.<z> = k[]
sage: L.<b> = NumberField(z^3 + a)
sage: L.base_field()
Number Field in a with defining polynomial x^3 + x + 1
sage: L.base_field() is k
True

This is very useful because the print representation of a relative field doesn’t describe the base field.:

sage: L
Number Field in b with defining polynomial z^3 + a over its base field
base_ring()

This is exactly the same as base_field.

EXAMPLES:

sage: k.<a> = NumberField([x^2 + 1, x^3 + x + 1])
sage: k.base_ring()
Number Field in a1 with defining polynomial x^3 + x + 1
sage: k.base_field()
Number Field in a1 with defining polynomial x^3 + x + 1
change_names(names)

Return relative number field isomorphic to self but with the given generator names.

INPUT:

  • names – number of names should be at most the number of generators of self, i.e., the number of steps in the tower of relative fields.

Also, K.structure() returns from_K and to_K, where from_K is an isomorphism from K to self and to_K is an isomorphism from self to K.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: L.<c,d> = K.change_names()
sage: L
Number Field in c with defining polynomial x^4 + 3 over its base field
sage: L.base_field()
Number Field in d with defining polynomial x^2 + 2

An example with a 3-level tower:

sage: K.<a,b,c> = NumberField([x^2 + 17, x^2 + x + 1, x^3 - 2]); K
Number Field in a with defining polynomial x^2 + 17 over its base field
sage: L.<m,n,r> = K.change_names()
sage: L
Number Field in m with defining polynomial x^2 + 17 over its base field
sage: L.base_field()
Number Field in n with defining polynomial x^2 + x + 1 over its base field
sage: L.base_field().base_field()
Number Field in r with defining polynomial x^3 - 2

And a more complicated example:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: L.<m, n, r> = K.change_names(); L
Number Field in m with defining polynomial x^2 + (-2*r - 3)*n - 2*r - 6 over its base field
sage: L.structure()
(Isomorphism given by variable name change map:
  From: Number Field in m with defining polynomial x^2 + (-2*r - 3)*n - 2*r - 6 over its base field
  To:   Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field,
 Isomorphism given by variable name change map:
  From: Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  To:   Number Field in m with defining polynomial x^2 + (-2*r - 3)*n - 2*r - 6 over its base field)
composite_fields(other, names=None, both_maps=False, preserve_embedding=True)

List of all possible composite number fields formed from self and other, together with (optionally) embeddings into the compositum; see the documentation for both_maps below.

Since relative fields do not have ambient embeddings, preserve_embedding has no effect. In every case all possible composite number fields are returned.

INPUT:

  • other - a number field
  • names - generator name for composite fields
  • both_maps - (default: False) if True, return quadruples (F, self_into_F, other_into_F, k) such that self_into_F maps self into F, other_into_F maps other into F. For relative number fields k is always None.
  • preserve_embedding - (default: True) has no effect, but is kept for compatibility with the absolute version of this function. In every case the list of all possible compositums is returned.

OUTPUT:

  • list - list of the composite fields, possibly with maps.

EXAMPLES:

sage: K.<a, b> = NumberField([x^2 + 5, x^2 - 2])
sage: L.<c, d> = NumberField([x^2 + 5, x^2 - 3])
sage: K.composite_fields(L, 'e')
[Number Field in e with defining polynomial x^8 - 24*x^6 + 464*x^4 + 3840*x^2 + 25600]
sage: K.composite_fields(L, 'e', both_maps=True)
[[Number Field in e with defining polynomial x^8 - 24*x^6 + 464*x^4 + 3840*x^2 + 25600,
  Relative number field morphism:
  From: Number Field in a with defining polynomial x^2 + 5 over its base field
 To:   Number Field in e with defining polynomial x^8 - 24*x^6 + 464*x^4 + 3840*x^2 + 25600
  Defn: a |--> -9/66560*e^7 + 11/4160*e^5 - 241/4160*e^3 - 101/104*e
        b |--> -21/166400*e^7 + 73/20800*e^5 - 779/10400*e^3 + 7/260*e,
  Relative number field morphism:
  From: Number Field in c with defining polynomial x^2 + 5 over its base field
  To:   Number Field in e with defining polynomial x^8 - 24*x^6 + 464*x^4 + 3840*x^2 + 25600
  Defn: c |--> -9/66560*e^7 + 11/4160*e^5 - 241/4160*e^3 - 101/104*e
        d |--> -3/25600*e^7 + 7/1600*e^5 - 147/1600*e^3 + 1/40*e,
  None]]
defining_polynomial()

Return the defining polynomial of this relative number field.

This is exactly the same as relative_polynomal().

EXAMPLES:

sage: C.<z> = CyclotomicField(5)
sage: PC.<X> = C[]
sage: K.<a> = C.extension(X^2 + X + z); K
Number Field in a with defining polynomial X^2 + X + z over its base field
sage: K.defining_polynomial()
X^2 + X + z
degree()
The degree, unqualified, of a relative number field is deliberately not implemented, so that a user cannot mistake the absolute degree for the relative degree, or vice versa.
different()
The different, unqualified, of a relative number field is deliberately not implemented, so that a user cannot mistake the absolute different for the relative different, or vice versa.
disc()
The discriminant, unqualified, of a relative number field is deliberately not implemented, so that a user cannot mistake the absolute discriminant for the relative discriminant, or vice versa.
discriminant()
The discriminant, unqualified, of a relative number field is deliberately not implemented, so that a user cannot mistake the absolute discriminant for the relative discriminant, or vice versa.
embeddings(K)

Compute all field embeddings of the relative number field self into the field K (which need not even be a number field, e.g., it could be the complex numbers). This will return an identical result when given K as input again.

If possible, the most natural embedding of self into K is put first in the list.

INPUT:

  • K – a field

EXAMPLES:

sage: K.<a,b> = NumberField([x^3 - 2, x^2+1])
sage: f = K.embeddings(ComplexField(58)); f
[
Relative number field morphism:
  From: Number Field in a with defining polynomial x^3 - 2 over its base field
  To:   Complex Field with 58 bits of precision
  Defn: a |--> -0.62996052494743676 - 1.0911236359717214*I
        b |--> -1.9428902930940239e-16 + 1.0000000000000000*I,
...
Relative number field morphism:
  From: Number Field in a with defining polynomial x^3 - 2 over its base field
  To:   Complex Field with 58 bits of precision
  Defn: a |--> 1.2599210498948731
        b |--> -0.99999999999999999*I
]
sage: f[0](a)^3
2.0000000000000002 - 8.6389229103644993e-16*I
sage: f[0](b)^2
-1.0000000000000001 - 3.8857805861880480e-16*I
sage: f[0](a+b)
-0.62996052494743693 - 0.091123635971721295*I
galois_closure(names=None)

Return the absolute number field K that is the Galois closure of this relative number field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: K.galois_closure('c')
Number Field in c with defining polynomial x^16 + 16*x^14 + 28*x^12 + 784*x^10 + 19846*x^8 - 595280*x^6 + 2744476*x^4 + 3212848*x^2 + 29953729
galois_group(type='pari', algorithm='pari', names=None)

Return the Galois group of the Galois closure of this number field as an abstract group. Note that even though this is an extension L/K, the group will be computed as if it were L/\QQ.

INPUT:

  • type - 'pari' or 'gap': type of object to return – a wrapper around a Pari or Gap transitive group object. -
  • algorithm - ‘pari’, ‘kash’, ‘magma’ (default: ‘pari’, except when the degree is >= 12 when ‘kash’ is tried)

At present much less functionality is available for Galois groups of relative extensions than absolute ones, so try the galois_group method of the corresponding absolute field.

EXAMPLES:

sage: x = polygen(QQ)
sage: K.<a> = NumberField(x^2 + 1)
sage: R.<t> = PolynomialRing(K)
sage: L = K.extension(t^5-t+a, 'b')
sage: L.galois_group(type="pari")
Galois group PARI group [240, -1, 22, "S(5)[x]2"] of degree 10 of the Number Field in b with defining polynomial t^5 - t + a over its base field
gen(n=0)

Return the n‘th generator of this relative number field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: K.gens()
(a, b)
sage: K.gen(0)
a
gens()

Return the generators of this relative number field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: K.gens()
(a, b)
is_absolute()

Returns False, since this is not an absolute field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: K.is_absolute()
False
sage: K.is_relative()
True
is_free(proof=None)

Determine whether or not L/K is free (i.e. if \mathcal{O}_L is a free \mathcal{O}_K-module).

INPUT:

  • proof – default: True

EXAMPLES:

sage: x = polygen(QQ)
sage: K.<a> = NumberField(x^2+6)
sage: x = polygen(K)
sage: L.<b> = K.extension(x^2 + 3)    ## extend by x^2+3
sage: L.is_free()
False
is_galois()

For a relative number field, is_galois() is deliberately not implemented, since it is not clear whether this would mean “Galois over \QQ” or “Galois over the given base field”. Use either is_galois_absolute() or is_galois_relative() respectively.

EXAMPLES:

sage: k.<a> =NumberField([x^3 - 2, x^2 + x + 1])
sage: k.is_galois()
...
NotImplementedError: For a relative number field L you must use either L.is_galois_relative() or L.is_galois_absolute() as appropriate
is_galois_absolute()

Return True if for this relative extension L/K, L is a Galois extension of \QQ.

EXAMPLE:

sage: K.<a> = NumberField(x^3 - 2)
sage: y = polygen(K); L.<b> = K.extension(y^2 - a)
sage: L.is_galois_absolute()
False
is_galois_relative()

Return True if for this relative extension L/K, L is a Galois extension of K.

EXAMPLE:

sage: K.<a> = NumberField(x^3 - 2)
sage: y = polygen(K); L.<b> = K.extension(y^2 - a)
sage: L.is_galois_relative()
True
lift_to_base(element)

Lift an element of this extension into the base field if possible, or raise a ValueError if it is not possible.

EXAMPLES:

sage: x = polygen(ZZ)
sage: K.<a> = NumberField(x^3 - 2)
sage: R.<y> = K[]
sage: L.<b> = K.extension(y^2 - a)
sage: L.lift_to_base(b^4)
a^2
sage: L.lift_to_base(b)
...
ValueError: The element b is not in the base field
maximal_order()

Return the maximal order, i.e., the ring of integers of this number field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^2 + 1, x^2 - 3])
sage: OK = K.maximal_order(); OK.basis()
[1, 1/2*a - 1/2*b, -1/2*b*a + 1/2, a]
sage: charpoly(OK.1)
x^2 + b*x + 1
sage: charpoly(OK.2)
x^2 - x + 1
sage: O2 = K.order([3*a, 2*b])
sage: O2.index_in(OK)
144

The following was previously “ridiculously slow”; see trac #4738:

sage: K.<a,b> = NumberField([x^4 + 1, x^4 - 3])
sage: K.maximal_order()
Maximal Relative Order in Number Field in a with defining polynomial x^4 + 1 over its base field
ngens()

Return the number of generators of this relative number field.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: K.gens()
(a, b)
sage: K.ngens()
2
number_of_roots_of_unity()

Return number of roots of unity in this relative field.

EXAMPLES:

sage: K.<a, b> = NumberField( [x^2 + x + 1, x^4 + 1] )
sage: K.number_of_roots_of_unity()
24
sage: K.roots_of_unity()[:5]
[-b^3*a, b^2*a + b^2, -b, -a, -b^3*a - b^3]
order(*gens, **kwds)

Return the order with given ring generators in the maximal order of this number field.

INPUT:

  • gens – list of elements of self; if no generators are given, just returns the cardinality of this number field (oo) for consistency.
  • check_is_integral – bool (default: True), whether to check that each generator is integral.
  • check_rank – bool (default: True), whether to check that the ring generated by gens is of full rank.
  • allow_subfield – bool (default: False), if True and the generators do not generate an order, i.e., they generate a subring of smaller rank, instead of raising an error, return an order in a smaller number field.

The check_is_integral and check_rank inputs must be given as explicit keyword arguments.

EXAMPLES:

sage: P.<a,b,c> = QQ[2^(1/2), 2^(1/3), 3^(1/2)]
sage: R = P.order([a,b,c]); R
Relative Order in Number Field in sqrt2 with defining polynomial x^2 - 2 over its base field

The base ring of an order in a relative extension is still \ZZ.:

sage: R.base_ring() Integer Ring

One must give enough generators to generate a ring of finite index in the maximal order:

sage: P.order([a,b])
...
ValueError: the rank of the span of gens is wrong        
pari_absolute_base_polynomial()

Return the PARI polynomial defining the absolute base field, in y.

EXAMPLES:

sage: x = polygen(ZZ)
sage: K.<a, b> = NumberField([x^2 + 2, x^2 + 3]); K
Number Field in a with defining polynomial x^2 + 2 over its base field
sage: K.pari_absolute_base_polynomial()
y^2 + 3
sage: K.pari_absolute_base_polynomial().parent()
Interface to the PARI C library

sage: z = ZZ['z'].0
sage: K.<a, b, c> = NumberField([z^2 + 2, z^2 + 3, z^2 + 5]); K
Number Field in a with defining polynomial z^2 + 2 over its base field
sage: K.pari_absolute_base_polynomial()
y^4 + 16*y^2 + 4
sage: K.base_field()
Number Field in b with defining polynomial z^2 + 3 over its base field
sage: len(QQ['y'](K.pari_absolute_base_polynomial()).roots(K.base_field()))
4
sage: K.pari_absolute_base_polynomial().parent()
Interface to the PARI C library
pari_polynomial(name='x')

PARI polynomial corresponding to the polynomial over the rationals that defines this field as an absolute number field. By default, this is a polynomial in the variable “x”.

EXAMPLES:

sage: k.<a, c> = NumberField([x^2 + 3, x^2 + 1])
sage: k.pari_polynomial()
x^4 + 8*x^2 + 4
sage: k.pari_polynomial('a')
a^4 + 8*a^2 + 4
sage: k.absolute_polynomial()
x^4 + 8*x^2 + 4
sage: k.relative_polynomial()
x^2 + 3
pari_relative_polynomial()

Return the PARI relative polynomial associated to this number field.

This is always a polynomial in x and y, suitable for PARI’s rnfinit function. Notice that if this is a relative extension of a relative extension, the base field is the absolute base field.

EXAMPLES:

sage: k.<i> = NumberField(x^2 + 1)
sage: m.<z> = k.extension(k['w']([i,0,1]))
sage: m
Number Field in z with defining polynomial w^2 + i over its base field
sage: m.pari_relative_polynomial()
Mod(1, y^2 + 1)*x^2 + Mod(y, y^2 + 1)

sage: l.<t> = m.extension(m['t'].0^2 + z)
sage: l.pari_relative_polynomial()
Mod(1, y^4 + 1)*x^2 + Mod(y, y^4 + 1)
pari_rnf(*args, **kwds)

Return the PARI relative number field object associated to this relative extension.

EXAMPLES:

sage: k.<a> = NumberField([x^4 + 3, x^2 + 2])
sage: k.pari_rnf()
[Mod(1, y^2 + 2)*x^4 + Mod(3, y^2 + 2), [], [[108, 0; 0, 108], [3, 0]~], ... 0]
places(all_complex=False, prec=None)

Return the collection of all infinite places of self.

By default, this returns the set of real places as homomorphisms into RIF first, followed by a choice of one of each pair of complex conjugate homomorphisms into CIF.

On the other hand, if prec is not None, we simply return places into RealField(prec) and ComplexField(prec) (or RDF, CDF if prec=53).

There is an optional flag all_complex, which defaults to False. If all_complex is True, then the real embeddings are returned as embeddings into CIF instead of RIF.

EXAMPLES:

sage: L.<b, c> = NumberFieldTower([x^2 - 5, x^3 + x + 3])
sage: L.places()
[Relative number field morphism:
From: Number Field in b with defining polynomial x^2 - 5 over its base field
To:   Real Field with 106 bits of precision
Defn: b |--> -2.236067977499789696409173668937
c |--> -1.213411662762229634132131377426,
Relative number field morphism:
From: Number Field in b with defining polynomial x^2 - 5 over its base field
To:   Real Field with 106 bits of precision
Defn: b |--> 2.236067977499789696411548005367
c |--> -1.213411662762229634130492421800,
Relative number field morphism:
From: Number Field in b with defining polynomial x^2 - 5 over its base field
To:   Complex Field with 53 bits of precision
Defn: b |--> -2.23606797749979 ...e-1...*I
c |--> 0.606705831381... - 1.45061224918844*I,
Relative number field morphism:
From: Number Field in b with defining polynomial x^2 - 5 over its base field
To:   Complex Field with 53 bits of precision
Defn: b |--> 2.23606797749979 - 4.44089209850063e-16*I
c |--> 0.606705831381115 - 1.45061224918844*I]        
polynomial()
For a relative number field, polynomial() is deliberately not implemented. Either relative_polynomial() or absolute_polynomial() must be used.
relative_degree()

Returns the relative degree of this relative number field.

EXAMPLES:

sage: K.<a> = NumberFieldTower([x^2 - 17, x^3 - 2])
sage: K.relative_degree()
2
relative_different()

Return the relative different of this extension L/K as an ideal of L. If you want the absolute different of L/\QQ, use L.absolute_different().

EXAMPLES:

sage: K.<i> = NumberField(x^2 + 1)
sage: PK.<t> = K[]
sage: L.<a> = K.extension(t^4  - i)
sage: L.relative_different()
Fractional ideal (4)
relative_discriminant()

Return the relative discriminant of this extension L/K as an ideal of K. If you want the (rational) discriminant of L/\QQ, use e.g. L.absolute_discriminant().

EXAMPLES:

sage: K.<i> = NumberField(x^2 + 1)
sage: t = K['t'].gen()
sage: L.<b> = K.extension(t^4 - i)
sage: L.relative_discriminant()
Fractional ideal (256)
sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: K.relative_discriminant()
Fractional ideal (-4*b)
relative_polynomial()

Return the defining polynomial of this relative number field over its base field.

EXAMPLES:

sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.relative_polynomial()
x^2 + x + 1

Use absolute polynomial for a polynomial that defines the absolute extension.:

sage: K.absolute_polynomial()
x^6 + 3*x^5 + 8*x^4 + 9*x^3 + 7*x^2 + 6*x + 3
relative_vector_space()

Return vector space over the base field of self and isomorphisms from the vector space to self and in the other direction.

EXAMPLES:

sage: K.<a,b,c> = NumberField([x^2 + 2, x^3 + 2, x^3 + 3]); K
Number Field in a with defining polynomial x^2 + 2 over its base field
sage: V, from_V, to_V = K.relative_vector_space()
sage: from_V(V.0)
1
sage: to_V(K.0)
(0, 1)
sage: from_V(to_V(K.0))
a
sage: to_V(from_V(V.0))
(1, 0)
sage: to_V(from_V(V.1))
(0, 1)

The underlying vector space and maps is cached:

sage: W, from_V, to_V = K.relative_vector_space()
sage: V is W
True
relativize(alpha, names)

Given an element in self or an embedding of a subfield into self, return a relative number field K isomorphic to self that is relative over the absolute field \QQ(\alpha) or the domain of \alpha, along with isomorphisms from K to self and from self to K.

INPUT:

  • alpha – an element of self, or an embedding of a subfield into self
  • names – name of generator for output field K.

OUTPUT: K – a relative number field

Also, K.structure() returns from_K and to_K, where from_K is an isomorphism from K to self and to_K is an isomorphism from self to K.

EXAMPLES:

sage: K.<a,b> = NumberField([x^4 + 3, x^2 + 2]); K
Number Field in a with defining polynomial x^4 + 3 over its base field
sage: L.<z,w> = K.relativize(a^2)
sage: z^2
z^2
sage: w^2
-3
sage: L
Number Field in z with defining polynomial x^4 + (-2*w + 4)*x^2 + 4*w + 1 over its base field
sage: L.base_field()
Number Field in w with defining polynomial x^2 + 3

Now suppose we have K below L below M:

sage: M = NumberField(x^8 + 2, 'a'); M
Number Field in a with defining polynomial x^8 + 2
sage: L, L_into_M, _ = M.subfields(4)[0]; L
Number Field in a0 with defining polynomial x^4 + 2
sage: K, K_into_L, _ = L.subfields(2)[0]; K
Number Field in a00 with defining polynomial x^2 + 2
sage: K_into_M = L_into_M * K_into_L

sage: L_over_K = L.relativize(K_into_L, 'c'); L_over_K
Number Field in c0 with defining polynomial x^2 + a00 over its base field
sage: L_over_K_to_L, L_to_L_over_K = L_over_K.structure()
sage: M_over_L_over_K = M.relativize(L_into_M * L_over_K_to_L, 'd'); M_over_L_over_K
Number Field in d0 with defining polynomial x^2 + c0 over its base field
sage: M_over_L_over_K.base_field() is L_over_K
True

Test relativizing a degree 6 field over its degree 2 and degree 3 subfields, using both an explicit element:

sage: K.<a> = NumberField(x^6 + 2); K
Number Field in a with defining polynomial x^6 + 2
sage: K2, K2_into_K, _ = K.subfields(2)[0]; K2
Number Field in a0 with defining polynomial x^2 + 2
sage: K3, K3_into_K, _ = K.subfields(3)[0]; K3
Number Field in a0 with defining polynomial x^3 - 2

Here we explicitly relativize over an element of K2 (not the generator):

sage: L = K.relativize(K3_into_K, 'b'); L
Number Field in b0 with defining polynomial x^2 + a0 over its base field
sage: L_to_K, K_to_L = L.structure()
sage: L_over_K2 = L.relativize(K_to_L(K2_into_K(K2.gen() + 1)), 'c'); L_over_K2
Number Field in c0 with defining polynomial x^3 - c1 + 1 over its base field
sage: L_over_K2.base_field()
Number Field in c1 with defining polynomial x^2 - 2*x + 3

Here we use a morphism to preserve the base field information:

sage: K2_into_L = K_to_L * K2_into_K
sage: L_over_K2 = L.relativize(K2_into_L, 'c'); L_over_K2
Number Field in c0 with defining polynomial x^3 - a0 over its base field
sage: L_over_K2.base_field() is K2
True
roots_of_unity()

Return all the roots of unity in this relative field, primitive or not.

EXAMPLES:

sage: K.<a, b> = NumberField( [x^2 + x + 1, x^4 + 1] )
sage: K.roots_of_unity()[:5]
[-b^3*a, b^2*a + b^2, -b, -a, -b^3*a - b^3]
subfields(degree=0, name=None)

Return all subfields of this relative number field self of the given degree, or of all possible degrees if degree is 0. The subfields are returned as absolute fields together with an embedding into self. For the case of the field itself, the reverse isomorphism is also provided.

EXAMPLES:

sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: PF.<Y> = F[]
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: K.subfields(2)
[
 (Number Field in c0 with defining polynomial x^2 - 48*x + 288, Ring morphism:
  From: Number Field in c0 with defining polynomial x^2 - 48*x + 288
  To:   Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: c0 |--> 12*a + 24, None),
(Number Field in c1 with defining polynomial x^2 - 48*x + 192, Ring morphism:
  From: Number Field in c1 with defining polynomial x^2 - 48*x + 192
  To:   Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: c1 |--> 8*b*a + 24, None),
(Number Field in c2 with defining polynomial x^2 - 48*x + 384, Ring morphism:
  From: Number Field in c2 with defining polynomial x^2 - 48*x + 384
  To:   Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: c2 |--> 8*b + 24, None)
]
sage: K.subfields(8, 'w')
[
 (Number Field in w0 with defining polynomial x^8 - 24*x^6 + 108*x^4 - 144*x^2 + 36, Ring morphism:
  From: Number Field in w0 with defining polynomial x^8 - 24*x^6 + 108*x^4 - 144*x^2 + 36
  To:   Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  Defn: w0 |--> c, Relative number field morphism:
  From: Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a - 2*b - 6 over its base field
  To:   Number Field in w0 with defining polynomial x^8 - 24*x^6 + 108*x^4 - 144*x^2 + 36
  Defn: c |--> w0
        a |--> 1/12*w0^6 - 11/6*w0^4 + 11/2*w0^2 - 3
        b |--> -1/24*w0^6 + w0^4 - 17/4*w0^2 + 3)
]
sage: K.subfields(3)
[]
uniformizer(P, others='positive')

Returns an element of self with valuation 1 at the prime ideal P.

INPUT:

  • self - a number field
  • P - a prime ideal of self
  • others - either “positive” (default), in which case the element will have non-negative valuation at all other primes of self, or “negative”, in which case the element will have non-positive valuation at all other primes of self.

Note

When P is principal (e.g. always when self has class number one) the result may or may not be a generator of P!

EXAMPLES:

sage: K.<a, b> = NumberField([x^2 + 23, x^2 - 3])
sage: P = K.prime_factors(5)[0]; P
Fractional ideal (5, (-1/2*b + 5/2)*a - 5/2*b - 11/2)
sage: u = K.uniformizer(P)
sage: u.valuation(P)
1
sage: (P, 1) in K.factor(u)
True
vector_space()
For a relative number field, vector_space() is deliberately not implemented, so that a user cannot confuse relative_vector_space() with absolute_vector_space().
sage.rings.number_field.number_field_rel.NumberField_relative_v1(base_field, poly, name, latex_name, canonical_embedding=None)

This is used in pickling relative fields.

EXAMPLES:

sage: from sage.rings.number_field.number_field_rel import NumberField_relative_v1
sage: R.<x> = CyclotomicField(3)[]
sage: NumberField_relative_v1(CyclotomicField(3), x^2 + 7, 'a', 'a')
Number Field in a with defining polynomial x^2 + 7 over its base field
sage.rings.number_field.number_field_rel.is_RelativeNumberField(x)

Return True if x is a relative number field.

EXAMPLES:

sage: from sage.rings.number_field.number_field_rel import is_RelativeNumberField
sage: is_RelativeNumberField(NumberField(x^2+1,'a'))
False
sage: k.<a> = NumberField(x^3 - 2)
sage: l.<b> = k.extension(x^3 - 3); l
Number Field in b with defining polynomial x^3 - 3 over its base field
sage: is_RelativeNumberField(l)
True
sage: is_RelativeNumberField(QQ)
False        

Previous topic

Number Fields

Next topic

Number Field Elements

This Page