| Home | Trees | Indices | Help |
|---|
|
|
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
NOTE:
Unlike in PARI/GP, class group computations *in SAGE* do *not* by
default assume the Generalized Riemann Hypothesis. To do class
groups computations not provably correctly you must often pass the
flag proof=False to functions or call the function
\code{proof.number_field(False)}. It can easily take 1000's of
times longer to do computations with \code{proof=True} (the
default).
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)
(-3024*beta1 + 1530)*beta0^2 + (-2320*beta1 + 5067)*beta0 - 3150*beta1 + 7592
|
|||
|
NumberField_generic EXAMPLES:... |
|||
| NumberField_absolute | |||
|
NumberField_relative EXAMPLES:... |
|||
|
NumberField_cyclotomic Create a cyclotomic extension of the rational field. |
|||
|
NumberField_quadratic Create a quadratic extension of the rational field. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
_gp =
|
|||
QQ = Rational Field
|
|||
ZZ =
|
|||
RIF = Real Interval Field with 53 bits of precision
|
|||
CIF = Complex Interval Field with 53 bits of precision
|
|||
_nf_cache =
|
|||
_cyclo_cache =
|
|||
|
|||
Return the unique copy of the gp (PARI) interpreter
used for number field computations.
EXAMPLES:
sage: from sage.rings.number_field.number_field import gp
sage: gp()
GP/PARI interpreter
|
Return \emph{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 QQ or a number field, or
a list of polynomials.
name -- a string (default: 'a'), the name of the generator
check -- bool (default: True); do type checking and
irreducibility checking.
EXAMPLES:
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
EXAMPLES: Constructing a relative number field
sage: K.<a> = NumberField(x^2 - 2)
sage: R.<t> = K[]
sage: L.<b> = K.extension(t^3+t+a); L
Number Field in b with defining polynomial t^3 + t + a over its base field
sage: L.absolute_field('c')
Number Field in c with defining polynomial x^6 + 2*x^4 + x^2 - 2
sage: a*b
a*b
sage: L(a)
a
sage: L.lift_to_base(b^3 + b)
-a
Constructing another number field:
sage: k.<i> = NumberField(x^2 + 1)
sage: R.<z> = k[]
sage: m.<j> = NumberField(z^3 + i*z + 3)
sage: m
Number Field in j with defining polynomial z^3 + i*z + 3 over its base field
Number fields are globally unique.
sage: K.<a>= NumberField(x^3-5)
sage: a^3
5
sage: L.<a>= NumberField(x^3-5)
sage: K is L
True
Having different defining polynomials makes them fields different:
sage: x = polygen(QQ, 'x'); y = polygen(QQ, 'y')
sage: k.<a> = NumberField(x^2 + 3)
sage: m.<a> = NumberField(y^2 + 3)
sage: k
Number Field in a with defining polynomial x^2 + 3
sage: m
Number Field in a with defining polynomial y^2 + 3
An example involving a variable name that defines a function in
PARI:
sage: theta = polygen(QQ, 'theta')
sage: M.<z> = NumberField([theta^3 + 4, theta^2 + 3]); M
Number Field in z0 with defining polynomial theta^3 + 4 over its base field
|
Return the tower of number fields defined by the polynomials or
number fields in the list v.
This is the field constructed first from v[0], then over that
field from v[1], etc. If all is False, then each v[i] must be
irreducible over the previous fields. Otherwise a list of all
possible fields defined by all those polynomials is output.
If names defines a variable name a, say, then the generators of
the intermediate number fields are a0, a1, a2, ...
INPUT:
v -- a list of polynomials or number fields
names -- variable names
check -- bool (default: True) only relevant if all is False.
Then check irreducibility of each input polynomial.
OUTPUT:
a single number field or a list of number fields
EXAMPLES:
sage: k.<a,b,c> = NumberField([x^2 + 1, x^2 + 3, x^2 + 5]); k
Number Field in a with defining polynomial x^2 + 1 over its base field
sage: a^2
-1
sage: b^2
-3
sage: c^2
-5
sage: (a+b+c)^2
(2*b + 2*c)*a + 2*c*b - 9
The Galois group is a product of 3 groups of order 2:
sage: k.galois_group()
Galois group PARI group [8, 1, 3, "E(8)=2[x]2[x]2"] of degree 8 of the Number Field in a with defining polynomial x^2 + 1 over its base field
Repeatedly calling base_field allows us to descend the internally
constructed tower of fields:
sage: k.base_field()
Number Field in b with defining polynomial x^2 + 3 over its base field
sage: k.base_field().base_field()
Number Field in c with defining polynomial x^2 + 5
sage: k.base_field().base_field().base_field()
Rational Field
In the following example the second polynomial is reducible over the
first, so we get an error:
sage: v = NumberField([x^3 - 2, x^3 - 2], names='a')
Traceback (most recent call last):
...
ValueError: defining polynomial (x^3 - 2) must be irreducible
We mix polynomial parent rings:
sage: k.<y> = QQ[]
sage: m = NumberField([y^3 - 3, x^2 + x + 1, y^3 + 2], 'beta')
sage: m
Number Field in beta0 with defining polynomial y^3 - 3 over its base field
sage: m.base_field ()
Number Field in beta1 with defining polynomial x^2 + x + 1 over its base field
A tower of quadratic fields:
sage: K.<a> = NumberField([x^2 + 3, x^2 + 2, x^2 + 1])
sage: K
Number Field in a0 with defining polynomial x^2 + 3 over its base field
sage: K.base_field()
Number Field in a1 with defining polynomial x^2 + 2 over its base field
sage: K.base_field().base_field()
Number Field in a2 with defining polynomial x^2 + 1
A bigger tower of quadratic fields.
sage: K.<a2,a3,a5,a7> = NumberField([x^2 + p for p in [2,3,5,7]]); K
Number Field in a2 with defining polynomial x^2 + 2 over its base field
sage: a2^2
-2
sage: a3^2
-3
sage: (a2+a3+a5+a7)^3
((6*a5 + 6*a7)*a3 + 6*a7*a5 - 47)*a2 + (6*a7*a5 - 45)*a3 + (-41)*a5 - 37*a7
|
Return a quadratic field obtained by adjoining a square root of
$D$ to the rational numbers, where $D$ is not a perfect square.
INPUT:
D -- a rational number
name -- variable name
check -- bool (default: True)
OUTPUT:
A number field defined by a quadratic polynomial.
EXAMPLES:
sage: QuadraticField(3, 'a')
Number Field in a with defining polynomial x^2 - 3
sage: K.<theta> = QuadraticField(3); K
Number Field in theta with defining polynomial x^2 - 3
sage: QuadraticField(9, 'a')
Traceback (most recent call last):
...
ValueError: D must not be a perfect square.
sage: QuadraticField(9, 'a', check=False)
Number Field in a with defining polynomial x^2 - 9
Quadratic number fields derive from general number fields.
sage: type(K)
<class 'sage.rings.number_field.number_field.NumberField_quadratic'>
sage: is_NumberField(K)
True
|
Return True if x is an absolute number field.
EXAMPLES:
sage: is_AbsoluteNumberField(NumberField(x^2+1,'a'))
True
sage: is_AbsoluteNumberField(NumberField([x^3 + 17, x^2+1],'a'))
False
The rationals are a number field, but they're not of the absolute number field class.
sage: is_AbsoluteNumberField(QQ)
False
|
Return True if x is of the quadratic \emph{number} field type.
EXAMPLES:
sage: is_QuadraticField(QuadraticField(5,'a'))
True
sage: is_QuadraticField(NumberField(x^2 - 5, 'b'))
True
sage: is_QuadraticField(NumberField(x^3 - 5, 'b'))
False
A quadratic field specially refers to a number field, not a finite
field:
sage: is_QuadraticField(GF(9,'a'))
False
|
Return True if x is a relative number field.
EXAMPLES:
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
|
Return the n-th cyclotomic field, where n is a positive integer.
INPUT:
n -- a positive integer
names -- name of generator (optional -- defaults to zetan).
EXAMPLES:
We create the $7$th cyclotomic field $\QQ(\zeta_7)$ with the
default generator name.
sage: k = CyclotomicField(7); k
Cyclotomic Field of order 7 and degree 6
sage: k.gen()
zeta7
Cyclotomic fields are of a special type.
sage: type(k)
<class 'sage.rings.number_field.number_field.NumberField_cyclotomic'>
We can specify a different generator name as follows.
sage: k.<z7> = CyclotomicField(7); k
Cyclotomic Field of order 7 and degree 6
sage: k.gen()
z7
The $n$ must be an integer.
sage: CyclotomicField(3/2)
Traceback (most recent call last):
...
TypeError: no coercion of this rational to integer
The degree must be positive.
sage: CyclotomicField(0)
Traceback (most recent call last):
...
ValueError: n (=0) must be a positive integer
The special case $n=1$ does \emph{not} return the rational numbers:
sage: CyclotomicField(1)
Cyclotomic Field of order 1 and degree 1
sage: cf6 = CyclotomicField(6) ; z6 = cf6.0
sage: cf3 = CyclotomicField(3) ; z3 = cf3.0
sage: cf3(z6)
zeta3 + 1
sage: cf6(z3)
zeta6 - 1
sage: cf9 = CyclotomicField(9) ; z9 = cf9.0
sage: cf18 = CyclotomicField(18) ; z18 = cf18.0
sage: cf18(z9)
zeta18^2
sage: cf9(z18)
-zeta9^5
sage: cf18(z3)
zeta18^3 - 1
sage: cf18(z6)
zeta18^3
sage: cf18(z6)**2
zeta18^3 - 1
sage: cf9(z3)
zeta9^3
|
Return True if x is a cyclotomic field, i.e., of the special
cyclotomic field class. This function does not return True
for a number field that just happens to be isomorphic to a
cyclotomic field.
EXAMPLES:
sage: is_CyclotomicField(NumberField(x^2 + 1,'zeta4'))
False
sage: is_CyclotomicField(CyclotomicField(4))
True
sage: is_CyclotomicField(CyclotomicField(1))
True
sage: is_CyclotomicField(QQ)
False
sage: is_CyclotomicField(7)
False
|
Return True if the integer $D$ is a fundamental discriminant, i.e.,
if $D \con 0,1\pmod{4}$, and $D\neq 0, 1$ and either (1) $D$ is square free
or (2) we have $D\con 0\pmod{4}$ with $D/4 \con 2,3\pmod{4}$ and $D/4$
square free. These are exactly the discriminants of quadratic fields.
EXAMPLES:
sage: [D for D in range(-15,15) if is_fundamental_discriminant(D)]
[-15, -11, -8, -7, -4, -3, 5, 8, 12, 13]
sage: [D for D in range(-15,15) if not is_square(D) and QuadraticField(D,'a').disc() == D]
[-15, -11, -8, -7, -4, -3, 5, 8, 12, 13]
|
This is used in pickling generic number fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field import NumberField_generic_v1
sage: R.<x> = QQ[]
sage: NumberField_generic_v1(x^2 + 1, 'i', 'i')
Number Field in i with defining polynomial x^2 + 1
|
This is used in pickling generic number fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field import NumberField_generic_v1
sage: R.<x> = QQ[]
sage: NumberField_generic_v1(x^2 + 1, 'i', 'i')
Number Field in i with defining polynomial x^2 + 1
|
This is used in pickling relative fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field 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
|
This is used in pickling relative fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field 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
|
This is used in pickling cyclotomic fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field import NumberField_cyclotomic_v1
sage: NumberField_cyclotomic_v1(5,'a')
Cyclotomic Field of order 5 and degree 4
sage: NumberField_cyclotomic_v1(5,'a').variable_name()
'a'
|
This is used in pickling quadratic fields.
EXAMPLES:
sage: from sage.rings.number_field.number_field import NumberField_quadratic_v1
sage: R.<x> = QQ[]
sage: NumberField_quadratic_v1(x^2 - 2, 'd')
Number Field in d with defining polynomial x^2 - 2
|
|
|||
_gp
|
ZZ
|
_nf_cache
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:28 2008 | http://epydoc.sourceforge.net |