NumberFieldIntegralBasis¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
NumberFieldIntegralBasis[a]
gives an integral basis for the field Q(a) generated by the algebraic number a: a list of algebraic integers that generate the ring of integers O_K of Q(a) as a module over the integers. The equation order Z[a] is enlarged to O_K by Round 2 (Pohst-Zassenhaus) when it is not already maximal, so the basis is correct for non-monogenic fields. a may be a radical, a Root object, or an AlgebraicNumber object; the basis it produces may not be unique. Threads over lists. Requires FLINT. Attributes: Listable, Protected.
Examples (7)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (5)¶
Q(2^(1/3)), monogenic
Z[theta] not maximal
Z[zeta_8]
In[3]:= N[NumberFieldIntegralBasis[E^(I Pi/4)]]
Out[3]= {1.0, 0.707107 + 0.707107*I, 6.12323e-17 + 1.0*I, -0.707107 + 0.707107*I}
Threads over lists
Applications (2)¶
Z[Sqrt[2]] is already the maximal order
Disc 5: the ring of integers needs (1 + Sqrt[5])/2
Algorithm¶
numberfieldintegralbasis.c — NumberFieldIntegralBasis[a].
See numberfieldintegralbasis.h for the contract. All field / maximal-order computation is delegated to flint_qqbar_integral_basis (which builds the algebraic-integer generator, runs the number-field layer's Dedekind + Round 2 maximal-order engine, and renders each basis row as a canonical AlgebraicNumber). This file only checks the argument shape and reports a decline; the evaluator re-canonicalises each returned element on its next fixed-point step.
Implementation notes¶
Algorithm. builtin_numberfieldintegralbasis checks arity 1 and delegates
to flint_qqbar_integral_basis, which returns a Z-module basis of the ring of
integers O_K of K = Q(a):
- Build the algebraic-integer generator
phi = lc·alphaofQ(a)(algint_generator), monic of degreen. Ifn ≤ 1,O_K = Zand the basis is{1}. - Hand
phi's monic integer defining polynomial to the number-field layer (nf_field_create), which runs Dedekind's criterion at every ramified prime and, where the equation orderZ[phi]is not maximal, enlarges it toO_Kby Round 2 (Pohst–Zassenhaus). This is what makes the basis correct for non-monogenic fields, not just{1, phi, …, phi^{n−1}}. - Read back the numerator lattice
Wand common denominatorD(O_K = (1/D)·L). The rows ofWare arbitrarily ordered; the engine puts them in the standard presentation — the lower-triangular Hermite normal form in thetheta-power basis, soomega_0 = 1andomega_khas degree exactlyk. FLINT'sfmpz_mat_hnfgives the upper-triangular HNF, so the lower-triangular one is obtained as a 180°-rotation applied to the column-reversed lattice. - Render each basis row
omega_i = (1/D) Σ_j H[i][j] phi^jwithpoly_to_algnum— anAlgebraicNumber[g, {..}], or a plainInteger/Rationalwhen the row is rational (asomega_0 = 1always is).
A decline routes a NumberFieldIntegralBasis::nintbas message through
mth_message.
Data structures. FLINT qqbar_t for phi; the NumberField* maximal-order
object (its Round-2 basis W and denominator D as mpz/fmpz); fmpz_mat
for the HNF; fmpq_poly per row; and the AlgebraicNumber representation for
each returned element.
Complexity / limits. Dominated by the maximal-order computation —
factorisation of the field discriminant and the p-radical / Round-2 steps at
each ramified prime. Listable (each generator is its own field), Protected;
bounded by the degree cap QQBAR_DEGREE_CAP = 120. Declines when O_K cannot be
certified (the discriminant will not factor, or a prime exceeds the single-word
modulus) or FLINT is compiled out. The basis returned is correct but not
unique (any Z-basis of O_K is admissible; this one is the HNF
presentation).
Attributes: Listable, Protected.
References¶
See also: AlgebraicNumber, N, Root
- H. Cohen, A Course in Computational Algebraic Number Theory, GTM 138 (Springer, 1993), §6.1 (the Round 2 / Pohst–Zassenhaus maximal-order algorithm) and §4.4 (integral bases).
- The FLINT library (https://flintlib.org),
qqbarmodule,fmpz_matHermite normal form (fmpz_mat_hnf), and the number-field maximal-order layer. - Source:
src/poly/numberfieldintegralbasis.c - Specification:
docs/spec/builtins/algebra.md - Tests:
tests/test_numberfieldintegralbasis.c
Notes & additional examples¶
Notes¶
NumberFieldIntegralBasis[a] gives a Z-module basis of the ring of integers
O_K of K = Q(a): a list of algebraic integers generating O_K over the
integers. The equation order Z[a] is enlarged to O_K by Round 2
(Pohst–Zassenhaus) when it is not already maximal, so the result is correct even
for non-monogenic fields. The Sqrt[5] example shows this: the basis is not
{1, Sqrt[5]} but {1, (1 + Sqrt[5])/2} — the half-integer generator — because
the discriminant of x^2 - 5 is 20, four times the field discriminant 5.
The basis is presented in Hermite normal form (so the k-th element has degree
k), but any Z-basis of O_K is admissible — the choice is not unique.
Listable (each generator is its own field) and Protected; requires FLINT.