Module: sage.rings.number_field.number_field
Author Log:
Module-level Functions
n) |
polynomial, [name=True], [check=a]) |
Return the number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over Q.
INPUT: polynomial -- a polynomial over Q (for now) name -- a string (default: 'a'), the name of the generator check -- bool (default: True); do type checking and irreducibility checking.
sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s'); K Number Field in s with defining polynomial z^2 - 2 sage: s = K.0; s s sage: s*s 2 sage: s^2 2
Constructing a relative number field
sage: K.<a> = NumberField(x^2 - 2) sage: R.<t> = K['t'] sage: L = K.extension(t^3+t+a); L Extension by t^3 + t + a of the Number Field in a with defining polynomial x^2 - 2 sage: L.absolute_field() Number Field in b with defining polynomial x^6 + 2*x^4 + x^2 - 2 sage: b = L.gen() sage: a*b -b^4 - b^2 sage: L.lift_to_base(-3*b^3 - 3*b + 1) 3*a + 1
D, [name=False], [check=a]) |
) |
x) |
x) |
x) |
x) |
D) |
Class: NumberField_cyclotomic
The command CyclotomicField(n) creates the n-th cyclotomic field, got by adjoing an n-th root of unity to the rational field.
sage: CyclotomicField(3) Cyclotomic Field of order 3 and degree 2 sage: CyclotomicField(18) Cyclotomic Field of order 18 and degree 6 sage: z = CyclotomicField(6).gen(); z zeta6 sage: z^3 -1 sage: (1+z)^3 6*zeta6 - 3
sage: K = CyclotomicField(197) sage: loads(K.dumps()) == K True sage: loads((z^2).dumps()) == z^2 True
self, n) |
Functions: complex_embedding,
integral_basis,
multiplicative_order_table,
zeta,
zeta_order
self, [prec=53]) |
Return the embedding of this cyclotomic field into the
approximate complex field with precision prec obtained by
sending the generator
of self to exp(2*pi*i/n), where
is the multiplicative order of
.
sage: C = CyclotomicField(4) sage: C.complex_embedding() Ring morphism: From: Cyclotomic Field of order 4 and degree 2 To: Complex Field with 53 bits of precision Defn: zeta4 |--> 0.000000000000000061232339957367660 + 1.0000000000000000*I
Note in the example above that the way zeta is computed (using sin and cosine in MPFR) means that only the prec bits of the number after the decimal point are valid.
sage: K = CyclotomicField(3) sage: phi = K.complex_embedding (10) sage: phi(K.0) -0.49951 + 0.86621*I sage: phi(K.0^3) 1.0000 sage: phi(K.0^3 - 1) 0 sage: phi(K.0^3 + 7) 8.0000
self) |
Return a list of elements of this number field that are a basis for the full ring of integers.
self, [n=None]) |
Returns an element of multiplicative order
in this this
number field, if there is one. Raises a ValueError if there
is not.
INPUT: n -- integer (default: None, returns element of maximal order) OUTPUT: root of unity
sage: k = CyclotomicField(7) sage: k.zeta() zeta7 sage: k.zeta().multiplicative_order() 7 sage: k = CyclotomicField(49) sage: k.zeta().multiplicative_order() 49 sage: k.zeta(7).multiplicative_order() 7 sage: k.zeta() zeta49 sage: k.zeta(7) zeta49^7
Special Functions: __call__,
__repr__,
_latex_
self, x) |
Create an element of this cyclotomic field from
.
The following example illustrates coercion from the cyclotomic field Q(zeta_42) to the cyclotomic field Q(zeta_6), in a case where such coercion is defined:
sage: k42 = CyclotomicField(42) sage: k6 = CyclotomicField(6) sage: a = k42.gen(0) sage: b = a^7 sage: b zeta42^7 sage: k6(b) zeta6 sage: b^2 zeta42^7 - 1 sage: k6(b^2) zeta6 - 1
Coercion of GAP cyclotomic elements is also fully supported.
Class: NumberField_extension
sage: K.<a> = NumberField(x^3 - 2) sage: t = K['x'].gen() sage: L = K.extension(t^2+t+a); L Extension by x^2 + x + a of the Number Field in a with defining polynomial x^3 - 2
self, base, polynomial, [name=None], [latex_name=b]) |
Note: polynomial must be defined in the ring K['x']
, where
K is the base field.
Functions: absolute_field,
absolute_polynomial,
base_field,
disc,
discriminant,
galois_group,
is_free,
lift_to_base,
pari_polynomial,
pari_relative_polynomial,
pari_rnf,
polynomial
self, [name=None]) |
Return this field as an extension of
rather than an
extension of the base field.
self) |
Return the polynomial over
which defines this field as an
extension of the rational numbers.
self, [certify=True]) |
Return the relative discriminant of this extension
as
an ideal of
. If you want the (rational) discriminant of
, use e.g.
L.absolute_field().discriminant()
.
Note that this uses PARI's rnfdisc
function, which
according to the documentation takes an nf
parameter in
GP but a bnf
parameter in the C library. If the C
library actually accepts an nf
, then this function
should be fixed and the certify
parameter removed.
sage: K.<i> = NumberField(x^2+1) sage: t = K['x'].gen() sage: L.<b> = K.extension(t^4-i) sage: L.discriminant() Fractional ideal (256) of Number Field in i with defining polynomial x^2 + 1
self, [certify=True]) |
Return the relative discriminant of this extension
as
an ideal of
. If you want the (rational) discriminant of
, use e.g.
L.absolute_field().discriminant()
.
Note that this uses PARI's rnfdisc
function, which
according to the documentation takes an nf
parameter in
GP but a bnf
parameter in the C library. If the C
library actually accepts an nf
, then this function
should be fixed and the certify
parameter removed.
sage: K.<i> = NumberField(x^2+1) sage: t = K['x'].gen() sage: L.<b> = K.extension(t^4-i) sage: L.discriminant() Fractional ideal (256) of Number Field in i with defining polynomial x^2 + 1
self, [pari_group=False], [use_kash=False]) |
Return the Galois group of the Galois closure of this number
field as an abstract group. Note that even though this is an
extension
, the group will be computed as if it were
.
For more (important!) documentation, so the documentation
for Galois groups of polynomials over
, e.g., by
typing
K.polynomial().galois_group?
, where
is a number field.
sage: K = NumberField(x^2 + 1); R = K['x'] sage: a, t = K.gen(), R.gen() sage: L = K.extension(t^5-t+a) sage: L.galois_group() Transitive group number 22 of degree 10
self, [certify=True]) |
Determine whether or not
is free (i.e. if
is
a free
-module).
sage: K = NumberField(x^2+6) sage: L = K.extension(K['x'].gen()^2 + 3) ## extend by x^2+3 sage: L.is_free() False
self, element) |
Lift an element of this extension into the base field if possible, or raise a ValueError if it is not possible.
sage: K = NumberField(x^3 - 2, 'a') sage: R = K['x'] sage: L = K.extension(R.gen()^2 - K.gen(), 'b') sage: b = L.gen() sage: L.lift_to_base(b^4) a^2 sage: L.lift_to_base(b) Traceback (most recent call last): ... ValueError: The element b is not in the base field
self) |
PARI polynomial corresponding to polynomial that defines this field.
Special Functions: __call__,
__repr__,
_coerce_,
_ideal_class_,
_latex_,
_NumberField_extension__base_inclusion,
_pari_base_bnf,
_pari_base_nf
self, x) |
Coerce x into this number field.
self) |
Return a LaTeXrepresentation of the extension.
sage: K.<a> = NumberField(x^3 - 2) sage: t = K['x'].gen() sage: K.extension(t^2+t+a)._latex_() '\\mbox{\\bf{}Q}[b,a]/(b^{2} + b + a, a^{3} - 2)'
self, element) |
Given an element of the base field, give its inclusion into this extension (according to PARI's rnfeltreltoabs) in terms of the generator of this field.
Class: NumberField_generic
sage: K = NumberField(x^3 - 2); K Number Field in a with defining polynomial x^3 - 2 sage: loads(K.dumps()) == K True
self, polynomial, [name=True], [latex_name=None], [check=None]) |
Functions: base_ring,
characteristic,
class_group,
class_number,
composite_fields,
defining_polynomial,
degree,
different,
disc,
discriminant,
elements_of_norm,
extension,
factor_integer,
galois_group,
gen,
ideal,
integral_basis,
is_field,
latex_variable_name,
narrow_class_group,
ngens,
order,
order_table,
pari_bnf,
pari_bnf_certify,
pari_nf,
pari_polynomial,
polynomial,
polynomial_quotient_ring,
polynomial_ring,
regulator,
signature,
trace_pairing,
units,
zeta,
zeta_coefficients
self, [certify=True]) |
Return the class group of this field.
self, other) |
List of all possible composite fields formed from self and other.
self) |
Compute the different ideal of this number field.
self, [v=None]) |
Returns the discriminant of the ring of integers of the 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 number field OUTPUT: Integer if v is omitted, and Rational otherwise.
self, [v=None]) |
Returns the discriminant of the ring of integers of the 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 number field OUTPUT: Integer if v is omitted, and Rational otherwise.
self, n, [certify=True]) |
Return a list of solutions modulo units of positive norm to
, where a can be any integer in this number field.
sage: K.<a> = NumberField(x^2+1) sage: K.elements_of_norm(3) [] sage: K.elements_of_norm(50) [7*a - 1, -5*a + 5, a - 7] # 32-bit [7*a - 1, -5*a + 5, -7*a - 1] # 64-bit
self, poly, [name=b]) |
Return the relative extension of this field by a given polynomial.
sage: K.<a> = NumberField(x^3 - 2) sage: t = K['x'].gen() sage: L = K.extension(t^2 + a); L Extension by x^2 + a of the Number Field in a with defining polynomial x^3 - 2
self, n) |
Ideal factorization of the principal ideal of the ring
of integers generated by
.
Here we show how to factor gaussian integers.
First we form a number field defined by
:
sage: K.<I> = NumberField(x^2 + 1); K Number Field in I with defining polynomial x^2 + 1
Here are the factors:
sage: fi, fj = K.factor_integer(13);fi,fj ((Fractional ideal (3*I - 2) of Number Field in I with defining polynomial x^2 + 1, 1), (Fractional ideal (-3*I - 2) of Number Field in I with defining polynomial x^2 + 1, 1))
Now we extract the reduced form of the generators:
sage: zi = fi[0].gens_reduced()[0]; zi 3*I - 2 sage: zj = fj[0].gens_reduced()[0]; zj -3*I - 2
We recover the integer that was factor in
sage: zi*zj 13
Author: Alex Clemesha (2006-05-20): examples
self, [pari_group=False], [use_kash=False]) |
Return the Galois group of the Galois closure of this number field as an abstract group.
For more (important!) documentation, so the documentation
for Galois groups of polynomials over
, e.g., by
typing
K.polynomial().galois_group?
, where
is a number field.
sage: NumberField(x^3-2).galois_group(pari_group=True) PARI group [6, -1, 2, "S3"] of degree 3
sage: NumberField(x-1).galois_group() # optional database_gap package Transitive group number 1 of degree 1 sage: NumberField(x^2+2).galois_group() # optional database_gap package Transitive group number 1 of degree 2 sage: NumberField(x^3-2).galois_group() # optional database_gap package Transitive group number 2 of degree 3
self, gens) |
Return the ideal in
generated by gens. This
overrides the
sage.ext.ring.Field
method to use the
sage.ext.ring.Ring
one instead, since we're not really
concerned with ideals in a field but in its ring of integers.
sage: K.<a> = NumberField(x^3-2) sage: K.ideal([a]) Fractional ideal (a) of Number Field in a with defining polynomial x^3 - 2
self) |
Return a list of elements of this number field that are a basis for the full ring of integers.
sage: x = PolynomialRing(QQ).gen() sage: K = NumberField(x^5+10*x+1, 'a') sage: K.integral_basis() [1, a, a^2, a^3, a^4]
Next we compute the ring of integers of a cubic field in which 2 is an "essential discriminant divisor", so the ring of integers is not generated by a single element.
sage: K = NumberField(x^3 + x^2 - 2*x + 8, 'a') sage: K.integral_basis() [1, a, 1/2*a^2 + 1/2*a]
self, [certify=True]) |
Return the narrow class group of this field.
sage: NumberField(x^3+x+9).narrow_class_group() Multiplicative Abelian Group isomorphic to C2
self, [certify=False]) |
PARI big number field corresponding to this field.
self) |
Run the PARI bnfcertify function to ensure the correctness of answers.
self) |
PARI number field corresponding to this field.
self) |
PARI polynomial corresponding to polynomial that defines this field.
self) |
Return the polynomial quotient ring isomorphic to this number field.
sage: R = PolynomialRing(RationalField(), 'x'); x = R.gen() sage: K = NumberField(x^3 + 2*x - 5, 'alpha') sage: K.polynomial_quotient_ring() Univariate Quotient Polynomial Ring in alpha over Rational Field with modulus x^3 + 2*x - 5
self, [certify=True]) |
Return the regulator of this number field.
Note that PARI computes the regulator to higher precision than the SAGE default.
sage: NumberField(x^2-2).regulator() 0.88137358701954305 sage: NumberField(x^4+x^3+x^2+x+1).regulator() 0.96242365011920694
self) |
Return (r1, r2), where r1 and r2 are the number of real embeddings and pairs of complex embeddings of this field, respectively.
sage: NumberField(x^2+1).signature() (0, 1) sage: NumberField(x^3-2).signature() (1, 1) sage: CyclotomicField(7).signature() (0, 3)
self, v) |
Return the matrix of the trace pairing on the elements of the
list
.
sage: x = QQ['x'].0 sage: K.<z> = NumberField(x^2 + 3, 'zeta3') sage: K.trace_pairing([1,z]) [ 2 0] [ 0 -6]
self, [certify=True]) |
Return generators for the unit group modulo torsion.
ALGORITHM: Uses PARI's bnfunit command.
sage: x = QQ['x'].0 sage: A = x^4 - 10*x^3 + 20*5*x^2 - 15*5^2*x + 11*5^3 sage: K = NumberField(A, 'a') sage: K.units() [8/275*a^3 - 12/55*a^2 + 15/11*a - 2]
self, [n=False], [all=2]) |
Return an n-th root of unity in this field. If all is True, return all of them.
INPUT: n -- positive integer all -- bool, default: False. If True, return a list of all n-th roots of 1)
If there are no n-th roots of unity in self, this function raises a ValueError exception.
sage: x = QQ['x'].0 sage: K = NumberField(x^2 + 3, 'zeta3') sage: K.zeta(1) 1 sage: K.zeta(2) -1 sage: K.zeta(2, all=True) [-1] sage: K.zeta(3) 1/2*zeta3 - 1/2 sage: K.zeta(3, all=True) [1/2*zeta3 - 1/2, -1/2*zeta3 - 1/2] sage: K.zeta(4) Traceback (most recent call last): ... ValueError: There are no 4-th roots of unity self.
self, n) |
Compute the first n coefficients of the Dedekind zeta function of this field as a Dirichlet series.
sage: NumberField(x^2+1).zeta_coefficients(10) [1, 1, 0, 1, 2, 0, 0, 1, 1, 2]
Special Functions: __call__,
__cmp__,
__repr__,
_coerce_,
_ideal_class_,
_is_valid_homomorphism_,
_latex_
self, x) |
Coerce x into this number field.
Class: NumberField_quadratic
The command QuadraticExtension(a) creates the field Q(sqrt(a)).
sage: QuadraticField(3, 'a') Number Field in a with defining polynomial x^2 - 3 sage: QuadraticField(-4) Number Field in a with defining polynomial x^2 + 4
self, polynomial, [name=True], [check=None]) |
Functions: class_number,
hilbert_class_field,
hilbert_class_polynomial
self, [proof=True]) |
Return the size of the class group of self.
If proof = False (not the default) and the discriminant of the field is negative, then the following warning from the PARI manual applies: IMPORTANT WARNING: For D<0, this function may give incorrect results when the class group has a low exponent (has many cyclic factors), because implementing Shank's method in full generality slows it down immensely.
self) |
Returns the Hilbert class field of this quadratic
field as an absolute extension of
. For a polynomial
that defines a relative extension see the
hilbert_class_polynomial
command.
Note: Computed using PARI via Schertz's method. This implementation is amazingly fast.
sage: K = NumberField(x^2 + 23, 'a') sage: K.hilbert_class_polynomial() x^3 + x^2 - 1 sage: K.hilbert_class_field() Number Field in a with defining polynomial x^6 + 2*x^5 + 70*x^4 + 90*x^3 + 1631*x^2 + 1196*x + 12743
self) |
Returns a polynomial over
whose roots generate the
Hilbert class field of this quadratic field.
Note: Computed using PARI via Schertz's method. This implementation is quite fast.
sage: K = NumberField(x^2 + 23) sage: K.hilbert_class_polynomial() x^3 + x^2 - 1
sage: K = NumberField(x^2 + 431) sage: K.hilbert_class_polynomial() x^21 + x^20 - 13*x^19 - 50*x^18 + 592*x^17 - 2403*x^16 + 5969*x^15 - 10327*x^14 + 13253*x^13 - 12977*x^12 + 9066*x^11 - 2248*x^10 - 5523*x^9 + 11541*x^8 - 13570*x^7 + 11315*x^6 - 6750*x^5 + 2688*x^4 - 577*x^3 + 9*x^2 + 15*x + 1
See About this document... for information on suggesting changes.