William Stein
{{{id=5| /// }}}Defining Number Fields
Remark: Magma (which you may also want to learn) is very similar.
{{{id=86| %magma RRemark: Pari (which you also want to learn something of) is different.
{{{id=101| gp.nfinit? /// }}} {{{id=84| %gp k = nfinit(x^4 - 2*x^2 - 1); k /// [x^4 - 2*x^2 - 1, [2, 1], -1024, 1, [[1, -1.5537739740300373073441589530631469482, -0.64359425290558262473544343741820980891, 1.4142135623730950488016887242096980786; 1, 1.5537739740300373073441589530631469482, 0.64359425290558262473544343741820980891, 1.4142135623730950488016887242096980786; 1, 0.E-38 - 0.64359425290558262473544343741820980893*I, 0.E-38 + 1.5537739740300373073441589530631469482*I, -1.4142135623730950488016887242096980786 + 0.E-38*I], [1, -1.5537739740300373073441589530631469482, -0.64359425290558262473544343741820980891, 1.4142135623730950488016887242096980786; 1, 1.5537739740300373073441589530631469482, 0.64359425290558262473544343741820980891, 1.4142135623730950488016887242096980786; 1, -0.64359425290558262473544343741820980893, 1.5537739740300373073441589530631469482, -1.4142135623730950488016887242096980786; 1, 0.64359425290558262473544343741820980893, -1.5537739740300373073441589530631469482, -1.4142135623730950488016887242096980786], [1, -2, -1, 1; 1, 2, 1, 1; 1, -1, 2, -1; 1, 1, -2, -1], [4, 0, 0, 0; 0, 4, 4, 0; 0, 4, -4, 0; 0, 0, 0, 8], [8, 0, 0, 0; 0, 8, 4, 0; 0, 0, 4, 0; 0, 0, 0, 4], [2, 0, 0, 0; 0, 1, 1, 0; 0, 1, -1, 0; 0, 0, 0, 1], [2, [0, 2, 0, 0; 1, 0, 0, 2; 1, 0, 0, 0; 0, 1, 1, 0]]], [-1.5537739740300373073441589530631469482, 1.5537739740300373073441589530631469482, 0.E-38 - 0.64359425290558262473544343741820980893*I], [1, x, x^3 - 2*x, x^2 - 1], [1, 0, 1, 0; 0, 1, 0, 2; 0, 0, 0, 1; 0, 0, 1, 0], [1, 0, 0, 0, 0, 1, 1, 0, 0, 1, -1, 0, 0, 0, 0, 2; 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0; 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, -1, 0, 1, -1, 0; 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]] }}} {{{id=83| gp.nfbasis? /// }}}Special kinds of number fields:
{{{id=25| K. = QuadraticField(5); K /// Number Field in a with defining polynomial x^2 - 5 }}} {{{id=4| a^2 /// 5 }}} {{{id=28| K = CyclotomicField(15); K /// Cyclotomic Field of order 15 and degree 8 }}} {{{id=27| z = K.gen(); z /// zeta15 }}} {{{id=29| z^15 /// 1 }}} {{{id=104| 1/((1+2*z)^3) /// -8878336/36264691*zeta15^7 + 14376704/36264691*zeta15^6 - 12283104/36264691*zeta15^5 + 5069520/36264691*zeta15^4 + 870160/36264691*zeta15^3 - 9827128/36264691*zeta15^2 + 10831182/36264691*zeta15 - 5302797/36264691 }}} {{{id=103| /// }}}Relative extensions (warning -- basic arithmetic is very slow in some relative extensions, due to the toy implementation. See trac 9541.)
{{{id=108| K.Elements
Fractional Ideals
The Ring $\mathcal{O}_K$ of Integers
Class Groups
{{{id=75| var('x') K.(Bug in how the class group prints above: see trac 10141.)
{{{id=21| a = sqrt(1+sqrt(2)) f = RR(a).algdep(4); f /// x^4 - 2*x^2 - 1 }}} {{{id=23| K. = NumberField(f); K /// Number Field in a with defining polynomial x^4 - 2*x^2 - 1 }}} {{{id=22| K.class_number() /// 1 }}} {{{id=9| /// }}}(Massive) Efficiency Tricks
This would take forever:
{{{id=81| K.maximal_order() /// ^CTraceback (most recent call last): File "Unit Groups of Number Fields
Recall Dirichlet's Theorem, which I have stated, but not yet proved.
Theorem: The group $U_K$ of units of $\mathcal{O}_K$ is a finite (cyclic) torsion group times a free abelian group of rank $r+s-1$, where $r$ is the number of real embeddings and $2s$ is the numbers of complex embeddings of $K$.
{{{id=125| x = var('x') K. = NumberField(x^3 + x^2 - 2*x + 8) U = K.unit_group() U /// Unit group with structure C2 x Z of Number Field in a with defining polynomial x^3 + x^2 - 2*x + 8 }}} {{{id=131| U.gens() /// [-1, 3*a^2 + 13*a + 13] }}} {{{id=130| g = U.gens()[1]; g /// 3*a^2 + 13*a + 13 }}} {{{id=129| g.norm() /// -1 }}}Note: Units need not lie on the unit circle!
{{{id=139| points(g.complex_embeddings(), pointsize=50) ///Fundamental Units (i.e., the best generators) can be very big:
{{{id=141| K. = QuadraticField(2011) K.unit_group().gens() /// [-1, 510732021116138713675018566232201605320997*a + 22903355954053525066202335319378237605968890] }}}(See Lenstra's article for a fun related discussion.)
{{{id=138| /// }}} {{{id=137| /// }}}An Infamous Gotcha's
Here's something that confused the heck out of me once.
{{{id=128| %magma RWTF: The issue is that Magma defines the discriminant of a number field to be the discriminant of the defining polynomial for the field. This directly conflicts with all standard usage in mathematics literature. So watch out. Always check documentation (in this the builtin docs don't help) and do consistency checks.
{{{id=133| magma.Discriminant? ///File: /Users/wstein/purple/psage-10.09.30/local/lib/python2.6/site-packages/sage/interfaces/magma.py
Type: <class 'sage.interfaces.magma.MagmaFunction'>
Definition: magma.Discriminant(*args, **kwds)
Docstring:
Intrinsic 'Discriminant' Signatures: (O) -> RngOrdIdl [ Recompute ] The discriminant of the order O with respect to the trace on its container algebra. Set Recompute to true to force a recomputation. ( O) -> RngIntElt Discriminant of the order O. ( A) -> RngOrdIdl, SeqEnum Returns the ideal of finite places and the sequence of real places where A is ramified. ( A) -> RngElt ( A) -> RngElt The reduced discriminant. ( C) -> RngIntElt The discriminant of the plane conic curve C. ( E) -> RngElt The discriminant of the elliptic curve E. ( C) -> RngElt The discriminant of the curve C. ( F) -> RngOrdIdl, SeqEnum The discriminant of the FldAb F. ( K) -> RngIntElt The discriminant for the field K. ( S, R) -> RngPadElt Discriminant of the extension S/R. ( K) -> RngIntElt The discriminant for the field K. ( H) -> FldRatElt, AlgMatElt ( M) -> RngIntElt The discriminant of H with respect to the trace pairing matrix. ( model) -> RngElt The discriminant Delta of the given genus one model. ( Q) -> RngIntElt The discriminant which the forms in Q share. ( x) -> RngIntElt The discriminant for the quadratic form x. ( O) -> . The discriminant of the order O. ( R) -> RngIntElt The discriminant of the order O in an algebraic field. ( L) -> RngElt Discriminant of the local ring L. ( f, v) -> RngMPolElt The discriminant of the polynomial f with respect to the v-th variable. ( f, V) -> RngMPolElt The discriminant of the polynomial f with respect to variable V. ( O) -> . The discriminant of the order O in an algebraic field. ( R) -> RngPadElt Discriminant of R/BaseRing(R). ( S, R) -> RngPadElt Discriminant of the extension S/R. ( I) -> RngIntElt The discriminant of the quadratic ideal. ( f) -> RngElt The discriminant of the univariate polynomial f.