This lesson is different from the ones that came before it. Instead of digging into every intrinsic of a single chapter, it takes a step back and surveys a large swath of the Magma Handbook at once: lattices and quadratic forms, "global" fields (number fields and their many special subtypes, function fields), and "local" fields (p-adic rings, valuations, Newton polygons, local Galois theory). The goal is a mental map — what each area is for and how the pieces relate — not a catalogue of function signatures.
Lattices and Quadratic Forms
A lattice (Lat) in Magma is a free Z-module sitting inside Q^n or R^n, equipped with a positive-definite inner product. Lattices show up constantly in number theory, coding theory, and representation theory. Internally, Magma keeps an LLL-reduced basis for every lattice, since LLL reduction (the Lenstra-Lenstra-Lovász algorithm) is what makes operations like finding short or closest vectors efficient — this is why lattices are preferred over plain R-modules over Z whenever a inner product is involved.
> L := LatticeWithGram(SymmetricMatrix([2,-1,2]));
> ShortestVectors(L);
Several related chapters extend this basic picture. LatNF generalizes lattices to modules over the ring of integers of a number field, using pseudobases (vectors paired with fractional ideals) rather than plain Z-bases. GLat studies lattices carrying an action of a finite integral matrix group G — a "G-lattice" — and provides tools like AutomorphismGroup and isometry testing, built on the Plesken–Souvignier backtrack search. QuadForm collects general-purpose functionality for quadratic forms represented either as homogeneous multivariate polynomials or as symmetric matrices (conversion functions like QuadraticForm and SymmetricMatrix link the two views to lattices). Finally QuadBin is a much older, self-contained package for binary quadratic forms $ax^2+bxy+cy^2$: these classify ideals in orders of quadratic fields, and Magma provides composition, reduction, and class group algorithms directly on the forms themselves, tying this chapter closely to the quadratic-field material below.
Number Fields and Their Special Cases
The core object of algebraic number theory in Magma is the number field (FldNum), a finite extension of Q (an absolute field) or of another number field (a relative field), always constructed as K = k[t]/(f(t)). Note that RationalField() itself is not a FldNum — use RationalsAsNumberField() if you need one. Every number field has an associated order (RngOrd, with ideals RngOrdIdl), and the ideal theory of orders — factorization, class groups, unit groups — is where most of classical algebraic number theory actually gets computed in Magma.
> K<a> := NumberField(x^3 - x - 1);
> OK := MaximalOrder(K);
> ClassGroup(OK);
Two subtypes get their own chapters because specialized algorithms make them much faster: quadratic fields (FldQuad/RngQuad), created with QuadraticField(d), and cyclotomic fields (FldCyc/RngCyc), which have both a "dense" representation (as Q(x)/f(x) for the cyclotomic polynomial) and a "sparse" one built from prime-power sub-extensions. Anything that works for general number fields also works for these.
Beyond arithmetic, three chapters push into deeper theory. RngOrdGal computes Galois groups and automorphisms of number fields (and function fields) and their subfields, representing the Galois group as a permutation group acting on roots computed p-adically. FldAb implements class field theory: it classifies abelian extensions of a number field via ray class groups, represented as maps from a finite abelian group to a group of ideals. Char builds Dirichlet and Hecke character groups on top of these ray class/residue structures. Rounding out this corner, AlgEtQ handles étale algebras — finite products of finite separable field extensions, useful for reasoning about several number fields as one ring — and FldAC provides algebraically closed fields, which grow larger algebraic extensions on demand so factorization and Gröbner basis algorithms work as if over an actual closure.
Function Fields
Function fields are the geometric cousins of number fields, and Magma deliberately parallels the two theories. FldFunRat gives rational function fields R(x_1,...,x_n) over any ring with a gcd algorithm for polynomials. FldFunG builds algebraic function fields F/k in one variable — finite extensions of k(x) — which behave like function fields of curves and support the same kind of order/ideal machinery number fields do. FldFunAb then supplies class field theory for global function fields, replacing ideal class groups with divisor class groups but otherwise mirroring FldAb. Finally, ArtRep (Artin representations) sits at the interface of these worlds: it represents complex representations of Gal(Q-bar/Q) that factor through a finite quotient, encoded as characters rather than as actual modules, feeding into L-function computations.
Local Fields: p-adics, Series, and Valuations
The "local" side of the handbook studies completions rather than number fields directly. RngLoc covers finite extensions of Z_p and Q_p, and Magma actually offers three different implementations — fixed-precision (RngPadRes), free-precision (RngPad/FldPad), and exact (RngXPad/FldXPad) — trading off precision tracking against speed. RngLocA generalizes this by allowing an extension by any irreducible polynomial in one step (not just the inertial/ramified split the older model requires), at the cost of not building an explicit ring of integers.
> Qp := pAdicField(5, 20);
> L<pi> := LocalField(Qp, Polynomial([5,0,1]));
Several smaller chapters build on this local picture. RngSer gives power, Laurent, and Puiseux series rings (differing only in what exponents are allowed), while RngLaz provides lazy power series whose coefficients are computed on demand from a formula, useful when infinitely many coefficients are "knowable" but only finitely many are ever needed. RngPowAlg specializes further to algebraic power series with fractional exponents arising as roots of polynomials, aimed at resolving surface singularities. RngVal gives basic valuation rings coming from Q or a rational function field. RngGal implements Galois rings, finite extensions of Z/p^a Z that generalize finite fields. Newton builds and manipulates Newton polygons, the convex-hull data used to read off valuations of roots of polynomials. RngSlope implements linear algebra over Z_p[[u]] for p-adic Hodge theory computations. Finally, two chapters connect local fields back to Galois theory: RngOrdGal's automorphism/Galois-group machinery extends to these settings, and GalRep represents local Galois representations Gal(K-bar/K) -> GL_m(C) as Frobenius-semisimple Weil–Deligne representations, the local analogue of Artin representations.
Putting It Together
The throughline across all ~24 chapters is that Magma consistently separates the field (or lattice) itself from the order/ring living inside it, and from the ideals/modules over that order — and then layers Galois theory and class field theory on top wherever the arithmetic supports it. Whether you are looking at a number field, a function field, or a p-adic field, you'll typically find: a construction step, an order or maximal-order step, ideal/class-group machinery, and (where applicable) automorphism/Galois-group computation using the same conceptual vocabulary. Recognizing which chapter a problem belongs to — lattice, global field, or local field — is most of the battle; the detailed intrinsics can always be looked up once you know where to look.