Magma's algebraic universe is built out of rings: the integers, the rationals, finite fields, polynomial rings, and everything constructed from them (orders, function fields, local rings, and so on) are all rings or fields in Magma's type hierarchy. This card is a bird's-eye survey of the most basic and most heavily used members of that family, plus the matrix and vector-space machinery built on top of them. The goal is a mental map of what exists and what it is for, not a full tour of every intrinsic.
The Base Rings: Integers and Rationals
Z, the ring of rational integers, and Q, the rational field, are the two structures Magma creates automatically at start-up — you never need to construct them before doing arithmetic. IntegerRing() (or Integers()) and RationalField() (or Rationals()) just return references to these unique global objects. Integers are stored as arbitrary-precision values, with a fast path for "small" integers (absolute value below 2^30); rationals are stored as reduced numerator/denominator pairs. Both types coerce freely into almost any other ring, so mixed arithmetic between an integer, a rational, and an element of some other ring generally just works without explicit conversion.
> Z := IntegerRing();
> Q := RationalField();
> 3/4 + Z!2;
11/4
Related to Z are the integer residue class rings Z/mZ (type RngIntRes), obtained as quotients of Z by an ideal, which is where modular arithmetic and Dirichlet characters live.
Finite Fields and Nearfields
Finite fields (FldFin) form a compatible lattice of structures in Magma: any two fields of the same cardinality are isomorphic, but Magma lets you build them from a specific defining polynomial while guaranteeing that embeddings between a field and its subfields commute. Small non-prime fields use Zech-logarithm tables for speed; larger ones are represented as polynomial quotient rings. GF(q) (equivalently FiniteField(q) or GaloisField(q)) builds the field of order q, and GF(p, n) builds the degree-n extension of the prime field via a Conway polynomial, which pins down a canonical choice among the isomorphic options.
Nearfields (FldNear) are a much more specialized cousin: sets satisfying all field axioms except commutativity of multiplication and one distributive law. They are of interest mainly because finite nearfields correspond exactly to sharply doubly transitive permutation groups and coordinatize certain translation planes — a niche but important tool in group theory and finite geometry.
> F := GF(3, 4);
> IsPrimeField(PrimeField(F));
true
Polynomial Rings
Magma distinguishes univariate polynomial rings (RngUPol), created with PolynomialRing(R), from multivariate polynomial rings (RngMPol), created with PolynomialRing(R, n). The distinction is not just cosmetic: univariate polynomials are stored as coefficient vectors for fast arithmetic, while multivariate polynomials are stored in distributive form (coefficient-monomial pairs), which scales to many variables at the cost of some per-operation overhead. Multivariate rings also carry a monomial order, which matters once you move on to Gröbner bases and ideal theory (covered elsewhere) — this chapter only deals with ring and element-level operations.
> R<x> := PolynomialRing(Rationals());
> P<x,y,z> := PolynomialRing(Rationals(), 3);
Real and Complex Fields
Real and complex fields (FldRe, FldCom) give arbitrary-precision floating-point approximations rather than exact values, built on the MPFR and MPC libraries (with Pari filling gaps). Every real or complex number carries an associated field of a fixed precision, and Magma guarantees that all values of the same precision share the same parent field. Unlike Z and Q, these are not exact rings — the usual caveats about rounding and comparison apply — but they are treated as fields of characteristic 0 for coercion purposes.
Dense and Sparse Matrices
Matrices (type Mtrx, an umbrella covering several concrete types) are the workhorse of linear algebra in Magma. A matrix's parent depends on its shape and role: square matrices live in a matrix algebra, non-square matrices in a matrix module, and there are further specializations for matrix groups and other structured contexts — but the bulk of matrix arithmetic is shared across all of them. Matrix(R, m, n, Q) and its variants build a dense matrix from a ring, dimensions, and a sequence of entries.
Sparse matrices (MtrxSprs) are a deliberately separate type for matrices with mostly-zero entries, supporting the same kinds of invariants (rank, determinant, nullspace vectors) but with algorithms tuned for sparsity — notably the index-calculus algorithms used, for example, in discrete-log computations on very large sparse systems.
> A := Matrix(Rationals(), 2, 2, [1,2,3,4]);
> Determinant(A);
-2
Vector Spaces and Bilinear/Quadratic Forms
A vector space over a field K (ModTupFld for tuple spaces, ModMatFld for spaces of m-by-n matrices) is Magma's home for finite-dimensional linear algebra: the standard space K^(n) of row vectors, matrix spaces K^(m x n), and the linear transformations between them (Hom(V, W)). Every such space is built as a subspace or quotient of one of these standard row spaces.
Polar spaces (FldForms) layer geometric structure on top: bilinear, sesquilinear, and quadratic forms on a vector space, together with the isometries and similarities that preserve them. Every non-degenerate reflexive form falls into one of a small number of standard types (alternating, symmetric, or Hermitian), which is the starting point for classifying symplectic, orthogonal, and unitary geometries.
> V := VectorSpace(GF(5), 3);
> M := GramMatrix(V);
How These Fit Together
The throughline across this chapter cluster is a hierarchy: exact base rings (Z, Q), fields built from them or from finite arithmetic (finite fields, nearfields, reals/complexes), polynomial rings built over any of those coefficient rings, and finally matrices and vector spaces defined over any field — with forms adding geometric structure on top. Knowing which chapter to reach for is mostly a matter of asking "what kind of coefficient object am I working over, and am I doing arithmetic, polynomial manipulation, or linear algebra with it?"