Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Math 582b
Views: 2495

Absolute versus Relative Number Fields

William Stein

Jan 13, 2016

Let's build a tour of number fields

R1.<x> = QQ[] F1.<a> = NumberField(x^3 + 2*x + 1) R2.<y> = F1[] F2.<b> = NumberField(y^2 - a) R3.<z> = F2[] F3.<c> = NumberField(z^3 - b) F3
Number Field in c with defining polynomial z^3 - b over its base field
c^3
b
F2
Number Field in b with defining polynomial y^2 - a over its base field
b^2
a
F1
Number Field in a with defining polynomial x^3 + 2*x + 1
a^3
-2*a - 1
(a+b+c)^3
(3*b + 3*a)*c^2 + (6*a*b + 3*a^2 + 3*a)*c + (3*a^2 + a + 1)*b + 3*a^2 - 2*a - 1
c._add_??
File: /projects/sage/sage-6.10/src/sage/rings/number_field/number_field_element.pyx Source: cpdef ModuleElement _add_(self, ModuleElement right): r""" EXAMPLE:: sage: K.<s> = QuadraticField(2) sage: s + s # indirect doctest 2*s sage: s + ZZ(3) # indirect doctest s + 3 """ cdef NumberFieldElement x cdef NumberFieldElement _right = right x = self._new() ZZ_mul(x.__denominator, self.__denominator, _right.__denominator) cdef ZZX_c t1, t2 ZZX_mul_ZZ(t1, self.__numerator, _right.__denominator) ZZX_mul_ZZ(t2, _right.__numerator, self.__denominator) ZZX_add(x.__numerator, t1, t2) x._reduce_c_() return x

Type

open /projects/sage/sage-6.10/src/sage/rings/number_field/number_field_element.pyx

in a file term.term or browse to that file on Github:

https://github.com/sagemath/sage/blob/master/src/sage/rings/number_field/number_field_element.pyx


I also put a copy of number_field_element.pyx in our lecture notes directory here. Also see the corresponding pxd file, which defines the *data* of a number field element.
smc.link("number_field_element.pyx") print smc.link("number_field_element.pxd")
unknown message type 'obj'
unknown message type 'obj'

In SMC you can select all text (in number_field_element.pyx), then type Control+Q to fold all code. This gives you a nice top-down view of the file.

Look at the file.

All number field elements are represented in terms of a single absolute polynomial over Z\ZZ and a denominator using the NTL C++ number theory library.

This is simple, but it means that in some cases arithmetic can be stupidly slow compared to Magma (and in others, very fast).

c.absolute_minpoly()
x^18 + 2*x^6 + 1
L.<alpha> = F3.absolute_field() L
Number Field in alpha with defining polynomial x^18 + 2*x^6 + 1

The structure method allows you to recover an explicit isomorphisms between LL and F3F_3:

L.structure?
File: /projects/sage/sage-6.10/src/sage/rings/number_field/number_field.py Signature : L.structure() Docstring : Return fixed isomorphism or embedding structure on self. This is used to record various isomorphisms or embeddings that arise naturally in other constructions. EXAMPLES: sage: K.<z> = NumberField(x^2 + 3) sage: L.<a> = K.absolute_field(); L Number Field in a with defining polynomial x^2 + 3 sage: L.structure() (Isomorphism given by variable name change map: From: Number Field in a with defining polynomial x^2 + 3 To: Number Field in z with defining polynomial x^2 + 3, Isomorphism given by variable name change map: From: Number Field in z with defining polynomial x^2 + 3 To: Number Field in a with defining polynomial x^2 + 3) sage: K.<a> = QuadraticField(-3) sage: R.<y> = K[] sage: D.<x0> = K.extension(y) sage: D_abs.<y0> = D.absolute_field() sage: D_abs.structure()[0](y0) -a
from_L, to_L = L.structure()
from_L(alpha + 7)
c + 7
to_L(a + b + c)
alpha^6 + alpha^3 + alpha

WARNING: use these morphisms! Do not get lazy and just try turning things into lists and converting them (copying and pasting). It'll lead to subtle bugs.

%time L.class_number(proof=False)
1 CPU time: 0.01 s, Wall time: 0.00 s
%time F3.class_number(proof=False)
1 CPU time: 0.06 s, Wall time: 0.06 s