AUTHORS:
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: beta^10
27*beta0
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
Bases: sage.rings.number_field.number_field.NumberField_generic
INPUT:
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
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
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
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)
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:
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
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:
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
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
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
sage: k.<a, c> = NumberField([x^2 + 1/3, x^2 + 1/4])
sage: k.absolute_polynomial()
x^4 + 7/6*x^2 + 1/144
sage: k.relative_polynomial()
x^2 + 1/3
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').absolute_polynomial_ntl()
([-27 34 51], 51)
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
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
]
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
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
Return relative number field isomorphic to self but with the given generator names.
INPUT:
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)
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:
OUTPUT:
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]]
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
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.
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 - 17, x^3 - 2])
sage: K.degree()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field you must use relative_degree or absolute_degree as appropriate
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.
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.different()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field you must use relative_different or absolute_different as appropriate
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.
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.disc()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field you must use relative_discriminant or absolute_discriminant as appropriate
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.
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.discriminant()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field you must use relative_discriminant or absolute_discriminant as appropriate
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:
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
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
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:
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
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
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)
TESTS:
Trivial extensions work like non-trivial ones (trac #2220):
sage: NumberField([x^2 - 3, x], 'a').gens()
(a0, 0)
sage: NumberField([x, x^2 - 3], 'a').gens()
(0, a1)
Return True is this is a CM extension, i.e. a totally imaginary quadratic extension of a totally real field.
EXAMPLES:
sage: F.<a> = NumberField(x^2 - 5)
sage: K.<z> = F.extension(x^2 + 7)
sage: K.is_CM_extension()
True
sage: K = CyclotomicField(7)
sage: K_rel = K.relativize(K.gen() + K.gen()^(-1), 'z')
sage: K_rel.is_CM_extension()
True
sage: F = CyclotomicField(3)
sage: K.<z> = F.extension(x^3 - 2)
sage: K.is_CM_extension()
False
A CM field K such that K/F is not a CM extension
sage: F.<a> = NumberField(x^2 + 1)
sage: K.<z> = F.extension(x^2 - 3)
sage: K.is_CM_extension()
False
sage: K.is_CM()
True
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
Determine whether or not \(L/K\) is free (i.e. if \(\mathcal{O}_L\) is a free \(\mathcal{O}_K\)-module).
INPUT:
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
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()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field L you must use either L.is_galois_relative() or L.is_galois_absolute() as appropriate
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
Return True if for this relative extension \(L/K\), \(L\) is a Galois extension of \(K\).
EXAMPLES:
sage: K.<a> = NumberField(x^3 - 2)
sage: y = polygen(K)
sage: L.<b> = K.extension(y^2 - a)
sage: L.is_galois_relative()
True
sage: M.<c> = K.extension(y^3 - a)
sage: M.is_galois_relative()
False
The following example previously gave the wrong result; see #9390:
sage: F.<a, b> = NumberField([x^2 - 2, x^2 - 3])
sage: F.is_galois_relative()
True
For this relative extension \(L/K\) and another relative extension \(M/K\), return True if there is a \(K\)-linear isomorphism from \(L\) to \(M\). More generally, other can be a relative extension \(M/K^\prime\) with base_isom an isomorphism from \(K\) to \(K^\prime\).
EXAMPLES:
sage: K.<z9> = NumberField(x^6 + x^3 + 1)
sage: R.<z> = PolynomialRing(K)
sage: m1 = 3*z9^4 - 4*z9^3 - 4*z9^2 + 3*z9 - 8
sage: L1 = K.extension(z^2 - m1, 'b1')
sage: G = K.galois_group(); gamma = G.gen()
sage: m2 = (gamma^2)(m1)
sage: L2 = K.extension(z^2 - m2, 'b2')
sage: L1.is_isomorphic_relative(L2)
False
sage: L1.is_isomorphic(L2)
True
sage: L3 = K.extension(z^4 - m1, 'b3')
sage: L1.is_isomorphic_relative(L3)
False
If we have two extensions over different, but isomorphic, bases, we can compare them by letting base_isom be an isomorphism from self’s base field to other’s base field:
sage: Kcyc.<zeta9> = CyclotomicField(9)
sage: Rcyc.<zcyc> = PolynomialRing(Kcyc)
sage: phi1 = K.hom([zeta9])
sage: m1cyc = phi1(m1)
sage: L1cyc = Kcyc.extension(zcyc^2 - m1cyc, 'b1cyc')
sage: L1.is_isomorphic_relative(L1cyc, base_isom=phi1)
True
sage: L2.is_isomorphic_relative(L1cyc, base_isom=phi1)
False
sage: phi2 = K.hom([phi1((gamma^(-2))(z9))])
sage: L1.is_isomorphic_relative(L1cyc, base_isom=phi2)
False
sage: L2.is_isomorphic_relative(L1cyc, base_isom=phi2)
True
Omitting base_isom raises a ValueError when the base fields are not identical:
sage: L1.is_isomorphic_relative(L1cyc)
Traceback (most recent call last):
...
ValueError: other does not have the same base field as self, so an isomorphism from self's base_field to other's base_field must be provided using the base_isom parameter.
The parameter base_isom can also be used to check if the relative extensions are Galois conjugate:
sage: for g in G:
... if L1.is_isomorphic_relative(L2, g.as_hom()):
... print g.as_hom()
Ring endomorphism of Number Field in z9 with defining polynomial x^6 + x^3 + 1
Defn: z9 |--> -z9^4 - z9
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^6)
2
sage: L.lift_to_base(355/113)
355/113
sage: L.lift_to_base(b)
Traceback (most recent call last):
...
ValueError: The element b is not in the base field
Return the maximal order, i.e., the ring of integers of this number field.
INPUT:
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
An example with nontrivial v:
sage: L.<a,b> = NumberField([x^2 - 3, x^2 - 5])
sage: O3 = L.maximal_order([3])
sage: O3.absolute_discriminant()
3686400
sage: O3.is_maximal()
False
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
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
Return the order with given ring generators in the maximal order of this number field.
INPUT:
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])
Traceback (most recent call last):
...
ValueError: the rank of the span of gens is wrong
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 with integer coefficients corresponding to the polynomial that defines this field as an absolute number field.
By default, this is a polynomial in the variable “x”. PARI prefers integral polynomials, so we clear the denominator. Therefore, this is NOT the same as simply converting the absolute defining polynomial to PARI.
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
sage: k.<a, c> = NumberField([x^2 + 1/3, x^2 + 1/4])
sage: k.pari_polynomial()
144*x^4 + 168*x^2 + 1
sage: k.absolute_polynomial()
x^4 + 7/6*x^2 + 1/144
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)
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()
[x^4 + 3, [], [[108, 0; 0, 108], 3], [8, 0; 0, 8], [], [], [[1, x - 1, x^2 - 1, x^3 - x^2 - x - 3], ..., 0]
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]
For a relative number field, polynomial() is deliberately not implemented. Either relative_polynomial() or absolute_polynomial() must be used.
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 + x + 1, x^3 + x + 1])
sage: K.polynomial()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field L you must use either L.relative_polynomial() or L.absolute_polynomial() as appropriate
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
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)
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() == F.ideal(4*b)
True
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
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
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:
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 a0_0 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 + a0_0 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
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*a, -b^2*a - b^2, b^3, -a, b*a + b]
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)
[]
Returns an element of self with valuation 1 at the prime ideal P.
INPUT:
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
For a relative number field, vector_space() is deliberately not implemented, so that a user cannot confuse relative_vector_space() with absolute_vector_space().
EXAMPLE:
sage: K.<a> = NumberFieldTower([x^2 - 17, x^3 - 2])
sage: K.vector_space()
Traceback (most recent call last):
...
NotImplementedError: For a relative number field L you must use either L.relative_vector_space() or L.absolute_vector_space() as appropriate
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
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