---
title: "Handbook of Magma Functions, Part VI: Global Fields"
version: "2.30-1"
canonical: "https://docs.magma-maths.org/GlobalFields/index-global-fields.html"
---

# Global Fields

- [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md): Defining number fields, elements, and embeddings.
- [Quadratic Fields](https://docs.magma-maths.org/GlobalFields/QuadraticFields/index-quadratic-fields.md): Quadratic field creation, structure, and element operations.
- [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md): Cyclotomic field creation, structure, and element operations.
- [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md): Orders in number fields: creation, arithmetic, and printing.
- [Galois Groups and Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/index-galois-groups-and-automorphisms.md): Automorphism groups, Galois groups, subfields, and cohomology.
- [Class Field Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/index-class-field-theory.md): Abelian extensions, ray class fields, and Galois module structure.
- [Étale Algebras](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/index-etale-algebras.md): Étale algebra construction, attributes, and homomorphisms.
- [Dirichlet and Hecke Characters](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/index-dirichlet-and-hecke-characters.md): Dirichlet and Hecke character construction and properties.
- [Algebraically Closed Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/index-algebraically-closed-fields.md): Algebraically closed field representation, structure, and creation.
- [Rational Function Fields](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/index-rational-function-fields.md): Rational function field creation, operations, and elements.
- [Algebraic Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/index-algebraic-function-fields.md): Algebraic function field creation and structural invariants.
- [Class Field Theory for Global Function Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/index-class-field-theory-for-global-function-fields.md): Class groups, abelian extensions, and Witt rings for function fields.
- [Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/index-artin-representations.md): Artin representation functions, invariants, and arithmetic.

<a id="algebraic-field"></a>
<a id="fldnum-main"></a>
## Number Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/NumberFields/introduction.md)
- [Acknowledgement](https://docs.magma-maths.org/GlobalFields/NumberFields/acknowledgement.md)
- [Creation Functions](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md)
  - [Creation of Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#creation-of-number-fields)
    - [`NumberField(f): RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield)
    - [`RationalsAsNumberField() → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-rationalsasnumberfield)
    - [`QNF() → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-qnf)
    - [`NumberField(s): [ RngUPolElt ] → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield-seq)
    - [`ext< F | s1, ..., sn >: FldNum, RngUPolElt, ..., RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-fldnum-ext)
    - [`ext<F | s>: FldNum, [RngUPolElt] → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-ext-fldnum-rngupolelt-fldnum)
    - [`ext< Q | s1, ..., sn >: FldRat, RngUPolElt, ..., RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-ext-fldrat-rngupolelt-rngupolelt-fldnum)
    - [`ext< Q | s >: FldRat, [RngUPolElt] → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-ext-fldrat-rngupolelt-fldnum)
    - [Example: Creating a Number Field](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-30ee5b)
    - [`RadicalExtension(F, d, a): Rng, RngIntElt, RngElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-radicalextension-rng-rngintelt-rngelt)
    - [`SplittingField(F): FldNum → FldNum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-splittingfield-fldnum)
    - [`NormalClosure(F): FldNum → FldNum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-normalclosure-fldnum)
    - [`SplittingField(f): RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-splittingfield-rngupolelt)
    - [`SplittingField(L): [RngUPolElt] → FldNum, [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-splittingfield-rngupolelt-2)
    - [`sub< F | e₁, ..., eₙ >: FldAlg, FldAlgElt, ..., FldAlgElt → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-sub-fldalg-fldalgelt-fldalgelt-fldalg-map)
    - [`sub< F | S >: FldAlg, SeqEnum → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-sub-fldalg-seqenum-fldalg-map)
    - [`MergeFields(F, L): FldNum, FldNum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-mergefields-fldnum-fldnum)
    - [`CompositeFields(F, L): FldNum, FldNum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-compositefields)
    - [`Compositum(K, L): FldNum, FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-compositum-fldnum-fldnum)
    - [`quo< FldNum : R | f >: RngUPol, RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-quo-rngupol-rngupolelt-fldnum)
    - [Example: Normal Closure via Composite Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-180416)
    - [`OptimizedRepresentation(F): FldNum → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-optimizedrepresentation)
    - [`OptimisedRepresentation(F): FldNum → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-optimisedrepresentation-fldnum)
    - [Example: Optimized Representation of a Field](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-91bae8)
    - [`IntegralModel(F): FldNum → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-integralmodel)
    - [Example: Integral Model of a Number Field](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-67a832)
  - [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#maximal-orders)
    - [`MaximalOrder(F): FldNum → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-maximalorder)
    - [`IntegerRing(F): FldNum → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-integerring-fldnum)
    - [`Integers(F): FldNum → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-integers-fldnum)
    - [`RingOfIntegers(F): FldNum → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-ringofintegers-fldnum)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#creation-of-elements)
    - [`F ! a: FldNum, RngElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#operation-op-fldnum-rngelt)
    - [`elt< F | a >: FldNum, RngElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-elt-fldnum-rngelt-fldnumelt)
    - [`F ! [a₀, a₁, ..., aₘ₋₁]: FldNum, [RngElt] → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#operation-op-fldnum-rngelt-2)
    - [`elt< F | [ a₀, a₁, ..., aₘ₋₁ ] >: FldNum, SeqEnum[RngElt] → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-elt-fldnum-seqenum-rngelt-fldnumelt)
    - [`elt< F | a₀, a₁, ..., aₘ₋₁>: FldNum, RngElt, ..., RngElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-elt-fldnum-rngelt-rngelt-fldnumelt)
    - [`Random(F, m): FldNum, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-random-fldnum-rngintelt)
    - [Example: Creating Number Field Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-543b5e)
    - [`One(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-one-fldnum)
    - [`Identity(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-identity-fldnum)
    - [`Zero(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-zero-fldnum)
    - [`Representative(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-representative-fldnum)
  - [Creation of Homomorphisms](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#creation-of-homomorphisms)
    - [`hom< F -> R | r >: FldNum, Rng, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-hom-fldnum-rng-rngelt-map)
    - [`hom< F -> R | h, r >: FldNum, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-hom-fldnum-rng-map-rngelt-map)
    - [`hom< F -> R | r >: FldNum, Rng, [RngElt] → Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-hom-fldnum-rng-rngelt-map-2)
    - [`hom< F -> R | h, r >: FldNum, Rng, Map, [RngElt] → Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-constructor-hom-fldnum-rng-map-rngelt-map-2)
    - [Example: Embedding a Quadratic Field in a Quartic Field](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#example-ex-4d9b55)
- [Structure Operations](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md)
  - [General Functions](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#general-functions)
    - [`Category(K): FldNum → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-category-fldnum)
    - [`Type(K): FldNum → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-type-fldnum)
    - [`ExtendedType(K): FldNum → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-extendedtype-fldnum)
    - [`Parent(K): FldNum → Pow`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-parent-fldnum)
    - [`AssignNames(~K, s): FldNum, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#procedure-assignnames-fldnum-monstgelt-ref)
    - [`Name(K, i): FldNum, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-name-fldnum-rngintelt)
    - [`K . i: FldNum, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-operation-fldnum-rngintelt-fldnumelt)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#related-structures)
    - [`GroundField(F): FldNum → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-groundfield-fldnum)
    - [`BaseField(F): FldNum → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-basefield-fldnum)
    - [`CoefficientField(F): FldNum → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-coefficientfield)
    - [`CoefficientRing(F): FldNum → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-coefficientring-fldnum)
    - [`AbsoluteField(F): FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-absolutefield)
    - [`SimpleExtension(F): FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-simpleextension)
    - [`RelativeField(F, L): FldNum, FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-relativefield-fldnum-fldnum)
    - [`RelativeField(Q, L): FldRat, FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-relativefield-fldrat-fldnum)
    - [`Components(F): FldNum → [FldNum]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-components-fldnum)
    - [Example: Compositum of Two Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-e3e873)
    - [`PrimeRing(F): FldNum → RngRat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-primering-fldnum)
    - [`PrimeField(F): FldNum → RngRat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-primefield-fldnum)
    - [`Centre(F): FldNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-centre-fldnum)
    - [`Embed(F, L, a): FldNum, FldNum, FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#procedure-embed-fldnum-fldnum-fldnumelt)
    - [`Embed(F, L, a): FldNum, FldNum, [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#procedure-embed-fldnum-fldnum-fldnumelt-2)
    - [`EmbeddingMap(F, L): FldNum, FldNum → Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-embeddingmap-fldnum-fldnum)
    - [Example: Embedding One Number Field in Another](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-909e79)
    - [`MinkowskiSpace(F): FldNum → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-minkowskispace-fldnum)
    - [`Completion(K, P): FldNum, RngOrdIdl → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-completion1)
    - [`comp<K|P>: FldNum, RngOrdIdl → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#constructor-constructor-comp-fldnum-rngordidl-fldloc-map)
    - [`Completion(K, P): FldNum, PlcNumElt → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-completion-fldnum-plcnumelt)
  - [Representing Fields as Vector Spaces](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#representing-fields-as-vector-spaces)
    - [`Algebra(K, J): FldNum, Fld → AlgAss, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-algebra-fldnum-fld)
    - [`Algebra(K, J, S): FldNum, Fld, [FldNumElt] → AlgAss, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-algebra-fldnum-fld-fldnumelt)
    - [`VectorSpace(K, J): FldNum, Fld → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-vectorspace-fldnum-fld)
    - [`KSpace(K, J): FldNum, Fld → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-kspace-fldnum-fld)
    - [`VectorSpace(K, J, S): FldNum, Fld, [FldNumElt] → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-vectorspace-fldnum-fld-fldnumelt)
    - [`KSpace(K, J, S): FldNum, Fld, [FldNumElt] → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-kspace-fldnum-fld-fldnumelt)
    - [Example: Minimal Polynomial over a Subfield](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-3f6dca)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#invariants)
    - [`Characteristic(F): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-characteristic-fldnum)
    - [`Degree(F): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-degree)
    - [`AbsoluteDegree(F): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-absolutedegree-fldnum)
    - [`Discriminant(F): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-discriminant)
    - [`Discriminant(F): FldNum → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-discriminant-fldnum)
    - [`AbsoluteDiscriminant(K): FldNum → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-absolutediscriminant-fldnum)
    - [`Regulator(K): FldNum → FldComElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-regulator-fldnum)
    - [`RegulatorLowerBound(K): FldNum → FldComElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-regulatorlowerbound-fldnum)
    - [`Signature(F): FldAlg → RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-signature-fldalg)
    - [`UnitRank(K): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-unitrank-fldnum)
    - [`DefiningPolynomial(F): FldNum → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-definingpolynomial-fldnum)
    - [`DefiningPolynomial(F): FldNum → [RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-definingpolynomial-fldnum-2)
    - [`Zeroes(F, n): FldNum, RngIntElt → [ FldComElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-zeroes-fldnum-rngintelt)
    - [Example: Zeros and Defining Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-e63cd9)
  - [Basis Representation](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#basis-representation)
    - [`Basis(F): FldNum → [ FldNumElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-basis-fldnum)
    - [`Basis(F, R): FldNum, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-basis-fldnum-rng)
    - [`IntegralBasis(F): FldNum → [ FldNumElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-integralbasis-fldnum)
    - [`IntegralBasis(F, R): FldNum, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-integralbasis-fldnum-rng)
    - [Example: Basis over Different Rings](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-49b3f2)
    - [`AbsoluteBasis(K): FldNum → [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-absolutebasis)
    - [Example: Basis and Integral Basis](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#example-ex-0dc237)
  - [Ring Predicates](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#ring-predicates)
    - [`F eq L: FldNum, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-eq-fldnum-fldnum)
    - [`F eq L: FldRat, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-eq-fldrat-fldnum)
    - [`F eq L: FldNum, FldRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-eq-fldnum-fldrat)
    - [`IsCommutative(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-iscommutative-rng)
    - [`IsUnitary(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isunitary-rng)
    - [`IsFinite(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isfinite-rng)
    - [`IsOrdered(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isordered-rng)
    - [`IsField(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isfield-rng)
    - [`IsNumberField(R): . → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isnumberfield)
    - [`IsAlgebraicField(R): . → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isalgebraicfield)
    - [`IsEuclideanDomain(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-iseuclideandomain-fldnum)
    - [`IsSimple(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-issimple-fldnum)
    - [`IsPID(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-ispid-fldnum)
    - [`IsUFD(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isufd-fldnum)
    - [`IsPrincipalIdealRing(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isprincipalidealring-fldnum)
    - [`IsDomain(R): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isdomain-fldnum)
    - [`F ne L: FldNum, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-ne-fldnum-fldnum)
    - [`K subset L: FldNum, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-subset-fldnum-fldnum)
    - [`K subset L: FldRat, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#operation-op-subset-fldrat-fldnum)
    - [`HasComplexConjugate(K): FldNum → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-hascomplexconjugate)
    - [`ComplexConjugate(x): FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-complexconjugate-fldnumelt)
  - [Field Predicates](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#field-predicates)
    - [`IsIsomorphic(F, L): FldNum, FldNum → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isisomorphic-fldnum-fldnum)
    - [`IsSubfield(F, L): FldNum, FldNum → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-issubfield-fldnum-fldnum)
    - [`IsSubfield(F, L): FldRat, FldNum → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-issubfield-fldrat-fldnum)
    - [`IsNormal(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isnormal-fldnum)
    - [`IsAbelian(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isabelian-fldnum)
    - [`IsCyclic(F): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-iscyclic-fldnum)
    - [`IsAbsoluteField(K): FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-isabsolutefield-fldnum)
- [Fields with a Labelled Embedding](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md)
  - [Creation Functions](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#creation-functions)
    - [`EmbeddedNumberField(L, c): FldNum, FldComElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-fldnum-fldcomelt)
    - [`EmbeddedNumberField(L, c): FldNum, FldReElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-fldnum-fldreelt)
    - [`HasEmbeddedNumberField(L, c): FldNum, FldComElt → BoolElt, FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-hasembeddednumberfield-fldnum-fldcomelt)
    - [`HasEmbeddedNumberField(L, c): FldNum, FldReElt → BoolElt, FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-hasembeddednumberfield-fldnum-fldreelt)
    - [`EmbeddedNumberField(f, r): RngUPolElt, FldReElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-rngupolelt-fldreelt)
    - [`EmbeddedNumberField(f, r): RngUPolElt, FldComElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-rngupolelt-fldcomelt)
    - [`HasEmbeddedNumberField(f, r): RngUPolElt, FldReElt → BoolElt, FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-hasembeddednumberfield-rngupolelt-fldreelt)
    - [`HasEmbeddedNumberField(f, r): RngUPolElt, FldComElt → BoolElt, FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-hasembeddednumberfield-rngupolelt-fldcomelt)
    - [`EmbeddedNumberField(f, i): RngUPolElt, RngIntElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-rngupolelt-rngintelt)
    - [`EmbeddedNumberField(L, i): FldNum, RngIntElt → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddednumberfield-fldnum-rngintelt)
    - [`EmbeddedSplittingField(f): RngUPolElt → FldNumEmb, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embeddedsplittingfield-rngupolelt)
    - [`Subfield(L, K): FldNumEmb, FldNum → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-subfield-fldnumemb-fldnum)
  - [Composition and Intersection](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#composition-and-intersection)
    - [`Composite(K, L): FldNumEmb, FldNumEmb → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-composite-fldnumemb-fldnumemb)
    - [`Intersection(K, L): FldNumEmb, FldNumEmb → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-intersection-fldnumemb-fldnumemb)
    - [`K meet L: FldNumEmb, FldNumEmb → FldNumEmb`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#operation-op-meet-fldnumemb-fldnumemb)
    - [`IsSubfieldEmb(K, L): FldNumEmb, FldNumEmb → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-issubfieldemb-fldnumemb-fldnumemb)
  - [Embedding and Reconstruction](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#embedding-and-reconstruction)
    - [`ComplexImage(x): FldNumElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-compleximage-fldnumelt)
    - [`Embedding(K): FldNumEmb → UserProgram`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-embedding-fldnumemb)
    - [`Reconstruction(L, x): FldNumEmb, FldComElt → BoolElt, FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-reconstruction-fldnumemb-fldcomelt)
    - [`Reconstruction(L, x): FldNumEmb, FldReElt → BoolElt, FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#function-reconstruction-fldnumemb-fldreelt)
    - [Example: Creating an Embedded Number Field](https://docs.magma-maths.org/GlobalFields/NumberFields/embedded-number-fields.md#example-ex-83530f)
- [Element Operations](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#parent-and-category)
    - [`Parent(a): FldNumElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-parent-fldnumelt)
    - [`Category(a): FldNumElt → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-category-fldnumelt)
    - [`Type(a): FldNumElt → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-type-fldnumelt)
    - [`ExtendedType(a): FldNumElt → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-extendedtype-fldnumelt)
  - [Arithmetic](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#arithmetic)
    - [`+ a: FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-operation-fldnumelt-fldnumelt)
    - [`- a: FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-operation-fldnumelt-fldnumelt-2)
    - [`a + b: FldNumElt, FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-plus-fldnumelt-fldnumelt)
    - [`a - b: FldNumElt, FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-minus-fldnumelt-fldnumelt)
    - [`a * b: FldNumElt, FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-times-fldnumelt-fldnumelt)
    - [`a / b: FldNumElt, FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-div-fldnumelt-fldnumelt)
    - [`a ^ k: FldNumElt, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-pow-fldnumelt-rngintelt)
    - [`Sqrt(a): FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-sqrt-fldnumelt)
    - [`SquareRoot(a): FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-squareroot-fldnumelt)
    - [`Root(a, n): FldNumElt, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-root-fldnumelt-rngintelt)
    - [`IsPower(a, k): FldNumElt, RngIntElt → BoolElt, FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-ispower-fldnumelt-rngintelt)
    - [`IsSquare(a): FldNumElt → BoolElt, FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-issquare-fldnumelt)
    - [`Denominator(a): FldNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-denominator-fldnumelt)
    - [`Numerator(a): FldNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-numerator-fldnumelt)
    - [`Qround(E, M): FldNumElt, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-qround-fldnumelt-rngintelt)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#equality-and-membership)
    - [`a eq b: FldNumElt, FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-eq-fldnumelt-fldnumelt)
    - [`a ne b: FldNumElt, FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-ne-fldnumelt-fldnumelt)
    - [`a in F: FldNumElt, FldNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-op-in-fldnumelt-fldnum)
  - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#predicates-on-elements)
    - [`IsIntegral(a): FldNumElt → BoolElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isintegral-fldnumelt)
    - [`IsPrimitive(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isprimitive-fldnumelt)
    - [`IsTotallyPositive(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-istotallypositive-fldnumelt)
    - [`IsZero(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-iszero-fldnumelt)
    - [`IsOne(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isone-fldnumelt)
    - [`IsMinusOne(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isminusone-fldnumelt)
    - [`IsUnit(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isunit-fldnumelt)
    - [`IsNilpotent(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isnilpotent-fldnumelt)
    - [`IsIdempotent(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isidempotent-fldnumelt)
    - [`IsZeroDivisor(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-iszerodivisor-fldnumelt)
    - [`IsRegular(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isregular-fldnumelt)
    - [`IsIrreducible(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isirreducible-fldnumelt)
    - [`IsPrime(a): FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-isprime-fldnumelt)
  - [Field Generators](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#field-generators)
    - [`K . 1: FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#operation-operation-fldnum-fldnumelt)
    - [`PrimitiveElement(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-primitiveelement-fldnum)
    - [`Generators(K): FldNum → {FldNumElt}`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generators-fldnum)
    - [`GeneratorsOverBaseRing(K): FldNum → {FldNumElt}`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generatorsoverbasering-fldnum)
    - [`GeneratorsSequence(K): FldNum → [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generatorssequence-fldnum)
    - [`GeneratorsSequenceOverBaseRing(K): FldNum → [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generatorssequenceoverbasering-fldnum)
    - [`Generators(K, k): FldAlg, FldAlg → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generators-fldalg-fldalg)
    - [`Generators(K, Q): FldAlg, FldRat → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-generators-fldalg-fldrat)
  - [Real and Complex Embeddings](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#real-and-complex-embeddings)
  - [Heights](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#heights)
  - [Norm, Trace, and Minimal Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#norm-trace-and-minimal-polynomial)
    - [`Norm(a): FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-norm)
    - [`Norm(a, R): FldNumElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-norm-fldnumelt-rng)
    - [`AbsoluteNorm(a): FldNumElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-absolutenorm-fldnumelt)
    - [`NormAbs(a): FldNumElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-normabs-fldnumelt)
    - [`Trace(a): FldNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-trace)
    - [`Trace(a): FldNumElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-trace-fldnumelt)
    - [`Trace(a, R): FldNumElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-trace-fldnumelt-rng)
    - [`AbsoluteTrace(a): FldNumElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-absolutetrace-fldnumelt)
    - [`TraceAbs(a): FldNumElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-traceabs-fldnumelt)
    - [`CharacteristicPolynomial(a): FldNumElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-characteristicpolynomial-fldnumelt)
    - [`CharacteristicPolynomial(a, R): FldNumElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-characteristicpolynomial-fldnumelt-rng)
    - [`AbsoluteCharacteristicPolynomial(a): FldNumElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-absolutecharacteristicpolynomial-fldnumelt)
    - [`MinimalPolynomial(a): FldNumElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-minimalpolynomial-fldnumelt)
    - [`MinimalPolynomial(a, R): FldNumElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-minimalpolynomial-fldnumelt-rng)
    - [`AbsoluteMinimalPolynomial(a): FldNumElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-absoluteminimalpolynomial-fldnumelt)
    - [`RepresentationMatrix(a): FldNumElt → NumMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-representationmatrix-fldnumelt)
    - [`RepresentationMatrix(a, R): FldNumElt, Rng → NumMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-representationmatrix-fldnumelt-rng)
    - [`AbsoluteRepresentationMatrix(a): FldNumElt → NumMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-absoluterepresentationmatrix-fldnumelt)
    - [Example: Norm, Trace, and Minimal Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#example-ex-441d85)
  - [Other Functions](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#other-functions)
    - [`ElementToSequence(a): FldNumElt → [ FldNumElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-elementtosequence-fldnumelt)
    - [`Eltseq(a): FldNumElt → [ FldNumElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-eltseq)
    - [`Eltseq(E, k): FldNumElt, FldNum → [RngElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-eltseq-fldnumelt-fldnum)
    - [`Eltseq(E, k): FldNumElt, Rng → [RngElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-eltseq-fldnumelt-rng)
    - [`Flat(e): FldNumElt → [ FldRatElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-flat-fldnumelt)
    - [`a[i]: FldNumElt, RngIntElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#literal-literal-a-i-fldnumelt-rngintelt-fldratelt)
    - [`a[i]: FldNumElt, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#literal-literal-a-i-fldnumelt-rngintelt-fldnumelt)
    - [`ProductRepresentation(a): FldNumElt → [ FldNumElt ], [ RngIntElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-productrepresentation-fldnumelt)
    - [`ProductRepresentation(P, E): [ FldNumElt ], [ RngIntElt ] → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-productrepresentation-fldnumelt-rngintelt)
    - [`PowerProduct(P, E): [FldNumElt], [RngIntElt] → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-powerproduct-fldnumelt-rngintelt)
- [Class Group and Unit Group](https://docs.magma-maths.org/GlobalFields/NumberFields/class-unit-group.md)
  - [Example: Class Group and Unit Group](https://docs.magma-maths.org/GlobalFields/NumberFields/class-unit-group.md#example-ex-c8082f)
- [Galois Theory](https://docs.magma-maths.org/GlobalFields/NumberFields/galois-theory.md)
  - [`GaloisGroup(K): FldNum → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/NumberFields/galois-theory.md#function-fldnum-galoisgroup)
  - [`Subfields(K): FldNum → [<FldNum, Map>]`](https://docs.magma-maths.org/GlobalFields/NumberFields/galois-theory.md#function-fldnum-subfields)
  - [`AutomorphismGroup(K): FldNum → GrpPerm, [Map], Map`](https://docs.magma-maths.org/GlobalFields/NumberFields/galois-theory.md#function-fldnum-automorphismgroup)
- [Solving Norm Equations](https://docs.magma-maths.org/GlobalFields/NumberFields/norm-equation.md)
  - [Example: Solving a Relative Norm Equation](https://docs.magma-maths.org/GlobalFields/NumberFields/norm-equation.md#example-ex-2b3577)
- [Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#creation-of-structures)
    - [`Places(K): FldNum → PlcNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-places-fldnum)
    - [`DivisorGroup(K): FldNum → DivNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-divisorgroup-fldnum)
  - [Operations on Structures](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operations-on-structures)
    - [`d1 eq d2: DivNum, DivNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-eq-divnum-divnum)
    - [`p1 eq p2: PlcNum, PlcNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-eq-plcnum-plcnum)
    - [`NumberField(P): PlcNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-numberfield-plcnum)
    - [`NumberField(D): DivNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-numberfield-divnum)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#creation-of-elements)
    - [`Place(I): RngOrdIdl → PlcNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-place-rngordidl)
    - [`Decomposition(K, p): FldNum, RngIntElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decomposition-fldnum-rngintelt)
    - [`Decomposition(K, I): FldNum, Infty → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decomposition-fldnum-infty)
    - [`Decomposition(K, p): FldNum, PlcNumElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decomposition-fldnum-plcnumelt)
    - [`Decomposition(m, p): Map[FldRat, FldNum], RngIntElt → SeqEnum[<PlcNumElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decomposition-map-fldrat-fldnum-rngintelt)
    - [`Decomposition(m, p): Map[FldNum, FldNum], PlcNumElt → SeqEnum[<PlcNumElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decomposition-map-fldnum-fldnum-plcnumelt)
    - [`InfinitePlaces(K): FldNum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-infiniteplaces-fldnum)
    - [`InfinitePlaces(K): FldRat → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-infiniteplaces-fldrat)
    - [`InfinitePlaces(K): RngInt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-infiniteplaces-rngint)
    - [`Divisor(pl): PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-divisor-plcnumelt)
    - [`Divisor(I): RngOrdFracIdl → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-divisor-rngordfracidl)
    - [`Divisor(x): FldNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-divisor-fldnumelt)
    - [`RealPlaces(K): FldRat → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-realplaces-fldrat)
    - [`RealPlaces(K): FldNum → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-realplaces-fldnum)
  - [Arithmetic with Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#arithmetic-with-places-and-divisors)
    - [`d1 + d2: DivNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-plus-divnumelt-divnumelt)
    - [`p + d: PlcNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-plus-plcnumelt-divnumelt)
    - [`d + p: DivNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-plus-divnumelt-plcnumelt)
    - [`p1 + p2: PlcNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-plus-plcnumelt-plcnumelt)
    - [`- p: PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-operation-plcnumelt-divnumelt)
    - [`- d: DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-operation-divnumelt-divnumelt)
    - [`d - p: DivNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-minus-divnumelt-plcnumelt)
    - [`p - d: PlcNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-minus-plcnumelt-divnumelt)
    - [`d1 - d2: DivNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-minus-divnumelt-divnumelt)
    - [`p1 - p2: PlcNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-minus-plcnumelt-plcnumelt)
    - [`p * k: PlcNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-times-plcnumelt-rngintelt)
    - [`d * k: DivNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-op-times-divnumelt-rngintelt)
    - [`p div k: PlcNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-operation-div-plcnumelt-rngintelt-divnumelt)
    - [`d div k: DivNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#operation-operation-div-divnumelt-rngintelt-divnumelt)
  - [Other Functions for Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#other-functions-for-places-and-divisors)
    - [`Valuation(a, p): FldNumElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-valuation-fldnumelt-plcnumelt)
    - [`Valuation(a, p): RngElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-valuation-rngelt-plcnumelt)
    - [`Valuation(I, p): RngOrdFracIdl, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-valuation-rngordfracidl-plcnumelt)
    - [`Support(D): DivNumElt → SeqEnum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-support-divnumelt)
    - [`Ideal(D): DivNumElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-ideal-divnumelt)
    - [`Ideal(D): PlcNumElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-ideal-plcnumelt)
    - [`Evaluate(x, p): FldNumElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-evaluate-fldnumelt-plcnumelt)
    - [`Evaluate(x, p): FldRatElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-evaluate-fldratelt-plcnumelt)
    - [`Evaluate(x, p): RngIntElt, Infty → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-evaluate-rngintelt-infty)
    - [`RealEmbeddings(a): FldNumElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-realembeddings-fldnumelt)
    - [`RealSigns(a): FldNumElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-realsigns-fldnumelt)
    - [`IsReal(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-isreal-plcnumelt)
    - [`IsComplex(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-iscomplex-plcnumelt)
    - [`IsFinite(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-isfinite-plcnumelt)
    - [`IsInfinite(p): PlcNumElt → BoolElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-isinfinite-plcnumelt)
    - [`Extends(P, p): PlcNumElt, PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-extends-plcnumelt-plcnumelt)
    - [`InertiaDegree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-inertiadegree-plcnumelt)
    - [`Degree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-degree-plcnumelt)
    - [`Degree(D): DivNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-degree-divnumelt)
    - [`NumberField(P): PlcNumElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-numberfield-plcnumelt)
    - [`NumberField(D): DivNumElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-numberfield-divnumelt)
    - [`ResidueClassField(P): PlcNumElt → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-residueclassfield-plcnumelt)
    - [`UniformizingElement(P): PlcNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-uniformizingelement-plcnumelt)
    - [`LocalDegree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-localdegree-plcnumelt)
    - [`RamificationIndex(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-ramificationindex-plcnumelt)
    - [`DecompositionGroup(P): PlcNumElt → GrpPerm`](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#function-decompositiongroup-plcnumelt)
- [Number Field Database](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md)
  - [Creation](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#creation)
    - [`NumberFieldDatabase(d): RngIntElt → DB`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-numberfielddatabase-rngintelt)
    - [`sub< D | dmin, dmax : parameters>: DB, RngIntElt, RngIntElt → DB`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#constructor-anfdb-sub)
    - [`sub< D | dabs : parameters>: DB, RngIntElt → DB`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#constructor-constructor-sub-db-rngintelt-db)
    - [`sub< D | : parameters>: DB → DB`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#constructor-constructor-sub-db-db)
  - [Access](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#access)
    - [`Degree(D): DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-degree-db)
    - [`DiscriminantRange(D): DB → RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-discriminantrange-db)
    - [`# D: DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#operation-operation-db-rngintelt)
    - [`NumberOfFields(D): DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-numberoffields-db)
    - [`NumberOfFields(D, d): DB, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-numberoffields-db-rngintelt)
    - [`NumberFields(D): DB → [ FldNum ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-numberfields-db)
    - [`NumberFields(D, d): DB, RngIntElt → [ FldNum ]`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#function-numberfields-db-rngintelt)
    - [Example: Basic Access to the Number Field Database](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#example-ex-461fd7)
    - [Example: Quintic Fields with a Given Signature](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#example-ex-07449b)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/NumberFields/bibliography.md)

### Introduction

This chapter gives an overview of number fields in Magma. Full documentation is spread across the following chapters:

Cyclotomic fields, Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)

Quadratic fields, Chapter [Quadratic Fields](https://docs.magma-maths.org/GlobalFields/QuadraticFields/index-quadratic-fields.md#chapfldquad)

Orders in number fields, including ideal theory, Chapter [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md#rngord-main)

Galois Theory, Chapter [Galois Groups and Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/index-galois-groups-and-automorphisms.md#rngordgal-main)

Class Field Theory, Chapter [Class Field Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/index-class-field-theory.md#fldab-main)

The algorithms, functions and syntax for number fields and orders are often parallel to those for extensions of function fields of one variable.

Number fields in Magma are finite extensions of the rational field ${\mathbb{Q}}$, or another number field. Extensions directly over ${\mathbb{Q}}$ are referred to as *absolute fields*, extensions of number fields are called *relative fields*.

The `RationalField()` is *not* a number field in Magma. A trivial extension is created by `RationalsAsNumberField()`.

A number field is constructed as $K = k[t]/(f(t))$ where $f$ is an irreducible polynomial in $k[t]$. The generator `K.1` is a root of $f$. A field may also be constructed as a multivariate quotient $K = k[s_1,\ldots,s_n]/(f_1(s_1), \ldots, f_n(s_n))$ for univariate $f_i$ in $k[t]$. The generators `K.i` are roots of $f_i$. This construction is a shortcut for creating a tower of single extensions.

Number fields in Magma are abstract: they do not come with a distinguished embedding into an algebraically closed field. Embeddings between fields can be defined by the user, and may also be chosen (once and for all) by functions such as `IsIsomorphic` and `IsSubfield`. Crucially, it is possible to create multiple copies of the field defined by a given polynomial. Therefore every extension defined by the user creates a *new* object in Magma (unless the user requests otherwise).

The embeddings of a field into the real and complex numbers are given by the `Conjugates` of an element, or by `InfinitePlaces` of a field (and `Evaluate` to evaluate the embedding corresponding to a place). See [Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#fldnum-plcnum).

The basis of `K<w>` $= k[t]/(f(t))$ over its base field $k$ is always the power basis $1, w, w^2, \dots, w^{n-1}$ (where the generator `w = K.1` is a root of $f$). The basis of an order in an absolute field is usually in hermite form with respect to the field basis, however there are exceptions such as the `LLL` of an order. The field of fractions of an order always has the same basis as the order.

An arbitrary number field can be converted to an absolute extension of ${\mathbb{Q}}$ using `AbsoluteField`, i.e. this finds a primitive element over ${\mathbb{Q}}$. Similarly, a number field defined by multiple polynomials can be converted to a field defined by a single polynomial using [`SimpleExtension`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-simpleextension).

Notes about relative fields:

- Invariants such as [`Degree`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-degree), [`Discriminant`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-discriminant), [`Norm`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-norm), [`Trace`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-trace) are always relative to the base field. They have variants of the form `Degree(K, k)` and `AbsoluteDegree`.
- Some operations and invariants are implemented only for absolute fields, for instance `ClassGroup`, `UnitGroup`, and so on.
- Conversions (eg between relative/absolute fields) may be time consuming. However the results are stored, so are only computed once. Applying the resulting maps to elements should be fast.

*Warnings:*

- `Discriminant(F)` for a field $F$ returns `Discriminant(DefiningPolynomial(F))`, *not* `Discriminant(MaximalOrder(F))`.
- Some functions defined for fields are shortcuts, referring to the maximal order. For example, `UnitGroup(F)` returns the (finitely generated) unit group of `MaximalOrder(F)`, *not* the multiplicative group of $F$.

### Acknowledgement

The number field module in Magma has mostly developed out of the Kant/Kash system (Kant-V4) [[KAN97](https://docs.magma-maths.org/references.md#cite-kash)], [[KAN00](https://docs.magma-maths.org/references.md#cite-kant)], developed by the group of M. Pohst at TU Berlin.

<a id="creation"></a>
<a id="fldnum-create"></a>
### Creation Functions

The following describes how number fields may be created. It also shows some ways of creating elements of these rings and homomorphisms from these rings into an arbitrary ring.

<a id="magma"></a>
<a id="fldnum-creation"></a>
#### Creation of Number Fields

Algebraic Number Fields can be created in a various ways, most of which involve polynomials. The fields can be created as absolute extensions, i.e. an extension of **Q** by one or more irreducible polynomial(s), or as a relative extension which is an extension of an algebraic field by one or more polynomial(s) irreducible over that field.

<a id="function-fldnum-numberfield"></a>
##### `NumberField(f): RngUPolElt -> FldNum`

```magma
Check            : BoolElt                    Default: true
DoLinearExtension: BoolElt                    Default: false
Global           : BoolElt                    Default: false
```

Given an irreducible polynomial $f$ of degree $n\geq 1$ over $K = {\mathbb{Q}}$ or some number field $K$, create the number field $L=K(\alpha)$ obtained by adjoining a root $\alpha$ of $f$ to $K$.

The polynomial $f$ is allowed to have either integer coefficients, coefficients in an order of $K$, coefficients from the rational field, or some algebraic field $K$. The field $K$ will be referred to as [`CoefficientField`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-coefficientfield). If the polynomial is defined over a field and the coefficients have denominators greater than $1$, an equivalent polynomial $df(x)$ is used to define $L$, where $d$ is the least common multiple of the denominators of the coefficients of $f$.

If the optional parameter `Check` is set to `false` then the polynomial is not checked for irreducibility. This is useful when building relative extensions where factoring can be time consuming.

If `DoLinearExtension` is `true` and the degree of $f$ is $1$ a trivial extension is returned. This is an object of type `FldNum` but of degree $1$. Otherwise (or by default), the coefficient field of $f$ is returned. (This is important in situations where the number of extensions matters.) Furthermore, a degree $1$ extension of ${\mathbb{Q}}$ is a field isomorphic to ${\mathbb{Q}}$, but regarded by Magma as a number field (while ${\mathbb{Q}}$ itself is not, since `FldRat` is not a subtype of `FldNum`). This then supports all of the number field functions (including for instance fractional ideals) while the `Rationals()` do not. On the other hand, arithmetic will be slower.

If `Global` is `true`, then Magma checks if this polynomial is the defining polynomial of some other field created using `Global := true`. In this case, the old field will be returned.

The angle bracket notation may be used to assign the root $\alpha$ to an identifier e.g. `L<y> := NumberField(f)` where $y$ will be a root of $f$.

<a id="function-rationalsasnumberfield"></a>
##### `RationalsAsNumberField() -> FldNum`

<a id="function-qnf"></a>
##### `QNF() -> FldNum`

This creates a number field isomorphic to ${\mathbb{Q}}$. It is equivalent to `NumberField(x-1 : DoLinearExtension)`, where $x$ is `PolynomialRing(Rationals()).1`.

The result is a field isomorphic to ${\mathbb{Q}}$, but regarded by Magma as a number field (while ${\mathbb{Q}}$ itself is not, since `FldRat` is not a subtype of `FldNum`). It therefore supports all of the number field functions, while the `Rationals()` do not. On the other hand, arithmetic will be slower.

Coercion can be used to convert to and from the `Rationals()`.

<a id="function-fldnum-numberfield-seq"></a>
##### `NumberField(s): [ RngUPolElt ] -> FldNum`

```magma
Check            : BoolElt                    Default: true
DoLinearExtension: BoolElt                    Default: false
Abs              : BoolElt                    Default: false
```

Let $K$ be a possibly trivial algebraic extension of $\Q$, $K$ will be referred to as the [`CoefficientField`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-coefficientfield).

Given a sequence $s$ of nonconstant polynomials $s_1, \ldots, s_m$, that are irreducible over $K$, create the number field $L=K(\alpha_1, \ldots, \alpha_m)$ obtained by adjoining a root $\alpha_i$ of each $s_i$ to $K$. The polynomials $s_i$ are allowed to have coefficients in an order of $K$ (or ${\mathbb{Z}}$) or in $K$ or a suitable field of fractions, but if in the latter cases denominators occur in the coefficients of $s_i$, an integral polynomial is used instead of $s_i$, as in the case of the definition of a number field by a single polynomial.

If $m>1$ and `Abs` is `false`, a tower of extension fields

$$
L_0=K\subset L_1=K(\alpha_m) \subset L_{2}=K(\alpha_{m-1}, \alpha_{m})\subset \cdots \subset L_m = K(\alpha_1, \ldots, \alpha_m)=L
$$

is created, and $L$ is a relative extension by $s_1$ over its ground field $L_{m-1}=K(\alpha_2, \ldots, \alpha_m)$. Thus, this construction has the same effect as $m$ applications of the [`ext< F | s1, ..., sn >`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-fldnum-ext) constructor. The angle bracket notation may be used to assign the $m$ generators $\alpha_i$ to identifiers: `L<a_1, ..., a_m> := NumberField([ s_1, ..., s_m ])`; thus the first generator $a_1$, which corresponds to `L.1`, generates $L$ over its ground field.

Note that it is important to ensure that in each of the above steps the polynomial $s_i$ is irreducible over $L_{i-1}$; by default Magma will check that this is the case. If the optional parameter `Check` is set to `false` then this checking will not be done.

If the optional parameter `Abs` is changed to `true`, then a non-simple extension will be returned. This is a extension of the coefficient field of the $f_i$ but such that the base field of $L$ will be $K$. The $i$th generator will be a root of the $i$th polynomial in this case, but all of the generators will have $L$ as parent. In this case, a sparse representation of number field elements will be used (based on multivariate polynomial rings). As a consequence, costs for arithmetic operations will (mainly) depend on the number of non-zero coefficients of the elements involved rather than the field degree. This allows to define and work in fields of degree $<10^6$. However, for general elements this representation is slower than the dense (default) representation.

If the optional parameter `DoLinearExtension` is set to `true`, linear polynomials will not be removed from the list.

<a id="constructor-fldnum-ext"></a>
##### `ext< F | s1, ..., sn >: FldNum, RngUPolElt, ..., RngUPolElt -> FldNum`

<a id="constructor-constructor-ext-fldnum-rngupolelt-fldnum"></a>
##### `ext<F | s>: FldNum, [RngUPolElt] -> FldNum`

<a id="constructor-constructor-ext-fldrat-rngupolelt-rngupolelt-fldnum"></a>
##### `ext< Q | s1, ..., sn >: FldRat, RngUPolElt, ..., RngUPolElt -> FldNum`

<a id="constructor-constructor-ext-fldrat-rngupolelt-fldnum"></a>
##### `ext< Q | s >: FldRat, [RngUPolElt] -> FldNum`

```magma
Check            : BoolElt                    Default: true
Global           : BoolElt                    Default: false
Abs              : BoolElt                    Default: false
DoLinearExtension: BoolElt                    Default: false
```

Construct the number field defined by extending the number field $F$ by the polynomials $s_i$ or the polynomials in the sequence $s$. Similar as for [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield)`(S)` described above, $F$ may be ${\mathbb{Q}}$. A tower of fields similar to that of [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield-seq) is created and the same restrictions as for that function apply to the polynomials that can be used in the constructor.

<a id="example-ex-30ee5b"></a>
##### `Example: Creating a Number Field (ex-30ee5b)`

To create the number field ${\mathbb{Q}}(\alpha)$, where $\alpha$ is a zero of the integer polynomial $x^4 - 420x^2 + 40000$, one may proceed as follows:

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> Degree(K);
> K;
Number Field with defining polynomial x^4 - 420*x^2 + 40000 over the Rational
Field
> y^4 - 420*y^2;
-40000
```

By assigning the generating element to $y$, we can from here on specify elements in the field as polynomials in $y$. The elements will always be printed as polynomials in ${\mathbb{Q}}[y]/f$:

```magma
> z := y^5/11;
> z;
1/11*(420*y^3 - 40000*y)
```

$K$ can be further extended by the use of either [`ext< F | s1, ..., sn >`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#constructor-fldnum-ext) or [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield).

```magma
> R<y> := PolynomialRing(K);
> f := y^2 + y + 1;
> L := ext<K | f>;
> L;
Number Field with defining polynomial y^2 + y + 1 over K
```

This is equivalent to

```magma
> KL := NumberField([x^2 + x + 1, x^4 - 420*x^2 + 40000]);
> KL;
Number Field with defining polynomial $.1^2 + $.1 + 1 over its ground field
```

but different to

```magma
> LK := NumberField([x^4 - 420*x^2 + 40000, x^2 + x + 1]);
> LK;
Number Field with defining polynomial $.1^4 - 420*$.1^2 + 40000 over its ground
field
```

To illustrate the use of `Global`:

```magma
> K1 := NumberField(x^3-2 : Global);
> K2 := NumberField(x^3-2 : Global);
> L1 := NumberField(x^3-2);
> L2 := NumberField(x^3-2);
> K1 eq K2;
true
> K1 eq L1;
false
> L1 eq L2;
false;
> K1!K2.1;
K1.1;
> K2!K1.1;
K1.1
>> L1!L2.1;
     ^
Runtime error in '!': Arguments are not compatible
LHS: FldNum
RHS: FldNumElt
```

A typical application of `DoLinearExtension` is as follows. To construct a Kummer extension of degree $p$, one has to start with a field containing the $p$-th roots of unity. In most situation this will be a field extension of degree $p-1$, but what happens if $\zeta_p$ is already in the base field?

```magma
> AdjoinRoot := function(K, p: DoLinearExtension := false)
>   f := CyclotomicPolynomial(p);
>   f := Polynomial(K, f);
>   f := Factorisation(f)[1][1];
>   return ext<K|f : DoLinearExtension := DoLinearExtension>;
> end function;
> K := NumberField(x^2+x+1);
> E1 := AdjoinRoot(K, 3);
> E1;
Number Field with defining polynomial x^2 + x + 1 over the
Rational Field
> E2 := AdjoinRoot(K, 3 : DoLinearExtension);
> E2;
Number Field with defining polynomial ext<K|>.1 - K.1 over
K
> Norm(E1.1);
1
> Norm(E2.1);
K.1
> Norm($1);
1
```

<a id="function-radicalextension-rng-rngintelt-rngelt"></a>
##### `RadicalExtension(F, d, a): Rng, RngIntElt, RngElt -> FldNum`

```magma
Check: BoolElt                    Default: true
```

Let $F$ be a number field. Let $a$ be an integral element of $F$ chosen such that $a$ is not an $n$-th power for any $n$ dividing $d$. Returns the number field obtained by adjoining the $d$-th root of $a$ to $F$.

<a id="function-splittingfield-fldnum"></a>
##### `SplittingField(F): FldNum -> FldNum, SeqEnum`

<a id="function-normalclosure-fldnum"></a>
##### `NormalClosure(F): FldNum -> FldNum, SeqEnum`

```magma
Abs: BoolElt                    Default: true
Opt: BoolElt                    Default: true
```

Given a number field $F$, this computes the splitting field of its defining polynomial. The roots of the defining polynomial in the splitting field are also returned.

If `Abs` is `true`, the resulting field will be an absolute extension, otherwise a tower is returned.

If `Opt` is `true`, an attempt of using [`OptimizedRepresentation`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-optimizedrepresentation) is done. If successful, the resulting field will have a much nicer representation. On the other hand, computing the intermediate maximal orders can be extremely time consuming.

<a id="function-splittingfield-rngupolelt"></a>
##### `SplittingField(f): RngUPolElt -> FldNum`

Given an irreducible polynomial $f$ over ${\mathbb{Z}}$, return its splitting field.

<a id="function-splittingfield-rngupolelt-2"></a>
##### `SplittingField(L): [RngUPolElt] -> FldNum, [FldNumElt]`

```magma
Abs: BoolElt                    Default: false
Opt: BoolElt                    Default: false
```

Given a sequence $L$ of polynomials over a number field or the rational numbers, compute a common splitting field, ie. a field $K$ such that every polynomial in $L$ splits into linear factors over $K$. The roots of the polynomials are returned as the second return value.

If the optional parameter `Abs` is `true`, then a primitive element for the splitting field is computed and the field returned will be generated by this primitive element over ${\mathbb{Q}}$. If in addition `Opt` is also `true`, then an optimized representation of $K$ is computed as well.

<a id="constructor-constructor-sub-fldalg-fldalgelt-fldalgelt-fldalg-map"></a>
##### `sub< F | e₁, ..., eₙ >: FldAlg, FldAlgElt, ..., FldAlgElt -> FldAlg, Map`

<a id="constructor-constructor-sub-fldalg-seqenum-fldalg-map"></a>
##### `sub< F | S >: FldAlg, SeqEnum -> FldAlg, Map`

Given a number field $F$ with coefficient field $G$ and $n$ elements $e_i\in F$, return the number field $H=G(e_1, \ldots, e_n)$ generated by the $e_i$ (over $G$), as well as the embedding homomorphism from $H$ to $F$.

<a id="function-mergefields-fldnum-fldnum"></a>
##### `MergeFields(F, L): FldNum, FldNum -> SeqEnum`

<a id="function-fldnum-compositefields"></a>
##### `CompositeFields(F, L): FldNum, FldNum -> SeqEnum`

Let $F$ and $L$ be absolute number fields. Returns a sequence of fields $[M_1, \ldots, M_r]$ such that each field $M_i$ contains both a root of the generating polynomial of $F$ and a root of the generating polynomial of $L$.

In detail: Suppose that $F$ is the smaller field (wrt. the degree). As a first step we factorise the defining polynomial of $L$ over $F$. For each factor obtained, an extension of $F$ is constructed and then transformed into an absolute extension. The sequence of extension fields is returned to the user.

<a id="function-compositum-fldnum-fldnum"></a>
##### `Compositum(K, L): FldNum, FldNum -> FldNum`

For absolute number fields $K$ and $L$, at least one of which must be normal, find a smallest common over field. Note that in contrast to [`CompositeFields`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-compositefields) above the result here is essentially unique since one field was normal.

<a id="constructor-constructor-quo-rngupol-rngupolelt-fldnum"></a>
##### `quo< FldNum : R | f >: RngUPol, RngUPolElt -> FldNum`

```magma
Check: BoolElt                    Default: true
```

Given a ring of polynomials $R$ in one variable over a number field $K$, create the number field $K(\alpha)$ obtained by adjoining a root $\alpha$ of $f$ to $K$. Here the coefficient ring $K$ of $R$ is allowed to be the rational field ${\mathbb{Q}}$. The polynomial $f$ is allowed to have coefficients in $K$, but if coefficients occur in $f$ which require denominator greater than $1$ when expressed on the basis of $K$, the polynomial will be replaced by an equivalent one requiring no such denominators: $\tilde f(x)=df(x)$, where $d$ is a common denominator. The parameter `Check` determines whether the polynomial is checked for irreducibility. The angle bracket notation may be used to assign the root $\alpha$ to an identifier: ```K<y> := quo< FldNum ``:`` R | f >```. If the category `FldNum` is not specified, `quo< R | f >` creates the quotient ring $R/f$ as a generic ring (not as a number field), in which only elementary arithmetic is possible.

<a id="example-ex-180416"></a>
##### `Example: Normal Closure via Composite Fields (ex-180416)`

To illustrate the use of `CompositeFields` we will use this function to compute the normal closure of ${\mathbb{Q}}(\alpha)$ where $\alpha$ is a zero of the integer polynomial $x^3 - 2$:

```magma
> K := RadicalExtension(Rationals(), 3, 2);
> l := CompositeFields(K, K);
> l;
[
    Number Field with defining polynomial $.1^3 - 2 over the Rational
    Field,
    Number Field with defining polynomial $.1^6 + 108 over the Rational
    Field
]
```

The second element of $l$ corresponds to the smallest field $L_2$ containing two distinct roots of $x^3-2$. Since the degree of $K$ is $3$, $L_2$ is the splitting field of $f$ and therefore the normal closure of $K$.

<a id="function-fldnum-optimizedrepresentation"></a>
##### `OptimizedRepresentation(F): FldNum -> FldNum, Map`

<a id="function-optimisedrepresentation-fldnum"></a>
##### `OptimisedRepresentation(F): FldNum -> FldNum, Map`

Given a number field $F$ with ground field ${\mathbb{Q}}$, this function will attempt to find an isomorphic field $L$ with a better defining polynomial than the one used to define $F$. If such a polynomial is found then $L$ is returned along with a map from $F$ into $L$; otherwise $F$ will be returned. For more details, please refer to [`OptimizedRepresentation`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-optimizedrepresentation) in Chapter [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md#rngord-main).

<a id="example-ex-91bae8"></a>
##### `Example: Optimized Representation of a Field (ex-91bae8)`

Some results of `OptimizedRepresentation` are shown.

```magma
> R<x> := PolynomialRing(Rationals());
> K := NumberField(x^4-420*x^2+40000);
> L := OptimizedRepresentation(K);
> L ne K;
true
> L;
Number Field with defining polynomial x^4 - 4*x^3 -
    17*x^2 + 42*x + 59 over the Rational Field
> L eq OptimizedRepresentation(L);
```

<a id="function-fldnum-integralmodel"></a>
##### `IntegralModel(F): FldNum -> FldNum, Map`

Given a number field $F$ with ground field ${\mathbb{Q}}$, return an isomorphic field $L$ whose defining polynomial is monic with integer coefficients, together with an isomorphism from $F$ to $L$. The transformation uses a substitution $y = dx$ for a positive integer $d$ chosen so that the roots become algebraic integers. If the defining polynomial is already integral, returns $F$ and the identity map.

<a id="example-ex-67a832"></a>
##### `Example: Integral Model of a Number Field (ex-67a832)`

```magma
> R<x> := PolynomialRing(Rationals());
> K := NumberField(x^3 - 2*x + 1/2);
> L, m := IntegralModel(K);
> L;
Number Field with defining polynomial x^3 - 8*x + 4 over the Rational Field
> m(K.1);
1/2*L.1
> Inverse(m)(L.1);
2*K.1
```

<a id="fldnum-max-ord"></a>
<a id="id1"></a>
#### Maximal Orders

The maximal order ${\cal O}_K$ is the ring of integers of an algebraic field consisting of all integral elements of the field; that is, elements which are roots of monic integer polynomials. It may also be called the number ring of a number field. It is arguably the single most important invariant of a number field, in fact in number theory when one talks about units, ideals, etc. of number fields, it is typically implied that the maximal order is the underlying ring.

Maximal orders and orders in general are explained in detail in Chapter [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md#rngord-main), here we only give a very brief overview.

There are a number of algorithms which Magma uses whilst computing maximal orders. The main ones are the Round–$2$ and the Round–$4$ methods ([[Bai96](https://docs.magma-maths.org/references.md#cite-bai1), [Coh93](https://docs.magma-maths.org/references.md#cite-cohen1), [Poh93](https://docs.magma-maths.org/references.md#cite-pohst2), [PZ89](https://docs.magma-maths.org/references.md#cite-pohst1)] for absolute extensions and [[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), [Fri97](https://docs.magma-maths.org/references.md#cite-fr1), [Pau01b](https://docs.magma-maths.org/references.md#cite-pauli-r4)] for relative extensions).

<a id="function-fldnum-maximalorder"></a>
##### `MaximalOrder(F): FldNum -> RngOrd`

<a id="function-integerring-fldnum"></a>
##### `IntegerRing(F): FldNum -> RngOrd`

<a id="function-integers-fldnum"></a>
##### `Integers(F): FldNum -> RngOrd`

<a id="function-ringofintegers-fldnum"></a>
##### `RingOfIntegers(F): FldNum -> RngOrd`

```magma
Al          : MonStgElt                    Default: "Auto"
MaximalOrder: Verbose                      Default: 5
```

Create the ring of integers of the algebraic number field $F$. An integral basis for $F$ can be found as the basis of the maximal order.

For information on the parameters, see Section [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#rngord-max-ord).

<a id="element"></a>
<a id="fldnum-main-elt-create"></a>
#### Creation of Elements

Since number fields are though of as quotients of (multivariate) polynomial rings, elements in those fields are represented as (multivariate) polynomials in the generator(s) of the field.

<a id="operation-op-fldnum-rngelt"></a>
##### `F ! a: FldNum, RngElt -> FldNumElt`

<a id="constructor-constructor-elt-fldnum-rngelt-fldnumelt"></a>
##### `elt< F | a >: FldNum, RngElt -> FldNumElt`

Coerce $a$ into the number field $F$. Here $a$ may be an integer or a rational field element, or an element from a subfield of $F$, or from an order in such or any other field related to $F$ through chains of subfields, optimised representation, absolute fields, etc.

<a id="operation-op-fldnum-rngelt-2"></a>
##### `F ! [a₀, a₁, ..., aₘ₋₁]: FldNum, [RngElt] -> FldNumElt`

<a id="constructor-constructor-elt-fldnum-seqenum-rngelt-fldnumelt"></a>
##### `elt< F | [ a₀, a₁, ..., aₘ₋₁ ] >: FldNum, SeqEnum[RngElt] -> FldNumElt`

<a id="constructor-constructor-elt-fldnum-rngelt-rngelt-fldnumelt"></a>
##### `elt< F | a₀, a₁, ..., aₘ₋₁>: FldNum, RngElt, ..., RngElt -> FldNumElt`

Given the number field, $F$ of degree $m$ over its ground field $G$ and a sequence $[a_0, \ldots, a_{m-1}]$ of elements of $G$, construct the element $a_0\alpha_0 + a_1\alpha_1 + \cdots a_{m-1}\alpha_{m-1}$ of $F$ where the $\alpha_i$ are the basis elements of $F$. In case $F$ was generated by a root of a single polynomial, we will always have $\alpha_i = {\tt F.1}^i$. If $F$ was defined using multiple polynomials and the `Abs` parameter, the basis will consist of products of powers of the generators.

<a id="function-random-fldnum-rngintelt"></a>
##### `Random(F, m): FldNum, RngIntElt -> FldNumElt`

A random element of the number field $F$. The maximal size of the coefficients is determined by the integer $m$.

<a id="example-ex-543b5e"></a>
##### `Example: Creating Number Field Elements (ex-543b5e)`

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> y^6;
136400*y^2 - 16800000
> K![-16800000, 0, 136400, 0];
136400*y^2 - 16800000
> K := NumberField([x^3-2, x^2-5]:Abs);
> Basis(K);
[
    1,
    K.1,
    K.1^2,
    K.2,
    K.1*K.2,
    K.1^2*K.2
]
> K![1,2,3,4,5,6];
6*K.1^2*K.2 + 3*K.1^2 + 5*K.1*K.2 + 2*K.1 + 4*K.2 + 1
```

<a id="function-one-fldnum"></a>
##### `One(K): FldNum -> FldNumElt`

<a id="function-identity-fldnum"></a>
##### `Identity(K): FldNum -> FldNumElt`

<a id="function-zero-fldnum"></a>
##### `Zero(K): FldNum -> FldNumElt`

<a id="function-representative-fldnum"></a>
##### `Representative(K): FldNum -> FldNumElt`

#### Creation of Homomorphisms

To specify homomorphisms from number fields, it is necessary to specify the image of the generating elements, and possible to specify a map on the coefficient field.

<a id="constructor-constructor-hom-fldnum-rng-rngelt-map"></a>
##### `hom< F -> R | r >: FldNum, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-fldnum-rng-map-rngelt-map"></a>
##### `hom< F -> R | h, r >: FldNum, Rng, Map, RngElt -> Map`

<a id="constructor-constructor-hom-fldnum-rng-rngelt-map-2"></a>
##### `hom< F -> R | r >: FldNum, Rng, [RngElt] -> Map`

<a id="constructor-constructor-hom-fldnum-rng-map-rngelt-map-2"></a>
##### `hom< F -> R | h, r >: FldNum, Rng, Map, [RngElt] -> Map`

Given an algebraic number field $F$, defined as an extension of the coefficient field $G$, as well as some ring $R$, build the homomorphism $\phi$ obtained by sending the defining primitive element $\alpha$ of $F$ to the element $r\in R$.

In case the field $F$ was defined using multiple polynomials, instead of an image for the primitive element, one has to give images for each of the generators.

It is possible (if $G={\mathbb{Q}}$) and sometimes necessary (if $G\neq {\mathbb{Q}}$) to specify a homomorphism $\phi$ on $F$ by specifying its action on $G$ by providing a homomorphism $h$ with $G$ as its domain and $R$ its codomain together with the image of $\alpha$. If $R$ does not cover $G$ then the homomorphism $h$ from $G$ into $R$ is necessary to ensure that the ground field can be mapped into $R$.

<a id="example-ex-4d9b55"></a>
##### `Example: Embedding a Quadratic Field in a Quartic Field (ex-4d9b55)`

We show a way to embed the field ${\mathbb{Q}}(\sqrt{2})$ in ${\mathbb{Q}}(\sqrt{2}+\sqrt{3})$. The application of the homomorphism suggests how the image could have been chosen.

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^2-2);
> KL<w> := NumberField(x^4-10*x^2+1);
> H := hom< K -> KL | (9*w-w^3)/2 >;
> H(y);
1/2*(-w^3 + 9*w)
> H(y)^2;
2
```

<a id="operation"></a>
<a id="fldnum-str-op"></a>
### Structure Operations

In the lists below $K$ always denotes a number field.

#### General Functions

Number fields form the Magma category `FldNum`. The notional power structures exist as parents of algebraic fields with no operations are allowed.

<a id="function-category-fldnum"></a>
##### `Category(K): FldNum -> Cat`

<a id="function-type-fldnum"></a>
##### `Type(K): FldNum -> Cat`

<a id="function-extendedtype-fldnum"></a>
##### `ExtendedType(K): FldNum -> Cat`

<a id="function-parent-fldnum"></a>
##### `Parent(K): FldNum -> Pow`

<a id="procedure-assignnames-fldnum-monstgelt-ref"></a>
##### `AssignNames(~K, s): FldNum, [ MonStgElt ]`

Procedure to change the names of the generating elements in the number field $K$ to the contents of the sequence of strings $s$. The $i$-th sequence element will be the name used for the generator of the $(i-1)$-st subfield down from $K$ as determined by the creation of $K$, the first element being used as the name for the generator of $K$. In the case where $K$ is defined by more than one polynomial as an absolute extension, the $i$th sequence element will be the name used for the root of the $i$th polynomial used in the creation of $K$. This procedure only changes the names used in printing the elements of $K$. It does *not* assign to any identifiers the value of a generator in $K$; to do this, use an assignment statement, or use angle brackets when creating the field. Note that since this is a procedure that modifies $K$, it is necessary to have a reference `~K` to $K$ in the call to this function.

<a id="function-name-fldnum-rngintelt"></a>
##### `Name(K, i): FldNum, RngIntElt -> FldNumElt`

<a id="operation-operation-fldnum-rngintelt-fldnumelt"></a>
##### `K . i: FldNum, RngIntElt -> FldNumElt`

Given a number field $K$, return the element which has the $i$-th name attached to it, that is, the generator of the $(i - 1)$-st subfield down from $K$ as determined by the creation of $K$. Here $i$ must be in the range $1\leq i\leq m$, where $m$ is the number of polynomials used in creating $K$. If $K$ was created using multiple polynomials as an absolute extension, `K.i` will be a root of the $i$th polynomial used in creating $K$.

#### Related Structures

Each number field has other structures related to it in various ways.

<a id="function-groundfield-fldnum"></a>
##### `GroundField(F): FldNum -> Fld`

<a id="function-basefield-fldnum"></a>
##### `BaseField(F): FldNum -> Fld`

<a id="function-fldnum-coefficientfield"></a>
##### `CoefficientField(F): FldNum -> Fld`

<a id="function-coefficientring-fldnum"></a>
##### `CoefficientRing(F): FldNum -> Fld`

Given a number field $F$, return the number field over which $F$ was defined. For an absolute number field $F$, the function returns the rational field ${\mathbb{Q}}$.

<a id="function-fldnum-absolutefield"></a>
##### `AbsoluteField(F): FldNum -> FldNum`

Given a number field $F$, this returns an isomorphic number field $L$ defined as an absolute extension (i.e. over ${\mathbb{Q}}$). (For algorithm, see [[Tra76](https://docs.magma-maths.org/references.md#cite-trager-factorization)])

<a id="function-fldnum-simpleextension"></a>
##### `SimpleExtension(F): FldNum -> FldNum`

Given a number field $F$ or an order $O$, this returns an isomorphic field $L$ defined as an absolute simple extension. (For algorithm, see [[Tra76](https://docs.magma-maths.org/references.md#cite-trager-factorization)])

<a id="function-relativefield-fldnum-fldnum"></a>
##### `RelativeField(F, L): FldNum, FldNum -> FldNum`

<a id="function-relativefield-fldrat-fldnum"></a>
##### `RelativeField(Q, L): FldRat, FldNum -> FldNum`

Given number fields $L$ and $F$ such that Magma knows that $F$ is a subfield of $L$, return an isomorphic number field $M$ defined as an extension over $F$.

<a id="function-components-fldnum"></a>
##### `Components(F): FldNum -> [FldNum]`

Given a number field $F$ return the sequence of number fields each defined by a defining polynomial of $F$.

<a id="example-ex-e3e873"></a>
##### `Example: Compositum of Two Number Fields (ex-e3e873)`

It is often desirable to build up a number field by adjoining several algebraic numbers to ${\mathbb{Q}}$. The following function returns a number field that is the composite field of two given number fields $K$ and $L$, provided that $K\cap L={\mathbb{Q}}$; if $K$ and $L$ have a common subfield larger than ${\mathbb{Q}}$ the function returns a field with the property that it contains a subfield isomorphic to $K$ as well as a subfield isomorphic to $L$.

```magma
> R<x> := PolynomialRing(Integers());
> Composite := function( K, L )
>     T<y> := PolynomialRing( K );
>     f := T!DefiningPolynomial( L );
>     ff := Factorization(f);
>     LKM := NumberField(ff[1][1]);
>     return AbsoluteField(LKM);
> end function;
```

To create, for example, the field ${\mathbb{Q}}(\sqrt{2}, \sqrt{3}, \sqrt{5})$, the above function should be applied twice:

```magma
> K := NumberField(x^2-3);
> L := NumberField(x^2-2);
> M := NumberField(x^2-5);
> KL := Composite(K, L);
> S<s> := PolynomialRing(BaseField(KL));
> KLM<w> := Composite(KL, M);
> KLM;
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

Note, that the same field may be constructed with just one call to [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield) followed by [`AbsoluteField`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-absolutefield):

```magma
> KLM2 := AbsoluteField(NumberField([x^2-3, x^2-2, x^2-5]));
> KLM2;
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

or by

```magma
> AbsoluteField(ext<Rationals() | [x^2-3, x^2-2, x^2-5]>);
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

In general, however, the resulting polynomials of $KLM$ and $KLM2$ will differ. To see the difference between `SimpleExtension` and `AbsoluteField`, we will create `KLM2` again:

```magma
> KLM3 := NumberField([x^2-3, x^2-2, x^2-5]: Abs);
> AbsoluteField(KLM3);
Number Field with defining polynomials [ x^2 - 3, x^2 - 2,
    x^2 - 5] over the Rational Field
> SimpleExtension(KLM3);
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

<a id="function-primering-fldnum"></a>
##### `PrimeRing(F): FldNum -> RngRat`

<a id="function-primefield-fldnum"></a>
##### `PrimeField(F): FldNum -> RngRat`

<a id="function-centre-fldnum"></a>
##### `Centre(F): FldNum -> FldNum`

<a id="procedure-embed-fldnum-fldnum-fldnumelt"></a>
##### `Embed(F, L, a): FldNum, FldNum, FldNumElt`

```magma
Overwrite: BoolElt                    Default: false
```

Install the embedding of a simple number field $F$ in $L$ where the image of the primitive element of $F$ is the element $a$ of $L$. This embedding will be used in coercing from $F$ into $L$.

If the addition of this embedding causes an inconsistency with currently known embeddings then the embedding will not be added unless `Overwrite` is set to `true`.

<a id="procedure-embed-fldnum-fldnum-fldnumelt-2"></a>
##### `Embed(F, L, a): FldNum, FldNum, [FldNumElt]`

```magma
Overwrite: BoolElt                    Default: false
```

Install the embedding of the non-simple number field $F$ in $L$ where the image of the generating elements of $F$ are in the sequence $a$ of elements of $L$. This embedding will be used in coercing from $F$ into $L$.

If the addition of this embedding causes an inconsistency with currently known embeddings then the embedding will not be added unless `Overwrite` is set to `true`.

<a id="function-embeddingmap-fldnum-fldnum"></a>
##### `EmbeddingMap(F, L): FldNum, FldNum -> Map`

Returns the embedding map of the number field $F$ in $L$ if an embedding is known.

<a id="example-ex-909e79"></a>
##### `Example: Embedding One Number Field in Another (ex-909e79)`

Magma does not recognize two independently created number fields as equal since more than one embedding of a field in a larger field may be possible. To coerce between them, it is convenient to be able to embed them in each other.

```magma
> k := NumberField(x^2-2);
> l := NumberField(x^2-2);
> l!k.1;
>> l!k.1;
    ^
Runtime error in '!': Arguments are not compatible
LHS: FldNum
RHS: FldNumElt
> l eq k;
false
> Embed(k, l, l.1);
> l!k.1;
l.1
> Embed(l, k, k.1);
> k!l.1;
k.1
```

`Embed` is useful in specifying the embedding of a field in a larger field.

```magma
> l<a> := NumberField(x^3-2);
> L<b> := NumberField(x^6+108);
> Root(L!2, 3);
1/18*b^4
> Embed(l, L, $1);
> L!l.1;
1/18*b^4
```

Another embedding would be

```magma
> Roots(PolynomialRing(L)!DefiningPolynomial(l));
[
    <1/36*(-b^4 - 18*b), 1>,
    <1/36*(-b^4 + 18*b), 1>,
    <1/18*b^4, 1>
]
> Embed(l, L, $1[1][1] : Overwrite := true);
> L!l.1;
1/36*(-b^4 - 18*b)
```

<a id="function-minkowskispace-fldnum"></a>
##### `MinkowskiSpace(F): FldNum -> Lat, Map`

```magma
Precision: RngIntElt                    Default: 167
```

The Minkowski vector space $V$ of the absolute number field $F$ as a real vector space, with inner product given by the $T_2$-norm ([`Length`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-length)) on $F$, and by the embedding $F \rightarrow V$.

<a id="function-fldnum-completion1"></a>
##### `Completion(K, P): FldNum, RngOrdIdl -> FldLoc, Map`

<a id="constructor-constructor-comp-fldnum-rngordidl-fldloc-map"></a>
##### `comp<K|P>: FldNum, RngOrdIdl -> FldLoc, Map`

```magma
Precision: RngIntElt                    Default: 20
```

For an absolute extension $K$ of ${\mathbb{Q}}$, compute the completion at a prime ideal $P$ which must be either a prime ideal of the maximal order or unramified. The result will be a local field or ring with default precision `Precision`.

The returned map is the canonical injection into the completion. It allows pointwise inverse operations.

<a id="function-completion-fldnum-plcnumelt"></a>
##### `Completion(K, P): FldNum, PlcNumElt -> FldLoc, Map`

```magma
Precision: RngIntElt                    Default: 20
```

For an absolute extension $K$ over ${\mathbb{Q}}$ and a (finite) place $P$, compute the completion at $P$. The precision and the map are as described for [`Completion`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-completion1).

#### Representing Fields as Vector Spaces

It is possible to express a number field as a vector space of any subfield using the intrinsics below. Such a construction also allows one to find properties of elements over these subfields.

<a id="function-algebra-fldnum-fld"></a>
##### `Algebra(K, J): FldNum, Fld -> AlgAss, Map`

<a id="function-algebra-fldnum-fld-fldnumelt"></a>
##### `Algebra(K, J, S): FldNum, Fld, [FldNumElt] -> AlgAss, Map`

Returns the associative structure constant algebra which is isomorphic to the number field $K$ as an algebra over $J$. Also returns the isomorphism from $K$ to the algebra mapping $w^i$ to the $i + 1$st unit vector of the algebra where $w$ is a primitive element of $K$.

If a sequence $S$ is given it is taken to be a basis of $K$ over $J$ and the isomorphism will map the $i$th element of $S$ to the $i$th unit vector of the algebra.

<a id="function-vectorspace-fldnum-fld"></a>
##### `VectorSpace(K, J): FldNum, Fld -> ModTupFld, Map`

<a id="function-kspace-fldnum-fld"></a>
##### `KSpace(K, J): FldNum, Fld -> ModTupFld, Map`

<a id="function-vectorspace-fldnum-fld-fldnumelt"></a>
##### `VectorSpace(K, J, S): FldNum, Fld, [FldNumElt] -> ModTupFld, Map`

<a id="function-kspace-fldnum-fld-fldnumelt"></a>
##### `KSpace(K, J, S): FldNum, Fld, [FldNumElt] -> ModTupFld, Map`

The vector space isomorphic to the number field $K$ as a vector space over $J$ and the isomorphism from $K$ to the vector space. The isomorphism maps $w^i$ to the $i + 1$st unit vector of the vector space where $w$ is a primitive element of $K$.

If $S$ is given, the isomorphism will map the $i$th element of $S$ to the $i$th unit vector of the vector space.

<a id="example-ex-3f6dca"></a>
##### `Example: Minimal Polynomial over a Subfield (ex-3f6dca)`

We use the `Algebra` of a relative number field to obtain the minimal polynomial of an element over a subfield which is not in its coefficient field tower.

```magma
> K := NumberField([x^2 - 2, x^2 - 3, x^2 - 7]);
> J := AbsoluteField(NumberField([x^2 - 2, x^2 - 7]));
> A, m := Algebra(K, J);
> A;
Associative Algebra of dimension 2 with base ring J
> m;
Mapping from: RngOrd: K to AlgAss: A
> m(K.1);
(1/10*(J.1^3 - 13*J.1)                      0)
> m(K.1^2);
(2 0)
> m(K.2);
(1/470*(83*J.1^3 + 125*J.1^2 - 1419*J.1 - 1735) 1/940*(-24*J.1^3 - 5*J.1^2 +
    382*J.1 + 295))
> m(K.2^2);
(3 0)
> m(K.3);
(1/10*(-J.1^3 + 23*J.1)                       0)
> m(K.3^2);
(7 0)
> A.1 @@ m;
1
> A.2 @@ m;
(($.1 - 1)*$.1 - $.1 - 1)*K.1 + ($.1 + 1)*$.1 + $.1 + 1
>
> r := 5*K.1 - 8*K.2 + K.3;
> m(r);
(1/235*(-238*J.1^3 - 500*J.1^2 + 4689*J.1 + 6940) 1/235*(48*J.1^3 + 10*J.1^2 -
    764*J.1 - 590))
> MinimalPolynomial($1);
$.1^2 + 1/5*(-4*J.1^3 + 42*J.1)*$.1 + 5*J.1^2 - 180
> Evaluate($1, r);
0
> K:Maximal;

  K
  |
  |
  $1
  |
  |
  $2
  |
  |
  Q

K  : $.1^2 - 2
$1 : $.1^2 - 3
$2 : x^2 - 7
> Parent($3);
Univariate Polynomial Ring over J
> J;
Number Field with defining polynomial $.1^4 - 18*$.1^2 + 25 over the Rational
Field
```

#### Invariants

Some information describing a number field can be retrieved.

<a id="function-characteristic-fldnum"></a>
##### `Characteristic(F): FldNum -> RngIntElt`

<a id="function-fldnum-degree"></a>
##### `Degree(F): FldNum -> RngIntElt`

Given a number field $F$, return the degree $[F:G]$ of $F$ over its ground field $G$.

<a id="function-absolutedegree-fldnum"></a>
##### `AbsoluteDegree(F): FldNum -> RngIntElt`

Given a number field $F$, return the absolute degree of $F$ over ${\mathbb{Q}}$.

<a id="function-fldnum-discriminant"></a>
##### `Discriminant(F): FldNum -> RngIntElt`

<a id="function-discriminant-fldnum"></a>
##### `Discriminant(F): FldNum -> RngOrdIdl`

Given an extension $F$ of ${\mathbb{Q}}$, return the discriminant of $F$. This discriminant is defined to be the discriminant of the defining polynomial, **not** as the discriminant of the maximal order.

The discriminant in a relative extension $F$ is the ideal in the base ring generated by the discriminant of the defining polynomial.

<a id="function-absolutediscriminant-fldnum"></a>
##### `AbsoluteDiscriminant(K): FldNum -> FldRatElt`

Given a number field $K$, return the absolute value of the discriminant of $K$ regarded as an extension of ${\mathbb{Q}}$.

<a id="function-regulator-fldnum"></a>
##### `Regulator(K): FldNum -> FldComElt`

Given a number field $K$, return the regulator of $K$ as a real number. Note that this will trigger the computation of the maximal order and its unit group if they are not known yet. This only works in an absolute extension.

<a id="function-regulatorlowerbound-fldnum"></a>
##### `RegulatorLowerBound(K): FldNum -> FldComElt`

Given a number field $K$, return a lower bound on the regulator of $O$ or $K$. This only works in an absolute extension.

<a id="function-signature-fldalg"></a>
##### `Signature(F): FldAlg -> RngIntElt, RngIntElt`

Given an absolute number field $F$, returns two integers, one being the number of real embeddings, the other the number of pairs of complex embeddings of $F$.

<a id="function-unitrank-fldnum"></a>
##### `UnitRank(K): FldNum -> RngIntElt`

The unit rank of the number field $K$ (one less than the number of real embeddings plus number of pairs of complex embeddings).

<a id="function-definingpolynomial-fldnum"></a>
##### `DefiningPolynomial(F): FldNum -> RngUPolElt`

<a id="function-definingpolynomial-fldnum-2"></a>
##### `DefiningPolynomial(F): FldNum -> [RngUPolElt]`

Given a number field $F$, the polynomial defining $F$ as an extension of its ground field $G$ is returned.

For non simple extensions, this will return a list of polynomials.

<a id="function-zeroes-fldnum-rngintelt"></a>
##### `Zeroes(F, n): FldNum, RngIntElt -> [ FldComElt ]`

Given an absolute number field $F$, and an integer $n$, return the zeroes of the defining polynomial of $F$ with a precision of exactly $n$ decimal digits. The function returns a sequence of length the degree of $F$; all of the real zeroes appear before the complex zeroes.

<a id="example-ex-e63cd9"></a>
##### `Example: Zeros and Defining Polynomial (ex-e63cd9)`

The information provided by `Zeros` and `DefiningPolynomial` is illustrated below.

```magma
> L := NumberField(x^6+108);
> DefiningPolynomial(L);
x^6 + 108
> Zeros(L, 30);
[ 1.889881574842309747150815910899999999994 +
1.0911236359717214035600726141999999999977*i,
1.889881574842309747150815910899999999994 -
1.0911236359717214035600726141999999999977*i,  0.E-29 +
2.1822472719434428071201452283999999999955*i,  0.E-29 -
2.1822472719434428071201452283999999999955*i,
-1.889881574842309747150815910899999999994 +
1.0911236359717214035600726141999999999977*i,
-1.889881574842309747150815910899999999994 -
1.0911236359717214035600726141999999999977*i ]
> l := NumberField(x^3 - 2);
> DefiningPolynomial(l);
x^3 - 2
> Zeros(l, 30);
[ 1.259921049894873164767210607299999999994,
-0.629960524947436582383605303639109999999 +
1.0911236359717214035600726141999999999977*i,
-0.629960524947436582383605303639109999999 -
1.0911236359717214035600726141999999999977*i ]
```

#### Basis Representation

The basis of a number field can be expressed using elements from any compatible ring.

<a id="function-basis-fldnum"></a>
##### `Basis(F): FldNum -> [ FldNumElt ]`

<a id="function-basis-fldnum-rng"></a>
##### `Basis(F, R): FldNum, Rng -> [ RngElt ]`

Return the current basis for the number field $F$ over its ground ring as a sequence of elements of $F$ or as a sequence of elements of $R$.

<a id="function-integralbasis-fldnum"></a>
##### `IntegralBasis(F): FldNum -> [ FldNumElt ]`

<a id="function-integralbasis-fldnum-rng"></a>
##### `IntegralBasis(F, R): FldNum, Rng -> [ RngElt ]`

An integral basis for the algebraic number field $F$ is returned as a sequence of elements of $F$ or $R$ if given. This is the same as the basis for the maximal order. Note that the maximal order will be determined (and stored) if necessary.

<a id="example-ex-49b3f2"></a>
##### `Example: Basis over Different Rings (ex-49b3f2)`

The following illustrates how a basis can look different when expressed in a different ring.

```magma
> f := x^5 + 5*x^4 - 75*x^3 + 250*x^2 + 65625;
> N := NumberField(f);
> N;
Number Field with defining polynomial x^5 + 5*x^4 - 75*x^3 + 250*x^2 + 65625
over the Rational Field
> Basis(N);
[
    1,
    N.1,
    N.1^2,
    N.1^3,
    N.1^4
]
> IntegralBasis(N);
[
    1,
    1/5*N.1,
    1/25*N.1^2,
    1/125*N.1^3,
    1/625*N.1^4
]
> IntegralBasis(N, MaximalOrder(N));
[
    [1, 0, 0, 0, 0],
    [0, 1, 0, 0, 0],
    [0, 0, 1, 0, 0],
    [0, 0, 0, 1, 0],
    [0, 0, 0, 0, 1]
]
```

<a id="function-fldnum-absolutebasis"></a>
##### `AbsoluteBasis(K): FldNum -> [FldNumElt]`

Returns an absolute basis for the number field $K$, i.e. a basis for $K$ as a ${\mathbb{Q}}$ vector space. The basis will consist of the products of the basis elements of the intermediate fields. The expansion is done depth-first.

<a id="example-ex-0dc237"></a>
##### `Example: Basis and Integral Basis (ex-0dc237)`

We continue our example of a field of degree 4. The functions `Basis` and `IntegralBasis` both return a sequence of elements, that can be accessed using the operators for enumerated sequences. Note that if, as in our example, $O$ is the maximal order of $K$, both functions produce the same output:

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> O := MaximalOrder(K);
> I := IntegralBasis(K);
> B := Basis(O);
> I, B;
[
    1,
    1/2*y,
    1/40*(y^2 + 10*y),
    1/800*(y^3 + 180*y + 400)
]
[
    O.1,
    O.2,
    O.3,
    O.4
]
> Basis(O, K);
[
    1,
    1/2*y,
    1/40*(y^2 + 10*y),
    1/800*(y^3 + 180*y + 400)
]
```

#### Ring Predicates

Number fields can be tested for having several properties that may hold for general rings.

<a id="operation-op-eq-fldnum-fldnum"></a>
##### `F eq L: FldNum, FldNum -> BoolElt`

<a id="operation-op-eq-fldrat-fldnum"></a>
##### `F eq L: FldRat, FldNum -> BoolElt`

<a id="operation-op-eq-fldnum-fldrat"></a>
##### `F eq L: FldNum, FldRat -> BoolElt`

Returns `true` if and only if the number fields $F$ and $L$ are indentical. No two number fields which have been created independently of each other will be considered equal since it is possible that they can be embedded into a larger field in more than one way.

<a id="function-iscommutative-rng"></a>
##### `IsCommutative(R): Rng -> BoolElt`

<a id="function-isunitary-rng"></a>
##### `IsUnitary(R): Rng -> BoolElt`

<a id="function-isfinite-rng"></a>
##### `IsFinite(R): Rng -> BoolElt`

<a id="function-isordered-rng"></a>
##### `IsOrdered(R): Rng -> BoolElt`

<a id="function-isfield-rng"></a>
##### `IsField(R): Rng -> BoolElt`

<a id="function-isnumberfield"></a>
##### `IsNumberField(R): . -> BoolElt`

<a id="function-isalgebraicfield"></a>
##### `IsAlgebraicField(R): . -> BoolElt`

<a id="function-iseuclideandomain-fldnum"></a>
##### `IsEuclideanDomain(F): FldNum -> BoolElt`

This is not a check for euclidean number fields. This function will always return `true`, as all number fields are euclidean domains.

<a id="function-issimple-fldnum"></a>
##### `IsSimple(F): FldNum -> BoolElt`

Checks if the number field $F$ is defined as a simple extension over the base ring.

<a id="function-ispid-fldnum"></a>
##### `IsPID(F): FldNum -> BoolElt`

<a id="function-isufd-fldnum"></a>
##### `IsUFD(F): FldNum -> BoolElt`

<a id="function-isprincipalidealring-fldnum"></a>
##### `IsPrincipalIdealRing(F): FldNum -> BoolElt`

Always `true` for number fields.

<a id="function-isdomain-fldnum"></a>
##### `IsDomain(R): FldNum -> BoolElt`

<a id="operation-op-ne-fldnum-fldnum"></a>
##### `F ne L: FldNum, FldNum -> BoolElt`

<a id="operation-op-subset-fldnum-fldnum"></a>
##### `K subset L: FldNum, FldNum -> BoolElt`

<a id="operation-op-subset-fldrat-fldnum"></a>
##### `K subset L: FldRat, FldNum -> BoolElt`

<a id="function-fldnum-hascomplexconjugate"></a>
##### `HasComplexConjugate(K): FldNum -> BoolElt, Map`

This function returns `true` if there is an automorphism in the number field $K$ that acts like complex conjugation.

<a id="function-complexconjugate-fldnumelt"></a>
##### `ComplexConjugate(x): FldNumElt -> FldNumElt`

For an element $x$ of a number field $K$ where [`HasComplexConjugate`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-hascomplexconjugate) returns `true` (in particular this includes totally real fields, cyclotomic and quadratic fields, and CM-extensions), the conjugate of $x$ is returned.

#### Field Predicates

Here all the predicates that are specific to number fields are listed.

<a id="function-isisomorphic-fldnum-fldnum"></a>
##### `IsIsomorphic(F, L): FldNum, FldNum -> BoolElt, Map`

Given two number fields $F$ and $L$, this returns `true` as well as an isomorphism $F\rightarrow L$, if $F$ and $L$ are isomorphic, and it returns `false` otherwise.

<a id="function-issubfield-fldnum-fldnum"></a>
##### `IsSubfield(F, L): FldNum, FldNum -> BoolElt, Map`

<a id="function-issubfield-fldrat-fldnum"></a>
##### `IsSubfield(F, L): FldRat, FldNum -> BoolElt, Map`

Given two number fields $F$ and $L$, this returns `true` as well as an embedding $F\hookrightarrow L$, if $F$ is a subfield of $L$, and it returns `false` otherwise.

<a id="function-isnormal-fldnum"></a>
##### `IsNormal(F): FldNum -> BoolElt`

Returns `true` if and only if the number field $F$ is a normal extension. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois group computation.

<a id="function-isabelian-fldnum"></a>
##### `IsAbelian(F): FldNum -> BoolElt`

Returns `true` if and only if the number field $F$ is a normal extension with abelian Galois group. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois Group computation.

<a id="function-iscyclic-fldnum"></a>
##### `IsCyclic(F): FldNum -> BoolElt`

Returns `true` if and only if the number field $F$ is a normal extension with cyclic Galois group. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois and automorphism group.

<a id="function-isabsolutefield-fldnum"></a>
##### `IsAbsoluteField(K): FldNum -> BoolElt`

Returns `true` iff the number field $K$ is a constructed as an absolute extension of ${\mathbb{Q}}$.

### Fields with a Labelled Embedding

A Number Field has several diffenent embeddings into the complex numbers. An embedded Number Field is a Number Field such that one of these embeddings is labelled. These fields form a category named `FldNumEmb`.

#### Creation Functions

Functions are provided to create fields of the special type `FldNumEmb`.

<a id="function-embeddednumberfield-fldnum-fldcomelt"></a>
##### `EmbeddedNumberField(L, c): FldNum, FldComElt -> FldNumEmb`

<a id="function-embeddednumberfield-fldnum-fldreelt"></a>
##### `EmbeddedNumberField(L, c): FldNum, FldReElt -> FldNumEmb`

Turns $L$ into a Number Field with a labelled embedding that extends the labelled embedding of its base field and maps its generator to $c$. It reports an error when no embedding fits $c$, as when $c$ is too far from every root. It also reports an error when $c$ is too coarse to distinguish matching embeddings. Use `HasEmbeddedNumberField` to test without an error.

<a id="function-hasembeddednumberfield-fldnum-fldcomelt"></a>
##### `HasEmbeddedNumberField(L, c): FldNum, FldComElt -> BoolElt, FldNumEmb`

<a id="function-hasembeddednumberfield-fldnum-fldreelt"></a>
##### `HasEmbeddedNumberField(L, c): FldNum, FldReElt -> BoolElt, FldNumEmb`

Returns `true` if exactly one embedding of $L$ extends the labelled embedding of its base field and maps its generator to $c$. Returns `false` when no embedding fits $c$ or when $c$ is too coarse to distinguish matching embeddings. When the answer is `true`, the second value is $L$ as a Number Field with that labelled embedding.

<a id="function-embeddednumberfield-rngupolelt-fldreelt"></a>
##### `EmbeddedNumberField(f, r): RngUPolElt, FldReElt -> FldNumEmb`

<a id="function-embeddednumberfield-rngupolelt-fldcomelt"></a>
##### `EmbeddedNumberField(f, r): RngUPolElt, FldComElt -> FldNumEmb`

Constructs the Number Field defined by $f$ with a labelled embedding. The embedding extends that of the coefficient field and maps the generator to $r$. It reports an error when no embedding fits $r$ or when $r$ is too coarse to distinguish matching embeddings. Use `HasEmbeddedNumberField` to test without an error.

<a id="function-hasembeddednumberfield-rngupolelt-fldreelt"></a>
##### `HasEmbeddedNumberField(f, r): RngUPolElt, FldReElt -> BoolElt, FldNumEmb`

<a id="function-hasembeddednumberfield-rngupolelt-fldcomelt"></a>
##### `HasEmbeddedNumberField(f, r): RngUPolElt, FldComElt -> BoolElt, FldNumEmb`

Returns `true` if the Number Field defined by $f$ has exactly one matching embedding. That embedding extends the labelled embedding of its coefficient field and maps its generator to $r$. Returns `false` when no embedding fits $r$ or when $r$ is too coarse to distinguish matching embeddings. When the answer is `true`, the second value is that Number Field with the labelled embedding.

<a id="function-embeddednumberfield-rngupolelt-rngintelt"></a>
##### `EmbeddedNumberField(f, i): RngUPolElt, RngIntElt -> FldNumEmb`

Constructs a Number Field with defining polynomial $f$ and labelled embedding with number $i$.

<a id="function-embeddednumberfield-fldnum-rngintelt"></a>
##### `EmbeddedNumberField(L, i): FldNum, RngIntElt -> FldNumEmb`

Constructs a Number Field with labelled embedding with number $i$ and the same defining polynomial as $L$.

<a id="function-embeddedsplittingfield-rngupolelt"></a>
##### `EmbeddedSplittingField(f): RngUPolElt -> FldNumEmb, SeqEnum`

Constructs the splitting field of $f$ as number field with labelled embedding. The second return value are the roots of $f$ in the splitting field.

<a id="function-subfield-fldnumemb-fldnum"></a>
##### `Subfield(L, K): FldNumEmb, FldNum -> FldNumEmb`

Turns the subfield $K$ of the Number Field $L$ with labelled embedding into a number field with labelled embedding.

#### Composition and Intersection

Number fields with a fixed embedding into the complex numbers have a unique composition and intersection as subfields of the complex numbers. The following functions are availabe to work in the subfield lattice.

<a id="function-composite-fldnumemb-fldnumemb"></a>
##### `Composite(K, L): FldNumEmb, FldNumEmb -> FldNumEmb`

The unique composite of $K$ and $L$ as a number field with labelled embedding.

<a id="function-intersection-fldnumemb-fldnumemb"></a>
##### `Intersection(K, L): FldNumEmb, FldNumEmb -> FldNumEmb`

<a id="operation-op-meet-fldnumemb-fldnumemb"></a>
##### `K meet L: FldNumEmb, FldNumEmb -> FldNumEmb`

The unique intersection of $K$ and $L$ as a number field with labelled embedding.

<a id="function-issubfieldemb-fldnumemb-fldnumemb"></a>
##### `IsSubfieldEmb(K, L): FldNumEmb, FldNumEmb -> BoolElt`

Returns `true` if the image of $K$ in the complex numbers is a subfield of the image of $L$ and `false` otherwise.

#### Embedding and Reconstruction

The following functions are available to work with elements of a number field with a labelled embedding.

<a id="function-compleximage-fldnumelt"></a>
##### `ComplexImage(x): FldNumElt -> FldComElt`

```magma
Precision: RngIntElt                    Default: 30
```

The image of $x$ in the complex numbers.

<a id="function-embedding-fldnumemb"></a>
##### `Embedding(K): FldNumEmb -> UserProgram`

```magma
Precision: RngIntElt                    Default: 30
```

The labelled embeding of $K$ into the complex numbers as a user program.

<a id="function-reconstruction-fldnumemb-fldcomelt"></a>
##### `Reconstruction(L, x): FldNumEmb, FldComElt -> BoolElt, FldNumElt`

<a id="function-reconstruction-fldnumemb-fldreelt"></a>
##### `Reconstruction(L, x): FldNumEmb, FldReElt -> BoolElt, FldNumElt`

```magma
UseLLLOrder: BoolElt                    Default: false
```

Attempts to reconstruct $x$ as an element in $L$. Returns `true` if successful and `false` otherwise. If the option `UseLLLOrder` is set, and LLL basis of the maximal order will be used.

<a id="example-ex-83530f"></a>
##### `Example: Creating an Embedded Number Field (ex-83530f)`

The approximation $2.0$ is too far from $7^{1/3}$ to identify an embedding. The approximation $1.913$ is close enough.

The polynomial $x^2 - 2x + 1 - 2/10^{12}$ has roots $1 \pm \sqrt{2}/10^6$. An approximation with five significant digits does not distinguish them. An approximation with 20 digits does:

```magma
> _<x> := PolynomialRing(Integers());
> K := NumberField(x^3-7);
> HasEmbeddedNumberField(K,2.0);
false
> HasEmbeddedNumberField(K,1.913);
true Number Field with defining polynomial x^3 - 7 over the Rational
Field
> f := ChangeRing(x^2 - 2*x + 1, Rationals()) - 2/10^12;
> HasEmbeddedNumberField(f, RealField(5)!1.0000);
false
> R := RealField(20);
> ok, M := HasEmbeddedNumberField(f, R!1.0000014142135623731);
> ok;
true
> ComplexImage(M.1);
1.00000141421356237309504880169
> L := EmbeddedNumberField(K,7^(1/3));
> ComplexImage(L.1 + L.1^2);
5.57223689279536061843719014967
> Reconstruction(L,1/2 + 7^(1/3) + 5 * 7^(2/3));
true 1/2*(10*L.1^2 + 2*L.1 + 1)
> Reconstruction(L,Sqrt(-1));
false
```

Intersection and composition can be used as follows:

```magma
> _<x> := PolynomialRing(Integers());
> K := EmbeddedNumberField(x^6-3,3^(1/6));
> L := EmbeddedNumberField(x^9-3,3^(1/9));
> K meet L;
Number Field with defining polynomial $.1^3 + 9*$.1^2 + 27*$.1 + 18
over the Rational Field
> C := Composite(K,L);
> Degree(C);
18
> IsSubfieldEmb(K,C) and IsSubfieldEmb(L,C);
true
```

Here is an example to work with towers of fields:

```magma
> _<x> := PolynomialRing(Integers());
> K := EmbeddedNumberField(x^2-2,Sqrt(2));
> L := EmbeddedNumberField(Polynomial([-K.1,0,1]),2^(1/4));
> ComplexImage(L.1);
1.18920711500272106671749997056
> ComplexImage(L!(K.1));
1.41421356237309504880168872421
```

The labelled embeddings determine the composite. Let $w$ be the cube root of 2 with positive imaginary part. Label $K = \Q(2^{1/3})$ at the complex conjugate of $w$, and label $L = \Q(\sqrt{2})(2^{1/3})$ at $w$. Their composite contains both $w$ and its conjugate. It therefore contains $\zeta_3$ and is $\Q(\sqrt{2}, 2^{1/3}, \zeta_3)$, of degree 12. The displayed images of the generators verify that the composite retains both labelled embeddings:

```magma
> _<x> := PolynomialRing(Integers());
> CC<i> := ComplexField(30);
> w := 2^(1/3) * (-1 + Sqrt(CC!-3))/2;
> w;
-0.629960524947436582383605303639 + 1.09112363597172140356007261419*i
> K := EmbeddedNumberField(x^3-2, ComplexConjugate(w));
> S := EmbeddedNumberField(x^2-2, Sqrt(2));
> _<y> := PolynomialRing(S);
> L := EmbeddedNumberField(y^3-2, w);
> C := Composite(K,L);
> AbsoluteDegree(C);
12
> ComplexImage(C!K.1);
-0.629960524947436582383605303639 - 1.09112363597172140356007261419*i
> ComplexImage(C!L.1);
-0.629960524947436582383605303639 + 1.09112363597172140356007261419*i
```

<a id="operation-element"></a>
<a id="fldnum-elt-ops"></a>
### Element Operations

#### Parent and Category

<a id="function-parent-fldnumelt"></a>
##### `Parent(a): FldNumElt -> FldNum`

<a id="function-category-fldnumelt"></a>
##### `Category(a): FldNumElt -> Cat`

<a id="function-type-fldnumelt"></a>
##### `Type(a): FldNumElt -> Cat`

<a id="function-extendedtype-fldnumelt"></a>
##### `ExtendedType(a): FldNumElt -> Cat`

#### Arithmetic

The table below lists the generic arithmetic functions on number field elements. Note that automatic coercion ensures that the binary operations `+`, `-`, `*`, and `/` may be applied to an element of a number field and an element of one of its orders; the result will be a number field element.

<a id="operation-operation-fldnumelt-fldnumelt"></a>
##### `+ a: FldNumElt -> FldNumElt`

<a id="operation-operation-fldnumelt-fldnumelt-2"></a>
##### `- a: FldNumElt -> FldNumElt`

<a id="operation-op-plus-fldnumelt-fldnumelt"></a>
##### `a + b: FldNumElt, FldNumElt -> FldNumElt`

<a id="operation-op-minus-fldnumelt-fldnumelt"></a>
##### `a - b: FldNumElt, FldNumElt -> FldNumElt`

<a id="operation-op-times-fldnumelt-fldnumelt"></a>
##### `a * b: FldNumElt, FldNumElt -> FldNumElt`

<a id="operation-op-div-fldnumelt-fldnumelt"></a>
##### `a / b: FldNumElt, FldNumElt -> FldNumElt`

<a id="operation-op-pow-fldnumelt-rngintelt"></a>
##### `a ^ k: FldNumElt, RngIntElt -> FldNumElt`

<a id="function-sqrt-fldnumelt"></a>
##### `Sqrt(a): FldNumElt -> FldNumElt`

<a id="function-squareroot-fldnumelt"></a>
##### `SquareRoot(a): FldNumElt -> FldNumElt`

Returns the square root of the number field element $a$ if it exists in the field containing $a$.

<a id="function-root-fldnumelt-rngintelt"></a>
##### `Root(a, n): FldNumElt, RngIntElt -> FldNumElt`

Returns the $n$-th root of the number field element $a$ if it exists in the field containing $a$.

<a id="function-ispower-fldnumelt-rngintelt"></a>
##### `IsPower(a, k): FldNumElt, RngIntElt -> BoolElt, FldNumElt`

<a id="function-issquare-fldnumelt"></a>
##### `IsSquare(a): FldNumElt -> BoolElt, FldNumElt`

Return `true` if the number field element $a$ is a $k$th power, (respectively square) and the root if so.

<a id="function-denominator-fldnumelt"></a>
##### `Denominator(a): FldNumElt -> RngIntElt`

Returns the denominator of the number field element $a$, that is the least common multiple of the denominators of the coefficients of $a$.

<a id="function-numerator-fldnumelt"></a>
##### `Numerator(a): FldNumElt -> RngIntElt`

Returns the numerator of the number field element $a$, that is the element multiplied by its denominator.

<a id="function-qround-fldnumelt-rngintelt"></a>
##### `Qround(E, M): FldNumElt, RngIntElt -> FldNumElt`

```magma
ContFrac: BoolElt                    Default: true
```

Finds an approximation of the number field element $E$ where the denominator is bounded by the integer $M$. If `ContFrac` is `true`, the approximation is computed by applying the continued fraction algorithm to the coefficients of $E$ viewed over $Q$.

#### Equality and Membership

Elements may also be tested for whether they lie in an ideal of an order. See Section [Predicates on Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngordidl-in).

<a id="operation-op-eq-fldnumelt-fldnumelt"></a>
##### `a eq b: FldNumElt, FldNumElt -> BoolElt`

<a id="operation-op-ne-fldnumelt-fldnumelt"></a>
##### `a ne b: FldNumElt, FldNumElt -> BoolElt`

<a id="operation-op-in-fldnumelt-fldnum"></a>
##### `a in F: FldNumElt, FldNum -> BoolElt`

#### Predicates on Elements

In addition to the generic predicates `IsMinusOne`, `IsZero`, and `IsOne`, the predicates `IsIntegral` and `IsPrimitive` are defined on elements of number fields.

<a id="function-isintegral-fldnumelt"></a>
##### `IsIntegral(a): FldNumElt -> BoolElt, RngIntElt`

Returns `true` if the element $a$ of a number field $F$ is contained in the ring of integers of $F$, `false` otherwise. We use the minimal polynomial to determine the answer, which means that the calculation of the maximal order is *not* triggered if it is not known yet. A denominator $d$ such that $d*a$ is integral is also returned on request.

<a id="function-isprimitive-fldnumelt"></a>
##### `IsPrimitive(a): FldNumElt -> BoolElt`

Returns `true` if the element $a$ of the number field $F$ generates $F$ over its coefficient field.

<a id="function-istotallypositive-fldnumelt"></a>
##### `IsTotallyPositive(a): FldNumElt -> BoolElt`

Returns `true` iff all real embeddings of the number field element $a$ are positive. For elements in absolute fields this is equivalent to all real conjugates being positive.

<a id="function-iszero-fldnumelt"></a>
##### `IsZero(a): FldNumElt -> BoolElt`

<a id="function-isone-fldnumelt"></a>
##### `IsOne(a): FldNumElt -> BoolElt`

<a id="function-isminusone-fldnumelt"></a>
##### `IsMinusOne(a): FldNumElt -> BoolElt`

<a id="function-isunit-fldnumelt"></a>
##### `IsUnit(a): FldNumElt -> BoolElt`

<a id="function-isnilpotent-fldnumelt"></a>
##### `IsNilpotent(a): FldNumElt -> BoolElt`

<a id="function-isidempotent-fldnumelt"></a>
##### `IsIdempotent(a): FldNumElt -> BoolElt`

<a id="function-iszerodivisor-fldnumelt"></a>
##### `IsZeroDivisor(a): FldNumElt -> BoolElt`

<a id="function-isregular-fldnumelt"></a>
##### `IsRegular(a): FldNumElt -> BoolElt`

<a id="function-isirreducible-fldnumelt"></a>
##### `IsIrreducible(a): FldNumElt -> BoolElt`

<a id="function-isprime-fldnumelt"></a>
##### `IsPrime(a): FldNumElt -> BoolElt`

#### Field Generators

<a id="operation-operation-fldnum-fldnumelt"></a>
##### `K . 1: FldNum -> FldNumElt`

Return the image $\alpha$ of $x$ in $G[x]/f$ where $f$ is the first defining polynomial of the number field $K$ and $G$ is the base field of $K$.

In case of simple extensions this will be a primitive element.

<a id="function-primitiveelement-fldnum"></a>
##### `PrimitiveElement(K): FldNum -> FldNumElt`

Returns a primitive element for the simple number field $K$, that is an element whose minimal polynomial has the same degree as the field. For a simple number field $K$ this is $K.1$ , while for non-simple fields a random element with this property is returned.

<a id="function-generators-fldnum"></a>
##### `Generators(K): FldNum -> {FldNumElt}`

The set of generators of the number field $K$ over its coefficient field, that is a set containing a root of each defining polynomial is returned.

<a id="function-generatorsoverbasering-fldnum"></a>
##### `GeneratorsOverBaseRing(K): FldNum -> {FldNumElt}`

A set of generators of the number field $K$ over ${\mathbb{Q}}$.

<a id="function-generatorssequence-fldnum"></a>
##### `GeneratorsSequence(K): FldNum -> [FldNumElt]`

The sequence of generators of the number field $K$ over its coefficient field, that is a sequence containing a root of each defining polynomial is returned.

<a id="function-generatorssequenceoverbasering-fldnum"></a>
##### `GeneratorsSequenceOverBaseRing(K): FldNum -> [FldNumElt]`

A sequence of generators of the number field $K$ over ${\mathbb{Q}}$.

<a id="function-generators-fldalg-fldalg"></a>
##### `Generators(K, k): FldAlg, FldAlg -> [FldAlgElt]`

<a id="function-generators-fldalg-fldrat"></a>
##### `Generators(K, Q): FldAlg, FldRat -> [FldAlgElt]`

A sequence of generators of the number field $K$ over $k$ is returned. That is a sequence containing a root of each defining polynomial for $K$ and its subfield down to the level of $k$ is returned.

#### Real and Complex Embeddings

See Chapter [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md#rngord-main) (on number fields and orders).

#### Heights

See Chapter [Number Fields and Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/index-number-fields-and-orders.md#rngord-main) (on number fields and orders).

#### Norm, Trace, and Minimal Polynomial

The norm, trace, and minimal polynomial of number field elements can be calculated both with respect to the coefficient ring and to $\Z$ or $\Q$.

<a id="function-fldnum-norm"></a>
##### `Norm(a): FldNumElt -> FldNumElt`

<a id="function-norm-fldnumelt-rng"></a>
##### `Norm(a, R): FldNumElt, Rng -> RngElt`

The relative norm $\rm N_{L/F}(a)$ over $F$ of the element $a$ of the number field $L$ where $F$ is the field over which $L$ is defined as an extension. If $R$ is given the norm is calculated over $R$. In this case, $R$ must occur as a coefficient ring somewhere in the tower under $L$.

<a id="function-absolutenorm-fldnumelt"></a>
##### `AbsoluteNorm(a): FldNumElt -> FldRatElt`

<a id="function-normabs-fldnumelt"></a>
##### `NormAbs(a): FldNumElt -> FldRatElt`

The absolute norm $\rm N_{L/{\mathbb{Q}}}(a)$ over ${\mathbb{Q}}$ of the element $a$ of the number field $L$.

<a id="function-fldnum-trace"></a>
##### `Trace(a): FldNumElt -> FldNumElt`

<a id="function-trace-fldnumelt"></a>
##### `Trace(a): FldNumElt -> FldRatElt`

<a id="function-trace-fldnumelt-rng"></a>
##### `Trace(a, R): FldNumElt, Rng -> RngElt`

The relative trace ${\operatorname{Tr}}_{L/F}(a)$ over $F$ of the element $a$ of the number field $L$ where $F$ is the field over which $L$ is defined as an extension. If $R$ is given the trace is computed over $R$. In this case, $R$ must occur as a coefficient ring somewhere in the tower under $L$.

<a id="function-absolutetrace-fldnumelt"></a>
##### `AbsoluteTrace(a): FldNumElt -> FldRatElt`

<a id="function-traceabs-fldnumelt"></a>
##### `TraceAbs(a): FldNumElt -> FldRatElt`

The absolute trace ${\operatorname{Tr}}_{L/{\mathbb{Q}}}(a)$ over ${\mathbb{Q}}$ of the element $a$ of the number field $L$.

<a id="function-characteristicpolynomial-fldnumelt"></a>
##### `CharacteristicPolynomial(a): FldNumElt -> RngUPolElt`

<a id="function-characteristicpolynomial-fldnumelt-rng"></a>
##### `CharacteristicPolynomial(a, R): FldNumElt, Rng -> RngUPolElt`

Given an element $a$ from a number field $L$, returns the characteristic polynomial of the element over $R$ if given or the subfield $F$ otherwise where $F$ is the field over which $L$ is defined as an extension.

<a id="function-absolutecharacteristicpolynomial-fldnumelt"></a>
##### `AbsoluteCharacteristicPolynomial(a): FldNumElt -> RngUPolElt`

Given an element $a$ from a number field, this function returns the characteristic polynomial of $a$ over ${\mathbb{Q}}$.

<a id="function-minimalpolynomial-fldnumelt"></a>
##### `MinimalPolynomial(a): FldNumElt -> RngUPolElt`

<a id="function-minimalpolynomial-fldnumelt-rng"></a>
##### `MinimalPolynomial(a, R): FldNumElt, Rng -> RngUPolElt`

Given an element $a$ from a number field $L$, returns the minimal polynomial of the element over $R$ if given otherwise the subfield $F$ where $F$ is the field over which $L$ is defined as an extension.

<a id="function-absoluteminimalpolynomial-fldnumelt"></a>
##### `AbsoluteMinimalPolynomial(a): FldNumElt -> RngUPolElt`

Given an element $a$ from a number field, this function returns the minimal polynomial of the element as a polynomial over ${\mathbb{Q}}$.

<a id="function-representationmatrix-fldnumelt"></a>
##### `RepresentationMatrix(a): FldNumElt -> NumMatElt`

<a id="function-representationmatrix-fldnumelt-rng"></a>
##### `RepresentationMatrix(a, R): FldNumElt, Rng -> NumMatElt`

Return the representation matrix of the number field element $a$, that is, the matrix which represents the linear map wrt to the field basis, given by multiplication by $a$. The $i$th row of the representation matrix gives the coefficients of $aw_i$ with respect to the basis $w_1, \ldots, w_n$.

If $R$ is given the matrix is over $R$ and with respect to the basis of the order or field over $R$.

<a id="function-absoluterepresentationmatrix-fldnumelt"></a>
##### `AbsoluteRepresentationMatrix(a): FldNumElt -> NumMatElt`

Return the representation matrix of the number field element $a$ relative to the ${\mathbb{Q}}$-basis of the field constructed using products of the basis elements, where $a$ is an element of the relative number field $L$.

Let $L_i := \sum L_{i-1} \omega_{i,j}$, $L := L_n$, and $L_0 := \Q$. Then the representation matrix is computed with respect to the $\Q$-basis $(\prod_j \omega_{i_j,j})_{i \in I}$ consisting of products of basis elements of the different levels.

<a id="example-ex-441d85"></a>
##### `Example: Norm, Trace, and Minimal Polynomial (ex-441d85)`

We create the norm, trace, minimal polynomial, and representation matrix of the element $\alpha/2$ in the quartic field $\Q(\alpha)$.

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> z := y/2;
> Norm(z), Trace(z);
2500 0
> MinimalPolynomial(z);
$.1^4 - 105*$.1^2 + 2500
> RepresentationMatrix(z);
[     0    1/2      0      0]
[     0      0    1/2      0]
[     0      0      0    1/2]
[-20000      0    210      0]
```

The awkwardness of the printing of the minimal polynomial above can be overcome by providing a parent for the polynomial, keeping in mind that it is a univariate polynomial over the rationals:

```magma
> P<t> := PolynomialRing(RationalField());
> MinimalPolynomial(z);
t^4 - 105*t^2 + 2500
```

#### Other Functions

Elements can be represented by sequences and have a product representation.

<a id="function-elementtosequence-fldnumelt"></a>
##### `ElementToSequence(a): FldNumElt -> [ FldNumElt ]`

<a id="function-fldnum-eltseq"></a>
##### `Eltseq(a): FldNumElt -> [ FldNumElt ]`

For an element $a$ of a number field $F$, a sequence of coefficients of length degree of $F$ with respect to the basis is returned.

<a id="function-eltseq-fldnumelt-fldnum"></a>
##### `Eltseq(E, k): FldNumElt, FldNum -> [RngElt]`

<a id="function-eltseq-fldnumelt-rng"></a>
##### `Eltseq(E, k): FldNumElt, Rng -> [RngElt]`

For an algebraic number $E\in K$ and a ring $k$ which occurs somewhere in the defining tower for $K$, return the list of coefficients of $E$ over $k$, that is, apply `Eltseq` to $E$ and to its coefficients until the list is over $k$.

<a id="function-flat-fldnumelt"></a>
##### `Flat(e): FldNumElt -> [ FldRatElt]`

The coefficients of the number field element $e$ wrt. to the canonical $Q$ basis for its field. This is performed by iterating [`Eltseq`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#function-fldnum-eltseq) until the coefficients are rational numbers. The coefficients obtained match the coefficients wrt. to [`AbsoluteBasis`](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#function-fldnum-absolutebasis).

<a id="literal-literal-a-i-fldnumelt-rngintelt-fldratelt"></a>
##### `a[i]: FldNumElt, RngIntElt -> FldRatElt`

<a id="literal-literal-a-i-fldnumelt-rngintelt-fldnumelt"></a>
##### `a[i]: FldNumElt, RngIntElt -> FldNumElt`

The coefficient of the $i$th basis element in the number field element $a$.

<a id="function-productrepresentation-fldnumelt"></a>
##### `ProductRepresentation(a): FldNumElt -> [ FldNumElt ], [ RngIntElt ]`

Return sequences $P$ and $E$ such that the product of elements in $P$ to the corresponding exponents in $E$ is the algebraic number $a$.

<a id="function-productrepresentation-fldnumelt-rngintelt"></a>
##### `ProductRepresentation(P, E): [ FldNumElt ], [ RngIntElt ] -> FldNumElt`

<a id="function-powerproduct-fldnumelt-rngintelt"></a>
##### `PowerProduct(P, E): [FldNumElt], [RngIntElt] -> FldNumElt`

Return the number field element $a$ of the universe of the sequence $P$ such that $a$ is the product of elements of $P$ to the corresponding exponents in the sequence $E$.

### Class Group and Unit Group

The `ClassGroup` routine and related functions are described in Section [Ideal Class Groups](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#rngord-clg). The routines for computing units in maximal orders of number fields are described in Section [Unit Groups](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#rngord-unit).

<a id="example-ex-c8082f"></a>
#### `Example: Class Group and Unit Group (ex-c8082f)`

In our field defined by $x^4 - 420*x^2 + 40000$, we obtain the class and unit groups as follows.

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> C := ClassGroup(K);
> C;
Abelian Group of order 1
> U := UnitGroup(K);
> U;
Abelian Group isomorphic to Z/2 + Z + Z + Z
Defined on 4 generators
Relations:
      2*U.1 = 0
> T := TorsionUnitGroup(K);
> T;
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*T.1 = 0
```

### Galois Theory

<a id="function-fldnum-galoisgroup"></a>
#### `GaloisGroup(K): FldNum -> GrpPerm, [RngElt], GaloisData`

<a id="function-fldnum-subfields"></a>
#### `Subfields(K): FldNum -> [<FldNum, Map>]`

<a id="function-fldnum-automorphismgroup"></a>
#### `AutomorphismGroup(K): FldNum -> GrpPerm, [Map], Map`

See Sections [Galois Groups](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#rngord-galoisgroup-main), [Subfields](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#rngord-subfields-main), and [Automorphism Groups](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#rngord-automorphismgroup-main).

<a id="norm-equation"></a>
<a id="fldnum-main-norm-equation"></a>
### Solving Norm Equations

Magma has routines for solving norm equations, Thue equations, index form equations, and unit equations. These are documented in Section [Diophantine Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#rngord-equations).

<a id="example-ex-2b3577"></a>
#### `Example: Solving a Relative Norm Equation (ex-2b3577)`

We try to solve $N(x) = 3$ in some relative extension: (Note that since the larger field is a quadratic extension, the second call tells us that there is no integral element with norm $3$)

```magma
> x := PolynomialRing(Integers()).1;
> K := NumberField([x^2-229, x^2-2]);
> NormEquation(K, 3);
true [
  1/3*K.1 - 16/3
]
```

Next we solve the same equation but come from a different angle, we will define the norm map as an element of the group ring and, instead of explicitly computing a relative extension, work instead with the implicit fixed field.

```magma
> F := AbsoluteField(K);
> t := F!K.2;
> t^2;
2
> A, _, mA := AutomorphismGroup(F);
> S := sub<A | [ x : x in A | mA(x)(t) eq t]>;
> N := map<F -> F | x:-> &* [ mA(y)(x) : y in S]>;
> NormEquation(3, N);
true [
  -5/1*$.1 + 2/3*$.3
]
```

Finally, to show the effect of `Raw`:

```magma
> f, s, base := NormEquation(3, N:Raw);
> s;
[
  ( 0  1 -1  1 -1  0  2 -1 -1 -1 -1  2  0  0)
]
> z := PowerProduct(base, s[1]);
> z;
-5/1*$.1 + 2/3*$.3
> N(z);
3
```

<a id="divisors"></a>
<a id="fldnum-plcnum"></a>
### Places and Divisors

A place of a number field $K$, an object of type `PlcNumElt`, is a class of absolute values (valuations) that induce the same topology on the field. By a famous theorem of Ostrowski, places of number fields are either finite, in which case they are in a one-to-one correspondence with the on-zero prime ideals of the maximal order, or infinite. The infinite places are identified with the embedding of $K$ into ${\mathbb{R}}$ or with pairs of embeddings into ${\mathbb{C}}$.

The group of divisors is formally the free group generated by the finite places and the ${\mathbb{R}}$-vectorspace generated by the infinite ones. Divisors are of type `DivNumElt`. Places have formal parent of type `PlcNum`, while divisors belong to `DivNum`.

#### Creation of Structures

<a id="function-places-fldnum"></a>
##### `Places(K): FldNum -> PlcNum`

<a id="function-divisorgroup-fldnum"></a>
##### `DivisorGroup(K): FldNum -> DivNum`

The set of places of the number field $K$ and the group of divisors of $K$ respectively.

#### Operations on Structures

<a id="operation-op-eq-divnum-divnum"></a>
##### `d1 eq d2: DivNum, DivNum -> BoolElt`

<a id="operation-op-eq-plcnum-plcnum"></a>
##### `p1 eq p2: PlcNum, PlcNum -> BoolElt`

<a id="function-numberfield-plcnum"></a>
##### `NumberField(P): PlcNum -> FldNum`

<a id="function-numberfield-divnum"></a>
##### `NumberField(D): DivNum -> FldNum`

The number field for which $P$ is the set of places or $D$ is the group of divisors.

#### Creation of Elements

<a id="function-place-rngordidl"></a>
##### `Place(I): RngOrdIdl -> PlcNumElt`

The place corresponding to prime ideal $I$.

<a id="function-decomposition-fldnum-rngintelt"></a>
##### `Decomposition(K, p): FldNum, RngIntElt -> SeqEnum`

<a id="function-decomposition-fldnum-infty"></a>
##### `Decomposition(K, I): FldNum, Infty -> SeqEnum`

A sequence of tuples of places and multiplicities. When a finite prime (integer) $p$ is given, the places and multiplicities correspond to the decomposition of $p$ in the maximal order of $K$. When the infinite prime is given, a sequence of all infinite places is returned.

<a id="function-decomposition-fldnum-plcnumelt"></a>
##### `Decomposition(K, p): FldNum, PlcNumElt -> SeqEnum`

For a number field $K$ and a place $p$ of the coefficient field of $K$, compute all places (and their multiplicity) that extend $p$. For finite places this is equivalent to the decomposition of the underlying prime ideal. The sequence returned will contain the places of $K$ extending $p$ and their ramification index.

For an infinite place $p$, this function will compute all extensions of $p$ in $K$. In this case, the integer returned in the second component of the tuples will be 1 if $p$ is complex or if $p$ is real and extends to a real place and $2$ otherwise.

<a id="function-decomposition-map-fldrat-fldnum-rngintelt"></a>
##### `Decomposition(m, p): Map[FldRat, FldNum], RngIntElt -> SeqEnum[<PlcNumElt, RngIntElt>]`

<a id="function-decomposition-map-fldnum-fldnum-plcnumelt"></a>
##### `Decomposition(m, p): Map[FldNum, FldNum], PlcNumElt -> SeqEnum[<PlcNumElt, RngIntElt>]`

For an extension $K/k$ of number fields (where $k$ can be $Q$ as well), given by the embedding map $m: k \to K$, decompose the place $p$ of $k$ in the larger field. In case $k=Q$, the place is given as either a prime number or zero to indicate the infinite place. The sequence returned contains pairs where the first component is a place above $p$ via $m$ and the second is the ramification index.

<a id="function-infiniteplaces-fldnum"></a>
##### `InfinitePlaces(K): FldNum -> SeqEnum`

<a id="function-infiniteplaces-fldrat"></a>
##### `InfinitePlaces(K): FldRat -> SeqEnum`

<a id="function-infiniteplaces-rngint"></a>
##### `InfinitePlaces(K): RngInt -> SeqEnum`

A sequence containing all the infinite places of the number field $K$ is returned.

<a id="function-divisor-plcnumelt"></a>
##### `Divisor(pl): PlcNumElt -> DivNumElt`

The divisor $1*pl$ for a place $pl$.

<a id="function-divisor-rngordfracidl"></a>
##### `Divisor(I): RngOrdFracIdl -> DivNumElt`

The divisor which is the linear combination of the places corresponding to the factorization of the ideal $I$ and the exponents of that factorization.

<a id="function-divisor-fldnumelt"></a>
##### `Divisor(x): FldNumElt -> DivNumElt`

The principal divisor $xO$ where $O$ is the maximal order of the underlying number field of which $x$ is an element. In particular, this computes a finite divisor.

<a id="function-realplaces-fldrat"></a>
##### `RealPlaces(K): FldRat -> [PlcNumElt]`

<a id="function-realplaces-fldnum"></a>
##### `RealPlaces(K): FldNum -> [PlcNumElt]`

For a number field $K$ a sequence containing all real (infinite) places is computed. For an absolute field this are precisely the embeddings into $R$ coming from the real roots of the defining polynomial.

#### Arithmetic with Places and Divisors

Divisors and places can be added, negated, subtracted and multiplied and divided by integers.

<a id="operation-op-plus-divnumelt-divnumelt"></a>
##### `d1 + d2: DivNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-plus-plcnumelt-divnumelt"></a>
##### `p + d: PlcNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-plus-divnumelt-plcnumelt"></a>
##### `d + p: DivNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-plus-plcnumelt-plcnumelt"></a>
##### `p1 + p2: PlcNumElt, PlcNumElt -> DivNumElt`

<a id="operation-operation-plcnumelt-divnumelt"></a>
##### `- p: PlcNumElt -> DivNumElt`

<a id="operation-operation-divnumelt-divnumelt"></a>
##### `- d: DivNumElt -> DivNumElt`

<a id="operation-op-minus-divnumelt-plcnumelt"></a>
##### `d - p: DivNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-minus-plcnumelt-divnumelt"></a>
##### `p - d: PlcNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-minus-divnumelt-divnumelt"></a>
##### `d1 - d2: DivNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-minus-plcnumelt-plcnumelt"></a>
##### `p1 - p2: PlcNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-times-plcnumelt-rngintelt"></a>
##### `p * k: PlcNumElt, RngIntElt -> DivNumElt`

<a id="operation-op-times-divnumelt-rngintelt"></a>
##### `d * k: DivNumElt, RngIntElt -> DivNumElt`

<a id="operation-operation-div-plcnumelt-rngintelt-divnumelt"></a>
##### `p div k: PlcNumElt, RngIntElt -> DivNumElt`

<a id="operation-operation-div-divnumelt-rngintelt-divnumelt"></a>
##### `d div k: DivNumElt, RngIntElt -> DivNumElt`

#### Other Functions for Places and Divisors

<a id="function-valuation-fldnumelt-plcnumelt"></a>
##### `Valuation(a, p): FldNumElt, PlcNumElt -> RngElt`

<a id="function-valuation-rngelt-plcnumelt"></a>
##### `Valuation(a, p): RngElt, PlcNumElt -> RngElt`

The valuation of the element $a$ of a number field at the place $p$.

<a id="function-valuation-rngordfracidl-plcnumelt"></a>
##### `Valuation(I, p): RngOrdFracIdl, PlcNumElt -> RngElt`

The valuation of the ideal $I$ at the finite place $p$.

<a id="function-support-divnumelt"></a>
##### `Support(D): DivNumElt -> SeqEnum, SeqEnum`

The support of the divisor $D$ as a sequence of places and a sequence of the corresponding exponents.

<a id="function-ideal-divnumelt"></a>
##### `Ideal(D): DivNumElt -> RngOrdIdl`

<a id="function-ideal-plcnumelt"></a>
##### `Ideal(D): PlcNumElt -> RngOrdIdl`

The ideal corresponding to the finite part of the divisor $D$.

<a id="function-evaluate-fldnumelt-plcnumelt"></a>
##### `Evaluate(x, p): FldNumElt, PlcNumElt -> RngElt`

<a id="function-evaluate-fldratelt-plcnumelt"></a>
##### `Evaluate(x, p): FldRatElt, PlcNumElt -> RngElt`

<a id="function-evaluate-rngintelt-infty"></a>
##### `Evaluate(x, p): RngIntElt, Infty -> RngElt`

The evaluation of the number field element $x$ in the residue class field of the place $p$, i.e. for a finite place $p$ this corresponds to the image under the residue class field map for the underlying prime ideal. For infinite places, this returns the corresponding conjugate, ie. a real or complex number.

<a id="function-realembeddings-fldnumelt"></a>
##### `RealEmbeddings(a): FldNumElt -> []`

The sequence of real embeddings of the algebraic number $a$ is computed, i.e. $a$ is evaluated at all real places of the number field.

<a id="function-realsigns-fldnumelt"></a>
##### `RealSigns(a): FldNumElt -> []`

A sequence containing $\pm1$ depending on whether the evaluation of the number field element $a$ at the corresponding real place is positive or negative.

<a id="function-isreal-plcnumelt"></a>
##### `IsReal(p): PlcNumElt -> BoolElt`

For an infinite place $p$, returns `true` if the corresponding embedding is real, i.e. if `Evaluate` at $p$ will give real results.

<a id="function-iscomplex-plcnumelt"></a>
##### `IsComplex(p): PlcNumElt -> BoolElt`

For an infinite place $p$, return `true` if the corresponding embedding is complex, i.e. if `Evaluate` at $p$ will generally yield complex results.

<a id="function-isfinite-plcnumelt"></a>
##### `IsFinite(p): PlcNumElt -> BoolElt`

For a place $p$ of a number field, return if the place is finite, i.e. if it corresponds to a prime ideal.

<a id="function-isinfinite-plcnumelt"></a>
##### `IsInfinite(p): PlcNumElt -> BoolElt, RngIntElt`

For a place $p$ of a number field return if the place is infinite, ie. if it corresponds to an embedding of the number field into the real or complex numbers. If the place is infinite, the index of the embedding it corresponds to is returned as well.

<a id="function-extends-plcnumelt-plcnumelt"></a>
##### `Extends(P, p): PlcNumElt, PlcNumElt -> BoolElt`

For two places $P$ of $K$ and $p$ of $k$ where $K$ is an extension of $k$, check whether $P$ extends $p$. For finite places, this is equivalent to checking if the prime ideal corresponding to $P$ divides, in the maximal order of $K$ the prime ideal of $p$. For infinite places `true` implies that for elements of $k$, evaluation at $P$ and $p$ will give identical results.

<a id="function-inertiadegree-plcnumelt"></a>
##### `InertiaDegree(P): PlcNumElt -> RngIntElt`

<a id="function-degree-plcnumelt"></a>
##### `Degree(P): PlcNumElt -> RngIntElt`

For a place $P$ of a number field, return the inertia degree of $P$. That is for a finite place, return the degree of the residue class field over it’s prime field, for infinite places it is always $1$.

<a id="function-degree-divnumelt"></a>
##### `Degree(D): DivNumElt -> RngElt`

For a divisor $D$ of a number field, the degree is the weighted sum of the degrees of the supporting places, the weights being the multiplicities.

<a id="function-numberfield-plcnumelt"></a>
##### `NumberField(P): PlcNumElt -> FldNum`

<a id="function-numberfield-divnumelt"></a>
##### `NumberField(D): DivNumElt -> FldNum`

For a place $P$ or divisor $D$ of a number field, return the underlying number field.

<a id="function-residueclassfield-plcnumelt"></a>
##### `ResidueClassField(P): PlcNumElt -> Fld`

For a place $P$ of a number field, compute the residue class field of $P$. For a finite place this will be a finite field, namely the residue class field of the underlying prime ideal. For an infinite place, the residue class field will be the field of real or complex numbers.

<a id="function-uniformizingelement-plcnumelt"></a>
##### `UniformizingElement(P): PlcNumElt -> FldNumElt`

For a finite place $P$ of a number field, return an element of valuation $1$. This will be the uniformizing element of the underlying prime ideal as well.

<a id="function-localdegree-plcnumelt"></a>
##### `LocalDegree(P): PlcNumElt -> RngIntElt`

The degree of the completion at the place $P$, i.e. the product of the inertia degree times the ramification index.

<a id="function-ramificationindex-plcnumelt"></a>
##### `RamificationIndex(P): PlcNumElt -> RngIntElt`

The ramification index of the place $P$. For infinite real places this is $1$ and $2$ for complex places.

<a id="function-decompositiongroup-plcnumelt"></a>
##### `DecompositionGroup(P): PlcNumElt -> GrpPerm`

For a place $P$ of a normal number field, return the decomposition group as a subgroup of the (abstract) automorphism group.

### Number Field Database

An optional database of number fields may be downloaded from the Magma website. This section defines the interface to that database.

There are databases for number fields of degrees 2 through 9. In the case of degree 2 the enumeration is complete in the discriminant range (discriminants of absolute value less than a million); the other databases include fields with small (absolute value of) discriminant, as well as various other fields that may be of interest. The selection of fields is eclectic, and it may well be that certain “obvious” ones are missing.

For each number field in the database, the following information is stored and may be used to limit the number fields of interest via the [`sub< D | dmin, dmax : parameters>`](https://docs.magma-maths.org/GlobalFields/NumberFields/database.md#constructor-anfdb-sub) constructor: The discriminant; the signature; the Galois group; the class number; and the class group.

#### Creation

<a id="function-numberfielddatabase-rngintelt"></a>
##### `NumberFieldDatabase(d): RngIntElt -> DB`

Returns a database object for the number fields of degree $d$.

<a id="constructor-anfdb-sub"></a>
##### `sub< D | dmin, dmax : parameters>: DB, RngIntElt, RngIntElt -> DB`

<a id="constructor-constructor-sub-db-rngintelt-db"></a>
##### `sub< D | dabs : parameters>: DB, RngIntElt -> DB`

<a id="constructor-constructor-sub-db-db"></a>
##### `sub< D | : parameters>: DB -> DB`

```magma
Signature            : [ RngIntElt ]                           Default: 
Signatures           : [ [RngIntElt] ]                         Default: 
GaloisGroup          : RngIntElt or GrpPerm                    Default: 
ClassNumber          : RngIntElt                               Default: 
ClassNumberLowerBound: RngIntElt                               Default: 1
ClassNumberUpperBound: RngIntElt                               Default: Infinity()
ClassNumberBounds    : [ RngIntElt ]                           Default: [ 1, Infinity() ]
ClassGroup           : [ RngIntElt ]                           Default: 
ClassSubGroup        : [ RngIntElt ]                           Default: [ ]
ClassSuperGroup      : [ RngIntElt ]                           Default: 
SearchByValue        : BoolElt                                 Default: false
```

Returns a sub-database of $D$, restricting (or further restricting, if $D$ is already a sub-database of the full database for that degree) the contents to those number fields satisfying the specified conditions. Note that (with the exception of `SearchByValue`, which does not actually limit the fields in the database) it is not possible to “undo” restrictions with this constructor — the results are always at least as limited as $D$ is.

The valid non-parameter arguments are up to two integers specifying the desired range of discriminants in the result. If two integers are provided these are taken as the lower (`dmin`) and upper (`dmax`) bounds on the discriminant. If one integer is provided it is taken as a bound (`dabs`) on the absolute value of the discriminant. If no integers are provided then the discriminant range is the same as for $D$.

The parameters `Signature` or `Signatures` may be used to specify the desired signature or signatures to match. A signature is specified as a sequence of two integers $[s_1, s_2]$ where $s_1 + 2s_2 = d$.

The parameter `GaloisGroup` may be used to specify the desired Galois group of the number field. It may be given as either a permutation group, or as the explicit index of this Galois group in the transitive groups database. (i.e., the first return value of `TransitiveGroupIdentification`.)

It is possible to require certain divisibility conditions on the class number. Internally, there are lower and upper bounds on this value, such that a number field will only match if its class number is divisible by the lower bound and divides the upper bound. These bounds may be set individually using `ClassNumberLowerBound` or `ClassNumberUpperBound`; setting `ClassNumber` is equivalent to setting both bounds to the same value. Both values may be specified at once by setting `ClassNumberBounds` to the sequence of the lower and upper bounds.

When finer control is desired, it is possible to specify desired sub- and super-groups of the class group. Each group is specified by the sequence of its Abelian invariants; the desired subgroup is set using `ClassSubGroup`, and the desired supergroup is set using `ClassSuperGroup`. Both may be set at once (thus requiring the group to match exactly) using `ClassGroup`.

When iterating through the database, the default is to iterate in order of the absolute value of the discriminant. Sometimes it is desirable to iterate in order of the actual value of the discriminant; this can be accomplished by setting the parameter `SearchByValue` to true.

#### Access

<a id="function-degree-db"></a>
##### `Degree(D): DB -> RngIntElt`

Returns the degree of the number fields stored in the database.

<a id="function-discriminantrange-db"></a>
##### `DiscriminantRange(D): DB -> RngIntElt, RngIntElt`

Returns the smallest and largest discriminants of the number fields stored in the database.

<a id="operation-operation-db-rngintelt"></a>
##### `# D: DB -> RngIntElt`

<a id="function-numberoffields-db"></a>
##### `NumberOfFields(D): DB -> RngIntElt`

Returns how many number fields are stored in the database.

<a id="function-numberoffields-db-rngintelt"></a>
##### `NumberOfFields(D, d): DB, RngIntElt -> RngIntElt`

Returns how many number fields of discriminant $d$ are stored in the database.

<a id="function-numberfields-db"></a>
##### `NumberFields(D): DB -> [ FldNum ]`

Returns the sequence of number fields stored in the database.

<a id="function-numberfields-db-rngintelt"></a>
##### `NumberFields(D, d): DB, RngIntElt -> [ FldNum ]`

Returns the sequence of number fields of discriminant $d$ stored in the database.

<a id="example-ex-461fd7"></a>
##### `Example: Basic Access to the Number Field Database (ex-461fd7)`

We illustrate with some basic examples. We start with the degree 2 number fields and get some basic information about the database.

```magma
> D := NumberFieldDatabase(2);
> DiscriminantRange(D);
-999995 999997
> #D;
607925
```

There are 13 fields with discriminant of absolute value less than 20:

```magma
> D20 := sub<D | 20>;
> #D20;
13
> [ Discriminant(F) : F in D20 ];
[ -3, -4, 5, -7, -8, 8, -11, 12, 13, -15, 17, -19, -20 ]
```

Note that these were listed in order of absolute value of the discriminant; we can also list them in value order:

```magma
> [ Discriminant(F) : F in sub<D20 | : SearchByValue> ];
[ -20, -19, -15, -11, -8, -7, -4, -3, 5, 8, 12, 13, 17 ]
```

Two of these number fields have class number 2:

```magma
> NumberFields(sub<D20 | : ClassNumber := 2>);
[
    Number Field with defining polynomial x^2 + x + 4 over the Rational Field,
    Number Field with defining polynomial x^2 + 5 over the Rational Field
]
```

<a id="example-ex-07449b"></a>
##### `Example: Quintic Fields with a Given Signature (ex-07449b)`

Now we move onto the fields of degree five, and in particular those with signature [1,2].

```magma
> D := NumberFieldDatabase(5);
> #D;
289040
> D12 := sub<D |: Signature := [1,2]>;
> #D12;
186906
```

We consider how many of these have class number equal to four. Note the cumulative nature of the restrictions has come into play.

```magma
> #sub<D12 |: ClassNumber := 4>;
1222
> #sub<D |: ClassNumber := 4>;
1255
```

The number with class group specifically isomorphic to $C_2\times C_2$ is much less:

```magma
> #sub<D12 |: ClassGroup := [2,2]>;
99
```

<a id="quadratic"></a>
<a id="chapfldquad"></a>
## Quadratic Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/QuadraticFields/introduction.md)
  - [Representation](https://docs.magma-maths.org/GlobalFields/QuadraticFields/introduction.md#representation)
- [Creation of Structures](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md)
  - [`QuadraticField(m): RngIntElt → FldQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-fldquad-quadraticfield)
  - [`EquationOrder(F): FldQuad → RngQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-equationorder-fldquad)
  - [`MaximalOrder(F): FldQuad → RngQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-maximalorder-fldquad)
  - [`IntegerRing(F): FldQuad → RngQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-integerring-fldquad)
  - [`RingOfIntegers(F): FldQuad → RngQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-ringofintegers-fldquad)
  - [`NumberField(O): RngQuad → FldQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-numberfield-rngquad)
  - [`sub< O | f >: RngQuad, RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#constructor-constructor-sub-rngquad-rngintelt)
  - [`IsQuadratic(K): FldNum → BoolElt, FldQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-isquadratic-fldnum)
  - [`IsQuadratic(O): RngOrd → BoolElt, RngQuad`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-isquadratic-rngord)
  - [Example: Creating a Quadratic Field and Order](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#example-ex-a2440a)
  - [Example: Embedding a Quadratic Field in a Cyclotomic Field](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#example-ex-6098de)
- [Operations on Structures](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md)
  - [`AssignNames(~F, [s]): FldQuad, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#procedure-assignnames-fldquad-monstgelt-ref)
  - [`AssignNames(~O, [s]): RngQuad, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#procedure-assignnames-rngquad-monstgelt-ref)
  - [`Name(F, 1): FldQuad, RngIntElt → FldQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-name-fldquad-rngintelt)
  - [`Name(O, 1): RngQuad, RngIntElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-name-rngquad-rngintelt)
  - [`FundamentalUnit(K): FldQuad → FldQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-fundamentalunit-fldquad)
  - [`FundamentalUnit(O): RngQuad → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-fundamentalunit-rngquad)
  - [`Discriminant(K): FldQuad → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-discriminant-fldquad)
  - [`Conductor(K): FldQuad → RngIntElt, [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-conductor-fldquad)
  - [`Conductor(O): RngQuad → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-conductor-rngquad)
  - [Ideal Class Group](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#ideal-class-group)
    - [`ClassGroup(K): FldQuad → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-classgroup-fldquad)
    - [`ClassGroup(O): RngQuad → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-classgroup-rngquad)
    - [`ClassNumber(K): FldQuad → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-classnumber-fldquad)
    - [`ClassNumber(O): RngQuad → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-classnumber-rngquad)
    - [`PicardGroup(O): RngQuad → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-picardgroup-rngquad)
    - [`PicardNumber(O): RngQuad → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-picardnumber-rngquad)
    - [Example: Class Groups by Sieving](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#example-ex-a05688)
    - [`QuadraticClassGroupTwoPart(K): FldQuad → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-quadraticclassgrouptwopart-fldquad)
    - [`QuadraticClassGroupTwoPart(O): RngQuad → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-quadraticclassgrouptwopart-rngquad)
    - [`QuadraticClassGroupTwoPart(d): RngIntElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-quadraticclassgrouptwopart-rngintelt)
    - [Example: Two-Part of a Quadratic Class Group](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#example-ex-53f1e4)
  - [Norm Equations](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#norm-equations)
    - [`NormEquation(F, m): FldQuad, RngIntElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-normequation-fldquad-rngintelt)
    - [`NormEquation(F, m: parameters): FldQuad, RngIntElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-normequation-fldquad-rngintelt-2)
    - [`NormEquation(O, m): RngQuad, RngIntElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-normequation-rngquad-rngintelt)
    - [`NormEquation(O, m: parameters): RngQuad, RngIntElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#function-normequation-rngquad-rngintelt-2)
    - [Example: Norm Equation in a Quadratic Order](https://docs.magma-maths.org/GlobalFields/QuadraticFields/structure_ops.md#example-ex-6e8332)
- [Special Element Operations](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md)
  - [Division Algorithm](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#division-algorithm)
    - [`a div b: RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#operation-operation-div-rngquadelt-rngquadelt-rngquadelt)
    - [`a mod b: RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#operation-operation-mod-rngquadelt-rngquadelt-rngquadelt)
    - [`GreatestCommonDivisor(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-greatestcommondivisor-rngquadelt-rngquadelt)
    - [`Gcd(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-gcd-rngquadelt-rngquadelt)
    - [`GCD(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-gcd-rngquadelt-rngquadelt-2)
    - [`LeastCommonMultiple(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-leastcommonmultiple-rngquadelt-rngquadelt)
    - [`Lcm(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-lcm-rngquadelt-rngquadelt)
    - [`LCM(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-lcm-rngquadelt-rngquadelt-2)
    - [`Modexp(a, e, n): RngQuadElt, RngInt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-modexp-rngquadelt-rngint-rngquadelt)
  - [Factorization](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#factorization)
    - [`Factorization(n): RngQuadElt → SeqEnum, Tup`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-factorization-rngquadelt)
    - [`Factorisation(n): RngQuadElt → SeqEnum, Tup`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-factorisation-rngquadelt)
    - [`TrialDivision(n, B): RngQuadElt, RngIntElt → SeqEnum, SeqEnum, Tup`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-trialdivision-rngquadelt-rngintelt)
  - [Conjugates](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#conjugates)
    - [`ComplexConjugate(a): FldQuadElt → FldQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-complexconjugate-fldquadelt)
    - [`ComplexConjugate(a): RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-complexconjugate-rngquadelt)
    - [`Conjugate(a): FldQuadElt → FldQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-conjugate-fldquadelt)
    - [`Conjugate(a): RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-conjugate-rngquadelt)
  - [Other Element Functions](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#other-element-functions)
    - [`BiquadraticResidueSymbol(a, b): RngQuadElt, RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-biquadraticresiduesymbol-rngquadelt-rngquadelt)
    - [`Primary(a): RngQuadElt → RngQuadElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#function-primary-rngquadelt)
    - [Example: Primes with 2 as a Biquadratic Residue](https://docs.magma-maths.org/GlobalFields/QuadraticFields/elements.md#example-ex-c87bf6)
- [Special Functions for Ideals](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md)
  - [`Content(I): RngQuadFracIdl → RngQuadFracIdl`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-content-rngquadfracidl)
  - [`Conjugate(I): RngQuadFracIdl → RngQuadFracIdl`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-conjugate-rngquadfracidl)
  - [`Discriminant(I): RngQuadFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-discriminant-rngquadfracidl)
  - [`QuadraticForm(I): RngQuadFracIdl → QuadBinElt`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-quadraticform-rngquadfracidl)
  - [`Ideal(f): QuadBinElt → RngQuadIdl`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-ideal-quadbinelt)
  - [`Reduction(I): RngQuadFracIdl → RngQuadFracIdl`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/special-ideals.md#function-reduction-rngquadfracidl)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/QuadraticFields/bibliography.md)

### Introduction

Quadratic fields in Magma can be created as a subtype of the number fields `FldNum`. The advantage of the special quadratic fields is that some special (faster) algorithms have been or will be implemented to deal with them; the functions for the special quadratic fields (created with the [`QuadraticField`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-fldquad-quadraticfield) function) are described here. Functions which work generally for number fields and their orders are described in Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).

The categories involved are `FldQuad` for fields, `RngQuad` for their orders and `FldQuadElt` and `RngQuadElt` for their elements.

#### Representation

For every squarefree integer $d$ (not $0$ or $1$) there is a unique quadratic field ${\mathbb{Q}}(\sqrt{d})$; for any integer $k$ we have the field ${\mathbb{Q}}(\sqrt{k^2d})\cong {\mathbb{Q}}(\sqrt{d})$. Given any integer $m$, the function [`QuadraticField`](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#function-fldquad-quadraticfield) will create a structure corresponding to the quadratic field ${\mathbb{Q}}(\sqrt{d})$, where $d$ is the squarefree kernel of $m$ ($d$ will have the same sign as $m$ and its absolute value is the largest squarefree divisor of $m$). In Magma a list of quadratic fields currently present is maintained, and if ${\mathbb{Q}}(\sqrt{d})$ has been created before a reference on it will be returned: two fields with the same $d$ are the same. The discriminant $D$ of ${\mathbb{Q}}(\sqrt{d})$ will be $D=d$ if $d\equiv1\bmod4$ and $D=4d$ if $d\equiv2,3\bmod4$. Elements of ${\mathbb{Q}}(\sqrt{d})$ are represented by a common positive denominator $b$ and two integer coefficients: $\alpha={1\over b}(x+y\sqrt{d})$. The ring of integers of $F={\mathbb{Q}}(\sqrt{d})$ will be $O_F={\mathbb{Z}}+\epsilon_d{\mathbb{Z}}$, where

$$
\epsilon_d=\cases{
\sqrt{d}&if $d\equiv 2, 3\bmod 4$,\\
{1+\sqrt{d}\over2}&if $d\equiv 1\bmod 4$.\\}
$$

Elements of $O_F$ are represented by two integer coefficients $\alpha=x+y\epsilon_d$. The pair $1, \epsilon_d$ forms an integral basis for $F={\mathbb{Q}}(\sqrt{d})$, but note that elements of $F$ are represented using the basis of the equation order ($1, \sqrt{d}$) instead. For any positive integer $f$ there is a suborder of conductor $f$ in $O_F$, whose elements are of the form $x + y f \epsilon_d$, for any integers $x, y$. The discriminant of the order of conductor $f$ is $f^2D$, where $D$ is the field discriminant.

The equation order of $F$ is $E_F = {\mathbb{Z}}+ \sqrt{d}{\mathbb{Z}}$. Suborders of conductor $f$ can be formed which will contain elements of the form $x + y f \sqrt{d}$ for any integers $x$ and $y$.

<a id="creation"></a>
<a id="fldquad-creation"></a>
### Creation of Structures

Squarefree integers determine quadratic fields. Associated with any quadratic field is its ring of integers (maximal order) and an equation order, and for every positive integer $f$ there exists an order of conductor $f$ inside the maximal order. For information on creating elements see Section [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#fldnum-main-elt-create).

<a id="function-fldquad-quadraticfield"></a>
#### `QuadraticField(m): RngIntElt -> FldQuad`

Given an integer $m$ that is not a square, create the field ${\mathbb{Q}}(\sqrt{d})$, where $d$ is the squarefree part of $m$. It is possible to assign a name to $\sqrt{d}$ using angle brackets: `R<s> := QuadraticField(m)`.

<a id="function-equationorder-fldquad"></a>
#### `EquationOrder(F): FldQuad -> RngQuad`

Creation of the order ${\mathbb{Z}}[\sqrt{d}]$ in the quadratic field $F={\mathbb{Q}}(\sqrt{d})$, with $d$ squarefree.

<a id="function-maximalorder-fldquad"></a>
#### `MaximalOrder(F): FldQuad -> RngQuad`

<a id="function-integerring-fldquad"></a>
#### `IntegerRing(F): FldQuad -> RngQuad`

<a id="function-ringofintegers-fldquad"></a>
#### `RingOfIntegers(F): FldQuad -> RngQuad`

Given a quadratic field $F={\mathbb{Q}}(\sqrt{d})$, with $d$ squarefree, create its maximal order. This order is ${\mathbb{Z}}[\sqrt{d}]$ if $d\equiv 2, 3\bmod 4$ and ${\mathbb{Z}}[{1+\sqrt{d}\over2}]$ if $d\equiv1\bmod4$.

<a id="function-numberfield-rngquad"></a>
#### `NumberField(O): RngQuad -> FldQuad`

Given a quadratic order, this returns the quadratic field of which it is an order.

<a id="constructor-constructor-sub-rngquad-rngintelt"></a>
#### `sub< O | f >: RngQuad, RngIntElt`

Create the sub-order of index $f$ in the order $O$ of a quadratic field. If $O$ is maximal, this will be the unique order of conductor $f$.

<a id="function-isquadratic-fldnum"></a>
#### `IsQuadratic(K): FldNum -> BoolElt, FldQuad`

<a id="function-isquadratic-rngord"></a>
#### `IsQuadratic(O): RngOrd -> BoolElt, RngQuad`

Return `true` if the field $K$ or order $O$ can be created as a quadratic field or order and the quadratic field or order if so.

<a id="example-ex-a2440a"></a>
#### `Example: Creating a Quadratic Field and Order (ex-a2440a)`

We create the quadratic field ${\mathbb{Q}}(\sqrt{5})$ and an order in it, and display some elements of the order in their representation as order element and as field element.

```magma
> Q<z> := QuadraticField(5);
> Q eq QuadraticField(45);
true
> O<w> := sub< MaximalOrder(Q) | 7 >;
> O;
Order of conductor 7 in Q
> w;
w
> Q ! w;
1/2*(7*z + 7)
> Eltseq(w), Eltseq(Q ! w);
[ 0, 1 ]
[ 7/2, 7/2 ]
> ( (7/2)+(7/2)*z )^2;
1/2*(49*z + 147)
>  Q ! w^2;
1/2*(49*z + 147)
> w^2;
7*w + 49
```

<a id="example-ex-6098de"></a>
#### `Example: Embedding a Quadratic Field in a Cyclotomic Field (ex-6098de)`

We define an injection $\phi\colon{\mathbb{Q}}(\sqrt{5})\rightarrow{\mathbb{Q}}(\zeta_5)$. First a square root of $5$ is identified in ${\mathbb{Q}}(\zeta_5)$.

```magma
> Q<w> := QuadraticField(5);
> F<z> := CyclotomicField(5);
> C<c> := PolynomialRing(F);
> Factorization(c^2-5);
[
   <c - 2*z^3 - 2*z^2 - 1, 1>,
   <c + 2*z^3 + 2*z^2 + 1, 1>
]
> h := hom< Q -> F | -2*z^3 - 2*z^2 - 1 >;
> h(w)^2;
5
```

### Operations on Structures

The majority of functions for quadratic fields and orders apply identically to number fields and orders in general. The functions which exist only for quadratic fields and orders are listed here along with those which deserve a special mention.

<a id="procedure-assignnames-fldquad-monstgelt-ref"></a>
#### `AssignNames(~F, [s]): FldQuad, [ MonStgElt ]`

<a id="procedure-assignnames-rngquad-monstgelt-ref"></a>
#### `AssignNames(~O, [s]): RngQuad, [ MonStgElt ]`

Procedure to change the name of the generator of a quadratic field $F$ or an order $O$ in a quadratic field to the string $s$. Elements of the quadratic field ${\mathbb{Q}}(\sqrt{d})$ with $m$ squarefree will be printed in the form `1/b*(x + y*s)`, where $b, x, y$ are integers. Similarly, for an order $O$ of conductor $f$ in a quadratic field elements will be printed in the format `x + y*s`. This procedure only changes the name used in printing the elements of $F$ or $O$, it does *not* make an assignment to an identifier $s$. To do this, use an assignment statement, or angle brackets when creating the field or order: `F<s> := QuadraticField(-3);`. Note that since this is a procedure that modifies $F$ or $O$, it is necessary to have a reference `~` in the call to this function.

<a id="function-name-fldquad-rngintelt"></a>
#### `Name(F, 1): FldQuad, RngIntElt -> FldQuadElt`

<a id="function-name-rngquad-rngintelt"></a>
#### `Name(O, 1): RngQuad, RngIntElt -> RngQuadElt`

Given a quadratic field $F$ or one of its orders $O$, return the element which has the name attached to it, that is, return $\sqrt{d}$ in the field, or $f \epsilon_d$ in a suborder of the maximal order or $f \sqrt{d}$ in a suborder of the equation order.

<a id="function-fundamentalunit-fldquad"></a>
#### `FundamentalUnit(K): FldQuad -> FldQuadElt`

<a id="function-fundamentalunit-rngquad"></a>
#### `FundamentalUnit(O): RngQuad -> RngQuadElt`

A generator for the unit group of the order $O$ or the maximal order of the quadratic field $K$.

<a id="function-discriminant-fldquad"></a>
#### `Discriminant(K): FldQuad -> RngIntElt`

The discriminant of the field $K$ which is only defined up to squares. The discriminant will be the discriminant of the polynomial or better.

<a id="function-conductor-fldquad"></a>
#### `Conductor(K): FldQuad -> RngIntElt, [RngIntElt]`

The conductor of the field $K$ which is the order of the smallest cyclotomic field containing $K$ and a sequence containing the ramified real places of $K$.

<a id="function-conductor-rngquad"></a>
#### `Conductor(O): RngQuad -> RngIntElt`

The conductor of the order $O$, which equals the index of $O$ in the maximal order.

#### Ideal Class Group

The function `ClassGroup` is available for number fields and orders in general but a different and faster algorithm is used by default for the quadratics. All of the algorithms, except for the sieving method described in [[Jac99](https://docs.magma-maths.org/references.md#cite-jacobson)] which uses the multiple polynomial quadratic sieve (MPQS), are based on binary quadratic forms, see [`ClassGroup`](https://docs.magma-maths.org/LatticesQuadraticForms/BinaryQuadraticForms/class-group.md#function-quadbin-classgroup) in Chapter [Binary Quadratic Forms](https://docs.magma-maths.org/LatticesQuadraticForms/BinaryQuadraticForms/index-binary-quadratic-forms.md#quadbin) for details.

<a id="function-classgroup-fldquad"></a>
##### `ClassGroup(K): FldQuad -> GrpAb, Map`

<a id="function-classgroup-rngquad"></a>
##### `ClassGroup(O): RngQuad -> GrpAb, Map`

```magma
FactorBasisBound: FldReElt                     Default: 0.1
ProofBound      : FldReElt                     Default: 6
ExtraRelations  : RngIntElt                    Default: 1
Al              : MonStgElt                    Default: "Automatic"
ClassGroupSieve : Verbose                      Default: 5
```

The class group of a maximal order $O$ or the maximal order of the quadratic field $K$, as an abelian group. The function also returns a map between the group and the power structure of ideals of $O$ or the maximal order of $K$. The parameter `Al` can be set to `"Sieve"` or `"NoSieve"` to control whether the sieving algorithm is used or not; by default it is used when the discriminant is greater than $10^{20}$. For more details on the parameters see [`ClassGroup`](https://docs.magma-maths.org/LatticesQuadraticForms/BinaryQuadraticForms/class-group.md#function-quadbin-classgroup) in Chapter [Binary Quadratic Forms](https://docs.magma-maths.org/LatticesQuadraticForms/BinaryQuadraticForms/index-binary-quadratic-forms.md#quadbin).

<a id="function-classnumber-fldquad"></a>
##### `ClassNumber(K): FldQuad -> RngIntElt`

<a id="function-classnumber-rngquad"></a>
##### `ClassNumber(O): RngQuad -> RngIntElt`

```magma
FactorBasisBound: FldReElt                     Default: 0.1
ProofBound      : FldReElt                     Default: 6
ExtraRelations  : RngIntElt                    Default: 1
Al              : MonStgElt                    Default: "Automatic"
```

The class number of the maximal order $O$ or the maximal order of the quadratic field $K$.

<a id="function-picardgroup-rngquad"></a>
##### `PicardGroup(O): RngQuad -> GrpAb, Map`

<a id="function-picardnumber-rngquad"></a>
##### `PicardNumber(O): RngQuad -> RngIntElt`

```magma
FactorBasisBound: FldReElt                     Default: 0.1
ProofBound      : FldReElt                     Default: 6
ExtraRelations  : RngIntElt                    Default: 1
Al              : MonStgElt                    Default: "Automatic"
```

The picard group (the group of the invertible ideals of $O$ modulo the principal ones) of the order $O$ or the size of this group. `PicardGroup` also returns a map from the group to the ideals of $O$.

<a id="example-ex-a05688"></a>
##### `Example: Class Groups by Sieving (ex-a05688)`

We give examples of class group calculations using sieving. We also show the use of the mapping between the group and the set of ideals. First a field with negative discriminant.

```magma
> D:=-(10^(30) + 3 );
> K := QuadraticField(D);
> time G, m := ClassGroup(K : Al := "Sieve");
Time: 10.750
> G, m;
Abelian Group isomorphic to Z/125355959329602
Defined on 1 generator
Relations:
    125355959329602*G.1 = 0
Mapping from: GrpAb: G to Set of ideals of Maximal Order of K
> m(G.1);
Ideal
Two element generators:
    385706622580333
    148769598702327446467038390888*$.2 + 307255216496036
> $1 @@ m;
G.1
```

And now a field with positive discriminant.

```magma
> K := QuadraticField(NextPrime(10^24));
> time G, m := ClassGroup(K : Al := "Sieve");
Time: 3.330
> G, m;
Abelian Group isomorphic to Z/3
Defined on 1 generator
Relations:
    3*$.1 = 0
Mapping from: GrpAb: G to Set of ideals of Maximal Equation Order of K
> m(G.1);
Ideal
Two element generators:
    3847
    $.2 + 616
> $1 @@ m;
G.1
> IsPrincipal($2^3);
true
```

<a id="function-quadraticclassgrouptwopart-fldquad"></a>
##### `QuadraticClassGroupTwoPart(K): FldQuad -> GrpAb, Map`

<a id="function-quadraticclassgrouptwopart-rngquad"></a>
##### `QuadraticClassGroupTwoPart(O): RngQuad -> GrpAb, Map`

<a id="function-quadraticclassgrouptwopart-rngintelt"></a>
##### `QuadraticClassGroupTwoPart(d): RngIntElt -> GrpAb, Map`

```magma
Factorization: RngIntEltFact                    Default: []
```

Use the Bosma-Stevenhagen algorithm to compute the 2-part of the class group of a quadratic order. Returned are: an array of forms that generates the 2-part and an array that gives the orders of the respective elements. The Factorization of the given discriminant can be given as additional information.

<a id="example-ex-53f1e4"></a>
##### `Example: Two-Part of a Quadratic Class Group (ex-53f1e4)`

```magma
> G, f := QuadraticClassGroupTwoPart(33923894057872); G;
Abelian Group isomorphic to Z/2 + Z/2 + Z/2 + Z/4 + Z/16 + Z/16
> Random(G);
11*G.1 + 2*G.2 + G.3 + G.4 + G.6
> f($1);
<-1212992,3947508,3780131>
> G, f := QuadraticClassGroupTwoPart(QuadraticField(33923894057872)); G;
Abelian Group isomorphic to Z/2 + Z/8 + Z/16
```

#### Norm Equations

For imaginary quadratic fields, (that is, for quadratic fields ${\mathbb{Q}}(\sqrt m)$ with $m < 0$), the function `NormEquation` is provided specially for quadratics to find integral elements of a given norm. For real quadratic fields conics are used, see Section [Finding Points](https://docs.magma-maths.org/ArithmeticGeometry/RationalCurvesAndConics/crvcon-sec-ratpoints.md#crvcon-subsec-point-finding) for details.

<a id="function-normequation-fldquad-rngintelt"></a>
##### `NormEquation(F, m): FldQuad, RngIntElt -> BoolElt, SeqEnum`

<a id="function-normequation-fldquad-rngintelt-2"></a>
##### `NormEquation(F, m: parameters): FldQuad, RngIntElt -> BoolElt, SeqEnum`

<a id="function-normequation-rngquad-rngintelt"></a>
##### `NormEquation(O, m): RngQuad, RngIntElt -> BoolElt, SeqEnum`

<a id="function-normequation-rngquad-rngintelt-2"></a>
##### `NormEquation(O, m: parameters): RngQuad, RngIntElt -> BoolElt, SeqEnum`

```magma
Factorization: [<RngIntElt, RngIntElt>]                    Default: 
All          : BoolElt                                     Default: true
Solutions    : RngIntElt                                   Default: All
Exact        : BoolElt                                     Default: false
Ineq         : BoolElt                                     Default: false
NormEquation : Verbose                                     Default: 1
```

Given quadratic field $F$ and a non-negative integer $m$, return `true` if there exists an element $\alpha$ in the ring of integers $O_F$ of $F$ with norm $m$, and `false` otherwise. Instead of searching the maximal order $O_F$ it is possible to search any suborder $O$ of $O_F$ for such element $\alpha$ by supplying $O$ as a first argument. For imaginary quadratic fields the method used is constructive (it uses Cornacchia’s algorithm, see [[Coh93](https://docs.magma-maths.org/references.md#cite-cohen1)] section 1.5.2), and if the value `true` is returned then a solution $[x]$ is also returned as a second return value. Note that if the discriminant $F={\mathbb{Q}}(\sqrt{d})$ with $d\equiv1\bmod4$ (and squarefree) this function searches for a solution in integers to $x^2+y^2d=4m$ (and the solution $\alpha={x+y\sqrt{d}\over 2}$ is returned), whereas for $d\equiv 2, 3\bmod4$ a solution $\alpha=x+y\sqrt{d}$ with $x^2+y^2d=m$ in integers $x, y$ is returned, if it exists. In an order of conductor $f$ a search is conducted for a solution to the same equation with $d$ replaced by $f^2d$. Note that a version of `NormEquation` with integer arguments $d$ and $m$ also exists (see Section [The Solution of Modular Equations](https://docs.magma-maths.org/BasicRings/Integers/modular.md#rngint-normeq)). Unless $m$ is the square of an integer, the factorization of $m$ is used by the algorithm; if it is known, it may be supplied as the value of the optional parameter `Factorization` to speed up the calculation. A verbose flag can be set to obtain some information on progress with the computation (see [`SetVerbose`](https://docs.magma-maths.org/MagmaLanguage/EnvironmentAndOptions/verbose.md#procedure-env-setverbose)).

For real quadratic fields the same algorithm is used as for the general number fields. The last $4$ parameters refer to this algorithm. See Section [Solving Norm Equations](https://docs.magma-maths.org/GlobalFields/NumberFields/norm-equation.md#fldnum-main-norm-equation) for a description.

<a id="example-ex-6e8332"></a>
##### `Example: Norm Equation in a Quadratic Order (ex-6e8332)`

```magma
> d := 302401481761723680;
> m := 76814814791186002463716;
> Q<z> := QuadraticField(-d);
> O<w> := sub< MaximalOrder(Q) | 6 >;
> f, s := NormEquation(O, m);
> s, Norm(s[1]);
406 + 1008*w 76814814791186002463716
```

### Special Element Operations

Several functions are available only for elements of certain maximal orders.

The maximal orders of `QuadraticField(d)` for $d = -1, -2, -3, -7, -11, 2, 3, 5$ and $13$ are Euclidean with respect to the `Norm`. The division algorithm, Euclidean algorithm, GCD, and LCM are available for these orders only. Below, we will refer to these orders as the “special Euclidean orders”.

#### Division Algorithm

<a id="operation-operation-div-rngquadelt-rngquadelt-rngquadelt"></a>
##### `a div b: RngQuadElt, RngQuadElt -> RngQuadElt`

This operation is available for all orders, but its behaviour depends on whether the order $R$ containing $a$ and $b$ is one of the special Euclidean orders listed above.

When $R$ is not a special Euclidean order, this returns the exact quotient of $a$ and $b$. An error results if $a$ is not exactly divisible by $b$ in $R$.

When $R$ is a special Euclidean order, this performs the division algorithm in $R$. It finds uniquely determined elements $q$ and $r$ in $R$ such that $a = q b + r$ and [`Norm`](https://docs.magma-maths.org/search.html?q=Norm&show=intrinsics&match=exact)$(r) < \ $[`Norm`](https://docs.magma-maths.org/search.html?q=Norm&show=intrinsics&match=exact)$(b)$, and returns $q$.

<a id="operation-operation-mod-rngquadelt-rngquadelt-rngquadelt"></a>
##### `a mod b: RngQuadElt, RngQuadElt -> RngQuadElt`

This operation requires $a$ and $b$ to belong to one of the special Euclidean orders listed above. It performs the same calculation as `div`, and returns the remainder $r$.

<a id="function-greatestcommondivisor-rngquadelt-rngquadelt"></a>
##### `GreatestCommonDivisor(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

<a id="function-gcd-rngquadelt-rngquadelt"></a>
##### `Gcd(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

<a id="function-gcd-rngquadelt-rngquadelt-2"></a>
##### `GCD(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

The greatest common divisor of $a$ and $b$, which must be elements of one of the special Euclidean orders listed above.

<a id="function-leastcommonmultiple-rngquadelt-rngquadelt"></a>
##### `LeastCommonMultiple(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

<a id="function-lcm-rngquadelt-rngquadelt"></a>
##### `Lcm(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

<a id="function-lcm-rngquadelt-rngquadelt-2"></a>
##### `LCM(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

The least common multiple of $a$ and $b$, which must be elements of one of the special Euclidean orders listed above.

<a id="function-modexp-rngquadelt-rngint-rngquadelt"></a>
##### `Modexp(a, e, n): RngQuadElt, RngInt, RngQuadElt -> RngQuadElt`

This returns $a^e \bmod n$, where $a$ and $n$ must be elements of one of the special Euclidean orders listed above.

#### Factorization

Magma’s factorization in maximal orders of quadratic number fields is based upon factoring the norm in the integers. Thus, the comments that are made about the `Factorization` command in the integers also apply here. Moreover, since the factorization may be off by a unit power, that power is also returned (the unit being -1, $\sqrt{-1}$, or $(1 + \sqrt{-3})/2$).

<a id="function-factorization-rngquadelt"></a>
##### `Factorization(n): RngQuadElt -> SeqEnum, Tup`

<a id="function-factorisation-rngquadelt"></a>
##### `Factorisation(n): RngQuadElt -> SeqEnum, Tup`

The factorization of $n$ in the maximal order of the quadratic number field $Q(\sqrt{d})$, where $d$ is one of: -1, -2, -3, -7, or -11. Returns the factorization along with the appropriate power of a unit (the unit being -1, $\sqrt{-1}$, or $(1 + \sqrt{-3})/2$).

<a id="function-trialdivision-rngquadelt-rngintelt"></a>
##### `TrialDivision(n, B): RngQuadElt, RngIntElt -> SeqEnum, SeqEnum, Tup`

Trial division of $n$ by primes of relative norm $\leq$ B in the maximal order of $Q(\sqrt{d})$, where $d$ is one of: -1, -2, -3, -7, or -11. Returns the factored part, the unfactored part, and the power of the unit that the factorization is off by (the unit being -1, $\sqrt{-1}$, or $(1 + \sqrt{-3})/2$).

#### Conjugates

<a id="function-complexconjugate-fldquadelt"></a>
##### `ComplexConjugate(a): FldQuadElt -> FldQuadElt`

<a id="function-complexconjugate-rngquadelt"></a>
##### `ComplexConjugate(a): RngQuadElt -> RngQuadElt`

The complex conjugate of quadratic field element $a$; returns $a$ in a real quadratic field and $\bar a=x-y\sqrt{d}$ if $a=x+y\sqrt{d}$ in an imaginary quadratic field ${\mathbb{Q}}(\sqrt{d})$.

<a id="function-conjugate-fldquadelt"></a>
##### `Conjugate(a): FldQuadElt -> FldQuadElt`

<a id="function-conjugate-rngquadelt"></a>
##### `Conjugate(a): RngQuadElt -> RngQuadElt`

The conjugate $x-y\sqrt{d}$ of $a=x+y\sqrt{d}$ in the quadratic field ${\mathbb{Q}}(\sqrt{d})$.

#### Other Element Functions

For the ring of integers of ${\mathbb{Q}}({\mathrm{i}})$ the biquadratic residue symbol (generalizing the Legendre symbol) is available.

<a id="function-biquadraticresiduesymbol-rngquadelt-rngquadelt"></a>
##### `BiquadraticResidueSymbol(a, b): RngQuadElt, RngQuadElt -> RngQuadElt`

Given a Gaussian integer $a$ and a primary, non-unit Gaussian integer $b$, where $a$ and $b$ are coprime, return the value of the biquadratic character $\left( {a\over b}\right)_4$. The value of this character is equal to ${\mathrm{i}}^k$, for some $k\in\{0,1,2,3\}$. If $a$ and $b$ have a factor in common, the function returns $0$, if $b$ is not primary or $b$ is a unit an error results.

<a id="function-primary-rngquadelt"></a>
##### `Primary(a): RngQuadElt -> RngQuadElt`

Return the unique associate $\bar a$ of the Gaussian integer $a$ that satisfies

$$
\bar a \equiv 1\bmod(1+{\mathrm{i}})^3,
$$

or 0 in case $a$ is divisible by $1+{\mathrm{i}}$.

<a id="example-ex-c87bf6"></a>
##### `Example: Primes with 2 as a Biquadratic Residue (ex-c87bf6)`

The following example checks for primes $p$ with $65\leq p\leq 1000$ and $p\equiv1\bmod 4$ a result that was conjectured by Euler and proved by Gauss, namely that

$$
z^4\equiv 2\bmod p\quad\hbox{\rm has a solution}\iff p=x^2+64y^2\quad\text{\rm for some }x, y.
$$

We use the function `NormEquation` to find the prime above $p$ in the Gaussian integers, and we build the set of such primes for which $2$ is a biquadratic residue (which means that $z^4\equiv 2\bmod p$ for some $z$).

```magma
> s := { };
> Q := QuadraticField(-1);
> M := RingOfIntegers(Q);
> for p := 65 to 1000 by 4 do
>    if IsPrime(p) then
>       _, x := NormEquation(Q, p);
>       if BiquadraticResidueSymbol(2, Primary(M!x[1])) eq 1 then
>          Include(~s, p);
>       end if;
>    end if;
> end for;
> s;
{ 73, 89, 113, 233, 257, 281, 337, 353, 577, 593, 601, 617, 881, 937 }
```

Next we create the set of all primes as above that are of the form $x^2+64y^2$. Note that we have to use `NormEquation` on a suborder of $Q$ now, because we want to solve $x^2+64y^2=p$, while `QuadraticField(-64)` returns just ${\mathbb{Q}}({\mathrm{i}})$ in which we can only solve $x^2+y^2=p$.

```magma
> S := sub<MaximalOrder(Q) | 8>;
> t := { };
> for p := 65 to 1000 by 4 do
>    if IsPrime(p) then
>       if NormEquation(S, p) then
>           Include(~t, p);
>       end if;
>    end if;
> end for;
> t;
{ 73, 89, 113, 233, 257, 281, 337, 353, 577, 593, 601, 617, 881, 937 }
```

### Special Functions for Ideals

Ideals of orders of quadratic fields inherit from ideals of orders of number fields (see Section [Ideals and Quotients](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngord-ideal) for the list of general functions and operations available). However there is also a correspondence between quadratic ideals and binary quadratic forms (see Chapter [Binary Quadratic Forms](https://docs.magma-maths.org/LatticesQuadraticForms/BinaryQuadraticForms/index-binary-quadratic-forms.md#quadbin)). The following functions make use of that correspondence.

<a id="function-content-rngquadfracidl"></a>
#### `Content(I): RngQuadFracIdl -> RngQuadFracIdl`

The content of the ideal.

<a id="function-conjugate-rngquadfracidl"></a>
#### `Conjugate(I): RngQuadFracIdl -> RngQuadFracIdl`

The conjugate of the ideal.

<a id="function-discriminant-rngquadfracidl"></a>
#### `Discriminant(I): RngQuadFracIdl -> RngIntElt`

The discriminant of the quadratic form associated with $I$.

<a id="function-quadraticform-rngquadfracidl"></a>
#### `QuadraticForm(I): RngQuadFracIdl -> QuadBinElt`

The quadratic form associated with $I$.

<a id="function-ideal-quadbinelt"></a>
#### `Ideal(f): QuadBinElt -> RngQuadIdl`

The quadratic ideal with associated quadratic form $f$.

<a id="function-reduction-rngquadfracidl"></a>
#### `Reduction(I): RngQuadFracIdl -> RngQuadFracIdl`

The quadratic ideal with associated quadratic form which is a reduction of the quadratic form associated to $I$.

<a id="cyclotomic"></a>
<a id="chapfldcyc"></a>
## Cyclotomic Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/introduction.md)
- [Creation Functions](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md)
  - [Creation of Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#creation-of-cyclotomic-fields)
    - [`CyclotomicField(m): RngIntElt → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-cyclotomicfield-rngintelt)
    - [`CyclotomicPolynomial(m): RngIntElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-cyclotomicpolynomial-rngintelt)
    - [`MinimalField(a): FldRatElt → FldRat`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-fldratelt)
    - [`MinimalField(a): FldCycElt → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-fldcycelt)
    - [`MinimalField(a): RngCycElt → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-rngcycelt)
    - [`MinimalCyclotomicField(a): FldRatElt → FldRat`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-fldratelt)
    - [`MinimalCyclotomicField(a): FldCycElt → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-fldcycelt)
    - [`MinimalCyclotomicField(a): RngCycElt → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-rngcycelt)
    - [`MinimalField(S): [ FldCycElt ] → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-fldcycelt-2)
    - [`MinimalField(S): { FldCycElt } → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-fldcycelt-3)
    - [`MinimalField(S): [ RngCycElt ] → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-rngcycelt-2)
    - [`MinimalField(S): { RngCycElt } → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalfield-rngcycelt-3)
    - [`MinimalCyclotomicField(S): [ FldCycElt ] → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-fldcycelt-2)
    - [`MinimalCyclotomicField(S): Setq → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-setq)
    - [`MinimalCyclotomicField(S): { FldCycElt } → FldCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-fldcycelt-3)
    - [`MinimalCyclotomicField(S): [ RngCycElt ] → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-rngcycelt-2)
    - [`MinimalCyclotomicField(S): { RngCycElt } → RngCyc`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimalcyclotomicfield-rngcycelt-3)
    - [Example: Dense and Sparse Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#example-ex-644033)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#creation-of-elements)
    - [`RootOfUnity(n): RngIntElt → FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-rootofunity-rngintelt)
    - [`RootOfUnity(n, K): RngIntElt, FldCyc → FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-rootofunity-rngintelt-fldcyc)
    - [`Minimise(~a): FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimise-fldcycelt-ref)
    - [`Minimize(~a): FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimize-fldcycelt-ref)
    - [`Minimise(~a): RngCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimise-rngcycelt-ref)
    - [`Minimize(~a): RngCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimize-rngcycelt-ref)
    - [`Minimise(~s): [ FldCycElt ]`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimise-fldcycelt-ref-2)
    - [`Minimize(~s): [ FldCycElt ]`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimize-fldcycelt-ref-2)
    - [`Minimise(~s): [ RngCycElt ]`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimise-rngcycelt-ref-2)
    - [`Minimize(~s): [ RngCycElt ]`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#procedure-minimize-rngcycelt-ref-2)
    - [`Minimise(a): FldCycElt → RngElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimise-fldcycelt)
    - [`Minimize(a): FldCycElt → RngElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimize-fldcycelt)
    - [`Minimise(a): RngCycElt → RngElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimise-rngcycelt)
    - [`Minimize(a): RngCycElt → RngElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimize-rngcycelt)
    - [`Minimise(s): { FldCycElt } → { RngElt }`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimise-fldcycelt-2)
    - [`Minimize(s): { FldCycElt } → { RngElt }`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimize-fldcycelt-2)
    - [`Minimise(s): { RngCycElt } → { RngElt }`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimise-rngcycelt-2)
    - [`Minimize(s): { RngCycElt } → { RngElt }`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#function-minimize-rngcycelt-2)
- [Structure Operations](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#invariants)
    - [`Conductor(K): FldCyc → RngIntElt, [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#function-conductor-fldcyc)
    - [`CyclotomicOrder(K): FldCyc → RngIntElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#function-cyclotomicorder-fldcyc)
    - [`CyclotomicOrder(K): FldRat → RngIntElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#function-cyclotomicorder-fldrat)
    - [`CyclotomicAutomorphismGroup(K): FldCyc → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#function-cyclotomicautomorphismgroup-fldcyc)
    - [`CyclotomicRelativeField(k, K): FldCyc, FldCyc → FldNum`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/structure.md#function-cyclotomicrelativefield-fldcyc-fldcyc)
- [Element Operations](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md)
  - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#predicates-on-elements)
    - [`IsReal(a): FldCycElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-isreal-fldcycelt)
    - [`IsReal(a): RngCycElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-isreal-rngcycelt)
  - [Conjugates](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#conjugates)
    - [`ComplexConjugate(a): FldCycElt → FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-complexconjugate-fldcycelt)
    - [`ComplexConjugate(a): RngCycElt → RngCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-complexconjugate-rngcycelt)
    - [`Conjugate(a, n): FldCycElt, RngIntElt → FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-conjugate-fldcycelt-rngintelt)
    - [`Conjugate(a, n): RngCycElt, RngIntElt → RngCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-conjugate-rngcycelt-rngintelt)
    - [`Conjugate(a, r): FldCycElt, FldCycElt → FldCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-conjugate-fldcycelt-fldcycelt)
    - [`Conjugate(a, r): RngCycElt, RngCycElt → RngCycElt`](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#function-conjugate-rngcycelt-rngcycelt)
    - [Example: Gaussian Periods](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/element.md#example-ex-591c1c)

### Introduction

Cyclotomic Fields (like the Quadratic Fields) are a subtype of the Number Fields (`FldNum`). They have some extra functionality which is described below and use some more efficient implementations. Orders of cyclotomic fields form the category `RngCyc` and the fields themselves `FldCyc`. Functions for cyclotomic fields and orders which work generally for number fields, their orders, and elements are listed in Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).

There are two different representations of cyclotomic fields available:

- The “dense” representation: the field is conceptually represented as $Q(x)/f(x)$ where $f$ is a cyclotomic polynomial, i.e., the minimal polynomial of a primitive root of unity.
- The “sparse” representation: Let $n=\prod p_i^{r_i}$ be the factorisation of $n$ into prime powers and $n_i := p_i^{r_i}$. Then $Q(\zeta_n) = Q(\zeta_{n_1}, \ldots, \zeta_{n_r})$ and the field is represented as $Q(x_1, \ldots, x_r)/\langle f_{n_1}(x_1), \ldots, f_{n_r}(x_r)\rangle$.

As with the number fields, the non-simple representation, the issues are the same: the “sparse” representation allows for much larger fields – as long as the elements used have only few coefficients. The “dense” representation on the other hand has the asymptotically-fastest arithmetic.

<a id="creation"></a>
<a id="fldcyc-creation"></a>
### Creation Functions

Functions are provided to create fields of the special type `FldCyc`. Orders and elements created from a field of this type will have the special types `RngCyc` and `FldCycElt` respectively and elements created from orders `RngCycElt`. These functions provide an object with the correct type which will allow the extra functions and efficient implementations to be used.

#### Creation of Cyclotomic Fields

Cyclotomic fields can be created from an integer specifying which roots of unity it should contain or from a collection of elements of an existing field or order. Cyclotomic polynomials can also be retrieved independently of the fields and orders.

<a id="function-cyclotomicfield-rngintelt"></a>
##### `CyclotomicField(m): RngIntElt -> FldCyc`

```magma
Sparse: Boolean                    Default: false
```

Given a positive integer $m$, create the field obtained by adjoining the $m$-th roots of unity to ${\mathbb{Q}}$. It is possible to assign a name to the primitive $m$-th root of unity $\zeta_{m}$ using angle brackets: `R<s> := CyclotomicField(m)`.

If ```Sparse := ``true```, names for all the generating elements can be assigned.

<a id="function-cyclotomicpolynomial-rngintelt"></a>
##### `CyclotomicPolynomial(m): RngIntElt -> RngUPolElt`

Given a positive integer $m$, create the cyclotomic polynomial of order $m$. This function is equivalent to `DefiningPolynomial(CyclotomicField(m))`.

<a id="function-minimalfield-fldratelt"></a>
##### `MinimalField(a): FldRatElt -> FldRat`

<a id="function-minimalfield-fldcycelt"></a>
##### `MinimalField(a): FldCycElt -> FldCyc`

<a id="function-minimalfield-rngcycelt"></a>
##### `MinimalField(a): RngCycElt -> RngCyc`

<a id="function-minimalcyclotomicfield-fldratelt"></a>
##### `MinimalCyclotomicField(a): FldRatElt -> FldRat`

<a id="function-minimalcyclotomicfield-fldcycelt"></a>
##### `MinimalCyclotomicField(a): FldCycElt -> FldCyc`

<a id="function-minimalcyclotomicfield-rngcycelt"></a>
##### `MinimalCyclotomicField(a): RngCycElt -> RngCyc`

Given an element $a$ from a cyclotomic field $F$ or ring $R$, this function returns the smallest cyclotomic field or order thereof (possibly the rational field or the ring of integers) $E\subset F$ containing $a$.

<a id="function-minimalfield-fldcycelt-2"></a>
##### `MinimalField(S): [ FldCycElt ] -> FldCyc`

<a id="function-minimalfield-fldcycelt-3"></a>
##### `MinimalField(S): { FldCycElt } -> FldCyc`

<a id="function-minimalfield-rngcycelt-2"></a>
##### `MinimalField(S): [ RngCycElt ] -> RngCyc`

<a id="function-minimalfield-rngcycelt-3"></a>
##### `MinimalField(S): { RngCycElt } -> RngCyc`

<a id="function-minimalcyclotomicfield-fldcycelt-2"></a>
##### `MinimalCyclotomicField(S): [ FldCycElt ] -> FldCyc`

<a id="function-minimalcyclotomicfield-setq"></a>
##### `MinimalCyclotomicField(S): Setq -> FldCyc`

<a id="function-minimalcyclotomicfield-fldcycelt-3"></a>
##### `MinimalCyclotomicField(S): { FldCycElt } -> FldCyc`

<a id="function-minimalcyclotomicfield-rngcycelt-2"></a>
##### `MinimalCyclotomicField(S): [ RngCycElt ] -> RngCyc`

<a id="function-minimalcyclotomicfield-rngcycelt-3"></a>
##### `MinimalCyclotomicField(S): { RngCycElt } -> RngCyc`

Given a set or sequence $S$ of cyclotomic field or ring elements, this function returns the smallest cyclotomic field or ring (possibly the rational field or integers) $G$ containing each of the elements of $S$.

<a id="example-ex-644033"></a>
##### `Example: Dense and Sparse Cyclotomic Fields (ex-644033)`

We will demonstrate the difference between the “dense” and the “sparse” representation on the cyclotomic field of order 100.

```magma
> K1 := CyclotomicField(100);
> K2 := CyclotomicField(100: Sparse := true);
> K2!K1.1;
zeta(100)_4*zeta(100)_25^19
```

Where `zeta(100)_25` indicates a 25th root of unity in a field of order 100.

```magma
> K1!K2.1;
zeta_100^25
```

#### Creation of Elements

For elements of cyclotomic number fields the following conventions are used. Primitive roots of unity $\zeta_m$ are chosen in such a way that $\zeta_m^{m/d}=\zeta_d$, for every divisor $d$ of $m$; one may think of this as choosing $\zeta_m={\rm e}^{2\pi{\mathrm{i}}\over m}$ (where the roots of unity are $\zeta_m^k = {\rm e}^{2k\pi{\mathrm{i}}\over m}$) in the complex plane for every $m$ (a convention that is followed for the explicit embedding in the complex domains). Elements of cyclotomic fields and orders can also be created using coercion (`!`) and the elt constructor (`elt<|>`) where the left hand side is the field or order the element will lie in. For details about coercion see Section [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#fldnum-main-elt-create).

<a id="function-rootofunity-rngintelt"></a>
##### `RootOfUnity(n): RngIntElt -> FldCycElt`

Create the $n$-th root of unity $\zeta_n$ in ${\mathbb{Q}}(\zeta_n)$.

<a id="function-rootofunity-rngintelt-fldcyc"></a>
##### `RootOfUnity(n, K): RngIntElt, FldCyc -> FldCycElt`

Given a cyclotomic field $K = {\mathbb{Q}}(\zeta_m)$ and an integer $n>2$, create the $n$-th root of unity $\zeta_n$ in $K$. An error results if $\zeta_n\notin K$, that is, if $n$ does not divide $m$ (or $2m$ in case $m$ is odd).

<a id="procedure-minimise-fldcycelt-ref"></a>
##### `Minimise(~a): FldCycElt`

<a id="procedure-minimize-fldcycelt-ref"></a>
##### `Minimize(~a): FldCycElt`

<a id="procedure-minimise-rngcycelt-ref"></a>
##### `Minimise(~a): RngCycElt`

<a id="procedure-minimize-rngcycelt-ref"></a>
##### `Minimize(~a): RngCycElt`

Given an element $a$ in a cyclotomic field $F$ or ring $R$, this procedure finds the minimal cyclotomic subfield $E\subset F$ or subring $E \subset F$ containing $a$, and coerces $a$ into $E$. Note that $E$ may be ${\mathbb{Q}}$ or ${\mathbb{Z}}$.

<a id="procedure-minimise-fldcycelt-ref-2"></a>
##### `Minimise(~s): [ FldCycElt ]`

<a id="procedure-minimize-fldcycelt-ref-2"></a>
##### `Minimize(~s): [ FldCycElt ]`

<a id="procedure-minimise-rngcycelt-ref-2"></a>
##### `Minimise(~s): [ RngCycElt ]`

<a id="procedure-minimize-rngcycelt-ref-2"></a>
##### `Minimize(~s): [ RngCycElt ]`

Given a set $s$ of cyclotomic field or ring elements, this procedure finds the minimal cyclotomic field or ring $E$ containing all of them, and coerces each element into $E$. The resulting set will have universe $E$. Note that $E$ may be ${\mathbb{Q}}$ or ${\mathbb{Z}}$.

<a id="function-minimise-fldcycelt"></a>
##### `Minimise(a): FldCycElt -> RngElt`

<a id="function-minimize-fldcycelt"></a>
##### `Minimize(a): FldCycElt -> RngElt`

<a id="function-minimise-rngcycelt"></a>
##### `Minimise(a): RngCycElt -> RngElt`

<a id="function-minimize-rngcycelt"></a>
##### `Minimize(a): RngCycElt -> RngElt`

Given an element $a$ in a cyclotomic field $F$ or ring $R$, this function finds the minimal cyclotomic subfield $E\subset F$ or subring $E \subset R$ containing $a$, and coerces $a$ into $E$. Note that $E$ may be ${\mathbb{Q}}$ or ${\mathbb{Z}}$.

<a id="function-minimise-fldcycelt-2"></a>
##### `Minimise(s): { FldCycElt } -> { RngElt }`

<a id="function-minimize-fldcycelt-2"></a>
##### `Minimize(s): { FldCycElt } -> { RngElt }`

<a id="function-minimise-rngcycelt-2"></a>
##### `Minimise(s): { RngCycElt } -> { RngElt }`

<a id="function-minimize-rngcycelt-2"></a>
##### `Minimize(s): { RngCycElt } -> { RngElt }`

Given a set $s$ of cyclotomic field or ring elements, this function finds the minimal cyclotomic field $E$ containing all of them, and coerces each element into $E$. The resulting set will have universe $E$. Note that $E$ may be ${\mathbb{Q}}$ or ${\mathbb{Z}}$.

### Structure Operations

In cyclotomic fields the generic ring functions are supported (see Chapter [Introduction to Rings](https://docs.magma-maths.org/BasicRings/IntroductionToRings/index-introduction-to-rings.md#rngintro)). The functions listed below are those functions for cyclotomic fields which are additional to those for number fields. For the list of functions applying to general number fields see Section [Creation Functions](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#fldnum-create) and Section [Structure Operations](https://docs.magma-maths.org/GlobalFields/NumberFields/operation.md#fldnum-str-op).

#### Invariants

<a id="function-conductor-fldcyc"></a>
##### `Conductor(K): FldCyc -> RngIntElt, [RngIntElt]`

The smallest $n$ such that the field $K$ is contained in ${\mathbb{Q}}(\zeta_n)$; for a cyclotomic field that is either the ‘cyclotomic order’ $m$ (see below) or half that, depending on whether $m \equiv 2 \bmod 4$. The second return value is a sequence of the ramified real places of $K$.

<a id="function-cyclotomicorder-fldcyc"></a>
##### `CyclotomicOrder(K): FldCyc -> RngIntElt`

<a id="function-cyclotomicorder-fldrat"></a>
##### `CyclotomicOrder(K): FldRat -> RngIntElt`

The value of $m$ for the cyclotomic field ${\mathbb{Q}}(\zeta_m)$. Note that this will be the $m$ with which the cyclotomic field was created.

<a id="function-cyclotomicautomorphismgroup-fldcyc"></a>
##### `CyclotomicAutomorphismGroup(K): FldCyc -> GrpAb, Map`

Returns the automorphism group of $K$ as an abstract abelian group $G$ and a map from $G$ into the set of all automorphisms. Note that similar functionality is also available through [`AutomorphismGroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-automorphismgroup) however, this function returns an abelian group and uses the fact that the automorphism group is already determined by the conductor.

<a id="function-cyclotomicrelativefield-fldcyc-fldcyc"></a>
##### `CyclotomicRelativeField(k, K): FldCyc, FldCyc -> FldNum`

Given two cyclotomic fields $k\subseteq K$ a number field $L/k$ is computed that is isomorphic to $K$.

### Element Operations

For the full range of operations for elements of a number field or order see Section [Element Operations](https://docs.magma-maths.org/GlobalFields/NumberFields/operation-element.md#fldnum-elt-ops).

#### Predicates on Elements

Because of the nature of cyclotomic fields and orders, some properties of elements are easier to determine than in the general case.

<a id="function-isreal-fldcycelt"></a>
##### `IsReal(a): FldCycElt -> BoolElt`

<a id="function-isreal-rngcycelt"></a>
##### `IsReal(a): RngCycElt -> BoolElt`

Whether the cyclotomic field or ring element $a$ is a real number, i.e., if it is invariant under the complex conjugation.

#### Conjugates

Elements of cyclotomic fields and orders can additionally have their complex conjugate computed. Conjugates are returned as cyclotomic elements (and not reals) and which conjugate is wanted can be indicated by providing a primitive root of unity.

<a id="function-complexconjugate-fldcycelt"></a>
##### `ComplexConjugate(a): FldCycElt -> FldCycElt`

<a id="function-complexconjugate-rngcycelt"></a>
##### `ComplexConjugate(a): RngCycElt -> RngCycElt`

The complex conjugate of cyclotomic field or ring element $a$.

<a id="function-conjugate-fldcycelt-rngintelt"></a>
##### `Conjugate(a, n): FldCycElt, RngIntElt -> FldCycElt`

<a id="function-conjugate-rngcycelt-rngintelt"></a>
##### `Conjugate(a, n): RngCycElt, RngIntElt -> RngCycElt`

The image under the map $\zeta \mapsto \zeta^n$. The second argument ($n$) must be coprime to the conductor.

<a id="function-conjugate-fldcycelt-fldcycelt"></a>
##### `Conjugate(a, r): FldCycElt, FldCycElt -> FldCycElt`

<a id="function-conjugate-rngcycelt-rngcycelt"></a>
##### `Conjugate(a, r): RngCycElt, RngCycElt -> RngCycElt`

The conjugate of the element $a\in{\mathbb{Q}}(\zeta_m)$ or its order, obtained by applying the field automorphism $\zeta_m\mapsto r$ where $r$ is a primitive root of unity.

<a id="example-ex-591c1c"></a>
##### `Example: Gaussian Periods (ex-591c1c)`

The following lines of code generate a set $W$ of minimal polynomials for the so-called Gaussian periods

$$
\eta_d=\sum_{i=0}^{(l-1)/d-1}\zeta_l^{g^{{d}i}}
$$

where $\zeta_l$ is a primitive $l$-th root of unity ($l$ is prime), and where $g$ is a primitive root modulo $l$. These have the property that they generate a degree $d$ cyclic subfield of ${\mathbb{Q}}(\zeta_l)$. We (arbitrarily) choose $l=13$ in this example.

```magma
> R<x> := PolynomialRing(RationalField());
> W := { R | };
> l := 13;
> L<z> := CyclotomicField(l);
> M := Divisors(l-1);
> g := PrimitiveRoot(l);
> for m in M do
>    d := (l-1) div m;
>    g_d := g^d;
>    w := &+[z^g_d^i : i in [0..m-1] ];
>    Include(~W, MinimalPolynomial(w));
> end for;
```

Here is the same loop in just one line, using sequence reduction:

```magma
> W := { R | MinimalPolynomial(&+[z^(g^((l-1) div m))^i : i in [0..m-1] ]) :
>        m in M };
> W;
{
      x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 +
       x + 1,
      x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1,
      x^3 + x^2 - 4*x + 1,
      x + 1
      x^4 + x^3 + 2*x^2 - 4*x + 3,
      x^2 + x - 3,
}
```

<a id="algebraic-field"></a>
<a id="rngord-main"></a>
## Number Fields and Orders

- [Introduction](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/introduction.md)
  - [Types](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/introduction.md#types)
- [Acknowledgement](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/acknowledgement.md)
- [Creation Functions](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md)
  - [Creation of Algebraic Fields](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#creation-of-algebraic-fields)
    - [`NumberField(f): RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-numberfield-rngupolelt)
    - [`RationalsAsNumberField() → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rationalsasnumberfield)
    - [`QNF() → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-qnf)
    - [`NumberField(s): [ RngUPolElt ] → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-numberfield-rngupolelt-2)
    - [`ext< F | s1, ..., sn >: FldAlg, RngUPolElt, ..., RngUPolElt → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-fldalg-rngupolelt-rngupolelt-fldalg)
    - [`ext<F | s>: FldAlg, [RngUPolElt] → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-fldalg-rngupolelt-fldalg)
    - [`ext< Q | s1, ..., sn >: FldRat, RngUPolElt, ..., RngUPolElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-fldrat-rngupolelt-rngupolelt-fldnum)
    - [`ext< Q | s >: FldRat, [RngUPolElt] → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-fldrat-rngupolelt-fldnum)
    - [`RadicalExtension(F, d, a): Rng, RngIntElt, RngElt → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-radicalextension-rng-rngintelt-rngelt)
    - [`SplittingField(F): FldAlg → FldAlg, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-splittingfield-fldalg)
    - [`NormalClosure(F): FldAlg → FldAlg, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-normalclosure-fldalg)
    - [`SplittingField(f): RngUPolElt → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-splittingfield-rngupolelt)
    - [`SplittingField(L): [RngUPolElt] → FldNum, [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-splittingfield-rngupolelt-2)
    - [`sub< F | e₁, ..., eₙ >: FldAlg, FldAlgElt, ..., FldAlgElt → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-sub-fldalg-fldalgelt-fldalgelt-fldalg-map)
    - [`sub< F | S >: FldAlg, SeqEnum → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-sub-fldalg-seqenum-fldalg-map)
    - [`MergeFields(F, L): FldAlg, FldAlg → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-mergefields-fldalg-fldalg)
    - [`CompositeFields(F, L): FldAlg, FldAlg → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-compositefields)
    - [`Compositum(K, L): FldAlg, FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-compositum-fldalg-fldalg)
    - [`Compositum(K, A): FldAlg, FldAb → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-compositum-fldalg-fldab)
    - [`OptimizedRepresentation(F): FldAlg → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-optimizedrepresentation)
    - [`OptimisedRepresentation(F): FldAlg → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimisedrepresentation-fldalg)
    - [`OptimizedRepresentation(F, d): FldAlg, RngIntElt → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimizedrepresentation-fldalg-rngintelt)
    - [`OptimisedRepresentation(F, d): FldAlg, RngIntElt → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimisedrepresentation-fldalg-rngintelt)
    - [Example: Optimized Representation of a Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-509ba1)
  - [Creation of Orders and Fields from Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#creation-of-orders-and-fields-from-orders)
    - [`EquationOrder(f): RngUPolElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-equationorder-rngupolelt)
    - [`EquationOrder(S): [RngUPolElt] → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-equationorder-rngupolelt-2)
    - [`EquationOrder(K): FldNum → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-equationorder-fldnum)
    - [`SubOrder(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-suborder-rngord)
    - [`EquationOrder(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-equationorder-rngord)
    - [`Integers(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-integers-rngord)
    - [`RingOfIntegers(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-ringofintegers-rngord)
    - [`IntegerRing(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-integerring-rngord)
    - [Example: Equation Order and Ring of Integers](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-4c8125)
    - [`sub< O | a₁, ..., aᵣ >: RngOrd, RngOrdElt, ..., RngOrdElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-sub-rngord-rngordelt-rngordelt-rngord)
    - [`ext< O | a₁, ..., aᵣ >: RngOrd, RngOrdElt, ..., RngOrdElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-rngord-ext-seq)
    - [`ext< Z | f >: RngInt, RngUPolElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-rngint-rngupolelt-rngord)
    - [`ext< O | f >: RngOrd, RngUPolElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-ext-rngord-rngupolelt-rngord)
    - [`FieldOfFractions(O): RngOrd → FldOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-fieldoffractions)
    - [`Order(F): FldOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-order-fldord)
    - [`NumberField(O): RngOrd → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-numberfield-rngord)
    - [`NumberField(F): FldOrd → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-numberfield-fldord)
    - [Example: Bases of an Order and Its Fraction Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-94a3f9)
    - [`OptimizedRepresentation(O): RngOrd → BoolElt, RngOrd, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimizedrepresentation-rngord)
    - [`OptimisedRepresentation(O): RngOrd → BoolElt, RngOrd, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimisedrepresentation-rngord)
    - [`OptimizedRepresentation(O, d): RngOrd, RngIntElt → BoolElt, RngOrd, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimizedrepresentation-rngord-rngintelt)
    - [`OptimisedRepresentation(O, d): RngOrd, RngIntElt → BoolElt, RngOrd, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-optimisedrepresentation-rngord-rngintelt)
    - [`O + P: RngOrd, RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-plus-rngord-rngord)
    - [`O meet P: RngOrd, RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-meet-rngord-rngord)
    - [`AsExtensionOf(O, P): RngOrd, RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-asextensionof-rngord-rngord)
    - [`Order(O, T, d): RngOrd, AlgMatElt, RngIntElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-order-rngord-algmatelt-rngintelt)
    - [`Order(O, M): RngOrd, ModDed → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-order-rngord-modded)
    - [`Order(O, M): RngOrd, PMat → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-order-rngord-pmat)
    - [`Order( [ e₁, ... eₙ ] ): [FldAlgElt] → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-order-seq)
  - [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#maximal-orders)
    - [`MaximalOrder(O): RngOrd → RngOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-maximalorder-rngord)
    - [`MaximalOrder(F): FldAlg → RngOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-maximalorder)
    - [`IntegerRing(F): FldAlg → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-integerring-fldalg)
    - [`Integers(F): FldAlg → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-integers-fldalg)
    - [`RingOfIntegers(F): FldAlg → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-ringofintegers-fldalg)
    - [`MaximalOrder(f): RngUPolElt → RngOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-maxord)
    - [Example: Maximal Order with Known Ramification](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-474b81)
    - [Example: Maximal Order with new driver](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-474b82)
    - [Orders and Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#orders-and-ideals)
      - [`pMaximalOrder(O, p): RngOrd, RngIntElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-pmaximalorder-rngord-rngintelt)
      - [`pMaximalOrder(O, p): RngOrd, RngOrdIdl → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-pmaximalorder-rngord-rngordidl)
      - [`pRadical(O, p): RngOrd, RngIntElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-pradical-rngord-rngintelt)
      - [`pRadical(O, p): RngOrd, RngOrdIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-pradical-rngord-rngordidl)
      - [`MultiplicatorRing(I): RngOrdFracIdl → Rng`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-multiplicatorring-rngordfracidl)
      - [Example: Implementing the Round 2 Algorithm](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-638433)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#creation-of-elements)
    - [`F ! a: FldAlg, RngElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-fldalg-rngelt)
    - [`elt< F | a >: FldAlg, RngElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-fldalg-rngelt-fldalgelt)
    - [`F ! [a₀, a₁, ..., aₘ₋₁]: FldAlg, [RngElt] → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-fldalg-rngelt-2)
    - [`elt< F | [ a₀, a₁, ..., aₘ₋₁ ] >: FldAlg, SeqEnum[RngElt] → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-fldalg-seqenum-rngelt-fldalgelt)
    - [`elt< F | a₀, a₁, ..., aₘ₋₁>: FldAlg, RngElt, ..., RngElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-fldalg-rngelt-rngelt-fldalgelt)
    - [`O ! a: RngOrd, RngElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-rngord-rngelt)
    - [`elt< O | a >: RngOrd, RngElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-rngord-rngelt-rngordelt)
    - [`O ! [a₀, a₁, ..., aₘ₋₁]: RngOrd, [ RngElt ] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#operation-op-rngord-rngelt-2)
    - [`elt< O | [ a₀, a₁, ..., aₘ₋₁ ] >: RngOrd, SeqEnum[RngElt] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-rngord-seqenum-rngelt-rngordelt)
    - [`elt< O | a₀, a₁, ..., aₘ₋₁ >: RngOrd, RngElt, ..., RngElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-elt-rngord-rngelt-rngelt-rngordelt)
    - [`Random(F, m): FldAlg, RngIntElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-random-fldalg-rngintelt)
    - [`Random(O, m): RngOrd, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-random-rngord-rngintelt)
    - [`Random(I, m): RngOrdFracIdl, RngIntElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-random-rngordfracidl-rngintelt)
    - [Example: Three Ways to Create an Element](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-759e86)
    - [`One(K): FldAlg → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-one-fldalg)
    - [`One(O): RngOrd → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-one-rngord)
    - [`Identity(K): FldAlg → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-identity-fldalg)
    - [`Identity(O): RngOrd → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-identity-rngord)
    - [`Zero(K): FldAlg → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-zero-fldalg)
    - [`Zero(O): RngOrd → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-zero-rngord)
    - [`Representative(K): FldAlg → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-representative-fldalg)
    - [`Representative(O): RngOrd → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-representative-rngord)
  - [Creation of Homomorphisms](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#creation-of-homomorphisms)
    - [`hom< F -> R | r >: FldAlg, Rng, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-fldalg-rng-rngelt-map)
    - [`hom< F -> R | h, r >: FldAlg, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-fldalg-rng-map-rngelt-map)
    - [`hom< O -> R | r >: RngOrd, Rng, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-rngord-rng-rngelt-map)
    - [`hom< O -> R | h, r >: RngOrd, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-rngord-rng-map-rngelt-map)
    - [Example: Embedding a Quadratic Field in a Quartic Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-d59686)
    - [`hom< O -> R | b₁, ..., bₙ >: RngFunOrd, Rng, RngElt, ..., RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-rngfunord-rng-rngelt-rngelt-map)
    - [`hom< O -> R | m, b₁, ..., bₙ >: RngFunOrd, Rng, Map, RngElt, ..., RngElt → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#constructor-constructor-hom-rngfunord-rng-map-rngelt-rngelt-map)
    - [`IsRingHomomorphism(m): Map → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-isringhomomorphism-map)
- [Printing](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/printing.md)
  - [`SetVerbose(s, n): MonStgElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/printing.md#procedure-setverbose-monstgelt-rngintelt)
  - [`SetKantPrinting(f): BoolElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/printing.md#function-setkantprinting-boolelt)
- [Real Precision](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/precision.md)
  - [`SetKantPrecision(F, n): FldAlg, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/precision.md#procedure-setkantprecision-fldalg-rngintelt)
  - [`SetKantPrecision(F, n, m): FldAlg, RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/precision.md#procedure-setkantprecision-fldalg-rngintelt-rngintelt)
  - [`SetKantPrecision(O, n): RngOrd, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/precision.md#procedure-setkantprecision-rngord-rngintelt)
  - [`SetKantPrecision(O, n, m): RngOrd, RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/precision.md#procedure-setkantprecision-rngord-rngintelt-rngintelt)
- [Structure Operations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md)
  - [General Functions](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#general-functions)
    - [`Category(F): FldAlg → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-category-fldalg)
    - [`Parent(F): FldAlg → Pow`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-parent-fldalg)
    - [`Category(O): RngOrd → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-category-rngord)
    - [`Parent(O): RngOrd → Pow`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-parent-rngord)
    - [`AssignNames(~K, s): FldNum, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-assignnames-fldnum-monstgelt-ref)
    - [`Name(K, i): FldNum, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-name-fldnum-rngintelt)
    - [`K . i: FldNum, RngIntElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-operation-fldnum-rngintelt-fldnumelt)
    - [`AssignNames(~F, s): FldOrd, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-assignnames-fldord-monstgelt-ref)
    - [`F . i: FldOrd, RngIntElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-operation-fldord-rngintelt-fldordelt)
    - [`Name(F, i): FldOrd, RngIntElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-name-fldord-rngintelt)
    - [`O . i: RngOrd, RngIntElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-operation-rngord-rngintelt-fldordelt)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#related-structures)
    - [`GroundField(F): FldAlg → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-groundfield-fldalg)
    - [`BaseField(F): FldAlg → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basefield-fldalg)
    - [`CoefficientField(F): FldAlg → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-coefficientfield-fldalg)
    - [`CoefficientRing(F): FldAlg → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-coefficientring-fldalg)
    - [`BaseRing(O): RngOrd → Rng`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-basering)
    - [`CoefficientRing(O): RngOrd → Rng`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-coefficientring-rngord)
    - [`AbsoluteField(F): FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absolutefield-fldalg)
    - [`AbsoluteOrder(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absoluteorder-rngord)
    - [`SimpleExtension(F): FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-simpleextension-fldalg)
    - [`SimpleExtension(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-simpleextension-rngord)
    - [`RelativeField(F, L): FldAlg, FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-relativefield-fldalg-fldalg)
    - [`RelativeField(Q, L): FldRat, FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-relativefield-fldrat-fldalg)
    - [`Components(F): FldAlg → [FldAlg]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-components-fldalg)
    - [`Components(O): RngOrd → [RngOrd]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-components-rngord)
    - [Example: Compositum of Two Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-3aa334)
    - [`Simplify(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-simplify-rngord)
    - [`LLL(O): RngOrd → RngOrd, AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-lll-rngord)
    - [Example: LLL Reduction of an Order Basis](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-06710d)
    - [`PrimeRing(F): FldAlg → RngRat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-primering-fldalg)
    - [`PrimeField(F): FldAlg → RngRat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-primefield-fldalg)
    - [`PrimeRing(O): RngOrd → RngInt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-primering-rngord)
    - [`Centre(F): FldAlg → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-centre-fldalg)
    - [`Centre(O): RngOrd → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-centre-rngord)
    - [`Embed(F, L, a): FldAlg, FldAlg, FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-embed-fldalg-fldalg-fldalgelt)
    - [`Embed(F, L, a): FldAlg, FldAlg, [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-embed-fldalg-fldalg-fldalgelt-2)
    - [`EmbeddingMap(F, L): FldAlg, FldAlg → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-embeddingmap-fldalg-fldalg)
    - [`HasEmbedding(F, L): FldAlg, FldAlg → Bool`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-hasembedding-fldalg-fldalg)
    - [`HasEmbedding(O1, O2): RngOrd, RngOrd → Bool`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-hasembedding-rngord-rngord)
    - [`CanComputeEmbedding(F, L): FldAlg, FldAlg → Bool`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-cancomputeembedding-fldalg-fldalg)
    - [`CanComputeEmbedding(O1, O2): RngOrd, RngOrd → Bool`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-cancomputeembedding-rngord-rngord)
    - [Example: Embedding One Number Field in Another](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-a44554)
    - [`Completion(K, P): FldAlg, RngOrdIdl → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-completion1)
    - [`Completion(O, P): RngOrd, RngOrdIdl → RngLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-completion-rngord-rngordidl)
    - [`comp<K|P>: FldAlg, RngOrdIdl → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#constructor-constructor-comp-fldalg-rngordidl-fldloc-map)
    - [`comp<O|P>: RngOrd, RngOrdIdl → RngLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#constructor-constructor-comp-rngord-rngordidl-rngloc-map)
    - [`Completion(K, P): FldAlg, PlcNumElt → FldLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-completion-fldalg-plcnumelt)
    - [`LocalRing(P, prec): RngOrdIdl, RngIntElt → RngLoc, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-localring-rngordidl-rngintelt)
    - [`Localization(O, P): RngOrd, RngOrdIdl → RngVal, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-localization-rngord-rngordidl)
  - [Representing Fields as Vector Spaces](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#representing-fields-as-vector-spaces)
    - [`Algebra(K, J): FldAlg, Fld → AlgAss, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-algebra-fldalg-fld)
    - [`Algebra(K, J, S): FldAlg, Fld, [FldAlgElt] → AlgAss, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-algebra-fldalg-fld-fldalgelt)
    - [`VectorSpace(K, J): FldAlg, Fld → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-vectorspace-fldalg-fld)
    - [`KSpace(K, J): FldAlg, Fld → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-kspace-fldalg-fld)
    - [`VectorSpace(K, J, S): FldAlg, Fld, [FldAlgElt] → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-vectorspace-fldalg-fld-fldalgelt)
    - [`KSpace(K, J, S): FldAlg, Fld, [FldAlgElt] → ModTupFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-kspace-fldalg-fld-fldalgelt)
    - [Example: Minimal Polynomial over a Subfield](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-4636b1)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#invariants)
    - [`Characteristic(F): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-characteristic-fldalg)
    - [`Characteristic(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-characteristic-rngord)
    - [`Degree(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-degree-rngord)
    - [`Degree(F): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-degree)
    - [`AbsoluteDegree(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absolutedegree-rngord)
    - [`AbsoluteDegree(F): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absolutedegree-fldalg)
    - [`Discriminant(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-discriminant-rngord)
    - [`Discriminant(O): RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-discriminant-rngint)
    - [`Discriminant(F): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-discriminant)
    - [`Discriminant(O): RngOrd → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-discriminant-rngord-2)
    - [`Discriminant(F): FldAlg → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-discriminant-fldalg)
    - [`AbsoluteDiscriminant(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absolutediscriminant-rngord)
    - [`AbsoluteDiscriminant(K): FldAlg → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-absolutediscriminant-fldalg)
    - [`ReducedDiscriminant(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-reduceddiscriminant-rngord)
    - [`ReducedDiscriminant(F): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-reduceddiscriminant-fldalg)
    - [`ReducedDiscriminant(O): RngOrd → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-reduceddiscriminant-rngord-2)
    - [`ReducedDiscriminant(F): FldAlg → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-reduceddiscriminant-fldalg-2)
    - [`Regulator(O: parameters): RngOrd → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-regulator-rngord)
    - [`Regulator(K): FldNum → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-regulator-fldnum)
    - [`RegulatorLowerBound(O): RngOrd → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-regulatorlowerbound-rngord)
    - [`RegulatorLowerBound(K): FldNum → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-regulatorlowerbound-fldnum)
    - [`Signature(O): RngOrd → RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-signature-rngord)
    - [`Signature(F): FldAlg → RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-signature-fldalg)
    - [`UnitRank(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-unitrank-rngord)
    - [`UnitRank(K): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-unitrank-fldnum)
    - [`Index(O, S): RngOrd, RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-index-rngord-rngord)
    - [`Index(O, S): RngOrd, RngOrd → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-index-rngord-rngord-2)
    - [`DefiningPolynomial(F): FldAlg → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-definingpolynomial-fldalg)
    - [`DefiningPolynomial(O): RngOrd → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-definingpolynomial-rngord)
    - [`DefiningPolynomial(F): FldAlg → [RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-definingpolynomial-fldalg-2)
    - [`DefiningPolynomial(O): RngOrd → [RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-definingpolynomial-rngord-2)
    - [`Zeroes(O, n): RngOrd, RngIntElt → [ FldReElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-zeroes-rngord-rngintelt)
    - [`Zeros(O, n): RngOrd, RngIntElt → [ FldReElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-zeros-rngord-rngintelt)
    - [`Zeroes(F, n): FldAlg, RngIntElt → [ FldReElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-zeroes-fldalg-rngintelt)
    - [`Zeros(F, n): FldAlg, RngIntElt → [ FldReElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-zeros-fldalg-rngintelt)
    - [Example: Zeros and Defining Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-afbcf8)
    - [`Different(O): RngOrd → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-different-rngord)
    - [`Conductor(O): RngOrd → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-conductor-rngord)
  - [Basis Representation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#basis-representation)
    - [`Basis(O): RngOrd → [ FldOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basis-rngord)
    - [`Basis(O, R): RngOrd, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basis-rngord-rng)
    - [`Basis(F): FldAlg → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basis-fldalg)
    - [`Basis(F, R): FldAlg, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basis-fldalg-rng)
    - [`IntegralBasis(F): FldAlg → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-integralbasis-fldalg)
    - [`IntegralBasis(F, R): FldAlg, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-integralbasis-fldalg-rng)
    - [Example: Basis over Different Rings](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-6e96c8)
    - [`AbsoluteBasis(K): FldAlg → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-absolutebasis)
    - [`BasisMatrix(O): RngOrd → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-basismatrix-rngord)
    - [`TransformationMatrix(O, P): RngOrd, RngOrd → AlgMatElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-transformationmatrix-rngord-rngord)
    - [`CoefficientIdeals(O): RngOrd → [RngOrdFracIdl]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-coefficientideals-rngord)
    - [Example: Basis and Integral Basis](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-292651)
    - [`MultiplicationTable(O): RngOrd → [AlgMatElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-multiplicationtable-rngord)
    - [`TraceMatrix(O): RngOrd → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-tracematrix-rngord)
    - [`TraceMatrix(F): FldAlg → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-tracematrix-fldalg)
    - [Example: Multiplication Table of an Order](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#example-ex-8f1664)
  - [Ring Predicates](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#ring-predicates)
    - [`N eq O: RngOrd, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-eq-rngord-rngord)
    - [`F eq L: FldAlg, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-eq-fldalg-fldalg)
    - [`F eq L: FldRat, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-eq-fldrat-fldalg)
    - [`F eq L: FldAlg, FldRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-eq-fldalg-fldrat)
    - [`IsCommutative(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-iscommutative-rng)
    - [`IsUnitary(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isunitary-rng)
    - [`IsFinite(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isfinite-rng)
    - [`IsOrdered(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isordered-rng)
    - [`IsField(R): Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isfield-rng)
    - [`IsNumberField(R): . → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isnumberfield)
    - [`IsAlgebraicField(R): Any → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isalgebraicfield-any)
    - [`IsEuclideanDomain(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-iseuclideandomain-fldalg)
    - [`IsSimple(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-issimple-fldalg)
    - [`IsSimple(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-issimple-rngord)
    - [`IsPID(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-ispid-fldalg)
    - [`IsUFD(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isufd-fldalg)
    - [`IsPrincipalIdealRing(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isprincipalidealring-fldalg)
    - [`IsPID(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-ispid-rngord)
    - [`IsUFD(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isufd-rngord)
    - [`IsPrincipalIdealRing(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isprincipalidealring-rngord)
    - [`IsDomain(R): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isdomain-fldalg)
    - [`F ne L: FldAlg, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-ne-fldalg-fldalg)
    - [`O ne N: RngOrd, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-ne-rngord-rngord)
    - [`O subset P: RngOrd, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-subset-rngord-rngord)
    - [`K subset L: FldAlg, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-subset-fldalg-fldalg)
    - [`K subset L: FldRat, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#operation-op-subset-fldrat-fldalg)
    - [`HasComplexConjugate(K): FldAlg → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-hascomplexconjugate)
    - [`ComplexConjugate(x): FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-complexconjugate-fldalgelt)
  - [Order Predicates](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#order-predicates)
    - [`IsEquationOrder(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isequationorder-rngord)
    - [`IsMaximal(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-ismaximal-rngord)
    - [`IsAbsoluteOrder(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isabsoluteorder-rngord)
    - [`IsWildlyRamified(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-iswildlyramified-rngord)
    - [`IsTamelyRamified(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-istamelyramified-rngord)
    - [`IsUnramified(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isunramified-rngord)
  - [Field Predicates](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#field-predicates)
    - [`IsIsomorphic(F, L): FldAlg, FldAlg → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isisomorphic-fldalg-fldalg)
    - [`IsSubfield(F, L): FldAlg, FldAlg → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-issubfield-fldalg-fldalg)
    - [`IsSubfield(F, L): FldRat, FldAlg → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-issubfield-fldrat-fldalg)
    - [`IsNormal(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isnormal-fldalg)
    - [`IsAbelian(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isabelian-fldalg)
    - [`IsCyclic(F): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-iscyclic-fldalg)
    - [`IsAbsoluteField(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isabsolutefield-fldalg)
    - [`IsWildlyRamified(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-iswildlyramified-fldalg)
    - [`IsTamelyRamified(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-istamelyramified-fldalg)
    - [`IsUnramified(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isunramified-fldalg)
    - [`IsQuadratic(K): FldAlg → BoolElt, FldQuad`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-isquadratic-fldalg)
    - [`IsTotallyReal(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-istotallyreal-fldalg)
  - [Setting Properties of Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#setting-properties-of-orders)
    - [`SetOrderMaximal(O, b): RngOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-setordermaximal-rngord-boolelt)
    - [`SetOrderTorsionUnit(O, e, r): RngOrd, RngOrdElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-setordertorsionunit-rngord-rngordelt-rngintelt)
    - [`SetOrderUnitsAreFundamental(O): RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-rngord-setorderunitsarefundamental)
- [Element Operations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#parent-and-category)
    - [`Parent(a): FldAlgElt → FldAlg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-parent-fldalgelt)
    - [`Parent(w): RngOrdElt → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-parent-rngordelt)
    - [`Category(a): FldAlgElt → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-category-fldalgelt)
    - [`Category(w): RngOrdElt → Cat`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-category-rngordelt)
  - [Arithmetic](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#arithmetic)
    - [`+ a: FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-fldalgelt-fldalgelt)
    - [`+ w: RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-rngordelt-rngordelt)
    - [`- a: FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-fldalgelt-fldalgelt-2)
    - [`- w: RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-rngordelt-rngordelt-2)
    - [`a + b: FldAlgElt, FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-plus-fldalgelt-fldalgelt)
    - [`w + v: RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-plus-rngordelt-rngordelt)
    - [`a - b: FldAlgElt, FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-minus-fldalgelt-fldalgelt)
    - [`w - v: RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-minus-rngordelt-rngordelt)
    - [`a * b: FldAlgElt, FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-times-fldalgelt-fldalgelt)
    - [`w * v: RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-times-rngordelt-rngordelt)
    - [`a / b: FldAlgElt, FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-div-fldalgelt-fldalgelt)
    - [`w / v: RngOrdElt, RngOrdElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-div-rngordelt-rngordelt)
    - [`a ^ k: FldAlgElt, RngIntElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-pow-fldalgelt-rngintelt)
    - [`w ^ k: RngOrdElt, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-pow-rngordelt-rngintelt)
    - [`w div v: RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-div-rngordelt-rngordelt-rngordelt)
    - [`Modexp(a, n, m): RngOrdElt, RngIntElt, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-modexp-rngordelt-rngintelt-rngintelt)
    - [`Sqrt(a): RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-sqrt-rngordelt)
    - [`Sqrt(a): FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-sqrt-fldalgelt)
    - [`SquareRoot(a): RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-squareroot-rngordelt)
    - [`SquareRoot(a): FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-squareroot-fldalgelt)
    - [`Root(a, n): RngOrdElt, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-root-rngordelt-rngintelt)
    - [`Root(a, n): FldAlgElt, RngIntElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-root-fldalgelt-rngintelt)
    - [`IsPower(a, k): FldAlgElt, RngIntElt → BoolElt, FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-ispower-fldalgelt-rngintelt)
    - [`IsPower(a, k): RngOrdElt, RngIntElt → BoolElt, RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-ispower-rngordelt-rngintelt)
    - [`IsSquare(a): FldAlgElt → BoolElt, FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-issquare-fldalgelt)
    - [`IsSquare(a): RngOrdElt → BoolElt, RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-issquare-rngordelt)
    - [`Denominator(a): FldAlgElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-denominator-fldalgelt)
    - [`Denominator(a): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-denominator-rngordelt)
    - [`Numerator(a): FldAlgElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-numerator-fldalgelt)
    - [`Qround(E, M): FldAlgElt, RngIntElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-qround-fldalgelt-rngintelt)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#equality-and-membership)
    - [`a eq b: FldAlgElt, FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-eq-fldalgelt-fldalgelt)
    - [`w eq v: RngOrdElt, RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-eq-rngordelt-rngordelt)
    - [`a ne b: FldAlgElt, FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-ne-fldalgelt-fldalgelt)
    - [`w ne v: RngOrdElt, RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-ne-rngordelt-rngordelt)
    - [`a in F: FldAlgElt, FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-in-fldalgelt-fldalg)
    - [`w in O: RngOrdElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-op-in-rngordelt-rngord)
  - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#predicates-on-elements)
    - [`IsIntegral(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isintegral-fldalgelt)
    - [`IsIntegral(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isintegral-rngordelt)
    - [`IsPrimitive(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isprimitive-fldalgelt)
    - [`IsPrimitive(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isprimitive-rngordelt)
    - [`IsTorsionUnit(w): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-istorsionunit-rngordelt)
    - [`IsPower(w, n): RngOrdElt, RngIntElt → BoolElt, RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-ispower-rngordelt-rngintelt-2)
    - [`IsTotallyPositive(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-istotallypositive-rngordelt)
    - [`IsTotallyPositive(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-istotallypositive-fldalgelt)
    - [`IsZero(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-iszero-fldalgelt)
    - [`IsZero(w): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-iszero-rngordelt)
    - [`IsOne(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isone-fldalgelt)
    - [`IsOne(w): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isone-rngordelt)
    - [`IsMinusOne(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isminusone-fldalgelt)
    - [`IsMinusOne(w): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isminusone-rngordelt)
    - [`IsUnit(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isunit-fldalgelt)
    - [`IsUnit(w): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isunit-rngordelt)
    - [`IsNilpotent(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isnilpotent-fldalgelt)
    - [`IsNilpotent(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isnilpotent-rngordelt)
    - [`IsIdempotent(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isidempotent-fldalgelt)
    - [`IsIdempotent(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isidempotent-rngordelt)
    - [`IsZeroDivisor(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-iszerodivisor-fldalgelt)
    - [`IsZeroDivisor(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-iszerodivisor-rngordelt)
    - [`IsRegular(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isregular-fldalgelt)
    - [`IsRegular(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isregular-rngordelt)
    - [`IsIrreducible(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isirreducible-fldalgelt)
    - [`IsIrreducible(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isirreducible-rngordelt)
    - [`IsPrime(a): FldAlgElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isprime-fldalgelt)
    - [`IsPrime(a): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-isprime-rngordelt)
  - [Field Generators](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#field-generators)
    - [`K . 1: FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#operation-operation-fldnum-fldnumelt)
    - [`PrimitiveElement(K): FldNum → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-primitiveelement-fldnum)
    - [`PrimitiveElement(F): FldOrd → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-primitiveelement-fldord)
    - [`PrimitiveElement(O): RngOrd → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-primitiveelement-rngord)
    - [`Generators(K): FldAlg → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-generators-fldalg)
    - [`Generators(K, k): FldAlg, FldAlg → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-generators-fldalg-fldalg)
    - [`Generators(K, Q): FldAlg, FldRat → [FldAlgElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-generators-fldalg-fldrat)
  - [Real and Complex Embeddings](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#real-and-complex-embeddings)
    - [`Conjugates(a): FldAlgElt → [ FldComElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-conjugates-fldalgelt)
    - [`Conjugates(a): RngOrdElt → [ FldComElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-conjugates-rngordelt)
    - [`Conjugate(a, l): FldAlgElt, RngIntElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-conjugate-fldalgelt-rngintelt)
    - [`Conjugate(a, l): RngOrdElt, RngIntElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-conjugate-rngordelt-rngintelt)
    - [`Conjugate(a, l): FldAlgElt, [RngIntElt] → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-conjugate-fldalgelt-rngintelt-2)
    - [`AbsoluteValues(a): FldAlgElt → [FldReElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutevalues-fldalgelt)
    - [`AbsoluteValues(a): RngOrdElt → [FldReElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutevalues-rngordelt)
    - [`Logs(a): FldAlgElt → [FldReElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-logs-fldalgelt)
    - [`Logs(a): RngOrdElt → [FldReElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-logs-rngordelt)
    - [`InfinitePlaces(K): FldAlg → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-infiniteplaces-fldalg)
    - [`InfinitePlaces(O): RngOrd → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-infiniteplaces-rngord)
    - [`Evaluate(x, p): FldAlgElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-evaluate-fldalgelt-plcnumelt)
    - [`Evaluate(x, p): RngOrdElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-evaluate-rngordelt-plcnumelt)
    - [`RealEmbeddings(a): FldAlgElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-realembeddings-fldalgelt)
    - [`RealEmbeddings(a): RngOrdElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-realembeddings-rngordelt)
    - [`MinkowskiLattice(O): RngOrd → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minkowskilattice-rngord)
    - [`Lattice(O): RngOrd → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-lattice-rngord)
    - [`MinkowskiLattice(I): RngOrdIdl → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minkowskilattice-rngordidl)
    - [`Lattice(I): RngOrdIdl → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-lattice-rngordidl)
    - [`MinkowskiSpace(F): FldAlg → Lat, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minkowskispace-fldalg)
  - [Heights](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#heights)
    - [`AbsoluteLogarithmicHeight(a): FldAlgElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutelogarithmicheight-fldalgelt)
    - [`AbsoluteLogarithmicHeight(a): RngOrdElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutelogarithmicheight-rngordelt)
    - [`CoefficientHeight(E): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-coefficientheight-rngordelt)
    - [`CoefficientHeight(E): FldAlgElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-coefficientheight-fldalgelt)
    - [`CoefficientLength(E): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-coefficientlength-rngordelt)
    - [`CoefficientLength(E): FldAlgElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-coefficientlength-fldalgelt)
    - [`Length(a): FldAlgElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-length)
    - [`Length(a): RngOrdElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-length-rngordelt)
    - [Example: Alternative Discriminant Function](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#example-ex-19f6ce)
  - [Norm, Trace, and Minimal Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#norm-trace-and-minimal-polynomial)
    - [`Norm(a): FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-norm-fldalgelt)
    - [`Norm(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-norm)
    - [`Norm(a, R): FldAlgElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-norm-fldalgelt-rng)
    - [`Norm(a): RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-norm-rngordelt)
    - [`Norm(a): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-norm-rngordelt-2)
    - [`Norm(a, R): RngOrdElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-norm-rngordelt-rng)
    - [`AbsoluteNorm(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutenorm-fldalgelt)
    - [`NormAbs(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-normabs-fldalgelt)
    - [`AbsoluteNorm(a): RngOrdElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutenorm-rngordelt)
    - [`NormAbs(a): RngOrdElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-normabs-rngordelt)
    - [`Trace(a): FldAlgElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-trace-fldalgelt)
    - [`Trace(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-trace)
    - [`Trace(a, R): FldAlgElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-trace-fldalgelt-rng)
    - [`Trace(a): RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-trace-rngordelt)
    - [`Trace(a): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-trace-rngordelt-2)
    - [`Trace(a, R): RngOrdElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-trace-rngordelt-rng)
    - [`AbsoluteTrace(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutetrace-fldalgelt)
    - [`TraceAbs(a): FldAlgElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-traceabs-fldalgelt)
    - [`AbsoluteTrace(a): RngOrdElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutetrace-rngordelt)
    - [`TraceAbs(a): RngOrdElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-traceabs-rngordelt)
    - [`CharacteristicPolynomial(a): FldAlgElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-characteristicpolynomial-fldalgelt)
    - [`CharacteristicPolynomial(a, R): FldAlgElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-characteristicpolynomial-fldalgelt-rng)
    - [`CharacteristicPolynomial(a): RngOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-characteristicpolynomial-rngordelt)
    - [`CharacteristicPolynomial(a, R): RngOrdElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-characteristicpolynomial-rngordelt-rng)
    - [`AbsoluteCharacteristicPolynomial(a): FldAlgElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutecharacteristicpolynomial-fldalgelt)
    - [`AbsoluteCharacteristicPolynomial(a): RngOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absolutecharacteristicpolynomial-rngordelt)
    - [`MinimalPolynomial(a): FldAlgElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minimalpolynomial-fldalgelt)
    - [`MinimalPolynomial(a, R): FldAlgElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minimalpolynomial-fldalgelt-rng)
    - [`MinimalPolynomial(a): RngOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minimalpolynomial-rngordelt)
    - [`MinimalPolynomial(a, R): RngOrdElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-minimalpolynomial-rngordelt-rng)
    - [`AbsoluteMinimalPolynomial(a): FldAlgElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absoluteminimalpolynomial-fldalgelt)
    - [`AbsoluteMinimalPolynomial(a): RngOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absoluteminimalpolynomial-rngordelt)
    - [`RepresentationMatrix(a): FldAlgElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-representationmatrix-fldalgelt)
    - [`RepresentationMatrix(a, R): FldAlgElt, Rng → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-representationmatrix-fldalgelt-rng)
    - [`RepresentationMatrix(a): RngOrdElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-representationmatrix-rngordelt)
    - [`RepresentationMatrix(a, R): RngOrdElt, Rng → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-representationmatrix-rngordelt-rng)
    - [`AbsoluteRepresentationMatrix(a): FldAlgElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absoluterepresentationmatrix-fldalgelt)
    - [`AbsoluteRepresentationMatrix(a): RngOrdElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-absoluterepresentationmatrix-rngordelt)
    - [Example: Norm, Trace, and Minimal Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#example-ex-68a043)
  - [The Quadratic Defect](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#the-quadratic-defect)
    - [`QuadraticDefect(a, p): RngElt, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-quadraticdefect-rngelt-rngordidl)
    - [`QuadraticDefect(a, p): FldRatElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-quadraticdefect-fldratelt-rngintelt)
    - [`QuadraticDefect(a, p): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-quadraticdefect-rngintelt-rngintelt)
    - [`QuadraticDefect(a, p): FldRatElt, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-quadraticdefect-fldratelt-rngint)
    - [`QuadraticDefect(a, p): RngIntElt, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-quadraticdefect-rngintelt-rngint)
    - [`RelativeQuadraticDefect(a, p): RngElt, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-relativequadraticdefect-rngelt-rngordidl)
    - [`RelativeQuadraticDefect(a, p): FldRatElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-relativequadraticdefect-fldratelt-rngintelt)
    - [`RelativeQuadraticDefect(a, p): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-relativequadraticdefect-rngintelt-rngintelt)
    - [`RelativeQuadraticDefect(a, p): FldRatElt, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-relativequadraticdefect-fldratelt-rngint)
    - [`RelativeQuadraticDefect(a, p): RngIntElt, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-relativequadraticdefect-rngintelt-rngint)
    - [`IsLocalSquare(a, p): RngElt, RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-islocalsquare-rngelt-rngordidl)
    - [`IsLocalSquare(a, p): FldRatElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-islocalsquare-fldratelt-rngintelt)
    - [`IsLocalSquare(a, p): RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-islocalsquare-rngintelt-rngintelt)
    - [`IsLocalSquare(a, p): FldRatElt, RngInt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-islocalsquare-fldratelt-rngint)
    - [`IsLocalSquare(a, p): RngIntElt, RngInt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-islocalsquare-rngintelt-rngint)
    - [`LocalMultiplicativeGroupModSquares(p): RngOrdIdl → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-localmultiplicativegroupmodsquares-rngordidl)
    - [`LocalMultiplicativeGroupModSquares(p): RngIntElt → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-localmultiplicativegroupmodsquares-rngintelt)
    - [`UnitSquareClassReps(p): RngOrdIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-unitsquareclassreps-rngordidl)
    - [`UnitSquareClassReps(p): RngIntElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-unitsquareclassreps-rngintelt)
    - [`NiceUnitSquareClassRepresentative(u, p): RngElt, RngOrdIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-niceunitsquareclassrepresentative-rngelt-rngordidl)
    - [`NiceUnitSquareClassRepresentative(u, p): RngElt, RngIntElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-niceunitsquareclassrepresentative-rngelt-rngintelt)
  - [Other Functions](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#other-functions)
    - [`ElementToSequence(a): FldAlgElt → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-elementtosequence-fldalgelt)
    - [`Eltseq(a): FldAlgElt → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-eltseq-fldalgelt)
    - [`ElementToSequence(a): RngOrdElt → [ FldOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-elementtosequence-rngordelt)
    - [`Eltseq(a): RngOrdElt → [ FldOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-eltseq)
    - [`Eltseq(E, k): FldAlgElt, FldAlg → [RngElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-eltseq-fldalgelt-fldalg)
    - [`Eltseq(E, k): FldAlgElt, Rng → [RngElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-eltseq-fldalgelt-rng)
    - [`Flat(e): FldAlgElt → [FldRatElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-flat-fldalgelt)
    - [`a[i]: FldAlgElt, RngIntElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#literal-literal-a-i-fldalgelt-rngintelt-fldratelt)
    - [`a[i]: FldAlgElt, RngIntElt → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#literal-literal-a-i-fldalgelt-rngintelt-fldalgelt)
    - [`a[i]: RngOrdElt, RngIntElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#literal-literal-a-i-rngordelt-rngintelt-fldratelt)
    - [`a[i]: RngOrdElt, RngIntElt → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#literal-literal-a-i-rngordelt-rngintelt-fldordelt)
    - [`ProductRepresentation(a): RngOrdElt → [ RngOrdElt ], [ RngIntElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-productrepresentation-rngordelt)
    - [`ProductRepresentation(a): FldAlgElt → [ FldAlgElt ], [ RngIntElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-productrepresentation-fldalgelt)
    - [`ProductRepresentation(P, E): [ FldAlgElt ], [ RngIntElt ] → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-productrepresentation-fldalgelt-rngintelt)
    - [`PowerProduct(P, E): [FldAlgElt], [RngIntElt] → FldAlgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-powerproduct-fldalgelt-rngintelt)
    - [`Valuation(w, I): RngOrdElt, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-valuation-rngordelt-rngordidl)
    - [`Valuation(w, I): FldAlgElt, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-valuation-fldalgelt-rngordidl)
    - [`Decomposition(a): RngOrdElt → SeqEnum[<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-decomposition-rngordelt)
    - [`Decomposition(a): FldOrdElt → SeqEnum[<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-decomposition-fldordelt)
    - [`Divisors(a): RngOrdElt → SeqEnum[RngOrdElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-divisors-rngordelt)
    - [`Index(a): RngOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-index-rngordelt)
    - [`Different(a): RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-different-rngordelt)
    - [`DegreeOnePrimeIdeals(O, B): RngOrd, RngIntElt → [ RngOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-degreeoneprimeideals-rngord-rngintelt)
- [Ideal Class Groups](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md)
  - [`SetPrintClassGroupWarnings(b): BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#procedure-setprintclassgroupwarnings-boolelt)
  - [`ClassGroup(O: parameters): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-rngord-classgroup)
  - [`ClassGroup(K: parameters): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classgroup-fldnum)
  - [`RingClassGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-ringclassgroup-rngord)
  - [`PicardGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-picardgroup-rngord)
  - [`ConditionalClassGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-conditionalclassgroup-rngord)
  - [`ConditionalClassGroup(K): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-conditionalclassgroup-fldnum)
  - [`ClassGroupPrimeRepresentatives(O, I): RngOrd, RngOrdIdl → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classgroupprimerepresentatives-rngord-rngordidl)
  - [`PrimeRepresentative(c, f: parameters): GrpAbElt, Map → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-primerepresentatives-rngord-from-class-group)
  - [`PrimeRepresentative(I: parameters): RngOrdIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-primerepresentatives-rngord-from-ideal)
  - [`ClassNumber(O: parameters): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classnumber-rngord)
  - [`ClassNumber(K: parameters): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classnumber-fldnum)
  - [`MinkowskiBound(K): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-minkowskibound-fldnum)
  - [`MinkowskiBound(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-minkowskibound-rngord)
  - [`BachBound(K): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-bachbound-fldnum)
  - [`BachBound(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-bachbound-rngord)
  - [`GRHBound(K): FldNum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-grhbound-fldnum)
  - [`GRHBound(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-grhbound-rngord)
  - [`FactorBasisVerify(O, a, b): RngOrd, RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#procedure-factorbasisverify-rngord-rngintelt-rngintelt)
  - [Class Group Internals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#class-group-internals)
    - [`EulerProduct(O, B): RngOrd, RngIntElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-eulerproduct-rngord-rngintelt)
    - [`ResidueGRH(O, B): RngOrd, RngIntElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-residuegrh-rngord-rngintelt)
    - [`ResidueGRHbound(O, e): RngOrd, FldReElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-residuegrhbound-rngord-fldreelt)
    - [`FactorBasis(K, B): FldNum, RngIntElt → [ RngOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-factorbasis-fldnum-rngintelt)
    - [`FactorBasis(O, B): RngOrd, RngIntElt → [ RngOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-factorbasis-rngord-rngintelt)
    - [`FactorBasis(O): RngOrd → [ RngOrdIdl ], Integer`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-factorbasis-rngord)
    - [`RelationMatrix(O): RngOrd → ModHomElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-relationmatrix-rngord)
    - [`Relations(O): RngOrd → ModHomElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-relations-rngord)
    - [`ClassGroupCyclicFactorGenerators(O): RngOrd → ModHomElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classgroupcyclicfactorgenerators-rngord)
    - [Example: Class Group of a Real Quadratic Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#example-ex-92eeba)
  - [Setting the Class Group Bounds](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#setting-the-class-group-bounds)
    - [`SetClassGroupBounds(string): MonStgElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#procedure-setclassgroupbounds-monstgelt)
    - [`SetClassGroupBounds(n): RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#procedure-setclassgroupbounds-rngintelt)
    - [Example: Setting Class Group Bounds](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#example-ex-3fbfbd)
  - [Class Group Map Caching](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#class-group-map-caching)
    - [`ClassGroupGetUseMemory(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-classgroupgetusememory-rngord)
    - [`ClassGroupSetUseMemory(O, f): RngOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#procedure-classgroupsetusememory-rngord-boolelt)
- [Unit Groups](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md)
  - [`UnitRank(O): RngOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitrank-rngord-2)
  - [`UnitRank(K): FldAlg → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitrank-fldalg)
  - [`TorsionUnitGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-torsionunitgroup-rngord)
  - [`TorsionUnitGroup(K): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-torsionunitgroup-fldnum)
  - [`UnitGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-rngord-unitgroup)
  - [`MultiplicativeGroup(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-multiplicativegroup-rngord)
  - [`UnitGroup(K): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitgroup-fldnum)
  - [`MultiplicativeGroup(K): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-multiplicativegroup-fldnum)
  - [`IndependentUnits(O): RngOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-independentunits-rngord)
  - [`IndependentUnits(K): FldNum → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-independentunits-fldnum)
  - [`pFundamentalUnits(O, p): RngOrd, RngIntElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-pfundamentalunits-rngord-rngintelt)
  - [`pFundamentalUnits(K, p): FldNum, RngIntElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-pfundamentalunits-fldnum-rngintelt)
  - [`UnitGroupAsSubgroup(O): RngOrd → GrpAb`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitgroupassubgroup-rngord)
  - [`MergeUnits(K, a): FldNum, FldNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-mergeunits-fldnum-fldnumelt)
  - [`MergeUnits(O, a): RngOrd, RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-mergeunits-rngord-rngordelt)
  - [Example: Class and Unit Groups of a Quartic Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#example-ex-98001b)
  - [`IsExceptionalUnit(u): RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-isexceptionalunit-rngordelt)
  - [`ExceptionalUnitOrbit(u): RngOrdElt → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-exceptionalunitorbit-rngordelt)
  - [`ExceptionalUnits(O): RngOrd → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-exceptionalunits-rngord)
  - [`UnitsWithSigns(O, oo, Signs): RngOrd, [ PlcNumElt ], [ RngInt ] → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-rngord-plcnumelt-rngint)
  - [`UnitsWithSigns(K, oo, Signs): FldAlg, [ PlcNumElt ], [ RngInt ] → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-fldalg-plcnumelt-rngint)
  - [`UnitsWithSigns(O, x): RngOrd, RngElt → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-rngord-rngelt)
  - [`UnitsWithSigns(K, x): FldAlg, RngElt → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-fldalg-rngelt)
  - [`UnitsWithSigns(x): RngOrdElt → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-rngordelt)
  - [`UnitsWithSigns(x): FldAlgElt → [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-unitswithsigns-fldalgelt)
  - [`HasTotallyPositiveGenerator(I): RngOrdFracIdl → BoolElt, [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-hastotallypositivegenerator-rngordfracidl)
  - [`TraceMinimalCone(nf): FldNum → TorCon`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-traceminimalcone-fldnum)
- [Diophantine Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md)
  - [Norm Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#norm-equations)
    - [`NormEquation(O, m): RngOrd, RngIntElt → BoolElt, [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-normequation-rngord-rngintelt)
    - [`NormEquation(O, m): RngOrd, RngOrdElt → BoolElt, [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-normequation-rngord-rngordelt)
    - [`NormEquation(F, m): FldAlg, RngIntElt → BoolElt, [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-rngord-normequation-fld)
    - [`NormEquation(F, m): FldAlg, FldAlgElt → BoolElt, [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-normequation-fldalg-fldalgelt)
    - [`NormEquation(F, m): FldAlg, FldRatElt → BoolElt, [ FldAlgElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-normequation-fldalg-fldratelt)
    - [`NormEquation(m, N): RngElt, Map → BoolElt, RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-normequation-rngelt-map)
    - [`IntegralNormEquation(a, N, O): RngElt, Map, RngOrd → BoolElt, [RngOrdElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-integralnormequation-rngelt-map-rngord)
    - [`SimNEQ(K, e, f): FldNum, FldNumElt, FldNumElt → BoolElt, [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-simneq-fldnum-fldnumelt-fldnumelt)
    - [Example: Solving a Relative Norm Equation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#example-ex-a68dc5)
  - [Thue Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#thue-equations)
    - [`ThueSystem(f): RngUPolElt → Thue`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-thuesystem-rngupolelt)
    - [`ThueSystem(O): RngOrd → Thue`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-thuesystem-rngord)
    - [`Evaluate(t, a, b): Thue, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-evaluate-thue-rngintelt-rngintelt)
    - [`Evaluate(t, S): Thue, [ RngIntElt ] → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-evaluate-thue-rngintelt)
    - [`Solutions(t, a): Thue, RngIntElt → [ [ RngIntElt, RngIntElt ] ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-solutions-thue-rngintelt)
    - [Example: Solving a Thue Equation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#example-ex-cbfc14)
  - [Unit Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#unit-equations)
    - [`UnitEquation(a, b, c): FldNumElt, FldNumElt, FldNumElt → [ ModHomElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-unitequation-fldnumelt-fldnumelt-fldnumelt)
    - [Example: Solving a Unit Equation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#example-ex-5cb066)
  - [Index Form Equations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#index-form-equations)
    - [`IndexFormEquation(O, k): RngOrd, RngIntElt → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-indexformequation-rngord-rngintelt)
    - [Example: Integral Power Bases via Index Forms](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#example-ex-a3384f)
- [Ideals and Quotients](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md)
  - [Creation of Ideals in Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#creation-of-ideals-in-orders)
    - [`x * O: RngElt, RngOrd → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngelt-rngord)
    - [`O * x: RngElt, RngOrd → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngelt-rngord-2)
    - [`F !! I: RngOrd, RngInt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-rngord-rngint)
    - [`F !! I: FldOrd, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-fldord-rngordfracidl)
    - [`F !! I: FldRat, RngOrdFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-fldrat-rngordfracidl)
    - [`F !! I: FldRat, RngIntFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-fldrat-rngintfracidl)
    - [`F !! I: FldOrd, RngIntFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-fldord-rngintfracidl)
    - [`O !! I: RngOrd, RngOrdFracIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-rngord-rngordfracidl)
    - [`O !! I: RngInt, RngInt → RngInt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-rngint-rngint)
    - [`ideal< O | a₁, a₂, ... , aₘ >: RngOrd, RngElt, ..., RngElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-rngelt-rngelt-rngordfracidl)
    - [`ideal<O | x>: RngOrd, RngIntElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-rngintelt-rngordidl)
    - [`ideal<O | M, d>: RngOrd, AlgMatElt, RngIntElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-algmatelt-rngintelt-rngordfracidl)
    - [`ideal<O | M, d>: RngOrd, ModDed, RngIntElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-modded-rngintelt-rngordfracidl)
    - [`ideal<O | M, I1, ..., In>: RngOrd, AlgMatElt, RngOrdFracIdl, ..., RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-algmatelt-rngordfracidl-rngordfracidl-rngordfracidl)
    - [`ideal<O | M, [I1, ..., In]>: RngOrd, AlgMatElt, [RngOrdFracIdl] → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-ideal-rngord-algmatelt-rngordfracidl-rngordfracidl)
    - [Example: Ideal Generated by an Element](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-dc3704)
    - [`FractionalIdeal(x): FldRatElt → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-fractionalideal-fldratelt)
    - [`FractionalIdeal(x): RngIntElt → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-fractionalideal-rngintelt)
    - [`FractionalIdeal(x): [ FldRatElt ] → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-fractionalideal-fldratelt-2)
    - [`FractionalIdeal(x): [ RngIntElt ] → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-fractionalideal-rngintelt-2)
    - [`FractionalIdeal(I): RngInt → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-fractionalideal-rngint)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#invariants)
    - [`Order(I): RngOrdFracIdl → RngOrd`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-order-rngordfracidl)
    - [`Order(I): RngIntFracIdl → RngInt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-order-rngintfracidl)
    - [`Denominator(I): RngOrdFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-denominator-rngordfracidl)
    - [`Denominator(I): RngIntFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-denominator-rngintfracidl)
    - [`PrimitiveElement(I): RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-primitiveelement-rngordidl)
    - [`PrimitiveElement(I): RngOrdFracIdl → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-primitiveelement-rngordfracidl)
    - [`UniformizingElement(P): RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-uniformizingelement-rngordidl)
    - [`UniformizingElement(P): RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-uniformizingelement-rngint)
    - [`Index(O, I): RngOrd, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-index-rngord-rngordidl)
    - [`Norm(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-norm-rngordidl)
    - [`Norm(I): RngOrdFracIdl → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-norm-rngordfracidl)
    - [`Norm(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-norm-rngordfracidl-2)
    - [`Norm(I): RngIntFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-norm-rngintfracidl)
    - [`MinimalInteger(I): RngOrdIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-minimalinteger-rngordidl)
    - [`Minimum(I): RngOrdFracIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-minimum-rngordfracidl)
    - [`Min(I): RngOrdFracIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-min-rngordfracidl)
    - [`AbsoluteNorm(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absolutenorm-rngordidl)
    - [`AbsoluteNorm(I): RngOrdFracIdl → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absolutenorm-rngordfracidl)
    - [`NormAbs(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-normabs-rngordidl)
    - [`NormAbs(I): RngOrdFracIdl → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-normabs-rngordfracidl)
    - [`CoefficientHeight(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coefficientheight-rngordidl)
    - [`CoefficientHeight(I): RngOrdFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coefficientheight-rngordfracidl)
    - [`CoefficientLength(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coefficientlength-rngordidl)
    - [`CoefficientLength(I): RngOrdFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coefficientlength-rngordfracidl)
    - [`RamificationIndex(I, p): RngOrdIdl, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-ramificationindex-rngordidl-rngintelt)
    - [`RamificationDegree(I, p): RngOrdIdl, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-ramificationdegree-rngordidl-rngintelt)
    - [`RamificationDegree(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-ramificationdegree-rngordidl)
    - [`RamificationIndex(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-ramificationindex-rngordidl)
    - [`AbsoluteRamificationDegree(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absoluteramificationdegree-rngordidl)
    - [`AbsoluteRamificationIndex(I): RndOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absoluteramificationindex-rndordidl)
    - [`ResidueClassField(O, I): RngOrd, RngOrdIdl → FldFin, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-residueclassfield-rngord-rngordidl)
    - [`ResidueClassField(I): RngOrdIdl → FldFin, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-residueclassfield-rngordidl)
    - [`Degree(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-degree-rngordidl)
    - [`InertiaDegree(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-inertiadegree-rngordidl)
    - [`AbsoluteInertiaDegree(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absoluteinertiadegree-rngordidl)
    - [`AbsoluteInertiaIndex(I): RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-absoluteinertiaindex-rngordidl)
    - [`Valuation(I, p): RngOrdFracIdl, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-valuation-rngordfracidl-rngordidl)
    - [`Valuation(I, p): RngIntFracIdl, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-valuation-rngintfracidl-rngint)
    - [`Content(I): RngOrdFracIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-content-rngordfracidl)
    - [Example: Invariants of an Ideal](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-f01e3a)
  - [Basis Representation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#basis-representation)
    - [`Basis(I): RngOrdIdl → [RngOrdElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-basis-rngordidl)
    - [`Basis(I): RngOrdFracIdl → [FldOrdElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-basis-rngordfracidl)
    - [`Basis(I): RngIntFracIdl → [FldRatElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-basis-rngintfracidl)
    - [`Basis(I, R): RngOrdFracIdl, Rng → [RngElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-basis-rngordfracidl-rng)
    - [`BasisMatrix(I): RngOrdFracIdl → MtrxSpcElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-basismatrix-rngordfracidl)
    - [`TransformationMatrix(I): RngOrdFracIdl → MtrxSpcElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-transformationmatrix-rngordfracidl)
    - [`CoefficientIdeals(I): RngOrdFracIdl → [RngOrdFracIdl]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coefficientideals-rngordfracidl)
    - [Example: Basis of an Ideal](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-49f139)
    - [`Module(I): RngOrdFracIdl → ModDed, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-module-rngordfracidl)
  - [Two–Element Presentations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#two-element-presentations)
    - [`Generators(I): RngOrdIdl → [ RngOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-generators-rngordidl)
    - [`Generators(I): RngOrdFracIdl → [ FldOrdElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-generators-rngordfracidl)
    - [`Generators(I): RngIntFracIdl → [ FldRatElt ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-generators-rngintfracidl)
    - [`TwoElement(I): RngOrdFracIdl → FldOrdElt, FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-twoelement-rngordfracidl)
    - [`TwoElementNormal(I): RngOrdIdl → RngOrdElt, RngOrdElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-twoelementnormal-rngordidl)
    - [Example: Two-Element Presentation of an Ideal](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-4c86cb)
  - [Standard Names](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#standard-names)
    - [`LMFDBLabel(I): RngOrdIdl → MonStgElg`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-lmfdblabel-rngordidl)
    - [`LMFDBIdeal(K, s): FldNum, MonStgElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-lmfdbideal-fldnum-monstgelt)
  - [Predicates on Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#predicates-on-ideals)
    - [`I eq J: RngOrdFracIdl, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-eq-rngordfracidl-rngordfracidl)
    - [`I ne J: RngOrdFracIdl, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-ne-rngordfracidl-rngordfracidl)
    - [`x in I: FldOrdElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-in-fldordelt-rngordfracidl)
    - [`x in I: RngOrdElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-in-rngordelt-rngordfracidl)
    - [`x notin I: FldOrdElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-notin-fldordelt-rngordfracidl)
    - [`x notin I: RngOrdElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-notin-rngordelt-rngordfracidl)
    - [`I subset J: RngOrdIdl, RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-subset-rngordidl-rngordidl)
    - [`IsIntegral(I): RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isintegral-rngordfracidl)
    - [`IsIntegral(I): RngIntFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isintegral-rngintfracidl)
    - [`IsZero(I): RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-iszero-rngordfracidl)
    - [`IsOne(I): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isone-rngordidl)
    - [`IsOne(I): RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isone-rngordfracidl)
    - [`IsOne(I): RngIntFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isone-rngintfracidl)
    - [`IsPrime(I): RngOrdIdl → BoolElt, RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isprime-rngordidl)
    - [`IsPrime(I): RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isprime-rngordfracidl)
    - [`IsPrincipal(I): RngOrdFracIdl → BoolElt, FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isprincipal-rngordfracidl)
    - [`IsRamified(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isramified-rngordidl)
    - [`IsRamified(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isramified-rngordidl-rngord)
    - [`IsRamified(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isramified-rngintelt-rngord)
    - [`IsRamified(P, O): RngInt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isramified-rngint-rngord)
    - [`IsSquarefree(I): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issquarefree-rngordidl)
    - [`IsSquarefree(I): RngInt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issquarefree-rngint)
    - [`IsTotallyRamified(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallyramified-rngordidl)
    - [`IsTotallyRamified(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallyramified-rngordidl-rngord)
    - [`IsTotallyRamified(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallyramified-rngintelt-rngord)
    - [`IsTotallyRamified(K): FldAlg → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallyramified-fldalg)
    - [`IsTotallyRamified(O): RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallyramified-rngord)
    - [`IsWildlyRamified(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-iswildlyramified-rngordidl)
    - [`IsWildlyRamified(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-iswildlyramified-rngordidl-rngord)
    - [`IsWildlyRamified(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-iswildlyramified-rngintelt-rngord)
    - [`IsTamelyRamified(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istamelyramified-rngordidl)
    - [`IsTamelyRamified(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istamelyramified-rngordidl-rngord)
    - [`IsTamelyRamified(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istamelyramified-rngintelt-rngord)
    - [`IsUnramified(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isunramified-rngordidl)
    - [`IsUnramified(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isunramified-rngordidl-rngord)
    - [`IsUnramified(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isunramified-rngintelt-rngord)
    - [`IsInert(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isinert-rngordidl)
    - [`IsInert(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isinert-rngordidl-rngord)
    - [`IsInert(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isinert-rngintelt-rngord)
    - [`IsInert(P, O): RngInt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isinert-rngint-rngord)
    - [`IsSplit(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issplit-rngordidl)
    - [`IsSplit(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issplit-rngordidl-rngord)
    - [`IsSplit(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issplit-rngintelt-rngord)
    - [`IsSplit(P, O): RngInt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issplit-rngint-rngord)
    - [`IsTotallySplit(P): RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallysplit-rngordidl)
    - [`IsTotallySplit(P, O): RngOrdIdl, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallysplit-rngordidl-rngord)
    - [`IsTotallySplit(P, O): RngIntElt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallysplit-rngintelt-rngord)
    - [`IsTotallySplit(P, O): RngInt, RngOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-istotallysplit-rngint-rngord)
  - [Ideal Arithmetic](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#ideal-arithmetic)
    - [`I * J: RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngordfracidl-rngordfracidl)
    - [`I * J: RngIntFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngintfracidl-rngordfracidl)
    - [`I * J: RngIntFracIdl, RngIntFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngintfracidl-rngintfracidl)
    - [`x * I: RngElt, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngelt-rngordfracidl)
    - [`x * I: FldRatElt, RngIntFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-fldratelt-rngintfracidl)
    - [`x * I: RngIntElt, RngIntFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngintelt-rngintfracidl)
    - [`I * x: RngOrdFracIdl, RngElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngordfracidl-rngelt)
    - [`&* L: [RngOrdFracIdl] → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-rngordfracidl-rngordfracidl)
    - [`&* L: { RngOrdFracIdl } → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-rngordfracidl-rngordfracidl-2)
    - [`I div J: RngOrdIdl, RngOrdIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-div-rngordidl-rngordidl-rngordidl)
    - [`I div J: RngOrdFracIdl, RngOrdFracIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-div-rngordfracidl-rngordfracidl-rngordidl)
    - [`I div J: RngInt, RngInt → RngInt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-div-rngint-rngint-rngint)
    - [`I / J: RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-div-rngordfracidl-rngordfracidl)
    - [`I / x: RngOrdFracIdl, RngElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-div-rngordfracidl-rngelt)
    - [`I + J: RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-plus-rngordfracidl-rngordfracidl)
    - [`I + J: RngIntFracIdl, RngIntFracIdl → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-plus-rngintfracidl-rngintfracidl)
    - [`I + J: RngIntFracIdl, RngInt → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-plus-rngintfracidl-rngint)
    - [`I ^ k: RngOrdFracIdl, RngIntElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-pow-rngordfracidl-rngintelt)
    - [`I ^ k: RngIntFracIdl, RngIntElt → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-pow-rngintfracidl-rngintelt)
    - [`I eq J: RngOrdFracIdl, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-eq-rngordfracidl-rngordfracidl-2)
    - [`I eq J: RngIntFracIdl, RngIntFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-eq-rngintfracidl-rngintfracidl)
    - [`I eq J: RngIntFracIdl, RngInt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-eq-rngintfracidl-rngint)
    - [`I subset J: RngOrdIdl, RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-subset-rngordidl-rngordidl-2)
    - [`E in I: RngOrdElt, RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-in-rngordelt-rngordidl)
    - [`E in I: RngOrdElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-in-rngordelt-rngordfracidl-2)
    - [`E in I: FldAlgElt, RngOrdFracIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-in-fldalgelt-rngordfracidl)
    - [`LCM(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-lcm-rngordfracidl-rngordfracidl)
    - [`Lcm(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-lcm-rngordfracidl-rngordfracidl-2)
    - [`LeastCommonMultiple(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-leastcommonmultiple-rngordfracidl-rngordfracidl)
    - [`GCD(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-gcd-rngordfracidl-rngordfracidl)
    - [`Gcd(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-gcd-rngordfracidl-rngordfracidl-2)
    - [`GreatestCommonDivisor(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-greatestcommondivisor-rngordfracidl-rngordfracidl)
    - [`Content(M): Mtrx → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-content-mtrx)
    - [`I meet J: RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-meet-rngordfracidl-rngordfracidl)
    - [`&meet S: [RngOrdFracIdl] → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-meet-rngordfracidl-rngordfracidl)
    - [`&meet S: { RngOrdFracIdl } → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-meet-rngordfracidl-rngordfracidl-2)
    - [`I meet R: RngOrdFracIdl, Rng → Any`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-meet-rngordfracidl-rng)
    - [`R meet I: Rng, RngOrdFracIdl → Any`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-meet-rng-rngordfracidl)
    - [`a mod I: RngOrdElt, RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-mod-rngordelt-rngordidl-rngordelt)
    - [`InverseMod(E, M): RngOrdElt, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-inversemod-rngordelt-rngintelt)
    - [`InverseMod(E, M): RngOrdElt, RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-inversemod-rngordelt-rngordidl)
    - [`Modinv(E, M): RngOrdElt, RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-modinv-rngordelt-rngordidl)
    - [`Modinv(E, M): RngOrdElt, RngIntElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-modinv-rngordelt-rngintelt)
    - [`ColonIdeal(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-colonideal-rngordfracidl-rngordfracidl)
    - [`IdealQuotient(I, J): RngOrdFracIdl, RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-idealquotient-rngordfracidl-rngordfracidl)
    - [Example: Colon Ideal of a Noninvertible Ideal](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-9af5d2)
    - [`IntegralSplit(I): RngOrdFracIdl → RngOrdIdl, RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-integralsplit-rngordfracidl)
    - [`Different(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-different-rngordfracidl)
    - [`Codifferent(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-codifferent-rngordfracidl)
  - [Roots of Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#roots-of-ideals)
    - [`Root(I, k): RngOrdFracIdl, RngIntElt → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-root-rngordfracidl-rngintelt)
    - [`IsPower(I, k): RngOrdFracIdl, RngIntElt → BoolElt, RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-ispower-rngordfracidl-rngintelt)
    - [`SquareRoot(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-squareroot-rngordfracidl)
    - [`Sqrt(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sqrt-rngordfracidl)
    - [`IsSquare(I): RngOrdFracIdl → BoolElt, RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-issquare-rngordfracidl)
  - [Factorization and Primes](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#factorization-and-primes)
    - [`Decomposition(O, p): RngOrd, RngIntElt → [<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decomposition-rngord-rngintelt)
    - [`Decomposition(O, p): RngOrd, RngOrdIdl → [ <RngOrdIdl, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decomposition-rngord-rngordidl)
    - [`DecompositionType(O, p): RngOrd, RngIntElt → [<RngIntElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decompositiontype-rngord-rngintelt)
    - [`DecompositionType(O, p): FldAlg, RngIntElt → [<RngIntElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decompositiontype-fldalg-rngintelt)
    - [`DecompositionType(O, p): FldAlg, RngOrdIdl → [<RngIntElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decompositiontype-fldalg-rngordidl)
    - [`DecompositionType(O, p): RngOrd, RngOrdIdl → [ <RngIntElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-decompositiontype-rngord-rngordidl)
    - [`Factorization(I): RngOrdFracIdl → [<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-factorization-rngordfracidl)
    - [`Factorisation(I): RngOrdFracIdl → [<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-factorisation-rngordfracidl)
    - [`Factorization(I): RngIntFracIdl → [<RngInt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-factorization-rngintfracidl)
    - [`Factorisation(I): RngIntFracIdl → [<RngInt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-factorisation-rngintfracidl)
    - [Example: Factorization in a Non-Maximal Order](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-4f7652)
    - [`Divisors(I): RngOrdIdl → [<RngOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-divisors-rngordidl)
    - [`Support(I): RngOrdFracIdl → {RngOrdIdl}`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-support-rngordfracidl)
    - [`Support(I): RngIntFracIdl → {RngInt}`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-support-rngintfracidl)
    - [`Support(L): [RngOrdFracIdl] → {RngOrdIdl}`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-support-rngordfracidl-2)
    - [`Support(L): [FldAlgElt] → {RngOrdIdl}`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-support-fldalgelt)
    - [`CoprimeBasis(L): [RngOrdFracIdl] → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coprimebasis-rngordfracidl)
    - [`CoprimeBasisInsert(~L, I): [RngOrdIdl], RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#procedure-coprimebasisinsert-rngordidl-rngordfracidl-ref)
    - [`PowerProduct(B, E): [RngOrdFracIdl], [RngIntElt] → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-powerproduct-rngordfracidl-rngintelt)
  - [Other Ideal Operations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#other-ideal-operations)
    - [`ChineseRemainderTheorem(I1, I2, e1, e2): RngOrdIdl, RngOrdIdl, RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-chineseremaindertheorem-rngordidl-rngordidl-rngordelt-rngordelt)
    - [`ChineseRemainderTheorem(X, M): SeqEnum[RngOrdElt], SeqEnum[RngOrdIdl] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-chineseremaindertheorem-seqenum-rngordelt-seqenum-rngordidl)
    - [`CRT(I1, I2, e1, e2): RngOrdIdl, RngOrdIdl, RngOrdElt, RngOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-crt-rngordidl-rngordidl-rngordelt-rngordelt)
    - [`CRT(X, M): SeqEnum[RngOrdElt], SeqEnum[RngOrdIdl] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-crt-seqenum-rngordelt-seqenum-rngordidl)
    - [`CRT(I1, L1, e1, L2): RngOrdIdl, [RngIntElt], RngOrdElt, [RngIntElt] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-chineseremaindertheoreminf)
    - [`ChineseRemainderTheorem(I1, L1, e1, L2): RngOrdIdl, [RngIntElt], RngOrdElt, [RngIntElt] → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-chineseremaindertheorem-rngordidl-rngintelt-rngordelt-rngintelt)
    - [`WeakApproximation(I, V): [RngOrdIdl], [RngIntElt] → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-weakapproximation-rngordidl-rngintelt)
    - [`WeakApproximation(I, V): [RngInt], [RngIntElt] → FldRatElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-weakapproximation-rngint-rngintelt)
    - [`Idempotents(I, J): RngOrdIdl, RngOrdIdl → BoolElt, RngOrdElt, RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-idempotents-rngordidl-rngordidl)
    - [`CoprimeRepresentative(I, J): RngOrdIdl, RngOrdIdl → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-coprimerepresentative-rngordidl-rngordidl)
    - [`MakeCoprime(I, J): RngOrdIdl, RngOrdIdl → FldOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-makecoprime-rngordidl-rngordidl)
    - [`IdealsUpTo(B, O): RngIntElt, RngOrd → [RngOrdIdl]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-idealsupto-rngintelt-rngord)
    - [`IdealsUpTo(B, K): RngIntElt, FldNum → [RngOrdIdl]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-idealsupto-rngintelt-fldnum)
    - [`ClassRepresentative(I): RngOrdFracIdl → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-classrepresentative-rngordfracidl)
    - [`SUnitGroup(I): RngOrdFracIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sunitgroup-rngordfracidl)
    - [`SUnitGroup(S): [ RngOrdIdl ] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-sunitgroup)
    - [Example: S-Units of a Real Quadratic Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-062dcc)
    - [`SUnitAction(SU, Act, S): Map, Map, SeqEnum[RngOrdIdl] → Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sunitaction-map-map-seqenum-rngordidl)
    - [`SUnitAction(SU, Act, S): Map, SeqEnum[Map], SeqEnum[RngOrdIdl] → [Map]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sunitaction-map-seqenum-map-seqenum-rngordidl)
    - [`SUnitDiscLog(SU, x, S): Map, FldAlgElt, SeqEnum[RngOrdIdl] → GrpAbElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sunitdisclog-map-fldalgelt-seqenum-rngordidl)
    - [`SUnitDiscLog(SU, L, S): Map, SeqEnum[FldAlgElt], SeqEnum[RngOrdIdl] → GrpAbElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-sunitdisclog-map-seqenum-fldalgelt-seqenum-rngordidl)
    - [Example: Galois Action on S-Units](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-95d956)
  - [Quotient Rings](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#quotient-rings)
    - [Operations on Quotient Rings](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operations-on-quotient-rings)
      - [`quo< O | I >: RngOrd, RngOrdIdl → RngOrdRes`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-quo-rngord-rngordidl-rngordres)
      - [`quo< O | M >: RngOrd, ModDed → RngOrdRes`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-quo-rngord-modded-rngordres)
      - [`quo< O | M >: RngOrd, AlgMatElt → RngOrdRes`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-quo-rngord-algmatelt-rngordres)
      - [`quo< O | S >: RngOrd, RngElt, ..., RngElt → RngOrdRes`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-quo-rngord-rngelt-rngelt-rngordres)
      - [`quo< O | m >: RngOrd, RngIntElt → RngOrdRes`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#constructor-constructor-quo-rngord-rngintelt-rngordres)
      - [`UnitGroup(OQ): RngOrdRes → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-unitgroup-rngordres)
      - [`MultiplicativeGroup(OQ): RngOrdRes → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-multiplicativegroup-rngordres)
      - [`Modulus(OQ): RngOrdRes → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-modulus-rngordres)
      - [Example: Quotient Rings of an Order](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-d59aa1)
    - [Elements of Quotients](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#elements-of-quotients)
      - [`OQ ! a: RngOrdRes, Elt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-rngordres-elt)
      - [`Random(OQ): RngOrdRes → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-random-rngordres)
      - [`a mod I: RngOrdElt, RngOrdIdl → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-mod-rngordelt-rngordidl-rngordelt-2)
      - [`a * b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-times-rngordreselt-rngordreselt)
      - [`a + b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-plus-rngordreselt-rngordreselt)
      - [`a - b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-minus-rngordreselt-rngordreselt)
      - [`a / b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-div-rngordreselt-rngordreselt)
      - [`- a: RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-rngordreselt-rngordreselt)
      - [`a ^ n: RngOrdResElt, RngIntElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-pow-rngordreselt-rngintelt)
      - [`a eq b: RngOrdResElt, RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-eq-rngordreselt-rngordreselt)
      - [`a ne b: RngOrdResElt, RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-op-ne-rngordreselt-rngordreselt)
      - [`a div b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-div-rngordreselt-rngordreselt-rngordreselt)
      - [`a mod b: RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#operation-operation-mod-rngordreselt-rngordreselt-rngordreselt)
      - [`Quotrem(a, b): RngOrdResElt, RngOrdResElt → RngOrdResElt, RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-quotrem-rngordreselt-rngordreselt)
      - [`Lcm(a, b): RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-lcm-rngordreselt-rngordreselt)
      - [`Gcd(a, b): RngOrdResElt, RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-gcd-rngordreselt-rngordreselt)
      - [`XGcd(a, b): RngOrdResElt, RngOrdResElt → RngOrdResElt, RngOrdResElt, RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-xgcd-rngordreselt-rngordreselt)
      - [`IsZero(a): RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-iszero-rngordreselt)
      - [`IsOne(a): RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isone-rngordreselt)
      - [`IsMinusOne(a): RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isminusone-rngordreselt)
      - [`IsUnit(a): RngOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-isunit-rngordreselt)
      - [`Eltseq(a): RngOrdResElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-eltseq-rngordreselt)
      - [`ElementToSequence(a): RngOrdResElt → []`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-elementtosequence-rngordreselt)
      - [`EuclideanNorm(a): RngOrdResElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-euclideannorm-rngordreselt)
      - [`Annihilator(a): RngOrdResElt → RngOrdResElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-annihilator-rngordreselt)
    - [Reconstruction](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#reconstruction)
      - [`ReconstructionEnvironment(p, k): RngOrdIdl, RngIntElt → RngOrdRecoEnv`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-reconstructionenvironment-rngordidl-rngintelt)
      - [`ReconstructionEnvironment(p, k): RngIntElt, RngIntElt → RngOrdRecoEnv`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-reconstructionenvironment-rngintelt-rngintelt)
      - [`Reconstruct(x, R): RngOrdElt, RngOrdRecoEnv → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-reconstruct-rngordelt-rngordrecoenv)
      - [`Reconstruct(x, R): RngIntElt, RngOrdRecoEnv → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-reconstruct-rngintelt-rngordrecoenv)
      - [`ChangePrecision(~R, k): RngOrdRecoEnv, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#procedure-changeprecision-rngordrecoenv-rngintelt-ref)
      - [Example: Roots via Order Reconstruction](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#example-ex-c0c980)
- [Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#creation-of-structures)
    - [`Places(K): FldNum → PlcNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-places-fldnum)
    - [`DivisorGroup(K): FldNum → DivNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-divisorgroup-fldnum)
  - [Operations on Structures](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operations-on-structures)
    - [`d1 eq d2: DivNum, DivNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-eq-divnum-divnum)
    - [`p1 eq p2: PlcNum, PlcNum → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-eq-plcnum-plcnum)
    - [`NumberField(P): PlcNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-numberfield-plcnum)
    - [`NumberField(D): DivNum → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-numberfield-divnum)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#creation-of-elements)
    - [`Place(I): RngOrdIdl → PlcNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-place-rngordidl)
    - [`Decomposition(K, I): FldAlg, Infty → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decomposition-fldalg-infty)
    - [`Decomposition(K, p): FldAlg, RngIntElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decomposition-fldalg-rngintelt)
    - [`Decomposition(K, p): FldNum, PlcNumElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decomposition-fldnum-plcnumelt)
    - [`Decomposition(m, p): Map[FldRat, FldAlg], RngIntElt → SeqEnum[<PlcNumElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decomposition-map-fldrat-fldalg-rngintelt)
    - [`Decomposition(m, p): Map[FldAlg, FldAlg], PlcNumElt → SeqEnum[<PlcNumElt, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decomposition-map-fldalg-fldalg-plcnumelt)
    - [`InfinitePlaces(K): FldAlg → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-infiniteplaces-fldalg-2)
    - [`InfinitePlaces(O): RngOrd → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-infiniteplaces-rngord-2)
    - [`RealPlaces(K): FldAlg → [PlcNumElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-realplaces-fldalg)
    - [`Divisor(pl): PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-divisor-plcnumelt)
    - [`Divisor(I): RngOrdFracIdl → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-divisor-rngordfracidl)
    - [`Divisor(x): FldNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-divisor-fldnumelt)
  - [Arithmetic with Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#arithmetic-with-places-and-divisors)
    - [`d1 + d2: DivNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-plus-divnumelt-divnumelt)
    - [`p + d: PlcNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-plus-plcnumelt-divnumelt)
    - [`d + p: DivNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-plus-divnumelt-plcnumelt)
    - [`p1 + p2: PlcNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-plus-plcnumelt-plcnumelt)
    - [`- p: PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-operation-plcnumelt-divnumelt)
    - [`- d: DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-operation-divnumelt-divnumelt)
    - [`d - p: DivNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-minus-divnumelt-plcnumelt)
    - [`p - d: PlcNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-minus-plcnumelt-divnumelt)
    - [`d1 - d2: DivNumElt, DivNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-minus-divnumelt-divnumelt)
    - [`p1 - p2: PlcNumElt, PlcNumElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-minus-plcnumelt-plcnumelt)
    - [`p * k: PlcNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-times-plcnumelt-rngintelt)
    - [`d * k: DivNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-op-times-divnumelt-rngintelt)
    - [`p div k: PlcNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-operation-div-plcnumelt-rngintelt-divnumelt)
    - [`d div k: DivNumElt, RngIntElt → DivNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#operation-operation-div-divnumelt-rngintelt-divnumelt)
  - [Other Functions for Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#other-functions-for-places-and-divisors)
    - [`Valuation(a, p): FldNumElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-valuation-fldnumelt-plcnumelt)
    - [`Valuation(a, p): RngElt, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-valuation-rngelt-plcnumelt)
    - [`Valuation(I, p): RngOrdFracIdl, PlcNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-valuation-rngordfracidl-plcnumelt)
    - [`Support(D): DivNumElt → SeqEnum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-support-divnumelt)
    - [`Ideal(D): DivNumElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-ideal-divnumelt)
    - [`Ideal(D): PlcNumElt → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-ideal-plcnumelt)
    - [`IsFinite(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-isfinite-plcnumelt)
    - [`IsInfinite(p): PlcNumElt → BoolElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-isinfinite-plcnumelt)
    - [`IsReal(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-isreal-plcnumelt)
    - [`IsComplex(p): PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-iscomplex-plcnumelt)
    - [`Extends(P, p): PlcNumElt, PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-extends-plcnumelt-plcnumelt)
    - [`InertiaDegree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-inertiadegree-plcnumelt)
    - [`Degree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-degree-plcnumelt)
    - [`Degree(D): DivNumElt → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-degree-divnumelt)
    - [`NumberField(P): PlcNumElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-numberfield-plcnumelt)
    - [`NumberField(D): DivNumElt → FldNum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-numberfield-divnumelt)
    - [`ResidueClassField(P): PlcNumElt → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-residueclassfield-plcnumelt)
    - [`UniformizingElement(P): PlcNumElt → FldNumElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-uniformizingelement-plcnumelt)
    - [`LocalDegree(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-localdegree-plcnumelt)
    - [`RamificationIndex(P): PlcNumElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-ramificationindex-plcnumelt)
    - [`DecompositionGroup(P): PlcNumElt → GrpPerm`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#function-decompositiongroup-plcnumelt)
- [The Montes Algorithm](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md)
  - [`Montes(f, p): RngUPolElt, RngElt → SeqEnum, SeqEnum, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#function-montes-rngupolelt-rngelt)
  - [Example: Montes Algorithm on a Polynomial](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#example-ex-25d08e)
  - [`Montes(K, p): FldArith, RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#procedure-montes-fldarith-rngelt)
  - [Example: Montes Algorithm on a Number Field](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#example-ex-cb9d42)
  - [`SFL(P, s): OMIdl, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#procedure-sfl-omidl-rngintelt)
  - [Example: Single Factor Lifting of an OM Prime](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#example-ex-e93eb7)
  - [`SetUseMontes(f): BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#procedure-setusemontes-boolelt)
  - [`SetUseMontes(t, f): Cat, BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#procedure-setusemontes-cat-boolelt)
  - [`GetUseMontes(t): Cat → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#function-getusemontes-cat)
  - [`SetVerbose("Montes", v): MonStgElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#procedure-setverbose-monstgelt-rngintelt-montes)
- [Ideals in OM Representation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md)
  - [`Ideal(I): OMIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-ideal-omidl)
  - [`OMRepresentation(I): RngFunOrdIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-omrepresentation-rngfunordidl)
  - [`OMRepresentation(I): RngOrdFracIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-omrepresentation-rngordfracidl)
  - [`OMRepresentation(L, S): FldArith, [FldArithElt] → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-omrepresentation-fldarith-fldarithelt)
  - [`OMRepresentation(L, a): FldArith, FldArithElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-omrepresentation-fldarith-fldarithelt-2)
  - [`OMRepresentation(L, a): FldArith, RngElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-omrepresentation-fldarith-rngelt)
  - [Example: Converting to and from OM Representation](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#example-ex-738d2c)
  - [Ideal Arithmetic](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#ideal-arithmetic)
    - [`I + J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-plus-omidl-omidl)
    - [`I * J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-times-omidl-omidl)
    - [`I / J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-div-omidl-omidl)
    - [`I ^ n: OMIdl, RngIntElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-pow-omidl-rngintelt)
    - [Example: Arithmetic of OM Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#example-ex-58ff3a)
  - [Ideal Predicates](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#ideal-predicates)
    - [`IsOne(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-isone-omidl)
    - [`IsZero(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-iszero-omidl)
    - [`I eq J: OMIdl, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-eq-omidl-omidl)
    - [`a in I: RngElt, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-in-rngelt-omidl)
    - [`I subset J: OMIdl, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#operation-op-subset-omidl-omidl)
    - [`IsPrime(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-isprime-omidl)
    - [`IsIntegral(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-rep.md#function-isintegral-omidl)
- [Ideal Operations](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md)
  - [`pIntegralBasis(I, p): OMIdl, RngElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-pintegralbasis-omidl-rngelt)
  - [`SIntegralBasis(I, S): OMIdl, SeqEnum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-sintegralbasis-omidl-seqenum)
  - [`SIntegralBasis(I, S): RngOrdFracIdl, [RngIntElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-sintegralbasis-rngordfracidl-rngintelt)
  - [`SIntegralBasis(I, S): RngFunOrdIdl, [RngUPolElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-sintegralbasis-rngfunordidl-rngupolelt)
  - [`Basis(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-basis-omidl)
  - [Example: p-Integral Basis of an OM Ideal](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#example-ex-a203ed)
  - [`TwoElement(I): OMIdl → FldArithElt, FldArithElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-twoelement-omidl)
  - [`Norm(I): OMIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-norm-omidl)
  - [`Valuation(alpha, P : parameters): FldArithElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-valuation-fldarithelt-omidl)
  - [`Valuation(alpha, P : parameters): FldRatElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-valuation-fldratelt-omidl)
  - [`Valuation(alpha, P : parameters): RngIntElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-valuation-rngintelt-omidl)
  - [`Valuation(alpha, P : parameters): RngUPolElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-valuation-rngupolelt-omidl)
  - [`Valuation(I, P): OMIdl, OMIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-valuation-omidl-omidl)
  - [`a mod P: FldArithElt, OMIdl → FldArithElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#operation-operation-mod-fldarithelt-omidl-fldarithelt)
  - [`Reduction(a, P): FldArithElt, OMIdl → FldArithElt`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-reduction-fldarithelt-omidl)
  - [`Reduction(a, P, m): FldArithElt, OMIdl, RngIntElt → [FldArithElt]`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-reduction-fldarithelt-omidl-rngintelt)
  - [`Factorization(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-factorization-omidl)
  - [`Factorisation(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-factorisation-omidl)
  - [Example: Operations on OM Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#example-ex-b5c67b)
  - [`ResidueField(I): OMIdl → Fld`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#function-residuefield-omidl)
  - [Example: Residual Degree and Ramification of OM Primes](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-op.md#example-ex-7694e8)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/bibliography.md)

### Introduction

This chapter deals with (general) number fields, and orders and ideals in number fields.

Special types of number fields (quadratic and cyclotomic) have special features described in the corresponding chapters ([Quadratic Fields](https://docs.magma-maths.org/GlobalFields/QuadraticFields/index-quadratic-fields.md#chapfldquad) and [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)). All the general features here apply to those types too.

#### Types

Number fields have type `FldNum`, with subtypes `FldQuad` and `FldCyc`. Their orders have types `RngOrd`, `RngQuad`, `RngCyc` respectively. The `FieldOfFractions` of an order is not the number field, rather it is an isomorphic field that has the same basis as the order (for speed); it has type `FldOrd`. The container type `FldAlg` is the union of `FldNum` and `FldOrd` (this is used in signatures that allow both).

Elements in fields and orders have corresponding types: `FldNumElt`, `FldAlgElt`, `RngQuadElt`, and so on.

Extended types are used to indicate the coefficient ring (i.e. base ring). An absolute extension is a `FldNum[FldRat]`, a relative extension is a `FldNum[FldNum]`, similarly for `RngOrd[RngInt]` and so on.

The `RationalField()` is *not* a number field (`FldRat` is not a subtype of `FldNum`). However, one can create `RationalsAsNumberField()`.

A number field (`FldNum`) is an algebraic extension of finite degree over a base field, which may be a number field $k$ or ${\mathbb{Q}}$. It is constructed as $K = k[t]/(f(t))$ where $f$ is an irreducible polynomial in $k[t]$. A field may also be constructed as a multivariate quotient $K = k[s_1,\ldots,s_n]/(f_1(s_1), \ldots, f_n(s_n))$ where each polynomial is univariate (although the internal representation of this is as a tower of extensions).

Orders can be constructed in two main ways:

- as finite extensions $E$ of a (maximal) order $m$ (or of ${\mathbb{Z}}$) by adjoining a root of a monic integral polynomial $f \in m[t]$
- as a transformation (i.e. change of basis) of another order.

The main restriction for the construction of orders is that the coefficient domain ([`BaseRing`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-basering)) must always be a maximal order if any structural computations are desired. An order $O$ over some maximal order $m$ is represented using a (pseudo) $m$-basis (of type [Pseudo Matrices](https://docs.magma-maths.org/Modules/ModulesOverDedekindDomains/pmat.md#pmat) similar to the way modules over Dedekind rings ([`ModDed`](https://docs.magma-maths.org/Modules/ModulesOverDedekindDomains/index-modules-over-dedekind-domains.md#modded-chapter), [Pseudo Matrices](https://docs.magma-maths.org/Modules/ModulesOverDedekindDomains/pmat.md#pmat)) are represented in general. Every other order must be free over its base ring.

An order $O$ is equipped with a unique field of fractions, [`FieldOfFractions`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-fieldoffractions)`(O)`, which has the same basis as the order and whose base field is the field of fractions of the base ring. The field of fractions exists to serve as the parent of fields elements represented in that basis, and support fractional ideals.

An proper ideal of an order has type `RngOrdIdl`, a fractional ideal has type `RngOrdIdlFrac`. An ideal does not play the role of parent to elements in it (their parent is the order or the field of fractions); in particular, there is no coercion of elements into ideals. Sometimes one needs the parent structure of all ideals or all fractional ideals: these are created by `PowerIdeal` of the `RngOrd` or the `FldOrd`.

The conventions regarding the basis of an order can be confusing. For relative extensions, an order $O$ is not necessarily a free module over its base ring $R$ and therefore a relative integral basis may not exist [[Poh](https://docs.magma-maths.org/references.md#cite-po64)]. Therefore, the module structure of $O$ over $R$ is given by `PseudoBasis(Module(O))` which consists of `Basis(O)` together with `CoefficientIdeals(O)`. The elements in `Basis(O)` are not necessarily contained in $O$; their parent is always `FieldOfFractions(O)`, which has the same basis. Note that `O.i` is `Basis(O)[i]`. For an element $x$ of $O$, `Eltseq(x)` returns a sequence of coefficients giving $x$ in terms of the basis – these coefficients are elements of `FieldOfFractions(R)`.

In this chapter, the phrase *algebraic field* will refer to a `FldAlg`, i.e. either a number field (`FldNum`) or a field of fractions (`FldOrd`).

### Acknowledgement

The number field module in Magma has mostly developed out of the Kant/Kash system (Kant-V4) [[KAN97](https://docs.magma-maths.org/references.md#cite-kash)], [[KAN00](https://docs.magma-maths.org/references.md#cite-kant)], developed by the group of M. Pohst at TU Berlin.

<a id="creation"></a>
<a id="rngord-create"></a>
### Creation Functions

This section describes the main ways to construct number fields and orders, as well as creation of elements and homomorphisms.

#### Creation of Algebraic Fields

A field may be created as an *absolute extension* (absolute field), i.e. an extension of $Q$ by an irreducible polynomial, or as a *relative extension* (relative field), i.e. an extension of another field $K$ by an irreducible polynomial over $K$. See also Section [Creation of Structures](https://docs.magma-maths.org/GlobalFields/QuadraticFields/creation.md#fldquad-creation) for quadratic fields and Section [Creation Functions](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/creation.md#fldcyc-creation) for cyclotomic fields (these are the special subtypes of number fields in Magma). Some other constructions (which involve nontrivial computations) are the composite formed by two or more given fields, and the splitting field of a given polynomial or field.

<a id="function-numberfield-rngupolelt"></a>
##### `NumberField(f): RngUPolElt -> FldNum`

```magma
Check            : BoolElt                    Default: true
DoLinearExtension: BoolElt                    Default: false
Global           : BoolElt                    Default: false
```

Given an irreducible polynomial $f$ of degree $n\geq 1$ over $K = {\mathbb{Q}}$ or some number field $K$, create the number field $L=K(\alpha)$ obtained by adjoining a root $\alpha$ of $f$ to $K$. For details see [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield) in Section [Creation of Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#fldnum-creation).

The angle bracket notation may be used to assign the root $\alpha$ to an identifier e.g. `L<y> := NumberField(f)` where $y$ will be a root of $f$.

<a id="function-rationalsasnumberfield"></a>
##### `RationalsAsNumberField() -> FldNum`

<a id="function-qnf"></a>
##### `QNF() -> FldNum`

This creates a number field isomorphic to ${\mathbb{Q}}$. It is equivalent to `NumberField(x-1 : DoLinearExtension)`, where $x$ is `PolynomialRing(Rationals()).1`.

The result is a field isomorphic to ${\mathbb{Q}}$, but regarded by Magma as a number field (while ${\mathbb{Q}}$ itself is not, since `FldRat` is not a subtype of `FldNum`). It therefore supports all of the number field functions, while the `Rationals()` do not. On the other hand, arithmetic will be slower.

Coercion can be used to convert to and from the `Rationals()`.

<a id="function-numberfield-rngupolelt-2"></a>
##### `NumberField(s): [ RngUPolElt ] -> FldNum`

```magma
Check            : BoolElt                    Default: true
DoLinearExtension: BoolElt                    Default: false
Abs              : BoolElt                    Default: false
```

Let $K$ be a possibly trivial algebraic extension of ${\mathbb{Q}}$. Given a sequence $s$ of nonconstant polynomials $s_1, \ldots, s_m$, that are irreducible over $K$, create the number field $L=K(\alpha_1, \ldots, \alpha_m)$ obtained by adjoining a root $\alpha_i$ of each $s_i$ to $K$. For details see [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield-seq) in Section [Creation of Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#fldnum-creation).

<a id="constructor-constructor-ext-fldalg-rngupolelt-rngupolelt-fldalg"></a>
##### `ext< F | s1, ..., sn >: FldAlg, RngUPolElt, ..., RngUPolElt -> FldAlg`

<a id="constructor-constructor-ext-fldalg-rngupolelt-fldalg"></a>
##### `ext<F | s>: FldAlg, [RngUPolElt] -> FldAlg`

<a id="constructor-constructor-ext-fldrat-rngupolelt-rngupolelt-fldnum"></a>
##### `ext< Q | s1, ..., sn >: FldRat, RngUPolElt, ..., RngUPolElt -> FldNum`

<a id="constructor-constructor-ext-fldrat-rngupolelt-fldnum"></a>
##### `ext< Q | s >: FldRat, [RngUPolElt] -> FldNum`

```magma
Check            : BoolElt                    Default: true
Global           : BoolElt                    Default: false
Abs              : BoolElt                    Default: false
DoLinearExtension: BoolElt                    Default: false
```

Create the algebraic field defined by extending $F$ by the polynomials $s_i$ or the polynomials in the sequence $s$. Similar as for `NumberField(S)` described above, $F$ may be ${\mathbb{Q}}$ or a field of fractions. If $F$ is a field of fractions a field of fractions will be returned otherwise a number field will be returned. A tower of fields similar to that of [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield-seq) is created and the same restrictions as for that function apply to the polynomials that can be used in the constructor.

<a id="function-radicalextension-rng-rngintelt-rngelt"></a>
##### `RadicalExtension(F, d, a): Rng, RngIntElt, RngElt -> FldAlg`

```magma
Check: BoolElt                    Default: true
```

Let $F$ be an algebraic field. Let $a$ be an integral element of $F$ chosen such that $a$ is not an $n$-th power for any $n$ dividing $d$. Returns the algebraic field obtained by adjoining the $d$-th root of $a$ to $F$.

<a id="function-splittingfield-fldalg"></a>
##### `SplittingField(F): FldAlg -> FldAlg, SeqEnum`

<a id="function-normalclosure-fldalg"></a>
##### `NormalClosure(F): FldAlg -> FldAlg, SeqEnum`

```magma
Abs: BoolElt                    Default: true
Opt: BoolElt                    Default: true
```

Given an algebraic field $F$, return the splitting field of its defining polynomial. The roots of the defining polynomial in the splitting field are also returned.

If `Abs` is `true`, the resulting field will be an absolute extension, otherwise a tower is returned.

If `Opt` is `true`, an attempt of using [`OptimizedRepresentation`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-optimizedrepresentation) is done. If successful, the resulting field will have a much nicer representation. On the other hand, computing the intermediate maximal orders can be extremely time consuming.

<a id="function-splittingfield-rngupolelt"></a>
##### `SplittingField(f): RngUPolElt -> FldAlg`

Given an irreducible polynomial $f$ over ${\mathbb{Z}}$, return its splitting field.

<a id="function-splittingfield-rngupolelt-2"></a>
##### `SplittingField(L): [RngUPolElt] -> FldNum, [FldNumElt]`

```magma
Abs: BoolElt                    Default: false
Opt: BoolElt                    Default: false
```

Given a sequence $L$ of polynomials over a number field or the rational numbers, compute a common splitting field, i.e. a field $K$ such that every polynomial in $L$ splits into linear factors over $K$. The roots of the polynomials are returned as the second return value.

If the optional parameter `Abs` is `true`, then a primitive element for the splitting field is computed and the field returned will be generated by this primitive element over ${\mathbb{Q}}$. If in addition `Opt` is also `true`, then an optimized representation of $K$ is computed as well.

<a id="constructor-constructor-sub-fldalg-fldalgelt-fldalgelt-fldalg-map"></a>
##### `sub< F | e₁, ..., eₙ >: FldAlg, FldAlgElt, ..., FldAlgElt -> FldAlg, Map`

<a id="constructor-constructor-sub-fldalg-seqenum-fldalg-map"></a>
##### `sub< F | S >: FldAlg, SeqEnum -> FldAlg, Map`

Given an algebraic field $F$ with ground field $G$ and $n$ elements $e_i\in F$, return the algebraic field $H=G(e_1, \ldots, e_n)$ generated by the $e_i$ (over $G$), as well as the embedding homomorphism from $H$ to $F$.

<a id="function-mergefields-fldalg-fldalg"></a>
##### `MergeFields(F, L): FldAlg, FldAlg -> SeqEnum`

<a id="function-rngord-compositefields"></a>
##### `CompositeFields(F, L): FldAlg, FldAlg -> SeqEnum`

Let $F$ and $L$ be absolute algebraic fields. Returns a sequence of fields $[M_1, \ldots, M_r]$ such that each field $M_i$ contains both a root of the generating polynomial of $F$ and a root of the generating polynomial of $L$.

In detail: Suppose that $F$ is the smaller field (wrt. the degree). As a first step we factorise the defining polynomial of $L$ over $F$. For each factor obtained, an extension of $F$ is constructed and then transformed into an absolute extension. The sequence of extension fields is returned to the user.

<a id="function-compositum-fldalg-fldalg"></a>
##### `Compositum(K, L): FldAlg, FldAlg -> FldAlg`

For absolute number fields $K$ and $L$, at least one of which must be normal, find a smallest common over field. Note that in contrast to [`CompositeFields`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-compositefields) above the result here is essentially unique since one field was normal.

<a id="function-compositum-fldalg-fldab"></a>
##### `Compositum(K, A): FldAlg, FldAb -> FldAlg`

For a normal number field $K$ and abelian extension $A$ of some subfield of $K$, find a smallest common over field. Note that in contrast to [`CompositeFields`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-compositefields) above the result here is essentially unique since $K$ is normal.

<a id="function-rngord-optimizedrepresentation"></a>
##### `OptimizedRepresentation(F): FldAlg -> FldAlg, Map`

<a id="function-optimisedrepresentation-fldalg"></a>
##### `OptimisedRepresentation(F): FldAlg -> FldAlg, Map`

```magma
Al: MonStgElt                    Default: "Fast"
```

<a id="function-optimizedrepresentation-fldalg-rngintelt"></a>
##### `OptimizedRepresentation(F, d): FldAlg, RngIntElt -> FldAlg, Map`

<a id="function-optimisedrepresentation-fldalg-rngintelt"></a>
##### `OptimisedRepresentation(F, d): FldAlg, RngIntElt -> FldAlg, Map`

Given an algebraic field $F$ with ground field $\Q$, this function will attempt to find an isomorphic field $L$ with a better defining polynomial (in the sense defined below) than the one used to define $F$. If such a polynomial is found then $L$ is returned as well as a map from $F$ into $L$; otherwise $F$ will be returned. If `Al` is set to `Fast`, a fast randomised approach is used. Further, it can be set to `Polredabs` to determine a unique defining polynomial with the same selection criteria as implemented in pari. Setting `Al` to `Old` calls the old algorithm described below.

If the argument $d$ is not specified, a polynomial $g$ with integer coefficients is defined to be better than $f$ if it is monic, irreducible, defines a number field isomorphic to $F$ and its discriminant is smaller (in absolute value) than that of $f$. If a second argument $d$ is specified, then $g$ is defined to be better if in addition to the previous requirements $d$ is not an index divisor, that is, if $d$ does not divide the index (defined in the Invariants sub–section) $[O_L : E_L]$ of the equation order $E_L$ of $L$ in the maximal order $O_L$ (which are defined in the next sub–section).

Note however, that as a first step this function will determine the maximal order of $F$ which may take some time if the field is large.

<a id="example-ex-509ba1"></a>
##### `Example: Optimized Representation of a Field (ex-509ba1)`

Some results of `OptimizedRepresentation` are shown. Note that `OptimizedRepresentation` is a random algorithm, and may return different results for the same input.

```magma
> _<x> := PolynomialRing(Rationals());
> K := NumberField(x^4-420*x^2+40000);
> L := OptimizedRepresentation(K);
> L ne K;
true
> L;
Number Field with defining polynomial
    x^4 - 4*x^3 - 17*x^2 + 42*x + 59
    over the Rational Field
> L eq OptimizedRepresentation(L);
true
> f := DefiningPolynomial(K);
// f is an element of Q[x], so Discriminant(f) is in Q not Z
> Z := IntegerRing();
> Factorization(Z !  Discriminant(f));
[ <2, 18>, <5, 8>, <41, 2> ]
> g := DefiningPolynomial(L);
> g;
x^4 - 4*x^3 - 17*x^2 + 42*x + 59;
> Factorization(Z ! Discriminant(g));
[ <2, 4>, <3, 4>, <5, 2>, <41, 2> ]
> OL := MaximalOrder(L);
> EL := EquationOrder(L);
> Index(OL, EL);
36
> OptimizedRepresentation(L, 2) eq L;
true
```

As we see from this computation, the prime $5$ (as well as $41$) divides the discriminant of $g$ twice. This means that, potentially, 5 would still divide the index of the equation order in the maximal order $O_L$ of $L$. However, in fact $E_L$ has only index $36$ in $O_L$.

The optimized representation of $L$ such that $2$ does not divide the index of $E_L$ in $O_L$ is $L$ so $2$ does divide the index seemingly contrary to the description above. However, if a more optimal representation cannot be found then the field is returned which is what happens here.

#### Creation of Orders and Fields from Orders

The maximal order ${\cal O}_K$ of an algebraic field and the equation order of a number field can be obtained from the field. Other orders of a field are unitary subrings of finite index in the ring of integers; they contain a subset of the integral elements in the field. The equation order ${\cal E}_K={\mathbb{Z}}[\alpha]$ of $K={\mathbb{Q}}(\alpha)\cong {\mathbb{Q}}[X]/f(X)$, where $K$ is a number field defined by a monic integral polynomial, has the same basis as $K$, a power basis. Obviously ${\cal E}_K\subset{\cal O}_K$ since the minimal polynomial of $\alpha$ is integral and monic. Once an order is created in Magma further orders can be created from it.

<a id="function-equationorder-rngupolelt"></a>
##### `EquationOrder(f): RngUPolElt -> RngOrd`

```magma
Check: BoolElt                    Default: true
```

Given an irreducible non-constant monic integral polynomial $f\in R[X]$, return the equation order $E={\mathbb{R}}[X]/f(X)$ corresponding to $f$. If the optional parameter `Check` is set to `false` then the polynomial will not be checked for irreducibility.

<a id="function-equationorder-rngupolelt-2"></a>
##### `EquationOrder(S): [RngUPolElt] -> RngOrd`

```magma
Abs              : BoolElt                    Default: false
DoLinearExtension: BoolElt                    Default: false
Check            : BoolElt                    Default: true
Global           : BoolElt                    Default: false
```

The equation order of [`NumberField`](https://docs.magma-maths.org/GlobalFields/NumberFields/creation.md#function-fldnum-numberfield-seq)`(S)`.

<a id="function-equationorder-fldnum"></a>
##### `EquationOrder(K): FldNum -> RngOrd`

Return the equation order corresponding to the polynomial with which the number field $K$ was defined. The field $K$ must have been defined by a monic integral polynomial. Thus this function returns the extension of the equation order of the ground field of $K$ by the defining polynomial of $K$.

<a id="function-suborder-rngord"></a>
##### `SubOrder(O): RngOrd -> RngOrd`

Provided the order $O$ is not an equation order, $O$ is a transformation of some order $O'$. This function returns $O'$.

<a id="function-equationorder-rngord"></a>
##### `EquationOrder(O): RngOrd -> RngOrd`

A suborder of the order $O$ which is defined by a polynomial. e.g. $R[x] / f$ where $R$ is a polynomial ring over the coefficient ring of $O$ and $f$ is in $R$. It will also be the final order of `SubOrder(SubOrder(... SubOrder(O)))`. The order $O$ must have a monic defining polynomial for the equation order to exist.

<a id="function-integers-rngord"></a>
##### `Integers(O): RngOrd -> RngOrd`

<a id="function-ringofintegers-rngord"></a>
##### `RingOfIntegers(O): RngOrd -> RngOrd`

<a id="function-integerring-rngord"></a>
##### `IntegerRing(O): RngOrd -> RngOrd`

Returns the ring of integers in the order $O$, ie. $O$ itself.

<a id="example-ex-4c8125"></a>
##### `Example: Equation Order and Ring of Integers (ex-4c8125)`

Once a number field $K={\mathbb{Q}}(\alpha)$ has been created, one can obtain the equation order $E={\mathbb{Z}}[\alpha]$ and the ring of integers $O_K$ simply as follows.

```magma
> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> E := EquationOrder(K);
> O := MaximalOrder(K);
> Index(O, E);
64000
```

Note that entirely different things happen here: for the equation order nothing has to be computed, but the determination of the maximal order involves the complicated Round 2 (or 4) algorithm. In our particular example above, $E$ is a subring of index $2^9\cdot 5^3$ in $O$ (see also the example for orders and ideals in the subsection [Orders and Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#rngord-orders-ideals) where a maximal order is created).

<a id="constructor-constructor-sub-rngord-rngordelt-rngordelt-rngord"></a>
##### `sub< O | a₁, ..., aᵣ >: RngOrd, RngOrdElt, ..., RngOrdElt -> RngOrd`

Create the suborder of the order $O$ generated (as an algebra over ${\mathbb{Z}}$) by the elements $a_1, \ldots, a_r\in O$, that is, create ${\mathbb{Z}}[a_1, \ldots, a_r]$. If the algebra does not have full rank as a sub-module of $O$, an error results. Note, however, that it is currently *not* required that $1$ is in the sub-ring.

<a id="constructor-rngord-ext-seq"></a>
##### `ext< O | a₁, ..., aᵣ >: RngOrd, RngOrdElt, ..., RngOrdElt -> RngOrd`

Given an order $O$, and elements $a_1, \ldots, a_r$ lying in the maximal order of $O$, create the order $O[a_1, \ldots, a_r]$. Note that using this constructor $O$ can only be extended to be as large as the maximal order. This does not cause the maximal order to get computed. See also [`Order`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-order-seq) for a different version that allows parameters to improve efficiency.

<a id="constructor-constructor-ext-rngint-rngupolelt-rngord"></a>
##### `ext< Z | f >: RngInt, RngUPolElt -> RngOrd`

<a id="constructor-constructor-ext-rngord-rngupolelt-rngord"></a>
##### `ext< O | f >: RngOrd, RngUPolElt -> RngOrd`

Given an order $O$ and a polynomial $f$ of degree $n$ with coefficients in $O$, create the extension $E$ of $O$ by a root of $f$ which forms a free module of rank $n$ over $O$ : $E\cong O[\alpha]$; it is necessary for $f$ to be irreducible over $O$.

<a id="function-rngord-fieldoffractions"></a>
##### `FieldOfFractions(O): RngOrd -> FldOrd`

Return the field containing all fractions of elements of $O$. The angle bracket notation can be used to assign names to the basis elements of $F$ and assign these elements to variables, e.g. `F<x, y> := FieldOfFractions(MaximalOrder(x^2 + 3))`.

<a id="function-order-fldord"></a>
##### `Order(F): FldOrd -> RngOrd`

The order of which $F$ was created as its field of fractions. This function is an inverse to `FieldOfFractions`.

<a id="function-numberfield-rngord"></a>
##### `NumberField(O): RngOrd -> FldNum`

The number field of an order is recursively defined by:

1. the number field of **Z** is **Q**
2. the number field of $O$ is the number field of the coefficient ring of $O$, (i.e. the order over which $O$ is defined), with an element $\alpha$ adjoined where $\alpha$ is a root of the defining polynomial of $O$.

<a id="function-numberfield-fldord"></a>
##### `NumberField(F): FldOrd -> FldNum`

The number field of `Order(F)` for a field of fractions $F$.

<a id="example-ex-94a3f9"></a>
##### `Example: Bases of an Order and Its Fraction Field (ex-94a3f9)`

The following illustrates the relationship between the bases of an order, its field of fractions, and its number field.

```magma
> R<x> := PolynomialRing(Integers());
> f := x^5 + 5*x^4 - 75*x^3 + 250*x^2 + 65625;
> M := MaximalOrder(f);
> M;
Maximal Order of Equation Order with defining polynomial x^5 + 5*x^4 - 75*x^3 +
    250*x^2 + 65625 over its ground order
> Basis(FieldOfFractions(M));
[
    M.1,
    M.2,
    M.3,
    M.4,
    M.5
]
> Basis(NumberField(M));
[
    1,
    $.1,
    $.1^2,
    $.1^3,
    $.1^4
]
> Basis(M);
[
    M.1,
    M.2,
    M.3,
    M.4,
    M.5
]
> M.1 eq 1;
true
> M.2 eq NumberField(M).1;
false
> E := EquationOrder(M);
> NumberField(M) eq NumberField(E);
true
> Basis(FieldOfFractions(E), NumberField(M));
[
    1,
    $.1,
    $.1^2,
    $.1^3,
    $.1^4
]
> M!Basis(FieldOfFractions(E))[1];
[1, 0, 0, 0, 0]
> M!Basis(FieldOfFractions(E))[2];
[0, 5, 0, 0, 0]
> M!NumberField(M).1;
[0, 5, 0, 0, 0]
```

<a id="function-optimizedrepresentation-rngord"></a>
##### `OptimizedRepresentation(O): RngOrd -> BoolElt, RngOrd, Map`

<a id="function-optimisedrepresentation-rngord"></a>
##### `OptimisedRepresentation(O): RngOrd -> BoolElt, RngOrd, Map`

<a id="function-optimizedrepresentation-rngord-rngintelt"></a>
##### `OptimizedRepresentation(O, d): RngOrd, RngIntElt -> BoolElt, RngOrd, Map`

<a id="function-optimisedrepresentation-rngord-rngintelt"></a>
##### `OptimisedRepresentation(O, d): RngOrd, RngIntElt -> BoolElt, RngOrd, Map`

Given an order $O$ with ground ring ${\mathbb{Z}}$, this function will attempt to find an isomorphic order $OO$ with discriminant the same as O with a better defining polynomial than the one used to define $O$. If such a polynomial is found then $OO$ is returned; otherwise only `false` is returned. If the argument $d$ is not specified, a polynomial $g$ with integer coefficients is defined to be better than $f$ if it is monic, irreducible, defines an order isomorphic to $O$ and its discriminant is smaller in absolute value than that of $f$. If a second argument $d$ is specified, then $g$ is defined to be better if in addition to the previous requirements $d$ is not an index divisor, that is, if $d$ does not divide the index (defined in the Invariants sub–section) $[OO : E_{OO}]$ of the equation order $E_{OO}$ of $OO$ in $OO$.

<a id="operation-op-plus-rngord-rngord"></a>
##### `O + P: RngOrd, RngOrd -> RngOrd`

Add two orders $O$ and $P$ having the same equation order. Computes the smallest common over order.

<a id="operation-op-meet-rngord-rngord"></a>
##### `O meet P: RngOrd, RngOrd -> RngOrd`

The intersection of two orders $O$ and $P$ having the same equation order.

<a id="function-asextensionof-rngord-rngord"></a>
##### `AsExtensionOf(O, P): RngOrd, RngOrd -> RngOrd`

Return the order $O$ as a transformation of the order $P$ where $O$ and $P$ have the same coefficient ring.

<a id="function-order-rngord-algmatelt-rngintelt"></a>
##### `Order(O, T, d): RngOrd, AlgMatElt, RngIntElt -> RngOrd`

```magma
Check: BoolElt                    Default: true
```

Let $O$ be an absolute order with basis $b_1, \ldots, n_n$, $T=(T_{i,j})\in{\operatorname{GL}}(n, {\mathbb{Q}}) \cap {\operatorname{Mat}}(n, {\mathbb{Z}})$ and $d\in \rm N$. This function creates the order with basis $(1/d\sum_{j=1}^n T_{i,j}b_j)_{i\leq i\leq n}$. The parameter `Check` can be set to `false` when the order is large to avoid checking that the result actually is an order. Note that this can result in a non-order being constructed which may cause errors later.

<a id="function-order-rngord-modded"></a>
##### `Order(O, M): RngOrd, ModDed -> RngOrd`

```magma
NFBasis: BoolElt                    Default: true
```

<a id="function-order-rngord-pmat"></a>
##### `Order(O, M): RngOrd, PMat -> RngOrd`

```magma
Check: BoolElt                    Default: true
```

Let $O$ be an order with (pseudo) basis $b_1, \ldots, b_n$ and $M=\sum_{i=1}^n A_i\alpha_i \subseteq k^n$ be an $o_k$-module where $o_k$ is the coefficient ring of $O$. This function creates the order $\sum_{i=1}^n A_i c_i$ where $c_i := \sum_{j=1}^n\alpha_{i,j}b_j$. If the parameter `Check` is set to `false`, then it will not be checked that the result actually is an order (potentially expensive). Note that this can result in a non-order being constructed which may cause errors later. If the parameter `NFBasis` is set to `false` then the `PseudoGenerators` of the module $M$ will be used rather than the `PseudoBasis`, however these pseudo generators must also be a pseudo basis.

<a id="function-rngord-order-seq"></a>
##### `Order([ e₁, ... eₙ ]): [FldAlgElt] -> RngOrd`

```magma
Verify : BoolElt                    Default: true
IsBasis: BoolElt                    Default: false
```

Given $n$ elements $e_1, \ldots, e_n$ in an algebraic extension field $F$ over ${\mathbb{Q}}$ create the minimal order $O$ of $F$ which contains all the $e_i$. If `Verify` is `true`, it is verified that the $e_i$ are integral algebraic numbers. This can be a lengthy process if the field is of large degree.

Setting `IsBasis` to `true` assumes that the given elements actually form a basis for the new order, thus it avoids testing for multiplicative closure. Without this parameter the order returned will have a canonical basis chosen with no direct relation to the input. Note that setting `IsBasis` to `true` can result in a non-order being constructed if the elements in the sequence are not a basis which may cause errors later. By default, products of the generators will be added until the module is closed under multiplication.

If `IsBasis` is set to `true` to specify the basis of the resulting order rather than avoid the expense of the multiplicative closure computation, it can be checked that the result $O$ is an order using `Order(SubOrder(O), Matrix(CoefficientRing(O), M*d), d) where d is Denominator(M) where M is BasisMatrix(O);`. If $O$ is not an order this will cause an error.

<a id="rngord-max-ord"></a>
<a id="id1"></a>
#### Maximal Orders

The maximal order ${\cal O}_K$ is the ring of integers of an algebraic field consisting of all integral elements of the field; that is, elements which are roots of monic integer polynomials. It may also be called the number ring of a number field.

There are a number of algorithms which Magma uses whilst computing maximal orders. Each maximal order is a sum of $p$-maximal orders. The main algorithm used for $p$-maximal orders is a mixture of the Round–$2$ and Round–$4$ methods ([[Bai96](https://docs.magma-maths.org/references.md#cite-bai1), [Coh93](https://docs.magma-maths.org/references.md#cite-cohen1), [Poh93](https://docs.magma-maths.org/references.md#cite-pohst2), [PZ89](https://docs.magma-maths.org/references.md#cite-pohst1)]) for absolute extensions and a variant of the Round–$2$ for relative extensions ([[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), [Fri97](https://docs.magma-maths.org/references.md#cite-fr1)]).

However if the field is a radical (pure) extension, there is another algorithm available which is used to calculate each $p$-maximal order. In this case we can compute a pseudo basis for the $p$-maximal orders knowing only the valuation of the constant coefficient of the defining polynomial at $p$ [[Sut12](https://docs.magma-maths.org/references.md#cite-suth-max-kummer)].

It is possible to compute the maximal order of an absolute extension of ${\mathbb{Z}}$ or ${\mathbb{Q}}$ defined by one monic, integral polynomial using the Montes Algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)]. The Montes algorithm can be selected using `Al := "Montes"` when the input is a field or an order. For more on the Montes Algorithm see Section [The Montes Algorithm](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/montes.md#montes-fld-num).

The Round–$2$ and Round–$4$ algorithms can be selected by setting the parameter `Al` to `"Round2"` and `"Round4"` respectively. Another option for this parameter and for computation of $p$-maximal orders is the `"Pauli"` method. This method is only available for equation orders in simple relative extensions. It uses the factorization of the defining polynomial over the completion of the order.

Alternatively, if the discriminant of the maximal order is already known, the parameters `Discriminant` or `Ramification` can be used. If the input is an order $O$ and the `Discriminant` or `Ramification` parameters are supplied an algorithm which can compute the maximal order given the discriminant of the maximal order will be used. `Discriminant` must be an integer if $O$ is an absolute order and must be an ideal of the coefficient ring of $O$ if $O$ is a relative order. `Ramification` must contain integers if $O$ is an absolute order and must contain ideals of the coefficient ring of $O$ if $O$ is a relative order. The ramification sequence is taken to contain prime factors of the discriminant. Only one of these parameters can be specified, and in this case `Al` cannot be specified. This algorithm is based on [[BL94c](https://docs.magma-maths.org/references.md#cite-buchman-lenstra)], Theorems 1.2 and 7.6.

Since version 2.30, a new driver combining the Montes and Buchmann-Lenstra methods is available for computing the maximal order of an absolute number field of degree greater than two. The parameter `Hint` can be used to supply a sequence of integers that may contain factors of the discriminant. Setting `TimeLimit` to a positive value limits integer factorization using runtime estimates calibrated for an i7 processor. This is an approximate limit: actual runtimes can vary substantially, even on the reference hardware. A second return value indicates whether the computation was interrupted by the time limit: it is set to true if the computation ran to completion. Finally, the [[Mul25](https://docs.magma-maths.org/references.md#cite-muldersquarefree)] factorization can be used by setting `Mulder` to `true`.

<a id="function-maximalorder-rngord"></a>
##### `MaximalOrder(O): RngOrd -> RngOrd, BoolElt`

<a id="function-rngord-maximalorder"></a>
##### `MaximalOrder(F): FldAlg -> RngOrd, BoolElt`

```magma
Al          : MonStgElt                    Default: "Auto"
Discriminant: Any                          Default: 
Ramification: SeqEnum                      Default: 
Hint        : SeqEnum                      Default: 
TimeLimit   : RngElt                       Default: 0
Mulder      : BoolElt                      Default: false
MaximalOrder: Verbose                      Default: 5
```

<a id="function-integerring-fldalg"></a>
##### `IntegerRing(F): FldAlg -> RngOrd`

<a id="function-integers-fldalg"></a>
##### `Integers(F): FldAlg -> RngOrd`

<a id="function-ringofintegers-fldalg"></a>
##### `RingOfIntegers(F): FldAlg -> RngOrd`

```magma
Al          : MonStgElt                    Default: "Auto"
Discriminant: Any                          Default: 
Ramification: SeqEnum                      Default: 
MaximalOrder: Verbose                      Default: 5
```

Return the maximal order or ring of integers of the number field $F$. When the input is an order $O$ or a field of fractions of an order $O$ return the order containing $O$ which is the largest order in the number field of $O$.

An integral basis for $F$ can be found as the basis of the maximal order.

For information on the parameters, see the introduction to this section above, [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#rngord-max-ord). The variants that support `TimeLimit` return, as a second value, `true` if the computation ran to completion. This is only available for absolute number fields.

<a id="function-rngord-maxord"></a>
##### `MaximalOrder(f): RngUPolElt -> RngOrd, BoolElt`

```magma
Check       : BoolElt                      Default: true
Al          : MonStgElt                    Default: "Auto"
Discriminant: Any                          Default: 
Ramification: SeqEnum                      Default: 
Hint        : SeqEnum                      Default: 
TimeLimit   : RngElt                       Default: 0
Mulder      : BoolElt                      Default: false
MaximalOrder: Verbose                      Default: 5
```

This is equivalent to `MaximalOrder(NumberField(f))`.

The `Check` parameter if set to `false` will prevent checking of the polynomial for irreducibility.

For information on the other parameters, see the introduction to this section above.

<a id="example-ex-474b81"></a>
##### `Example: Maximal Order with Known Ramification (ex-474b81)`

The following shows the advantage of the `Ramification` parameter to the `MaximalOrder` function.

```magma
> R<t> := PolynomialRing(Integers());
> f1 := t^14 - 63*t^12 - 9555*t^11 + 118671*t^10 - 708246*t^9 - 17922660*t^8 +
> 859373823*t^7 + 2085856500*t^6 - 117366985106*t^5 - 335941176396*t^4 +
> 4638317668005*t^3 + 17926524826973*t^2 + 7429846568445*t+ 91264986397629;
> d1 := [2, 3, 5, 7, 59];
> time MaximalOrder(f1:Ramification := d1);
Maximal Order of Equation Order with defining polynomial x^14 - 63*x^12 -
    9555*x^11 + 118671*x^10 - 708246*x^9 - 17922660*x^8 + 859373823*x^7 +
    2085856500*x^6 - 117366985106*x^5 - 335941176396*x^4 + 4638317668005*x^3 +
    17926524826973*x^2 + 7429846568445*x + 91264986397629 over Z
Time: 0.230
true
> time MaximalOrder(f1);
Maximal Order of Equation Order with defining polynomial x^14 - 63*x^12 -
    9555*x^11 + 118671*x^10 - 708246*x^9 - 17922660*x^8 + 859373823*x^7 +
    2085856500*x^6 - 117366985106*x^5 - 335941176396*x^4 + 4638317668005*x^3 +
    17926524826973*x^2 + 7429846568445*x + 91264986397629 over Z
Time: 0.590
true
> f2 := t^14 - 129864*t^12 - 517832*t^11 + 6567239322*t^10 + 33352434192*t^9 -
> 166594899026864*t^8 - 752915315481312*t^7 + 2275891736459084940*t^6 +
> 7743078094604088768*t^5 - 16633213695413438344032*t^4 -
> 39871919309692447523616*t^3 + 60126791399546070679893112*t^2 +
> 77844118533852728698751040*t - 83173498199506854751458701376;
> d2 := [2,3,7,4145023];
>
> time MaximalOrder(f2:Ramification := d2);
Maximal Order of Equation Order with defining polynomial x^14 - 129864*x^12 -
    517832*x^11 + 6567239322*x^10 + 33352434192*x^9 - 166594899026864*x^8 -
    752915315481312*x^7 + 2275891736459084940*x^6 + 7743078094604088768*x^5 -
    16633213695413438344032*x^4 - 39871919309692447523616*x^3 +
    60126791399546070679893112*x^2 + 77844118533852728698751040*x -
    83173498199506854751458701376 over Z
Time: 0.730
true
> time MaximalOrder(f2);
Maximal Order of Equation Order with defining polynomial x^14 - 129864*x^12 -
    517832*x^11 + 6567239322*x^10 + 33352434192*x^9 - 166594899026864*x^8 -
    752915315481312*x^7 + 2275891736459084940*x^6 + 7743078094604088768*x^5 -
    16633213695413438344032*x^4 - 39871919309692447523616*x^3 +
    60126791399546070679893112*x^2 + 77844118533852728698751040*x -
    83173498199506854751458701376 over Z
Time: 0.840
true
> f13 := t^15 - 114*t^14 + 282185319*t^13 + 1247857228852*t^12 -
> 35114805704965233*t^11 - 141524337796433387826*t^10 +
> 2604584980442264028744009*t^9 + 14153948932132918272984150384*t^8 -
> 178273077248353369941327628479552*t^7 - 1142953506821390914419260564494304768
> *t^6 + 15975069142211276963134599495014990639616*t^5 +
> 33516684438303088018217308253251277376159744*t^4 -
> 617589777108203716232396372453619309554471256064*t^3 -
> 397561412445066919545461762354884631501806174863360*t^2 +
> 2266657182908547570648245464215192357802047101628186624*t
> - 1302222456532760256406916223259306960561657428777814196224;
> d13 := [2, 3, 3377890562461, 7623585272461];
> time MaximalOrder(f13: Ramification := d13);
Maximal Order of Equation Order with defining polynomial x^15 - 114*x^14 +
    282185319*x^13 + 1247857228852*x^12 - 35114805704965233*x^11 -
    141524337796433387826*x^10 + 2604584980442264028744009*x^9 +
    14153948932132918272984150384*x^8 - 178273077248353369941327628479552*x^7 -
    1142953506821390914419260564494304768*x^6 +
    15975069142211276963134599495014990639616*x^5 +
    33516684438303088018217308253251277376159744*x^4 -
    617589777108203716232396372453619309554471256064*x^3 -
    397561412445066919545461762354884631501806174863360*x^2 +
    2266657182908547570648245464215192357802047101628186624*x -
    1302222456532760256406916223259306960561657428777814196224 over Z
Time: 0.270
true
```

<a id="example-ex-474b82"></a>
##### `Example: Maximal Order with new driver (ex-474b82)`

The usage of the new driver is shown in the next examples.

```magma
> R<t> := PolynomialRing(Integers());
> f13 := t^15 - 114*t^14 + 282185319*t^13 + 1247857228852*t^12 -
> 35114805704965233*t^11 - 141524337796433387826*t^10 +
> 2604584980442264028744009*t^9 + 14153948932132918272984150384*t^8 -
> 178273077248353369941327628479552*t^7 - 1142953506821390914419260564494304768
> *t^6 + 15975069142211276963134599495014990639616*t^5 +
> 33516684438303088018217308253251277376159744*t^4 -
> 617589777108203716232396372453619309554471256064*t^3 -
> 397561412445066919545461762354884631501806174863360*t^2 +
> 2266657182908547570648245464215192357802047101628186624*t
> - 1302222456532760256406916223259306960561657428777814196224;
> time MaximalOrder(f13);
Maximal Order of Equation Order with defining polynomial x^15 - 114*x^14 + 282185319*x^13 + 1247857228852*x^12 - 35114805704965233*x^11 
 - 141524337796433387826*x^10 + 2604584980442264028744009*x^9 + 
 14153948932132918272984150384*x^8 - 178273077248353369941327628479552*x^7 - 
 1142953506821390914419260564494304768*x^6 + 
 15975069142211276963134599495014990639616*x^5 + 
 33516684438303088018217308253251277376159744*x^4 - 
 617589777108203716232396372453619309554471256064*x^3 - 
 397561412445066919545461762354884631501806174863360*x^2 + 
 2266657182908547570648245464215192357802047101628186624*x - 
 1302222456532760256406916223259306960561657428777814196224 over its ground order
true
Time: 0.060
> p1 := 10^50+151; p2 := 10^55+21;
> time MaximalOrder(t^3 - p1*p2 : TimeLimit := 1);
Equation Order with defining polynomial x^3 - 
 100000000000000000000000000000000000000000000000151000210000000000000000000\
 0000000000000000000000000003171 over its ground order
false
Time: 0.850
> Discriminant($1);
-270000000000000000000000000000000000000000000000815401134000000000000000000000\
0000000000000000006156304246811907000000000000000000000000000000000000025856369\
9591400000000000000000000000000000000000000000271491507
> time MaximalOrder(t^3 - p1*p2 : Hint := [p1], TimeLimit := 1);
Maximal Equation Order with defining polynomial x^3 - 
 100000000000000000000000000000000000000000000000151000210000000000000000000\
 0000000000000000000000000003171 over its ground order
true
Time: 0.060
> Discriminant($1);
-270000000000000000000000000000000000000000000000815401134000000000000000000000\
0000000000000000006156304246811907000000000000000000000000000000000000025856369\
9591400000000000000000000000000000000000000000271491507
```

Thus, in some cases the maximal order can be determined without a hard integer factorization. Using `hint` to give partial information about ramified primes can be helpful. Further, in many cases the maximal order is found (but not proven) without a hard factorization.

<a id="orders-ideals"></a>
<a id="rngord-orders-ideals"></a>
##### Orders and Ideals

Orders may be created using ideals of another order. Ideals are discussed in Section [Ideals and Quotients](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngord-ideal). The following intrinsics form part of the computation of maximal orders as discussed above in Section [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#rngord-max-ord).

<a id="function-pmaximalorder-rngord-rngintelt"></a>
###### `pMaximalOrder(O, p): RngOrd, RngIntElt -> RngOrd`

<a id="function-pmaximalorder-rngord-rngordidl"></a>
###### `pMaximalOrder(O, p): RngOrd, RngOrdIdl -> RngOrd`

```magma
Al: MonStgElt                    Default: "Auto"
```

The $p$-maximal overorder of $O$ (see also the example below). This is the largest overorder $P$ such that the index $(P:O)$ is a power of $p$, a prime in the coefficient ring of $O$. The options for the `Al` parameter are the same as those for [`MaximalOrder`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#function-rngord-maxord).

If $O$ is a kummer extension then specific code is used to calculate each $p$-maximal order, rather than the Round $2$ or Round $4$ methods. In this case we know $1$ or $2$ elements which generate the $p$-maximal order and can easily write the order down.

<a id="function-pradical-rngord-rngintelt"></a>
###### `pRadical(O, p): RngOrd, RngIntElt -> RngOrdIdl`

<a id="function-pradical-rngord-rngordidl"></a>
###### `pRadical(O, p): RngOrd, RngOrdIdl -> RngOrdIdl`

Returns the $p$-radical of an order $O$ for a prime $p$ in the coefficient ring of $O$, defined as the ideal consisting of elements of $O$ for which some power lies in the ideal $pO$.

It is possible to call this function for $p$ not prime (so long as $p$ is greater than the degree of $O$ if it is an integer). In this case the $p$-trace-radical will be computed, i.e.

$$
\{ x\in F \mid {\operatorname{Tr}}(xO)\subseteq p{\mathbb{Z}}\}.
$$

If $p$ is square free and all divisors are larger than the field degree, this is the intersection of the radicals for all $l$ dividing $p$. In particular together with `MultiplicatorRing` this can sometime be used to compute maximal orders without factoring the discriminant [[BL94c](https://docs.magma-maths.org/references.md#cite-buchman-lenstra), [Fri00](https://docs.magma-maths.org/references.md#cite-fr2)] or at least “good” approximations.

<a id="function-multiplicatorring-rngordfracidl"></a>
###### `MultiplicatorRing(I): RngOrdFracIdl -> Rng`

Returns the multiplicator ring $M$ of the ideal $I$ of the order $O$, that is, the subring of elements of the field of fractions $K$ of $O$ multiplying $I$ into itself: $M=\{ x \in F : xI\subset I\}$.

<a id="example-ex-638433"></a>
###### `Example: Implementing the Round 2 Algorithm (ex-638433)`

To illustrate how the Round 2 algorithm for the determination of the ring of integers works, we present an implementation of it in the Magma language. The key functions are `MultiplicatorRing` and `pRadical`, called by the following function `pMaximalOverOrder`;

```magma
> pMaximalOverOrder := function(ord, p)
>        ovr := MultiplicatorRing(pRadical(ord, p));
>        print "index is", Index(ovr, ord);
>        return (Index(ovr, ord) eq 1) select ovr else $$(ovr, p);
> end function;
```

which finds the largest overorder in which the given order has $p$-power index. This function is now simply applied to the equation order, for each prime dividing the discriminant:

```magma
> Round2 := function(E, K)
>        // E should be some order of a number field K
>        d := Discriminant(E);
>        fact := Factorization(Abs(d));
>        print fact;
>        M := E;
>        for x in fact do
>             M := M+pMaximalOverOrder(E, x[1]);
>        end for;
>        print "index of equation order in maximal order is:", Index(M, E);
>        return M;
> end function;
```

In our running example, this produces the following output:

```magma
> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> E := EquationOrder(K);
> Round2(E, K);
[ <2, 18>, <5, 8>, <41, 2> ]
index is 2
index is 4
index is 8
index is 4
index is 2
index is 1
index is 5
index is 25
index is 1
index is 1
index of equation order in maximal order is: 64000
Transformation of E
Transformation Matrix:
[800   0   0   0]
[  0 400   0   0]
[  0 200  20   0]
[400 180   0   1]
Denominator: 800
```

<a id="element"></a>
<a id="rngord-main-elt-create"></a>
#### Creation of Elements

Elements of algebraic fields and of orders are displayed quite differently. Algebraic field elements are always printed as a linear combination with rational coefficients of the basis elements of the field. For number fields which have a power basis this is also a polynomial in the primitive element of the field with rational coefficients; that is, an element of $G[x]/f$, where $f$ was the defining polynomial of the field over the ground field $G$. Since in general $G$ will be an algebraic field itself, elements in relative extensions, i.e. $G$ strictly bigger than ${\mathbb{Q}}$, will be printed as linear combinations with linear combinations as coefficients and for number fields this will look like multivariate polynomials. In fact they are recursively defined univariate polynomials. Elements of orders are displayed as sequences of integer coefficients, referring to the basis of the order. To convert this ${\mathbb{Z}}$-basis representation to a polynomial expression in the primitive element of an associated number field, the element should be coerced into the number field (using `!`). To print the element as a linear combination of the basis elements, coerce the element into the field of fractions.

<a id="operation-op-fldalg-rngelt"></a>
##### `F ! a: FldAlg, RngElt -> FldAlgElt`

<a id="constructor-constructor-elt-fldalg-rngelt-fldalgelt"></a>
##### `elt< F | a >: FldAlg, RngElt -> FldAlgElt`

Coerce $a$ into the field $F$. Here $a$ may be an integer or a rational field element, or an element from a subfield of $F$, or from an order in such.

<a id="operation-op-fldalg-rngelt-2"></a>
##### `F ! [a₀, a₁, ..., aₘ₋₁]: FldAlg, [RngElt] -> FldAlgElt`

<a id="constructor-constructor-elt-fldalg-seqenum-rngelt-fldalgelt"></a>
##### `elt< F | [ a₀, a₁, ..., aₘ₋₁ ] >: FldAlg, SeqEnum[RngElt] -> FldAlgElt`

<a id="constructor-constructor-elt-fldalg-rngelt-rngelt-fldalgelt"></a>
##### `elt< F | a₀, a₁, ..., aₘ₋₁>: FldAlg, RngElt, ..., RngElt -> FldAlgElt`

Given the algebraic field, $F$ of degree $m$ over its ground field $G$ and a sequence $[a_0, \ldots, a_{m-1}]$ of elements of $G$, construct the element $a_0\alpha_0 + a_1\alpha_1 + \cdots a_{m-1}\alpha_{m-1}$ of $F$ where the $\alpha_i$ are the basis elements of $F$.

<a id="operation-op-rngord-rngelt"></a>
##### `O ! a: RngOrd, RngElt -> RngOrdElt`

<a id="constructor-constructor-elt-rngord-rngelt-rngordelt"></a>
##### `elt< O | a >: RngOrd, RngElt -> RngOrdElt`

Coerce $a$ into the order $O$. Here $a$ is allowed to be an integer, or an integral element of an associated algebraic field of $O$, or an element of a quotient order.

<a id="operation-op-rngord-rngelt-2"></a>
##### `O ! [a₀, a₁, ..., aₘ₋₁]: RngOrd, [ RngElt ] -> RngOrdElt`

<a id="constructor-constructor-elt-rngord-seqenum-rngelt-rngordelt"></a>
##### `elt< O | [ a₀, a₁, ..., aₘ₋₁ ] >: RngOrd, SeqEnum[RngElt] -> RngOrdElt`

<a id="constructor-constructor-elt-rngord-rngelt-rngelt-rngordelt"></a>
##### `elt< O | a₀, a₁, ..., aₘ₋₁ >: RngOrd, RngElt, ..., RngElt -> RngOrdElt`

Given the order $O$ of degree $m$ and elements $a_0, a_{1}, \ldots, a_{m-1}$ in the ground order of $O$, construct the element $a_0\alpha_0 + a_1  \alpha_1 + \cdots + a_{m-1} \alpha_{m-1}$ of $O$, where $\alpha_0, \ldots, \alpha_{m-1}$ is the basis for the order.

<a id="function-random-fldalg-rngintelt"></a>
##### `Random(F, m): FldAlg, RngIntElt -> FldAlgElt`

<a id="function-random-rngord-rngintelt"></a>
##### `Random(O, m): RngOrd, RngIntElt -> RngOrdElt`

A random element of the algebraic field $F$ or order $O$. The maximal size of the coefficients is determined by $m$.

<a id="function-random-rngordfracidl-rngintelt"></a>
##### `Random(I, m): RngOrdFracIdl, RngIntElt -> FldOrdElt`

A random element of the ideal $I$ as an element of the field of fractions of the associated order. The maximal size of the coefficients with respect to the ideal basis is determined by $m$.

<a id="example-ex-759e86"></a>
##### `Example: Three Ways to Create an Element (ex-759e86)`

Here are three ways of creating the same integral element in $K$ as an element of the maximal order and its field of fractions.

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> O := MaximalOrder(K);
> e := O ! (y^2/40 + y/4);
> // Coordinates of e with respect to Basis(O):
> v := Eltseq(e);
> v;
[ 0, 1, 1, 0 ]
> // The same coordinates build the element directly,
> // both in O and in its field of fractions:
> f := elt< O | v >;
> f eq e;
true
> F<a, b, c, d> := FieldOfFractions(O);
> g := F ! v;
> g eq e;
true
> g;
b + c
```

These constructions would have failed if the element was not in $O$.

<a id="function-one-fldalg"></a>
##### `One(K): FldAlg -> FldAlgElt`

<a id="function-one-rngord"></a>
##### `One(O): RngOrd -> RngOrdElt`

<a id="function-identity-fldalg"></a>
##### `Identity(K): FldAlg -> FldAlgElt`

<a id="function-identity-rngord"></a>
##### `Identity(O): RngOrd -> RngOrdElt`

<a id="function-zero-fldalg"></a>
##### `Zero(K): FldAlg -> FldAlgElt`

<a id="function-zero-rngord"></a>
##### `Zero(O): RngOrd -> RngOrdElt`

<a id="function-representative-fldalg"></a>
##### `Representative(K): FldAlg -> FldAlgElt`

<a id="function-representative-rngord"></a>
##### `Representative(O): RngOrd -> RngOrdElt`

#### Creation of Homomorphisms

To specify homomorphisms from algebraic fields or orders in algebraic fields, it is necessary to specify the image of the generating elements, and possible to specify a map on the ground field.

<a id="constructor-constructor-hom-fldalg-rng-rngelt-map"></a>
##### `hom< F -> R | r >: FldAlg, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-fldalg-rng-map-rngelt-map"></a>
##### `hom< F -> R | h, r >: FldAlg, Rng, Map, RngElt -> Map`

Given an algebraic field $F$, defined as an extension of the ground field $G$, as well as some ring $R$, build the homomorphism $\phi$ obtained by sending the defining primitive element $\alpha$ of $F$ to the element $r\in R$.

If $F$ is a field of fractions then $r$ will be the image of the primitive element of the field of fractions of the equation order of `Order(F)`.

It is possible (if $G={\mathbb{Q}}$) and sometimes necessary (if $G\neq {\mathbb{Q}}$) to specify a homomorphism $\phi$ on $F$ by specifying its action on $G$ by providing a homomorphism $h$ with $G$ as its domain and $R$ its codomain together with the image of $\alpha$. If $R$ does not cover $G$ then the homomorphism $h$ from $G$ into $R$ is necessary to ensure that the ground field can be mapped into $R$.

<a id="constructor-constructor-hom-rngord-rng-rngelt-map"></a>
##### `hom< O -> R | r >: RngOrd, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-rngord-rng-map-rngelt-map"></a>
##### `hom< O -> R | h, r >: RngOrd, Rng, Map, RngElt -> Map`

Given an order $O$, a ring $R$, and an element $r\in R$, construct a homomorphism $\phi$ by sending the primitive element of the equation order of $O$ to $r$.

To be more precise: Let $K$ be the field of fractions of $O$, $k$ be the base field of $K$ i.e. the field of fractions of the base ring of $O$, and $N$ := `NumberField(O)`. As a $k$–algebra $K$ is generated by $x := K!N.1$, so $x$ is zero of `DefiningPolynomial(O)`. The element $r$ given in the map construction will be the image of $x$.

When $O$ is an equation order e.g. if $O$ was defined using a monic integral polynomial $x$ will be `O.2`.

As in the field case it is possible to specify a map on the coefficient ring of $O$ (ring over which $O$ is defined) with codomain $R$. This is necessary if $R$ does not cover the coefficient ring of $O$.

<a id="example-ex-d59686"></a>
##### `Example: Embedding a Quadratic Field in a Quartic Field (ex-d59686)`

We show a way to embed the field ${\mathbb{Q}}(\sqrt{2})$ in ${\mathbb{Q}}(\sqrt{2}+\sqrt{3})$. The application of the homomorphism suggests how the image could have been chosen.

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^2-2);
> KL<w> := NumberField(x^4-10*x^2+1);
> H := hom< K -> KL | (9*w-w^3)/2 >;
> H(y);
1/2*(-w^3 + 9*w)
> H(y)^2;
2
```

Homomorphisms can be created between any order or algebraic field and any ring.

```magma
> f := x^4 + 5*x^3 - 25*x^2 + 125*x + 625;
> M := MaximalOrder(f);
> F<a, b, c, d> := FieldOfFractions(M);
> FF := FiniteField(5, 3);
> F;
Field of Fractions of M
> FF;
Finite field of size 5^3
> h := hom< F -> FF | Coercion(Rationals(), FF), 3*FF.1>;
> h;
Mapping from: FldOrd: F to FldFin: FF
> h(a); h(b);
1

>> h(a); h(b);
          ^
Runtime error in map application: Application of map failed
> h(5*b); h(5*5*c); h(5*5*5*d);
FF.1^94
FF.1^64
FF.1^34
```

This unexpected behaviour occurs because when the basis of $F$ is expressed with respect to the power basis of the number field they have denominator divisible by $5$. A more well–behaved example is shown below.

```magma
> FF := FiniteField(11, 5);
> h := hom< F -> FF | Coercion(Rationals(), FF), 7*FF.1>;
> h(a);
1
> h(b); h(c); h(d);
FF.1^48316
FF.1^96632
FF.1^144948
> 7*FF.1;
FF.1^112736
> 5*h(b);
FF.1^112736
> PrimitiveElement(F);
5/1*b
```

<a id="constructor-constructor-hom-rngfunord-rng-rngelt-rngelt-map"></a>
##### `hom< O -> R | b₁, ..., bₙ >: RngFunOrd, Rng, RngElt, ..., RngElt -> Map`

<a id="constructor-constructor-hom-rngfunord-rng-map-rngelt-rngelt-map"></a>
##### `hom< O -> R | m, b₁, ..., bₙ >: RngFunOrd, Rng, Map, RngElt, ..., RngElt -> Map`

Return the map from the order $O$ of an algebraic number field to the ring $R$ mapping the basis elements to $b_1, .., b_n$. If given, the map $m$ should be from the coefficient ring of $O$ to $R$ and will be used to map the coefficients of the basis elements. If not given the coefficient ring of $O$ should by covered by $R$.

<a id="function-isringhomomorphism-map"></a>
##### `IsRingHomomorphism(m): Map -> BoolElt`

Return whether the vector space homomorphism $m$ is a homomorphism of rings.

### Printing

<a id="procedure-setverbose-monstgelt-rngintelt"></a>
#### `SetVerbose(s, n): MonStgElt, RngIntElt`

There are a number of verbose flags `s` applying to the functions described in this chapter. The flags and their levels `n` are mentioned in the descriptions of the functions which use them.

Note however, that setting the verbose levels may produce unexpected results since the effective scope of the flags is a little bit vague. Consider the following example:

```magma
> SetVerbose("MaximalOrder", 1);
> SetVerbose("Factor", 1);
> L := NumberField(PolynomialRing(Rationals()).1^2-10);
Factorize square-free polynomial over Z of degree 2
Deflation factor: 2

Number of deflated factors: 1

Factor inflated polynomial 0 of degree 2
Total factorization time: 0.000
Final irreducibility test factorization:
<x^2 - 10, 0>
> Regulator(L);
order_maximal_sub: called with algo_flag: 0
no algorithm selected
nothing about algebra-splitting selected
nothing about reduced-discriminant selected
nothing about dedekind-test selected
order_maximal_sub: calling order_maximal_sub_sub
order_maximal_sub_sub: called with algo_flag: 16
no algorithm selected
nothing about algebra-splitting selected
use reduced-discriminant selected
nothing about dedekind-test selected
red disc: f =x^2 - 10
 r_disc = 20
Reduced discriminant: 20
Factorization of reduced discriminant:
2^2 * 5^1
calculation and factorisation of reduced discriminant: 0.01
Factorization of discriminant:
2^3 * 5^1

factors with (possibly) not maximal overorder:
2^3
-----------------------
order_max_p_sub called:
prime: 2, prime_bound: 3, algo_flag: 16
-----------------------
no algorithm selected
nothing about algebra-splitting selected
nothing about dedekind-test selected
---------------------------
order_max_p_sub_sub called:
prime: 2, prime_bound: 3, algo_flag: 89
---------------------------
round2 selected
no algebra-splitting selected
use dedekind-test selected
No split performed ...
(due to user advice or impossible) ...
standard algorithm.
----------------------------
order_max_p_rnd2_sub called:
prime: 2, prime_bound: 3, algo_flag: 89
----------------------------
use dedekind-test selected
Order is already 2-maximal.
1.81844645923206682348369896356070899378625394276899999999
```

The first few lines of output are generated, because the creation of number fields involves a test of irreducibility for the defining polynomial(s).

The next group of lines come from the computation of the maximal order which is used for the regulator computation.

In general the amount of output generated increases with the value supplied. Furthermore, the output corresponding to larger values gets more and more technical.

<a id="function-setkantprinting-boolelt"></a>
#### `SetKantPrinting(f): BoolElt -> BoolElt`

Kant-style printing means that integers and rational numbers will be printed as integers and rational numbers. Especially in relative extensions this produces easier to read output - but it is no longer possible to paste the output back into the system again. Turns Kant-style printing on if $f$ is `true` and off if $f$ is `false`.

### Real Precision

Many number field functions involve calculations over real/complex fields. Sometimes it may be necessary to increase the precision used internally. On the other hand, since the default precision is quite high, some calculations may be sped up by decreasing it – at the user’s own risk!

Note however that many functions will work automatically with a much larger precision if necessary to guarantee $P$ digits for the user. Generally all functions take care of the necessary precision. Only under rare circumstances will any computation fail because of precision loss.

<a id="procedure-setkantprecision-fldalg-rngintelt"></a>
#### `SetKantPrecision(F, n): FldAlg, RngIntElt`

<a id="procedure-setkantprecision-fldalg-rngintelt-rngintelt"></a>
#### `SetKantPrecision(F, n, m): FldAlg, RngIntElt, RngIntElt`

<a id="procedure-setkantprecision-rngord-rngintelt"></a>
#### `SetKantPrecision(O, n): RngOrd, RngIntElt`

<a id="procedure-setkantprecision-rngord-rngintelt-rngintelt"></a>
#### `SetKantPrecision(O, n, m): RngOrd, RngIntElt, RngIntElt`

Set the precision to be used internally for real/complex calculations involving the field $F$ or the order $O$ to be $n$.

The second integer $m$ sets the precision for some unit calculations (this may become obsolete).

<a id="operation"></a>
<a id="rngord-str-op"></a>
### Structure Operations

In the lists below $F$ usually refers to an algebraic field, $K$ to a number field, and $O$ to an order.

#### General Functions

Number fields form the Magma category `FldNum`, orders form `RngOrd` and their fields of fractions form `FldOrd`. The notional power structures exist as parents of algebraic fields and their orders, no operations are allowed.

<a id="function-category-fldalg"></a>
##### `Category(F): FldAlg -> Cat`

<a id="function-parent-fldalg"></a>
##### `Parent(F): FldAlg -> Pow`

<a id="function-category-rngord"></a>
##### `Category(O): RngOrd -> Cat`

<a id="function-parent-rngord"></a>
##### `Parent(O): RngOrd -> Pow`

<a id="procedure-assignnames-fldnum-monstgelt-ref"></a>
##### `AssignNames(~K, s): FldNum, [ MonStgElt ]`

Procedure to change the names of the generating elements in the number field $K$ to the contents of the sequence of strings $s$. The $i$-th sequence element will be the name used for the generator of the $(i-1)$-st subfield down from $K$ as determined by the creation of $K$, the first element being used as the name for the generator of $K$. In the case where $K$ is defined by more than one polynomial as an absolute extension, the $i$th sequence element will be the name used for the root of the $i$th polynomial used in the creation of $K$. This procedure only changes the names used in printing the elements of $K$. It does *not* assign to any identifiers the value of a generator in $K$; to do this, use an assignment statement, or use angle brackets when creating the field. Note that since this is a procedure that modifies $K$, it is necessary to have a reference `~K` to $K$ in the call to this function.

<a id="function-name-fldnum-rngintelt"></a>
##### `Name(K, i): FldNum, RngIntElt -> FldNumElt`

<a id="operation-operation-fldnum-rngintelt-fldnumelt"></a>
##### `K . i: FldNum, RngIntElt -> FldNumElt`

Given a number field $K$, return the element which has the $i$-th name attached to it, that is, the generator of the $(i - 1)$-st subfield down from $K$ as determined by the creation of $K$. Here $i$ must be in the range $1\leq i\leq m$, where $m$ is the number of polynomials used in creating $K$. If $K$ was created using multiple polynomials as an absolute extension, `K.i` will be a root of the $i$th polynomial used in creating $K$.

<a id="procedure-assignnames-fldord-monstgelt-ref"></a>
##### `AssignNames(~F, s): FldOrd, [ MonStgElt ]`

Assign the strings in the sequence $s$ to the names of the basis elements of the field of fractions $F$.

<a id="operation-operation-fldord-rngintelt-fldordelt"></a>
##### `F . i: FldOrd, RngIntElt -> FldOrdElt`

<a id="function-name-fldord-rngintelt"></a>
##### `Name(F, i): FldOrd, RngIntElt -> FldOrdElt`

Return the $i$th basis element of the field of fractions $F$.

<a id="operation-operation-rngord-rngintelt-fldordelt"></a>
##### `O . i: RngOrd, RngIntElt -> FldOrdElt`

Return the $i$th basis element of the order $O$.

#### Related Structures

Each order and field has other orders and fields which are related to it in various ways.

<a id="function-groundfield-fldalg"></a>
##### `GroundField(F): FldAlg -> Fld`

<a id="function-basefield-fldalg"></a>
##### `BaseField(F): FldAlg -> Fld`

<a id="function-coefficientfield-fldalg"></a>
##### `CoefficientField(F): FldAlg -> Fld`

<a id="function-coefficientring-fldalg"></a>
##### `CoefficientRing(F): FldAlg -> Fld`

Given an algebraic field $F$, return the algebraic field over which $F$ was defined. For an absolute number field $F$, the function returns the rational field ${\mathbb{Q}}$.

<a id="function-rngord-basering"></a>
##### `BaseRing(O): RngOrd -> Rng`

<a id="function-coefficientring-rngord"></a>
##### `CoefficientRing(O): RngOrd -> Rng`

Given an order $O$, this returns the order over which $O$ was defined. For an absolute order $O$ this will be the integers ${\mathbb{Z}}$.

<a id="function-absolutefield-fldalg"></a>
##### `AbsoluteField(F): FldAlg -> FldAlg`

Given an algebraic field $F$, this returns an isomorphic number field $L$ defined as an absolute extension (i.e. over ${\mathbb{Q}}$).

<a id="function-absoluteorder-rngord"></a>
##### `AbsoluteOrder(O): RngOrd -> RngOrd`

Given an order $O$, this returns an isomorphic order $O'$ defined as an order in an absolute extension (over ${\mathbb{Q}}$).

<a id="function-simpleextension-fldalg"></a>
##### `SimpleExtension(F): FldAlg -> FldAlg`

<a id="function-simpleextension-rngord"></a>
##### `SimpleExtension(O): RngOrd -> RngOrd`

Given an algebraic field $F$ or an order $O$, this returns an isomorphic field $L$ defined as an absolute simple extension or the $Z$-isomorphic order in it. (For algorithm, see [[Tra76](https://docs.magma-maths.org/references.md#cite-trager-factorization)])

<a id="function-relativefield-fldalg-fldalg"></a>
##### `RelativeField(F, L): FldAlg, FldAlg -> FldAlg`

<a id="function-relativefield-fldrat-fldalg"></a>
##### `RelativeField(Q, L): FldRat, FldAlg -> FldAlg`

Given algebraic fields $L$ and $F$ such that Magma knows that $F$ is a subfield of $L$, return an isomorphic algebraic field $M$ defined as an extension over $F$.

<a id="function-components-fldalg"></a>
##### `Components(F): FldAlg -> [FldAlg]`

<a id="function-components-rngord"></a>
##### `Components(O): RngOrd -> [RngOrd]`

Given an equation order $O$ or a field of fractions $F$ of an equation order $O$ return the sequence of orders or fields each defined by a defining polynomial of $O$ or $F$.

<a id="example-ex-3aa334"></a>
##### `Example: Compositum of Two Number Fields (ex-3aa334)`

It is often desirable to build up a number field by adjoining several algebraic numbers to ${\mathbb{Q}}$. The following function returns a number field that is the composite field of two given number fields $K$ and $L$, provided that $K\cap L={\mathbb{Q}}$; if $K$ and $L$ have a common subfield larger than ${\mathbb{Q}}$ the function returns a field with the property that it contains a subfield isomorphic to $K$ as well as a subfield isomorphic to $L$.

```magma
> R<x> := PolynomialRing(Integers());
> Composite := function( K, L )
>     T<y> := PolynomialRing( K );
>     f := T!DefiningPolynomial( L );
>     ff := Factorization(f);
>     LKM := NumberField(ff[1][1]);
>     return AbsoluteField(LKM);
> end function;
```

To create, for example, the field ${\mathbb{Q}}(\sqrt{2}, \sqrt{3}, \sqrt{5})$, the above function should be applied twice:

```magma
> K := NumberField(x^2-3);
> L := NumberField(x^2-2);
> M := NumberField(x^2-5);
> KL := Composite(K, L);
> S<s> := PolynomialRing(BaseField(KL));
> KLM<w> := Composite(KL, M);
> KLM;
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

Note, that the same field may be constructed with just one call to `NumberField` followed by `AbsoluteField`:

```magma
> KLM2 := AbsoluteField(NumberField([x^2-3, x^2-2, x^2-5]));
> KLM2;
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

or by

```magma
> AbsoluteField(ext<Rationals() | [x^2-3, x^2-2, x^2-5]>);
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

In general, however, the resulting polynomials of $KLM$ and $KLM2$ will differ. To see the difference between `SimpleExtension` and `AbsoluteField`, we will create `KLM2` again:

```magma
> KLM3 := NumberField([x^2-3, x^2-2, x^2-5]: Abs);
> AbsoluteField(KLM3);
Number Field with defining polynomials [ x^2 - 3, x^2 - 2,
    x^2 - 5] over the Rational Field
> SimpleExtension(KLM3);
Number Field with defining polynomial s^8 - 40*s^6 + 352*s^4 - 960*s^2 + 576
over the Rational Field
```

<a id="function-simplify-rngord"></a>
##### `Simplify(O): RngOrd -> RngOrd`

Given an order $O$, obtained by a chain of transformations from an equation order $E$, return an order that is given directly by a single transformation over $E$.

<a id="function-lll-rngord"></a>
##### `LLL(O): RngOrd -> RngOrd, AlgMatElt`

```magma
Delta: RngElt                    Default: 0.99
```

Given an order $O$, return an order $O'$ obtained from $O$ by a transformation matrix $T$, which is returned as a second value. $O'$ will have a LLL-reduced basis.

<a id="example-ex-06710d"></a>
##### `Example: LLL Reduction of an Order Basis (ex-06710d)`

Using `LLL` to reduce the basis of an order is shown.

```magma
> M := MaximalOrder(x^4-14*x^3+14*x^2-14*x+14);
> L, T := LLL(M);
> L;
Maximal Order, Transformation of M
Transformation Matrix:
[  1   0   0   0]
[ -3   1   0   0]
[  3 -13   1   0]
[ -7   1 -13   1]
> T;
[  1   0   0   0]
[ -3   1   0   0]
[  3 -13   1   0]
[ -7   1 -13   1]
> Basis(M);
[
    M.1,
    M.2,
    M.3,
    M.4
]
> Basis(L, M);
[
    [1, 0, 0, 0],
    [-3, 1, 0, 0],
    [3, -13, 1, 0],
    [-7, 1, -13, 1]
]
> L eq M;
true
```

Even though $L$ and $M$ are considered to be equal because they contain the same elements $L$ has a basis which is LLL reduced but $M$ does not.

Following on from the orders and ideals example ([Implementing the Round 2 Algorithm](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#example-ex-638433)) we have

```magma
> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> E := EquationOrder(K);
> O := Round2(E, K);
[ <2, 18>, <5, 8>, <41, 2> ]
index is 2
index is 4
index is 8
index is 4
index is 2
index is 1
index is 5
index is 25
index is 1
index is 1
index of equation order in maximal order is: 64000
> L := LLL(O);
> O;
Transformation of E
Transformation Matrix:
[800   0   0   0]
[  0 400   0   0]
[  0 200  20   0]
[400 180   0   1]
Denominator: 800
> O:Maximal;
   F[1]
    |
   F[2]
  /
 /
Q
F  [ 1]     Given by transformation matrix
F  [ 2]     x^4 - 420*x^2 + 40000
Index: 64000/1
Signature: [4, 0]
> L;
Transformation of O
Transformation Matrix:
[-1  0  0  0]
[-1 -1  0  1]
[10  1 -2  0]
[ 5  1 -1  0]
> L:Maximal;
   F[1]
    |
   F[2]
    |
   F[3]
  /
 /
Q
F  [ 1]     Given by transformation matrix
F  [ 2]     Given by transformation matrix
F  [ 3]     x^4 - 420*x^2 + 40000
Index: 1/1
Signature: [4, 0]
> Simplify(L):Maximal;
   F[1]
    |
   F[2]
  /
 /
Q
F  [ 1]     Given by transformation matrix
F  [ 2]     x^4 - 420*x^2 + 40000
Index: 64000/1
Signature: [4, 0]
> Simplify(L);
Transformation of E
Transformation Matrix:
[-800    0    0    0]
[-400 -220    0    1]
[8000    0  -40    0]
[4000  200  -20    0]
Denominator: 800
```

<a id="function-primering-fldalg"></a>
##### `PrimeRing(F): FldAlg -> RngRat`

<a id="function-primefield-fldalg"></a>
##### `PrimeField(F): FldAlg -> RngRat`

<a id="function-primering-rngord"></a>
##### `PrimeRing(O): RngOrd -> RngInt`

<a id="function-centre-fldalg"></a>
##### `Centre(F): FldAlg -> FldAlg`

<a id="function-centre-rngord"></a>
##### `Centre(O): RngOrd -> RngOrd`

<a id="procedure-embed-fldalg-fldalg-fldalgelt"></a>
##### `Embed(F, L, a): FldAlg, FldAlg, FldAlgElt`

```magma
Overwrite: BoolElt                    Default: false
```

Install the embedding of a simple field $F$ in $L$ where the image of the primitive element of $F$ is the element $a$ of $L$. This embedding will be used in coercing from $F$ into $L$.

If the addition of this embedding causes an inconsistency with currently known embeddings then the embedding will not be added unless `Overwrite` is set to `true`.

<a id="procedure-embed-fldalg-fldalg-fldalgelt-2"></a>
##### `Embed(F, L, a): FldAlg, FldAlg, [FldAlgElt]`

```magma
Overwrite: BoolElt                    Default: false
```

Install the embedding of the non-simple field $F$ in $L$ where the image of the generating elements of $F$ are in the sequence $a$ of elements of $L$. This embedding will be used in coercing from $F$ into $L$.

If the addition of this embedding causes an inconsistency with currently known embeddings then the embedding will not be added unless `Overwrite` is set to `true`.

<a id="function-embeddingmap-fldalg-fldalg"></a>
##### `EmbeddingMap(F, L): FldAlg, FldAlg -> Map`

Returns the embedding map of $F$ in $L$ if an embedding is known.

<a id="function-hasembedding-fldalg-fldalg"></a>
##### `HasEmbedding(F, L): FldAlg, FldAlg -> Bool`

<a id="function-hasembedding-rngord-rngord"></a>
##### `HasEmbedding(O1, O2): RngOrd, RngOrd -> Bool`

```magma
Print: RngIntElt                    Default: 0
```

Return whether there is an embedding of $F$ into $L$ or $O1$ into $O2$ already installed. For information about the installed embedding set the `Print` parameter $> 0$ with higher values providing more information than lower.

<a id="function-cancomputeembedding-fldalg-fldalg"></a>
##### `CanComputeEmbedding(F, L): FldAlg, FldAlg -> Bool`

<a id="function-cancomputeembedding-rngord-rngord"></a>
##### `CanComputeEmbedding(O1, O2): RngOrd, RngOrd -> Bool`

```magma
Print: RngIntElt                    Default: 0
```

Return whether an embedding of $F$ into $L$ or $O1$ into $O2$ can be computed. For information about the installed embedding set the `Print` parameter $> 0$ with higher values providing more information than lower.

<a id="example-ex-a44554"></a>
##### `Example: Embedding One Number Field in Another (ex-a44554)`

Magma does not recognize two independently created number fields as equal since more than one embedding of a field in a larger field may be possible. To coerce between them then it is convenient to be able to embed them in each other.

```magma
> k := NumberField(x^2-2);
> l := NumberField(x^2-2);
> l!k.1;
>> l!k.1;
    ^
Runtime error in '!': Arguments are not compatible
LHS: FldNum
RHS: FldNumElt
> l eq k;
false
> HasEmbedding(k, l);
false
> CanComputeEmbedding(k, l);
false
> Embed(k, l, l.1);
> l!k.1;
l.1
> HasEmbedding(k, l : Print := 1);
From Equation Order with defining polynomial x^2 - 2 over Z
 to Equation Order with defining polynomial x^2 - 2 over Z
 costs 11 type Composition
true
> HasEmbedding(l, k : Print := 1);
From Equation Order with defining polynomial x^2 - 2 over Z
 to Equation Order with defining polynomial x^2 - 2 over Z
 costs 100 type Inverse of an Inclusion
true
> Embed(l, k, k.1);
> k!l.1;
k.1
> HasEmbedding(l, k : Print := 1);
From Equation Order with defining polynomial x^2 - 2 over Z
 to Equation Order with defining polynomial x^2 - 2 over Z
 costs 11 type Composition
true
```

`Embed` is useful in specifying the embedding of a field in a larger field.

```magma
> l<a> := NumberField(x^3-2);
> L<b> := NumberField(x^6+108);
> Root(L!2, 3);
1/18*b^4
> Embed(l, L, $1);
> L!l.1;
1/18*b^4
```

Another embedding would be

```magma
> Roots(PolynomialRing(L)!DefiningPolynomial(l));
[
    <1/36*(-b^4 - 18*b), 1>,
    <1/36*(-b^4 + 18*b), 1>,
    <1/18*b^4, 1>
]
> Embed(l, L, $1[1][1] : Overwrite := true);
> L!l.1;
1/36*(-b^4 - 18*b)
```

<a id="function-rngord-completion1"></a>
##### `Completion(K, P): FldAlg, RngOrdIdl -> FldLoc, Map`

<a id="function-completion-rngord-rngordidl"></a>
##### `Completion(O, P): RngOrd, RngOrdIdl -> RngLoc, Map`

<a id="constructor-constructor-comp-fldalg-rngordidl-fldloc-map"></a>
##### `comp<K|P>: FldAlg, RngOrdIdl -> FldLoc, Map`

<a id="constructor-constructor-comp-rngord-rngordidl-rngloc-map"></a>
##### `comp<O|P>: RngOrd, RngOrdIdl -> RngLoc, Map`

```magma
Precision: RngIntElt                    Default: 50
```

For an absolute extension $K$ of ${\mathbb{Q}}$ or $O$ of ${\mathbb{Z}}$, compute the completion at a prime ideal $P$ which must be either a prime ideal of the maximal order or unramified. The result will be a local field or ring with default precision `Precision` or $e$`*Precision` if the ideal is ramified with ramification degree $e$.

The returned map is the canonical injection into the completion. It allows pointwise inverse operations.

<a id="function-completion-fldalg-plcnumelt"></a>
##### `Completion(K, P): FldAlg, PlcNumElt -> FldLoc, Map`

```magma
Precision: RngIntElt                    Default: 50
```

For an absolute extension $K$ over ${\mathbb{Q}}$ and a (finite) place $P$, compute the completion at $P$. The precision and the map are as described for [`Completion`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-completion1).

<a id="function-localring-rngordidl-rngintelt"></a>
##### `LocalRing(P, prec): RngOrdIdl, RngIntElt -> RngLoc, Map`

The completion of `Order(P)` at the prime ideal $P$ up to default precision `prec`.

<a id="function-localization-rngord-rngordidl"></a>
##### `Localization(O, P): RngOrd, RngOrdIdl -> RngVal, Map`

Given an order $O$ of an algebraic number field and a prime ideal $p$ of $O$ return the localization of $O$ at $p$ and the map from $O$ into the localization.

#### Representing Fields as Vector Spaces

These functions are used to recreate a number field as an associative algebra or as a vector space. In both cases, the base field may be any subfield.

<a id="function-algebra-fldalg-fld"></a>
##### `Algebra(K, J): FldAlg, Fld -> AlgAss, Map`

<a id="function-algebra-fldalg-fld-fldalgelt"></a>
##### `Algebra(K, J, S): FldAlg, Fld, [FldAlgElt] -> AlgAss, Map`

Returns the associative structure constant algebra which is isomorphic to the algebraic field $K$ as an algebra over $J$. Also returns the isomorphism from $K$ to the algebra mapping $w^i$ to the $i + 1$st unit vector of the algebra where $w$ is a primitive element of $K$.

If a sequence $S$ is given it is taken to be a basis of $K$ over $J$ and the isomorphism will map the $i$th element of $S$ to the $i$th unit vector of the algebra.

<a id="function-vectorspace-fldalg-fld"></a>
##### `VectorSpace(K, J): FldAlg, Fld -> ModTupFld, Map`

<a id="function-kspace-fldalg-fld"></a>
##### `KSpace(K, J): FldAlg, Fld -> ModTupFld, Map`

<a id="function-vectorspace-fldalg-fld-fldalgelt"></a>
##### `VectorSpace(K, J, S): FldAlg, Fld, [FldAlgElt] -> ModTupFld, Map`

<a id="function-kspace-fldalg-fld-fldalgelt"></a>
##### `KSpace(K, J, S): FldAlg, Fld, [FldAlgElt] -> ModTupFld, Map`

The vector space isomorphic to the algebraic field $K$ as a vector space over $J$ and the isomorphism from $K$ to the vector space. The isomorphism maps $w^i$ to the $i + 1$st unit vector of the vector space where $w$ is a primitive element of $K$.

If $S$ is given, the isomorphism will map the $i$th element of $S$ to the $i$th unit vector of the vector space.

<a id="example-ex-4636b1"></a>
##### `Example: Minimal Polynomial over a Subfield (ex-4636b1)`

We use the `Algebra` of a relative number field to obtain the minimal polynomial of an element over a subfield which is not in its coefficient field tower.

```magma
> K := NumberField([x^2 - 2, x^2 - 3, x^2 - 7]);
> J := AbsoluteField(NumberField([x^2 - 2, x^2 - 7]));
> A, m := Algebra(K, J);
> A;
Associative Algebra of dimension 2 with base ring J
> m;
Mapping from: RngOrd: K to AlgAss: A
> m(K.1);
(1/10*(J.1^3 - 13*J.1)                      0)
> m(K.1^2);
(2 0)
> m(K.2);
(1/470*(83*J.1^3 + 125*J.1^2 - 1419*J.1 - 1735) 1/940*(-24*J.1^3 - 5*J.1^2 +
    382*J.1 + 295))
> m(K.2^2);
(3 0)
> m(K.3);
(1/10*(-J.1^3 + 23*J.1)                       0)
> m(K.3^2);
(7 0)
> A.1 @@ m;
1
> A.2 @@ m;
(($.1 - 1)*$.1 - $.1 - 1)*K.1 + ($.1 + 1)*$.1 + $.1 + 1
>
> r := 5*K.1 - 8*K.2 + K.3;
> m(r);
(1/235*(-238*J.1^3 - 500*J.1^2 + 4689*J.1 + 6940) 1/235*(48*J.1^3 + 10*J.1^2 -
    764*J.1 - 590))
> MinimalPolynomial($1);
$.1^2 + 1/5*(-4*J.1^3 + 42*J.1)*$.1 + 5*J.1^2 - 180
> Evaluate($1, r);
0
> K:Maximal;

  K
  |
  |
  $1
  |
  |
  $2
  |
  |
  Q

K  : $.1^2 - 2
$1 : $.1^2 - 3
$2 : x^2 - 7
> Parent($3);
Univariate Polynomial Ring over J
> J;
Number Field with defining polynomial $.1^4 - 18*$.1^2 + 25 over the Rational
Field
```

#### Invariants

Some information describing an order can be retrieved.

<a id="function-characteristic-fldalg"></a>
##### `Characteristic(F): FldAlg -> RngIntElt`

<a id="function-characteristic-rngord"></a>
##### `Characteristic(O): RngOrd -> RngIntElt`

<a id="function-degree-rngord"></a>
##### `Degree(O): RngOrd -> RngIntElt`

<a id="function-rngord-degree"></a>
##### `Degree(F): FldAlg -> RngIntElt`

Given an algebraic field $F$, return the degree $[F:G]$ of $F$ over its ground field $G$. For an order $O$ it returns the relative degree of $O$ over its ground order.

<a id="function-absolutedegree-rngord"></a>
##### `AbsoluteDegree(O): RngOrd -> RngIntElt`

<a id="function-absolutedegree-fldalg"></a>
##### `AbsoluteDegree(F): FldAlg -> RngIntElt`

Given an order $O$ or an algebraic field $F$, return the absolute degree of $O$ over ${\mathbb{Z}}$ or $F$ over ${\mathbb{Q}}$.

<a id="function-discriminant-rngord"></a>
##### `Discriminant(O): RngOrd -> RngIntElt`

<a id="function-discriminant-rngint"></a>
##### `Discriminant(O): RngInt -> RngIntElt`

<a id="function-rngord-discriminant"></a>
##### `Discriminant(F): FldAlg -> RngIntElt`

<a id="function-discriminant-rngord-2"></a>
##### `Discriminant(O): RngOrd -> RngOrdIdl`

<a id="function-discriminant-fldalg"></a>
##### `Discriminant(F): FldAlg -> RngOrdIdl`

Given an extension $F$ of ${\mathbb{Q}}$, return the discriminant of $F$. This discriminant is defined to be the discriminant of the order of the field of fractions or the equation order of a number field.

The discriminant of any order $O$ defined over ${\mathbb{Z}}$ is by definition the discriminant of its basis, where the discriminant of any sequence of elements $\omega_i$ from $K$ is defined to be the determinant of the trace matrix of the sequence.

The discriminant of absolute fields and orders is an integer.

The discriminant in a relative extension is the ideal generated by the discriminants of all sequences of elements $\omega_i$ from $O$, where the discriminant of a sequence is defined to be the determinant of its trace matrix. This can only be computed in when the coefficient ring of $O$ is maximal or when $O$ has a power basis.

The discriminant of relative orders is an ideal of the base ring.

<a id="function-absolutediscriminant-rngord"></a>
##### `AbsoluteDiscriminant(O): RngOrd -> RngIntElt`

Given an order $O$, return the absolute value of the discriminant of $O$ regarded as an order over ${\mathbb{Z}}$.

<a id="function-absolutediscriminant-fldalg"></a>
##### `AbsoluteDiscriminant(K): FldAlg -> FldRatElt`

Given an algebraic field $K$, return the absolute value of the discriminant of $K$ regarded as an extension of ${\mathbb{Q}}$.

<a id="function-reduceddiscriminant-rngord"></a>
##### `ReducedDiscriminant(O): RngOrd -> RngIntElt`

<a id="function-reduceddiscriminant-fldalg"></a>
##### `ReducedDiscriminant(F): FldAlg -> RngIntElt`

<a id="function-reduceddiscriminant-rngord-2"></a>
##### `ReducedDiscriminant(O): RngOrd -> RngOrdIdl`

<a id="function-reduceddiscriminant-fldalg-2"></a>
##### `ReducedDiscriminant(F): FldAlg -> RngOrdIdl`

The reduced discriminant of an order $O$ is defined as the maximal elementary divisor (elementary ideal) of the torsion module $O^\#/O$ where $O^\#$ is the dual module to $O$ with respect to the trace form. The reduced discriminant of an algebraic field is that of the order of a field of fractions and that of the equation order of a number field.

For absolute extensions this is the largest entry of the Smith normal form of the `TraceMatrix`. For relative extensions, in addition to the `TraceMatrix` one has to consider the coefficient ideals.

For orders with a power basis, this is (a generator of) the inverse of the ideal generated by the cofactors $X$ and $Y$ of $Xf + Yf'=1$ where $f$ is the defining polynomial of the order and $f'$ its first derivative.

<a id="function-regulator-rngord"></a>
##### `Regulator(O: parameters): RngOrd -> FldReElt`

```magma
Current: BoolElt                    Default: false
```

<a id="function-regulator-fldnum"></a>
##### `Regulator(K): FldNum -> FldReElt`

Given a number field $K$ or an order $O$, return the regulator of $K$ or $O$, as a real number. Note that this will trigger the computation of the maximal order and its unit group if they are not known yet. This only works in an absolute extension.

If `Current` is `true` and a maximal system of independent units is known, then the regulator of that system is returned. In this case no effort is spent to produce a system of fundamental units.

The precision of the answer may be controlled by using `SetKantPrecision` for the relevant order.

<a id="function-regulatorlowerbound-rngord"></a>
##### `RegulatorLowerBound(O): RngOrd -> FldReElt`

<a id="function-regulatorlowerbound-fldnum"></a>
##### `RegulatorLowerBound(K): FldNum -> FldReElt`

Given an order $O$ or number field $K$, return a lower bound on the regulator of $O$ or $K$. This only works in an absolute extension.

<a id="function-signature-rngord"></a>
##### `Signature(O): RngOrd -> RngIntElt, RngIntElt`

<a id="function-signature-fldalg"></a>
##### `Signature(F): FldAlg -> RngIntElt, RngIntElt`

Given an absolute algebraic field $F$, or an order $O$ of $F$, returns two integers, one being the number of real embeddings, the other the number of pairs of complex embeddings of $F$.

<a id="function-unitrank-rngord"></a>
##### `UnitRank(O): RngOrd -> RngIntElt`

<a id="function-unitrank-fldnum"></a>
##### `UnitRank(K): FldNum -> RngIntElt`

The unit rank of the order $O$ or the number field $K$ (one less than the number of real embeddings plus number of pairs of complex embeddings).

<a id="function-index-rngord-rngord"></a>
##### `Index(O, S): RngOrd, RngOrd -> RngIntElt`

<a id="function-index-rngord-rngord-2"></a>
##### `Index(O, S): RngOrd, RngOrd -> RngOrdIdl`

The module index of order $S$ in order $O$, for orders $S\subset O$. $O$ and $S$ must have the same equation order and $S$ must be a suborder of $O$.

<a id="function-definingpolynomial-fldalg"></a>
##### `DefiningPolynomial(F): FldAlg -> RngUPolElt`

<a id="function-definingpolynomial-rngord"></a>
##### `DefiningPolynomial(O): RngOrd -> RngUPolElt`

<a id="function-definingpolynomial-fldalg-2"></a>
##### `DefiningPolynomial(F): FldAlg -> [RngUPolElt]`

<a id="function-definingpolynomial-rngord-2"></a>
##### `DefiningPolynomial(O): RngOrd -> [RngUPolElt]`

Given an algebraic field $F$, the polynomial defining $F$ as an extension of its ground field $G$ is returned. For an order $O$, a integral polynomial is returned that defines $O$ over its coefficient ring.

For non simple extensions, this will return a list of polynomials.

<a id="function-zeroes-rngord-rngintelt"></a>
##### `Zeroes(O, n): RngOrd, RngIntElt -> [ FldReElt ]`

<a id="function-zeros-rngord-rngintelt"></a>
##### `Zeros(O, n): RngOrd, RngIntElt -> [ FldReElt ]`

<a id="function-zeroes-fldalg-rngintelt"></a>
##### `Zeroes(F, n): FldAlg, RngIntElt -> [ FldReElt ]`

<a id="function-zeros-fldalg-rngintelt"></a>
##### `Zeros(F, n): FldAlg, RngIntElt -> [ FldReElt ]`

Given an absolute algebraic field $F$ or an order $O$ in $F$, and an integer $n$, return the zeroes of the defining polynomial of $F$ with a precision of exactly $n$ decimal digits. The function returns a sequence of length the degree of $F$; all of the real zeroes appear before the complex zeroes.

<a id="example-ex-afbcf8"></a>
##### `Example: Zeros and Defining Polynomial (ex-afbcf8)`

The information provided by `Zeros` and `DefiningPolynomial` is illustrated below.

```magma
> L := NumberField(x^6+108);
> DefiningPolynomial(L);
x^6 + 108
> Zeros(L, 30);
[ 1.889881574842309747150815910899999999994 +
1.0911236359717214035600726141999999999977*i,
1.889881574842309747150815910899999999994 -
1.0911236359717214035600726141999999999977*i,  0.E-29 +
2.1822472719434428071201452283999999999955*i,  0.E-29 -
2.1822472719434428071201452283999999999955*i,
-1.889881574842309747150815910899999999994 +
1.0911236359717214035600726141999999999977*i,
-1.889881574842309747150815910899999999994 -
1.0911236359717214035600726141999999999977*i ]
> l := NumberField(x^3 - 2);
> DefiningPolynomial(l);
x^3 - 2
> Zeros(l, 30);
[ 1.259921049894873164767210607299999999994,
-0.629960524947436582383605303639109999999 +
1.0911236359717214035600726141999999999977*i,
-0.629960524947436582383605303639109999999 -
1.0911236359717214035600726141999999999977*i ]
```

<a id="function-different-rngord"></a>
##### `Different(O): RngOrd -> RngOrdIdl`

The different of a maximal order $O\subset K$ is defined as the inverse ideal of $\{ x \in K \mid {\operatorname{Tr}}(xO)\subset O\}$.

<a id="function-conductor-rngord"></a>
##### `Conductor(O): RngOrd -> RngOrdIdl`

The conductor of an order $O$ is the largest ideal of its maximal order that is still contained in $O$: $\{ x \in M \mid xM \subseteq O\}$.

#### Basis Representation

The basis of an order or algebraic field can be expressed using elements from any compatible ring. Basis related matrices can be formed.

<a id="function-basis-rngord"></a>
##### `Basis(O): RngOrd -> [ FldOrdElt ]`

<a id="function-basis-rngord-rng"></a>
##### `Basis(O, R): RngOrd, Rng -> [ RngElt ]`

<a id="function-basis-fldalg"></a>
##### `Basis(F): FldAlg -> [ FldAlgElt ]`

<a id="function-basis-fldalg-rng"></a>
##### `Basis(F, R): FldAlg, Rng -> [ RngElt ]`

Return the current basis for the order $O$ or algebraic field $F$ over its ground ring as a sequence of elements of its field of fractions or as a sequence of elements of $R$.

When $O$ is an extension of another order, the basis is to be interpreted with the corresponding `CoefficientIdeals`.

<a id="function-integralbasis-fldalg"></a>
##### `IntegralBasis(F): FldAlg -> [ FldAlgElt ]`

<a id="function-integralbasis-fldalg-rng"></a>
##### `IntegralBasis(F, R): FldAlg, Rng -> [ RngElt ]`

An integral basis for the algebraic field $F$ is returned as a sequence of elements of $F$ or $R$ if given. This is the same as the basis for the maximal order. Note that the maximal order will be determined (and stored) if necessary.

<a id="example-ex-6e96c8"></a>
##### `Example: Basis over Different Rings (ex-6e96c8)`

The following illustrates how a basis can look different when expressed in a different ring.

```magma
> f := x^5 + 5*x^4 - 75*x^3 + 250*x^2 + 65625;
> M := MaximalOrder(f);
> M;
Maximal Order of Equation Order with defining polynomial x^5 + 5*x^4 - 75*x^3 +
    250*x^2 + 65625 over its ground order
> Basis(M);
[
    M.1,
    M.2,
    M.3,
    M.4,
    M.5
]
> Basis(NumberField(M));
[
    1,
    $.1,
    $.1^2,
    $.1^3,
    $.1^4
]
> Basis(M, NumberField(M));
[
    1,
    1/5*$.1,
    1/25*$.1^2,
    1/125*$.1^3,
    1/625*$.1^4
]
```

<a id="function-rngord-absolutebasis"></a>
##### `AbsoluteBasis(K): FldAlg -> [FldAlgElt]`

Returns an absolute basis for the algebraic field $K$, i.e. a basis for $K$ as a ${\mathbb{Q}}$ vector space. The basis will consist of the products of the basis elements of the intermediate fields. The expansion is done depth-first.

<a id="function-basismatrix-rngord"></a>
##### `BasisMatrix(O): RngOrd -> AlgMatElt`

Given an order $O$ in a number field $K$ of degree $n$, this returns an $n\times n$ matrix whose $i$-th row contains the (rational) coefficients for the $i$-th basis element of $O$ with respect to the power basis of $K$. Thus, if $b_i$ is the $i$-th basis element of $O$,

$$
b_i=\sum_{j=1}^{n}M_{ij}\alpha^{j-1}
$$

where $M$ is the matrix and $\alpha$ is the generator of $K$.

The matrix is the same as `TransformationMatrix(O, E)`, where $E$ is the equation order for $K$, except that the entries of the basis matrix are from the subfield of $K$, instead of the coefficient ring of the order.

<a id="function-transformationmatrix-rngord-rngord"></a>
##### `TransformationMatrix(O, P): RngOrd, RngOrd -> AlgMatElt, RngIntElt`

Returns the transformation matrix for the transformation between the orders $O$ and $P$ with common equation order of degree $n$. The function returns an $n\times n$ matrix $T$ with integral entries as well as a common integer denominator. The rows of the matrix express the $n$ basis elements of $O$ as a linear combination of the basis elements of $P$. Hence the effect of multiplying $T$ on the left by a row vector $v$ containing the basis coefficients of an element of $O$ is the row vector $v\cdot T$ expressing the same element of the common number field on the basis for $P$.

<a id="function-coefficientideals-rngord"></a>
##### `CoefficientIdeals(O): RngOrd -> [RngOrdFracIdl]`

The coefficient ideals of the order $O$ of a relative extension. These are the ideals $\{A_i\}$ of the coefficient ring of $O$ such that for every element $e$ of $O$, $e = \sum_i a_i*b_i$ where $\{b_i\}$ is the basis returned for $O$ and each $a_i \in A_i$.

<a id="example-ex-292651"></a>
##### `Example: Basis and Integral Basis (ex-292651)`

We continue our example of a field of degree 4. The functions `Basis` and `IntegralBasis` both return a sequence of elements, that can be accessed using the operators for enumerated sequences. Note that if, as in our example, $O$ is the maximal order of $K$, both functions produce the same output:

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> O := MaximalOrder(K);
> I := IntegralBasis(K);
> B := Basis(O);
> I, B;
[
    1,
    1/2*y,
    1/40*(y^2 + 10*y),
    1/800*(y^3 + 180*y + 400)
]
[
    O.1,
    O.2,
    O.3,
    O.4
]
> Basis(O, K);
[
    1,
    1/2*y,
    1/40*(y^2 + 10*y),
    1/800*(y^3 + 180*y + 400)
]
```

The `BasisMatrix` function makes it possible to move between orders, in the following manner. We may regard orders as free ${\mathbb{Z}}$-modules of rank the degree of the number field. The basis matrix then provides the transformation between the order and the equation order. The function `ElementToSequence` can be used to create module elements.

```magma
> BM := BasisMatrix(O);
> Mod := RSpace(RationalField(), Degree(K));
> z := O ! y;
> e := z^2-3*z;
> em := Mod ! ElementToSequence(e);
> em;
(  0 -26  40   0)
> f := em*BM;
> f;
( 0 -3  1  0)
```

So, since $f$ is represented with respect to the basis of the equation order, which is the power basis, we indeed get the original element back. Of course it is much more useful to go in the other direction, using the inverse transformation. We check the result in the last line:

```magma
> E := EquationOrder(K);
> f := y^3+7;
> fm := Mod ! ElementToSequence(f);
> e := fm*BM^-1;
> e;
(-393 -360    0  800)
> &+[e[i]*B[i] : i in [1 .. Degree(K)] ];
-393/1*O.1 - 360/1*O.2 + 800/1*O.4
> K!$1;
y^3 + 7
```

<a id="function-multiplicationtable-rngord"></a>
##### `MultiplicationTable(O): RngOrd -> [AlgMatElt]`

Given an order $O$ of some number field $K$ of degree $n$, return the multiplication table with respect to the basis of $O$ as a sequence of $n$ matrices of size $n\times n$. The $i$-th matrix will have as its $j$-th row the basis representation of $b_ib_j$, where $b_i$ is the $i$-th basis element for $O$.

<a id="function-tracematrix-rngord"></a>
##### `TraceMatrix(O): RngOrd -> AlgMatElt`

<a id="function-tracematrix-fldalg"></a>
##### `TraceMatrix(F): FldAlg -> AlgMatElt`

Return the trace matrix of an order $O$ or algebraic field $F$, which has the trace ${\operatorname{Tr}}(\omega_i\omega_j)$ as its $i, j$-th entry where the $\omega_i$ are the basis for $O$ or $F$.

<a id="example-ex-8f1664"></a>
##### `Example: Multiplication Table of an Order (ex-8f1664)`

We continue our example of a field of degree 4. The multiplication table of the order $O$ consists of $4$ matrices, such that the $i$-th $4\times 4$ matrix ($1\leq i\leq 4$) determines the multiplication by the $i$-th basis element of $O$ as a linear transformation with respect to that basis. Thus the third row of $T[2]$ gives the basis coefficients for the product of $B[2]$ and $B[3]$, and we can use the sequence reduction operator to calculate $B[2]*B[3]$ in an alternative way:

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> O := MaximalOrder(K);
> B := Basis(O);
> B[2];
O.2
> T := MultiplicationTable(O);
> T[2];
[  0   1   0   0]
[  0  -5  10   0]
[ -5  -7   5  10]
[-25  -7  15   0]
>  &+[ T[2][3][i]*B[i] : i in [1..4] ];
-5/1*O.1 - 7/1*O.2 + 5/1*O.3 + 10/1*O.4
> B[2]*B[3];
-5/1*O.1 - 7/1*O.2 + 5/1*O.3 + 10/1*O.4
```

The trace matrix may be found either by using the built-in function or by the one-line definition given below (for a field of degree 4):

```magma
> TraceMatrix(O);
[  4   0  21   2]
[  0 210 105 215]
[ 21 105 173 118]
[  2 215 118 226]
> MatrixRing(RationalField(), 4) ! [Trace(B[i]*B[j]): i, j in [1..4] ];
[  4   0  21   2]
[  0 210 105 215]
[ 21 105 173 118]
[  2 215 118 226]
```

#### Ring Predicates

Orders and algebraic fields can be tested for having several properties that may hold for general rings.

<a id="operation-op-eq-rngord-rngord"></a>
##### `N eq O: RngOrd, RngOrd -> BoolElt`

Two orders are equal if the transformation matrix taking one to the other is integral and has determinant $1$ or $-1$. For the transformation matrix to exist the orders must have the same number field.

<a id="operation-op-eq-fldalg-fldalg"></a>
##### `F eq L: FldAlg, FldAlg -> BoolElt`

<a id="operation-op-eq-fldrat-fldalg"></a>
##### `F eq L: FldRat, FldAlg -> BoolElt`

<a id="operation-op-eq-fldalg-fldrat"></a>
##### `F eq L: FldAlg, FldRat -> BoolElt`

Returns `true` if and only if the fields $F$ and $L$, are the same. No two algebraic fields which have been created independently of each other will be considered equal since it is possible that they can be embedded into a larger field in more than one way.

<a id="function-iscommutative-rng"></a>
##### `IsCommutative(R): Rng -> BoolElt`

<a id="function-isunitary-rng"></a>
##### `IsUnitary(R): Rng -> BoolElt`

<a id="function-isfinite-rng"></a>
##### `IsFinite(R): Rng -> BoolElt`

<a id="function-isordered-rng"></a>
##### `IsOrdered(R): Rng -> BoolElt`

<a id="function-isfield-rng"></a>
##### `IsField(R): Rng -> BoolElt`

These predicates are clear.

<a id="function-isnumberfield"></a>
##### `IsNumberField(R): . -> BoolElt`

Returns `true` iff `Type(R)` matches `FldNum`.

<a id="function-isalgebraicfield-any"></a>
##### `IsAlgebraicField(R): Any -> BoolElt`

Returns `true` iff `Type(R)` matches `FldAlg` (i.e. either `FldNum` or `FldOrd`).

<a id="function-iseuclideandomain-fldalg"></a>
##### `IsEuclideanDomain(F): FldAlg -> BoolElt`

This is not a check for euclidean number fields. This function will always return an error.

<a id="function-issimple-fldalg"></a>
##### `IsSimple(F): FldAlg -> BoolElt`

<a id="function-issimple-rngord"></a>
##### `IsSimple(O): RngOrd -> BoolElt`

Checks if the field $F$ or the order $O$ is defined as a simple extension over the base ring.

<a id="function-ispid-fldalg"></a>
##### `IsPID(F): FldAlg -> BoolElt`

<a id="function-isufd-fldalg"></a>
##### `IsUFD(F): FldAlg -> BoolElt`

<a id="function-isprincipalidealring-fldalg"></a>
##### `IsPrincipalIdealRing(F): FldAlg -> BoolElt`

Always `true` for fields.

<a id="function-ispid-rngord"></a>
##### `IsPID(O): RngOrd -> BoolElt`

<a id="function-isufd-rngord"></a>
##### `IsUFD(O): RngOrd -> BoolElt`

<a id="function-isprincipalidealring-rngord"></a>
##### `IsPrincipalIdealRing(O): RngOrd -> BoolElt`

Always `false` for orders. Even if the class number is $1$, orders are not considered to be PIDs.

<a id="function-isdomain-fldalg"></a>
##### `IsDomain(R): FldAlg -> BoolElt`

<a id="operation-op-ne-fldalg-fldalg"></a>
##### `F ne L: FldAlg, FldAlg -> BoolElt`

<a id="operation-op-ne-rngord-rngord"></a>
##### `O ne N: RngOrd, RngOrd -> BoolElt`

<a id="operation-op-subset-rngord-rngord"></a>
##### `O subset P: RngOrd, RngOrd -> BoolElt`

<a id="operation-op-subset-fldalg-fldalg"></a>
##### `K subset L: FldAlg, FldAlg -> BoolElt`

<a id="operation-op-subset-fldrat-fldalg"></a>
##### `K subset L: FldRat, FldAlg -> BoolElt`

<a id="function-rngord-hascomplexconjugate"></a>
##### `HasComplexConjugate(K): FldAlg -> BoolElt, Map`

This function returns `true` if there is an automorphism in the field $K$ that acts like complex conjugation.

<a id="function-complexconjugate-fldalgelt"></a>
##### `ComplexConjugate(x): FldAlgElt -> FldAlgElt`

For an element $x$ of a field $K$ where [`HasComplexConjugate`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-hascomplexconjugate) returns `true` (in particular this includes totally real fields, cyclotomic and quadratic fields, and CM-extensions), the conjugate of $x$ is returned.

#### Order Predicates

Since orders are rings with additional properties, special predicates are applicable.

<a id="function-isequationorder-rngord"></a>
##### `IsEquationOrder(O): RngOrd -> BoolElt`

This returns `true` if the basis of the order $O$ is an integral power basis, `false` otherwise.

<a id="function-ismaximal-rngord"></a>
##### `IsMaximal(O): RngOrd -> BoolElt`

This returns `true` if the order $O$ in the field $F$ is the maximal order of $F$, `false` otherwise. The user is warned that this may trigger the computation of the maximal order.

<a id="function-isabsoluteorder-rngord"></a>
##### `IsAbsoluteOrder(O): RngOrd -> BoolElt`

Returns `true` iff the order $O$ is a constructed as an absolute extension of ${\mathbb{Z}}$.

<a id="function-iswildlyramified-rngord"></a>
##### `IsWildlyRamified(O): RngOrd -> BoolElt`

Returns `true` iff the order $O$ is wildly ramified, i.e. if there is a prime ideal $P$ of $O$ such that the characteristic of its residue class field divides its ramification index.

<a id="function-istamelyramified-rngord"></a>
##### `IsTamelyRamified(O): RngOrd -> BoolElt`

Returns `true` iff the order $O$ is not wildly ramified, i.e. if for all prime ideals $P$ of $O$ the characteristic of its residue class field does not divide the ramification index.

<a id="function-isunramified-rngord"></a>
##### `IsUnramified(O): RngOrd -> BoolElt`

Returns `true` iff the order $O$ is unramified at the *finite* places.

#### Field Predicates

Here all the predicates that are specific to algebraic fields are listed.

<a id="function-isisomorphic-fldalg-fldalg"></a>
##### `IsIsomorphic(F, L): FldAlg, FldAlg -> BoolElt, Map`

Given two algebraic fields $F$ and $L$, this returns `true` as well as an isomorphism $F\rightarrow L$, if $F$ and $L$ are isomorphic, and it returns `false` otherwise.

<a id="function-issubfield-fldalg-fldalg"></a>
##### `IsSubfield(F, L): FldAlg, FldAlg -> BoolElt, Map`

<a id="function-issubfield-fldrat-fldalg"></a>
##### `IsSubfield(F, L): FldRat, FldAlg -> BoolElt, Map`

Given two algebraic fields $F$ and $L$, this returns `true` as well as an embedding $F\hookrightarrow L$, if $F$ is a subfield of $L$, and it returns `false` otherwise.

<a id="function-isnormal-fldalg"></a>
##### `IsNormal(F): FldAlg -> BoolElt`

Returns `true` if and only if the algebraic field $F$ is a normal extension. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois group computation.

<a id="function-isabelian-fldalg"></a>
##### `IsAbelian(F): FldAlg -> BoolElt`

Returns `true` if and only if the algebraic field $F$ is a normal extension with abelian Galois group. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois Group computation.

<a id="function-iscyclic-fldalg"></a>
##### `IsCyclic(F): FldAlg -> BoolElt`

Returns `true` if and only if the algebraic field $F$ is a normal extension with cyclic Galois group. At present this may only be applied if $F$ is an absolute extension or simple relative extension. In the relative case the result is obtained via Galois and automorphism group.

<a id="function-isabsolutefield-fldalg"></a>
##### `IsAbsoluteField(K): FldAlg -> BoolElt`

Returns `true` iff the algebraic field $K$ is a constructed as an absolute extension of ${\mathbb{Q}}$.

<a id="function-iswildlyramified-fldalg"></a>
##### `IsWildlyRamified(K): FldAlg -> BoolElt`

Returns `true` iff the algebraic field $K$ is wildly ramified, i.e. if there is a prime ideal $P$ of $K$ (its maximal order) such that the characteristic of its residue class field divides the ramification index.

<a id="function-istamelyramified-fldalg"></a>
##### `IsTamelyRamified(K): FldAlg -> BoolElt`

Returns `true` iff the algebraic field $K$ is not wildly ramified, i.e. if for all prime ideals $P$ of the maximal order of $K$, the characteristic of its residue class field does not divide the ramification index.

<a id="function-isunramified-fldalg"></a>
##### `IsUnramified(K): FldAlg -> BoolElt`

Returns `true` iff the algebraic field $K$ is unramified at the *finite* places.

<a id="function-isquadratic-fldalg"></a>
##### `IsQuadratic(K): FldAlg -> BoolElt, FldQuad`

If the number field $K$ is quadratic, return `true` and an isomorphic quadratic field.

<a id="function-istotallyreal-fldalg"></a>
##### `IsTotallyReal(K): FldAlg -> BoolElt`

Tests if the number field $F$ is totally real, ie. if all infinite places are real. For absolute fields this is equivalent to the defining polynomial having only real roots.

#### Setting Properties of Orders

Several properties of orders can be set to be known and/or to have a given value.

<a id="procedure-setordermaximal-rngord-boolelt"></a>
##### `SetOrderMaximal(O, b): RngOrd, BoolElt`

Set the order $O$ to be maximal if $b$ is `true` or known to be non maximal if $b$ is `false`.

<a id="procedure-setordertorsionunit-rngord-rngordelt-rngintelt"></a>
##### `SetOrderTorsionUnit(O, e, r): RngOrd, RngOrdElt, RngIntElt`

Set the torsion unit of the order $O$ to be the element $e$ with order $r$.

<a id="procedure-rngord-setorderunitsarefundamental"></a>
##### `SetOrderUnitsAreFundamental(O): RngOrd`

This tells Magma to assume that the currently known unit group for the order $O$ is the full unit group, in all subsequent calculations involving `NumberField(O)`. (This can only be invoked after a unit group has been computed.)

<a id="operation-element"></a>
<a id="rngord-elt-ops"></a>
### Element Operations

#### Parent and Category

<a id="function-parent-fldalgelt"></a>
##### `Parent(a): FldAlgElt -> FldAlg`

<a id="function-parent-rngordelt"></a>
##### `Parent(w): RngOrdElt -> RngOrd`

<a id="function-category-fldalgelt"></a>
##### `Category(a): FldAlgElt -> Cat`

<a id="function-category-rngordelt"></a>
##### `Category(w): RngOrdElt -> Cat`

#### Arithmetic

The table below lists the generic arithmetic functions on algebraic field and order elements. Note that automatic coercion ensures that the binary operations `+`, `-`, `*`, and `/` may be applied to an element of an algebraic field and an element of one of its orders; the result will be an algebraic field element. Since division of order elements does not generally result in an order element, the operation `/` applied to two elements of an order returns an element in the field of fractions of the order; similarly if the exponent $k$ in `a^k` is negative.

For finding the value of an element mod an ideal or the inverse of an element mod an ideal see Section [Ideal Arithmetic](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngordidl-arith).

<a id="operation-operation-fldalgelt-fldalgelt"></a>
##### `+ a: FldAlgElt -> FldAlgElt`

<a id="operation-operation-rngordelt-rngordelt"></a>
##### `+ w: RngOrdElt -> RngOrdElt`

<a id="operation-operation-fldalgelt-fldalgelt-2"></a>
##### `- a: FldAlgElt -> FldAlgElt`

<a id="operation-operation-rngordelt-rngordelt-2"></a>
##### `- w: RngOrdElt -> RngOrdElt`

<a id="operation-op-plus-fldalgelt-fldalgelt"></a>
##### `a + b: FldAlgElt, FldAlgElt -> FldAlgElt`

<a id="operation-op-plus-rngordelt-rngordelt"></a>
##### `w + v: RngOrdElt, RngOrdElt -> RngOrdElt`

<a id="operation-op-minus-fldalgelt-fldalgelt"></a>
##### `a - b: FldAlgElt, FldAlgElt -> FldAlgElt`

<a id="operation-op-minus-rngordelt-rngordelt"></a>
##### `w - v: RngOrdElt, RngOrdElt -> RngOrdElt`

<a id="operation-op-times-fldalgelt-fldalgelt"></a>
##### `a * b: FldAlgElt, FldAlgElt -> FldAlgElt`

<a id="operation-op-times-rngordelt-rngordelt"></a>
##### `w * v: RngOrdElt, RngOrdElt -> RngOrdElt`

<a id="operation-op-div-fldalgelt-fldalgelt"></a>
##### `a / b: FldAlgElt, FldAlgElt -> FldAlgElt`

<a id="operation-op-div-rngordelt-rngordelt"></a>
##### `w / v: RngOrdElt, RngOrdElt -> FldOrdElt`

<a id="operation-op-pow-fldalgelt-rngintelt"></a>
##### `a ^ k: FldAlgElt, RngIntElt -> FldAlgElt`

<a id="operation-op-pow-rngordelt-rngintelt"></a>
##### `w ^ k: RngOrdElt, RngIntElt -> RngOrdElt`

<a id="operation-operation-div-rngordelt-rngordelt-rngordelt"></a>
##### `w div v: RngOrdElt, RngOrdElt -> RngOrdElt`

The quotient of the order element $w$ by the order element $v$; $v$ must divide $w$ exactly, ($v$ and $w$ must be elements of the same order).

<a id="function-modexp-rngordelt-rngintelt-rngintelt"></a>
##### `Modexp(a, n, m): RngOrdElt, RngIntElt, RngIntElt -> RngOrdElt`

Given a non-negative integer $n$ and an integer $m$ greater than 1, this function returns the modular power $a^n \ mod\  m$ of the order element $a$.

<a id="function-sqrt-rngordelt"></a>
##### `Sqrt(a): RngOrdElt -> RngOrdElt`

<a id="function-sqrt-fldalgelt"></a>
##### `Sqrt(a): FldAlgElt -> FldAlgElt`

<a id="function-squareroot-rngordelt"></a>
##### `SquareRoot(a): RngOrdElt -> RngOrdElt`

<a id="function-squareroot-fldalgelt"></a>
##### `SquareRoot(a): FldAlgElt -> FldAlgElt`

Returns the square root of the element $a$ if it exists in the order or field containing $a$.

<a id="function-root-rngordelt-rngintelt"></a>
##### `Root(a, n): RngOrdElt, RngIntElt -> RngOrdElt`

<a id="function-root-fldalgelt-rngintelt"></a>
##### `Root(a, n): FldAlgElt, RngIntElt -> FldAlgElt`

Returns the $n$-th root of the element $a$ if it exists in the order or field containing $a$.

<a id="function-ispower-fldalgelt-rngintelt"></a>
##### `IsPower(a, k): FldAlgElt, RngIntElt -> BoolElt, FldAlgElt`

<a id="function-ispower-rngordelt-rngintelt"></a>
##### `IsPower(a, k): RngOrdElt, RngIntElt -> BoolElt, RngOrdElt`

<a id="function-issquare-fldalgelt"></a>
##### `IsSquare(a): FldAlgElt -> BoolElt, FldAlgElt`

<a id="function-issquare-rngordelt"></a>
##### `IsSquare(a): RngOrdElt -> BoolElt, RngOrdElt`

Return `true` if the element $a$ is a $kth$ power, (respectively square) and the root in the order or field containing $a$ if so.

<a id="function-denominator-fldalgelt"></a>
##### `Denominator(a): FldAlgElt -> RngIntElt`

<a id="function-denominator-rngordelt"></a>
##### `Denominator(a): RngOrdElt -> RngIntElt`

Returns the denominator of the element $a$, that is the least common multiple of the denominators of the coefficients of $a$.

<a id="function-numerator-fldalgelt"></a>
##### `Numerator(a): FldAlgElt -> RngIntElt`

Returns the numerator of the element $a$, that is the element multiplied by its denominator.

<a id="function-qround-fldalgelt-rngintelt"></a>
##### `Qround(E, M): FldAlgElt, RngIntElt -> FldAlgElt`

```magma
ContFrac: BoolElt                    Default: true
```

Finds an approximation of the field element $E$ where the denominator is bounded by the integer $M$. If `ContFrac` is `true`, the approximation is computed by applying the continued fraction algorithm to the coefficients of $E$ viewed over $Q$.

#### Equality and Membership

Elements may also be tested for whether they lie in an ideal of an order. See Section [Predicates on Ideals](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngordidl-in).

<a id="operation-op-eq-fldalgelt-fldalgelt"></a>
##### `a eq b: FldAlgElt, FldAlgElt -> BoolElt`

<a id="operation-op-eq-rngordelt-rngordelt"></a>
##### `w eq v: RngOrdElt, RngOrdElt -> BoolElt`

<a id="operation-op-ne-fldalgelt-fldalgelt"></a>
##### `a ne b: FldAlgElt, FldAlgElt -> BoolElt`

<a id="operation-op-ne-rngordelt-rngordelt"></a>
##### `w ne v: RngOrdElt, RngOrdElt -> BoolElt`

<a id="operation-op-in-fldalgelt-fldalg"></a>
##### `a in F: FldAlgElt, FldAlg -> BoolElt`

<a id="operation-op-in-rngordelt-rngord"></a>
##### `w in O: RngOrdElt, RngOrd -> BoolElt`

#### Predicates on Elements

In addition to the generic predicates `IsMinusOne`, `IsZero`, and `IsOne`, the predicates `IsIntegral` and `IsPrimitive` are defined on elements of algebraic fields and orders.

<a id="function-isintegral-fldalgelt"></a>
##### `IsIntegral(a): FldAlgElt -> BoolElt`

<a id="function-isintegral-rngordelt"></a>
##### `IsIntegral(a): RngOrdElt -> BoolElt`

Returns `true` if the element $a$ of an algebraic field $F$ or of an order in $F$ is contained in the ring of integers of $F$, `false` otherwise. This is vacuously true for order elements. We use the minimal polynomial to determine the answer, which means that the calculation of the maximal order is *not* triggered if it is not known yet. When $a$ is a field element a denominator $d$ such that $d*a$ is integral is also returned on request.

<a id="function-isprimitive-fldalgelt"></a>
##### `IsPrimitive(a): FldAlgElt -> BoolElt`

<a id="function-isprimitive-rngordelt"></a>
##### `IsPrimitive(a): RngOrdElt -> BoolElt`

Returns `true` if the element $a$ of the algebraic field $F$ or one of its orders $O$ generates $F$.

<a id="function-istorsionunit-rngordelt"></a>
##### `IsTorsionUnit(w): RngOrdElt -> BoolElt`

Returns `true` if and only if the order element $w$ is a unit of finite order.

<a id="function-ispower-rngordelt-rngintelt-2"></a>
##### `IsPower(w, n): RngOrdElt, RngIntElt -> BoolElt, RngOrdElt`

Given an element $w$ in an order $O$ and an integer $n>1$, this function returns `true` if and only if there exists an element $v\in O$ such that $w=v^n$; if `true`, such an element $v$ is returned as well.

<a id="function-istotallypositive-rngordelt"></a>
##### `IsTotallyPositive(a): RngOrdElt -> BoolElt`

<a id="function-istotallypositive-fldalgelt"></a>
##### `IsTotallyPositive(a): FldAlgElt -> BoolElt`

Returnes `true` iff all real embeddings of the element $a$ are positive. For elements in absolute fields this is equivalent to all real conjugates being positive.

<a id="function-iszero-fldalgelt"></a>
##### `IsZero(a): FldAlgElt -> BoolElt`

<a id="function-iszero-rngordelt"></a>
##### `IsZero(w): RngOrdElt -> BoolElt`

<a id="function-isone-fldalgelt"></a>
##### `IsOne(a): FldAlgElt -> BoolElt`

<a id="function-isone-rngordelt"></a>
##### `IsOne(w): RngOrdElt -> BoolElt`

<a id="function-isminusone-fldalgelt"></a>
##### `IsMinusOne(a): FldAlgElt -> BoolElt`

<a id="function-isminusone-rngordelt"></a>
##### `IsMinusOne(w): RngOrdElt -> BoolElt`

<a id="function-isunit-fldalgelt"></a>
##### `IsUnit(a): FldAlgElt -> BoolElt`

<a id="function-isunit-rngordelt"></a>
##### `IsUnit(w): RngOrdElt -> BoolElt`

<a id="function-isnilpotent-fldalgelt"></a>
##### `IsNilpotent(a): FldAlgElt -> BoolElt`

<a id="function-isnilpotent-rngordelt"></a>
##### `IsNilpotent(a): RngOrdElt -> BoolElt`

<a id="function-isidempotent-fldalgelt"></a>
##### `IsIdempotent(a): FldAlgElt -> BoolElt`

<a id="function-isidempotent-rngordelt"></a>
##### `IsIdempotent(a): RngOrdElt -> BoolElt`

<a id="function-iszerodivisor-fldalgelt"></a>
##### `IsZeroDivisor(a): FldAlgElt -> BoolElt`

<a id="function-iszerodivisor-rngordelt"></a>
##### `IsZeroDivisor(a): RngOrdElt -> BoolElt`

<a id="function-isregular-fldalgelt"></a>
##### `IsRegular(a): FldAlgElt -> BoolElt`

<a id="function-isregular-rngordelt"></a>
##### `IsRegular(a): RngOrdElt -> BoolElt`

<a id="function-isirreducible-fldalgelt"></a>
##### `IsIrreducible(a): FldAlgElt -> BoolElt`

<a id="function-isirreducible-rngordelt"></a>
##### `IsIrreducible(a): RngOrdElt -> BoolElt`

<a id="function-isprime-fldalgelt"></a>
##### `IsPrime(a): FldAlgElt -> BoolElt`

<a id="function-isprime-rngordelt"></a>
##### `IsPrime(a): RngOrdElt -> BoolElt`

#### Field Generators

<a id="operation-operation-fldnum-fldnumelt"></a>
##### `K . 1: FldNum -> FldNumElt`

Return the image $\alpha$ of $x$ in $G[x]/f$ where $f$ is the first defining polynomial of $K$ and $G$ is the base field of $K$.

In case of simple extensions this will be a primitive element.

<a id="function-primitiveelement-fldnum"></a>
##### `PrimitiveElement(K): FldNum -> FldNumElt`

<a id="function-primitiveelement-fldord"></a>
##### `PrimitiveElement(F): FldOrd -> FldOrdElt`

Returns a primitive element for the simple algebraic field, that is an element whose minimal polynomial has the same degree as the field. For a number field $K$ this is $K.1$ but for a field of fractions this is $F!K.1$ where $K$ is the number field of $F$.

For non-simple fields, a random element is returned.

<a id="function-primitiveelement-rngord"></a>
##### `PrimitiveElement(O): RngOrd -> RngOrdElt`

Given an order $O$, returns a primitive element for `FieldOfFractions(O)`.

<a id="function-generators-fldalg"></a>
##### `Generators(K): FldAlg -> [FldAlgElt]`

The list of generators of $K$ over its coefficient field, that is a sequence containing a root of each defining polynomial is returned.

<a id="function-generators-fldalg-fldalg"></a>
##### `Generators(K, k): FldAlg, FldAlg -> [FldAlgElt]`

<a id="function-generators-fldalg-fldrat"></a>
##### `Generators(K, Q): FldAlg, FldRat -> [FldAlgElt]`

A list of generators of $K$ over $k$ is returned. That is a sequence containing a root of each defining polynomial for $K$ and its subfield down to the level of $k$ is returned.

#### Real and Complex Embeddings

The precision of the real and complex numbers returned by the functions below should be controlled using the optional argument `Precision` in each function. *Note:* `SetKantPrecision` should not be used for this purpose.

<a id="function-conjugates-fldalgelt"></a>
##### `Conjugates(a): FldAlgElt -> [ FldComElt ]`

<a id="function-conjugates-rngordelt"></a>
##### `Conjugates(a): RngOrdElt -> [ FldComElt ]`

```magma
Precision: RngIntElt                    Default: 
```

Given an element $a$ in a number field or order, this returns a sequence of complex numbers, which are the real and complex embeddings of $a$.

When $a$ is an element of an *absolute* field or order $R$ (i.e. $R$ has base field ${\mathbb{Q}}$ or ${\mathbb{Z}}$), the number of embeddings is the degree of $R$. The $r_1$ real conjugates are listed first, followed by the $r_2$ pairs of complex conjugates.

When $a$ is an element of a *relative* field or order $R$, the sequence contains `Evaluate(a, v)` where $v$ runs through `InfinitePlaces(R)`. In particular, it contains only $r_1 + r_2$ numbers.

In both cases, the conjugates are given in a fixed ordering which depends only on (the defining polynomials of) the field or order.

<a id="function-conjugate-fldalgelt-rngintelt"></a>
##### `Conjugate(a, l): FldAlgElt, RngIntElt -> FldReElt`

<a id="function-conjugate-rngordelt-rngintelt"></a>
##### `Conjugate(a, l): RngOrdElt, RngIntElt -> FldReElt`

```magma
Precision: RngIntElt                    Default: 
```

For $a$ in an *absolute* field or order, this returns `Conjugates(a)[l]`.

<a id="function-conjugate-fldalgelt-rngintelt-2"></a>
##### `Conjugate(a, l): FldAlgElt, [RngIntElt] -> FldReElt`

```magma
Precision: RngIntElt                    Default: 
```

For $a$ in a *relative* field or order, this returns the conjugate of $a$ indexed by $l$, where $l = [l_1, \ldots, l_n]$ is a sequence of integers.

Let $K$ be the parent of $a$, defined as a tower of extensions with $n$ steps ${\mathbb{Q}}\subseteq K_1\subseteq \ldots\subseteq K_n = K$. The embedding indexed by $l$ is defined inductively: it extends the embedding $[l_1, \ldots, l_{n-1}]$ of $K_{n-1}$ and is the $l_n$th such extension. These extensions are ordered by a fixed rule, depending only on (the defining polynomials of) the field tower.

The `InfinitePlaces` of $K$ are indexed the same way.

<a id="function-absolutevalues-fldalgelt"></a>
##### `AbsoluteValues(a): FldAlgElt -> [FldReElt]`

<a id="function-absolutevalues-rngordelt"></a>
##### `AbsoluteValues(a): RngOrdElt -> [FldReElt]`

This returns a sequence of $r_1 + r_2$ positive real numbers. These are the absolute values of the real and complex embeddings of the element $a$, which is required to be an element of an absolute field or order.

<a id="function-logs-fldalgelt"></a>
##### `Logs(a): FldAlgElt -> [FldReElt]`

<a id="function-logs-rngordelt"></a>
##### `Logs(a): RngOrdElt -> [FldReElt]`

This returns a sequence of $r_1 + r_2$ positive real numbers. These are the natural logs of the absolute values of the real and complex embeddings of the element $a$, which is required to be a nonzero element of an absolute field or order.

<a id="function-infiniteplaces-fldalg"></a>
##### `InfinitePlaces(K): FldAlg -> [PlcNumElt]`

<a id="function-infiniteplaces-rngord"></a>
##### `InfinitePlaces(O): RngOrd -> [PlcNumElt]`

This returns a sequence containing all the infinite places of the field. Each place corresponds to a real embedding or a pair of complex embeddings. The ordering of the places is fixed.

<a id="function-evaluate-fldalgelt-plcnumelt"></a>
##### `Evaluate(x, p): FldAlgElt, PlcNumElt -> RngElt`

<a id="function-evaluate-rngordelt-plcnumelt"></a>
##### `Evaluate(x, p): RngOrdElt, PlcNumElt -> RngElt`

When $p$ is a finite place, this returns the image of $x$ in the residue class field corresponding to $p$.

When $p$ is an infinite place, this returns the image of $x$ under the corresponding embedding, i.e., a real or complex number. (This can also be obtained using `Conjugate` or `Conjugates`.)

<a id="function-realembeddings-fldalgelt"></a>
##### `RealEmbeddings(a): FldAlgElt -> []`

<a id="function-realembeddings-rngordelt"></a>
##### `RealEmbeddings(a): RngOrdElt -> []`

This returns the sequence of values `Evaluate(a,p)` where $p$ runs through the real places of the field.

<a id="function-minkowskilattice-rngord"></a>
##### `MinkowskiLattice(O): RngOrd -> Lat, Map`

<a id="function-lattice-rngord"></a>
##### `Lattice(O): RngOrd -> Lat, Map`

```magma
Precision: RngIntElt                    Default: 
```

Given an absolute order $O$, returns the lattice determined by the real and complex embeddings of $O$.

<a id="function-minkowskilattice-rngordidl"></a>
##### `MinkowskiLattice(I): RngOrdIdl -> Lat, Map`

<a id="function-lattice-rngordidl"></a>
##### `Lattice(I): RngOrdIdl -> Lat, Map`

```magma
Precision: RngIntElt                    Default: 
```

Given an ideal $I$ in an absolute order, returns the lattice determined by the real and complex embeddings of $I$.

<a id="function-minkowskispace-fldalg"></a>
##### `MinkowskiSpace(F): FldAlg -> Lat, Map`

The Minkowski vector space $V$ of the absolute field $F$ as a real vector space, with inner product given by the $T_2$-norm ([`Length`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation-element.md#function-rngord-length)) on $F$, and by the embedding $F \rightarrow V$.

#### Heights

The real precision of results can be controlled using `SetKantPrecision`.

<a id="function-absolutelogarithmicheight-fldalgelt"></a>
##### `AbsoluteLogarithmicHeight(a): FldAlgElt -> FldReElt`

<a id="function-absolutelogarithmicheight-rngordelt"></a>
##### `AbsoluteLogarithmicHeight(a): RngOrdElt -> FldReElt`

Let $P$ be the minimal polynomial of the element $a$ over ${\mathbb{Z}}$, with leading coefficient $a_0$ and roots $\alpha_1, \ldots, \alpha_n$. Then the absolute logarithmic height is defined to be

$$
h(\alpha) = {1\over n} \log(a_0 \prod_{j=1}^{n} \max(1, |\alpha_j|)).
$$

<a id="function-coefficientheight-rngordelt"></a>
##### `CoefficientHeight(E): RngOrdElt -> RngIntElt`

<a id="function-coefficientheight-fldalgelt"></a>
##### `CoefficientHeight(E): FldAlgElt -> RngIntElt`

Computes the coefficient height of the element $E$, that is for an element of an absolute field it returns the maximum of the denominator and the largest coefficient wrt. to the basis of the parent. For elements in relative extensions, it returns the maximal coefficient height of all the coefficients wrt. the basis of the parent.

This function indicates in some way the difficulty of operations involving this element.

<a id="function-coefficientlength-rngordelt"></a>
##### `CoefficientLength(E): RngOrdElt -> RngIntElt`

<a id="function-coefficientlength-fldalgelt"></a>
##### `CoefficientLength(E): FldAlgElt -> RngIntElt`

Computes the coefficient length of the element $E$, that is for an element of an absolute field it returns the sum of the denominator and the absolute values of all coefficients wrt. to the basis of the parent. For elements in relative extensions, it returns the sum of the coefficient length of all the coefficients wrt. the basis of the parent.

This function gives an indication on the amount of memory occupied by this element.

<a id="function-rngord-length"></a>
##### `Length(a): FldAlgElt -> FldReElt`

<a id="function-length-rngordelt"></a>
##### `Length(a): RngOrdElt -> FldReElt`

Return the $T_2$-norm of the element $a$, which is a real number. This equals the sum of the (complex) norms of the conjugates of $a$.

<a id="example-ex-19f6ce"></a>
##### `Example: Alternative Discriminant Function (ex-19f6ce)`

It is not hard to write an alternative discriminant function, using the `Conjugates` of the basis `[O.1, O.2, ...]`.

```magma
> function disc(O)
>     B := [ Conjugates(O.i) : i in [1 .. Degree(O)] ];
>     D := Determinant(Matrix(B))^2;
>     return RealField(20) ! D;
> end function;
> _<x> := PolynomialRing(Integers());
> O := MaximalOrder(NumberField(x^4 - 420*x^2 + 40000));
> disc(O);
42025.000000000000001
> Discriminant(O);
42025
```

The function `disc` obtains a real approximation to the exact value given by `Discriminant`. Here is an alternative way of getting the $T_2$ norm returned by `Length`, using the complex `Norm` function, together with the `Conjugates` function.

```magma
> norm := func< a | &+[ Norm(Conjugates(a)[i]) : \\
>                      i in [1 .. Degree(Parent(a))] ] >;
```

#### Norm, Trace, and Minimal Polynomial

The norm, trace and minimal polynomial of order and algebraic field elements can be calculated both with respect to the coefficient ring and to ${\mathbb{Z}}$ or ${\mathbb{Q}}$.

<a id="function-norm-fldalgelt"></a>
##### `Norm(a): FldAlgElt -> FldAlgElt`

<a id="function-rngord-norm"></a>
##### `Norm(a): FldAlgElt -> FldRatElt`

<a id="function-norm-fldalgelt-rng"></a>
##### `Norm(a, R): FldAlgElt, Rng -> RngElt`

<a id="function-norm-rngordelt"></a>
##### `Norm(a): RngOrdElt -> RngOrdElt`

<a id="function-norm-rngordelt-2"></a>
##### `Norm(a): RngOrdElt -> RngIntElt`

<a id="function-norm-rngordelt-rng"></a>
##### `Norm(a, R): RngOrdElt, Rng -> RngElt`

The relative norm $\rm N_{L/F}(a)$ over $F$ of the element $a$ of $L$ where $F$ is the field or order over which $L$ is defined as an extension. If $R$ is given the norm is calculated over $R$. In this case, $R$ must occur as a coefficient ring somewhere in the tower under $L$.

<a id="function-absolutenorm-fldalgelt"></a>
##### `AbsoluteNorm(a): FldAlgElt -> FldRatElt`

<a id="function-normabs-fldalgelt"></a>
##### `NormAbs(a): FldAlgElt -> FldRatElt`

<a id="function-absolutenorm-rngordelt"></a>
##### `AbsoluteNorm(a): RngOrdElt -> FldRatElt`

<a id="function-normabs-rngordelt"></a>
##### `NormAbs(a): RngOrdElt -> FldRatElt`

The absolute norm $\rm N_{L/{\mathbb{Q}}}(a)$ over ${\mathbb{Q}}$ of the element $a$ of $L$ (or one of its orders).

<a id="function-trace-fldalgelt"></a>
##### `Trace(a): FldAlgElt -> FldAlgElt`

<a id="function-rngord-trace"></a>
##### `Trace(a): FldAlgElt -> FldRatElt`

<a id="function-trace-fldalgelt-rng"></a>
##### `Trace(a, R): FldAlgElt, Rng -> RngElt`

<a id="function-trace-rngordelt"></a>
##### `Trace(a): RngOrdElt -> RngOrdElt`

<a id="function-trace-rngordelt-2"></a>
##### `Trace(a): RngOrdElt -> RngIntElt`

<a id="function-trace-rngordelt-rng"></a>
##### `Trace(a, R): RngOrdElt, Rng -> RngElt`

The relative trace ${\operatorname{Tr}}_{L/F}(a)$ over $F$ of the element $a$ of $L$ where $F$ is the field or order over which $L$ is defined as an extension. If $R$ is given the trace is computed over $R$. In this case, $R$ must occur as a coefficient ring somewhere in the tower under $L$.

<a id="function-absolutetrace-fldalgelt"></a>
##### `AbsoluteTrace(a): FldAlgElt -> FldRatElt`

<a id="function-traceabs-fldalgelt"></a>
##### `TraceAbs(a): FldAlgElt -> FldRatElt`

<a id="function-absolutetrace-rngordelt"></a>
##### `AbsoluteTrace(a): RngOrdElt -> FldRatElt`

<a id="function-traceabs-rngordelt"></a>
##### `TraceAbs(a): RngOrdElt -> FldRatElt`

The absolute trace ${\operatorname{Tr}}_{L/{\mathbb{Q}}}(a)$ over ${\mathbb{Q}}$ of the element $a$ of $L$ (or one of its orders).

<a id="function-characteristicpolynomial-fldalgelt"></a>
##### `CharacteristicPolynomial(a): FldAlgElt -> RngUPolElt`

<a id="function-characteristicpolynomial-fldalgelt-rng"></a>
##### `CharacteristicPolynomial(a, R): FldAlgElt, Rng -> RngUPolElt`

<a id="function-characteristicpolynomial-rngordelt"></a>
##### `CharacteristicPolynomial(a): RngOrdElt -> RngUPolElt`

<a id="function-characteristicpolynomial-rngordelt-rng"></a>
##### `CharacteristicPolynomial(a, R): RngOrdElt, Rng -> RngUPolElt`

Given an element $a$ from an algebraic field or order $L$, returns the characteristic polynomial of the element over $R$ if given or the subfield or suborder $F$ otherwise where $F$ is the field or order over which $L$ is defined as an extension.

<a id="function-absolutecharacteristicpolynomial-fldalgelt"></a>
##### `AbsoluteCharacteristicPolynomial(a): FldAlgElt -> RngUPolElt`

<a id="function-absolutecharacteristicpolynomial-rngordelt"></a>
##### `AbsoluteCharacteristicPolynomial(a): RngOrdElt -> RngUPolElt`

Given an element $a$ from an algebraic field or one of its orders, this function returns the characteristic polynomial of the element. For field elements the polynomial will have coefficients in the rational field, for order elements the coefficients will be in the ring of integers.

<a id="function-minimalpolynomial-fldalgelt"></a>
##### `MinimalPolynomial(a): FldAlgElt -> RngUPolElt`

<a id="function-minimalpolynomial-fldalgelt-rng"></a>
##### `MinimalPolynomial(a, R): FldAlgElt, Rng -> RngUPolElt`

<a id="function-minimalpolynomial-rngordelt"></a>
##### `MinimalPolynomial(a): RngOrdElt -> RngUPolElt`

<a id="function-minimalpolynomial-rngordelt-rng"></a>
##### `MinimalPolynomial(a, R): RngOrdElt, Rng -> RngUPolElt`

Given an element $a$ from an algebraic field or order $L$, returns the minimal polynomial of the element over $R$ if given otherwise the subfield or suborder $F$ where $F$ is the field or order over which $L$ is defined as an extension.

<a id="function-absoluteminimalpolynomial-fldalgelt"></a>
##### `AbsoluteMinimalPolynomial(a): FldAlgElt -> RngUPolElt`

<a id="function-absoluteminimalpolynomial-rngordelt"></a>
##### `AbsoluteMinimalPolynomial(a): RngOrdElt -> RngUPolElt`

Given an element $a$ from an algebraic field or one of its orders, this function returns the minimal polynomial of the element. For field elements the polynomial will have coefficients in the rational field, for order elements the coefficients will be in the ring of integers.

<a id="function-representationmatrix-fldalgelt"></a>
##### `RepresentationMatrix(a): FldAlgElt -> AlgMatElt`

<a id="function-representationmatrix-fldalgelt-rng"></a>
##### `RepresentationMatrix(a, R): FldAlgElt, Rng -> AlgMatElt`

<a id="function-representationmatrix-rngordelt"></a>
##### `RepresentationMatrix(a): RngOrdElt -> AlgMatElt`

<a id="function-representationmatrix-rngordelt-rng"></a>
##### `RepresentationMatrix(a, R): RngOrdElt, Rng -> AlgMatElt`

Return the representation matrix of $a$, that is, the matrix which represents the linear map given by multiplication by $a$. If $a$ is an order element, this matrix is with respect to the basis for the order; if $a$ is an algebraic field element, the basis for the field is used. The $i$th row of the representation matrix gives the coefficients of $aw_i$ with respect to the basis $w_1, \ldots, w_n$.

If $R$ is given the matrix is over $R$ and with respect to the basis of the order or field over $R$.

<a id="function-absoluterepresentationmatrix-fldalgelt"></a>
##### `AbsoluteRepresentationMatrix(a): FldAlgElt -> AlgMatElt`

<a id="function-absoluterepresentationmatrix-rngordelt"></a>
##### `AbsoluteRepresentationMatrix(a): RngOrdElt -> AlgMatElt`

Return the representation matrix of $a$ relative to the ${\mathbb{Q}}$-basis of the field constructed using products of the basis elements, where $a$ is an element of the relative number field $L$.

Let $L_i := \sum L_{i-1} \omega_{i,j}$, $L := L_n$, and $L_0 := \Q$. Then the representation matrix is computed with respect to the $\Q$-basis $(\prod_j \omega_{i_j,j})_{i \in I}$ consisting of products of basis elements of the different levels.

<a id="example-ex-68a043"></a>
##### `Example: Norm, Trace, and Minimal Polynomial (ex-68a043)`

We create the norm, trace, minimal polynomial, and representation matrix of the element $\alpha/2$ in the quartic field $\Q(\alpha)$.

```magma
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> z := y/2;
> Norm(z), Trace(z);
2500 0
> MinimalPolynomial(z);
$.1^4 - 105*$.1^2 + 2500
> RepresentationMatrix(z);
[     0    1/2      0      0]
[     0      0    1/2      0]
[     0      0      0    1/2]
[-20000      0    210      0]
```

The awkwardness of the printing of the minimal polynomial above can be overcome by providing a parent for the polynomial, keeping in mind that it is a univariate polynomial over the rationals:

```magma
> P<t> := PolynomialRing(RationalField());
> MinimalPolynomial(z);
t^4 - 105*t^2 + 2500
```

#### The Quadratic Defect

Let $K$ be a number field or the field of rationals and let $p$ be a prime ideal in the ring of integers $O$ of $K$. Further, let $K_p$ be the completion of $K$ at $p$. Every square class of $K_p^*/(K_p^*)^2$ has a representative in $K$. The following functions allow to work with these classes, without the construction of the completion $K_p$ explicitly.

<a id="function-quadraticdefect-rngelt-rngordidl"></a>
##### `QuadraticDefect(a, p): RngElt, RngOrdIdl -> RngIntElt`

<a id="function-quadraticdefect-fldratelt-rngintelt"></a>
##### `QuadraticDefect(a, p): FldRatElt, RngIntElt -> RngIntElt`

<a id="function-quadraticdefect-rngintelt-rngintelt"></a>
##### `QuadraticDefect(a, p): RngIntElt, RngIntElt -> RngIntElt`

<a id="function-quadraticdefect-fldratelt-rngint"></a>
##### `QuadraticDefect(a, p): FldRatElt, RngInt -> RngIntElt`

<a id="function-quadraticdefect-rngintelt-rngint"></a>
##### `QuadraticDefect(a, p): RngIntElt, RngInt -> RngIntElt`

<a id="function-relativequadraticdefect-rngelt-rngordidl"></a>
##### `RelativeQuadraticDefect(a, p): RngElt, RngOrdIdl -> RngIntElt`

<a id="function-relativequadraticdefect-fldratelt-rngintelt"></a>
##### `RelativeQuadraticDefect(a, p): FldRatElt, RngIntElt -> RngIntElt`

<a id="function-relativequadraticdefect-rngintelt-rngintelt"></a>
##### `RelativeQuadraticDefect(a, p): RngIntElt, RngIntElt -> RngIntElt`

<a id="function-relativequadraticdefect-fldratelt-rngint"></a>
##### `RelativeQuadraticDefect(a, p): FldRatElt, RngInt -> RngIntElt`

<a id="function-relativequadraticdefect-rngintelt-rngint"></a>
##### `RelativeQuadraticDefect(a, p): RngIntElt, RngInt -> RngIntElt`

For an element $a$ in $K$, let

$$
q_p(a):= \bigcap_{b \in K_p} (a - b^2) O_p
$$

be the quadratic defect of $a$ in the completion $K_p$. Further $q_p(a) / a$ is called the relative quadratic defect of $a \ne 0$ in $K_p$.

The above function computes the valuation of the (relative) quadratic defect of $a$ in $K_p$. Note that the valuation might be infinity, which happens if and only if $a$ is a square in $K_p$.

<a id="function-islocalsquare-rngelt-rngordidl"></a>
##### `IsLocalSquare(a, p): RngElt, RngOrdIdl -> BoolElt`

<a id="function-islocalsquare-fldratelt-rngintelt"></a>
##### `IsLocalSquare(a, p): FldRatElt, RngIntElt -> BoolElt`

<a id="function-islocalsquare-rngintelt-rngintelt"></a>
##### `IsLocalSquare(a, p): RngIntElt, RngIntElt -> BoolElt`

<a id="function-islocalsquare-fldratelt-rngint"></a>
##### `IsLocalSquare(a, p): FldRatElt, RngInt -> BoolElt`

<a id="function-islocalsquare-rngintelt-rngint"></a>
##### `IsLocalSquare(a, p): RngIntElt, RngInt -> BoolElt`

Given an element $a$ in $K$, decide if $a$ is a square in the completion $K_p$.

<a id="function-localmultiplicativegroupmodsquares-rngordidl"></a>
##### `LocalMultiplicativeGroupModSquares(p): RngOrdIdl -> ModFld, Map`

<a id="function-localmultiplicativegroupmodsquares-rngintelt"></a>
##### `LocalMultiplicativeGroupModSquares(p): RngIntElt -> ModFld, Map`

Let $K$ be a number field or the rationals and let $p$ be a prime ideal of the ring of integers of $K$. Then the units of the completion modulo squares $K_p^* / (K_p^*)^2$ form a $GF(2)$-vector space $V$. This function returns $V$ and a map from $K$ to $V$ which can compute inverses.

If $V$ has rank $r$ say, then the first $r-1$ basis vectors of $V$ generate the subspace corresponding to the elements of $O^*_p / (O_p^*)^2$.

<a id="function-unitsquareclassreps-rngordidl"></a>
##### `UnitSquareClassReps(p): RngOrdIdl -> SeqEnum`

<a id="function-unitsquareclassreps-rngintelt"></a>
##### `UnitSquareClassReps(p): RngIntElt -> SeqEnum`

Returns a sequence of elements in $O$ that represent the elements of $O^*_p / (O_p^*)^2$.

<a id="function-niceunitsquareclassrepresentative-rngelt-rngordidl"></a>
##### `NiceUnitSquareClassRepresentative(u, p): RngElt, RngOrdIdl -> RngElt`

<a id="function-niceunitsquareclassrepresentative-rngelt-rngintelt"></a>
##### `NiceUnitSquareClassRepresentative(u, p): RngElt, RngIntElt -> RngElt`

Given an element in $u$ in $K$ which has $p$-adic valuation $0$, return some element $v$ in $K$ such that $uv$ is a square in $O_p^*$ and the quadratic defect of $u$ is $(v-1)O_p$.

#### Other Functions

<a id="function-elementtosequence-fldalgelt"></a>
##### `ElementToSequence(a): FldAlgElt -> [ FldAlgElt ]`

<a id="function-eltseq-fldalgelt"></a>
##### `Eltseq(a): FldAlgElt -> [ FldAlgElt ]`

<a id="function-elementtosequence-rngordelt"></a>
##### `ElementToSequence(a): RngOrdElt -> [ FldOrdElt ]`

<a id="function-rngord-eltseq"></a>
##### `Eltseq(a): RngOrdElt -> [ FldOrdElt ]`

For an element $a$ of an algebraic field $F$, a sequence of coefficients of length degree of $F$ with respect to the basis is returned. For an element of an order $O$, the sequence of coefficients of the element with respect to the basis of $O$ are returned.

Note however that the universe of the sequence if always a field since in general in relative extensions integral coefficients cannot be achieved.

<a id="function-eltseq-fldalgelt-fldalg"></a>
##### `Eltseq(E, k): FldAlgElt, FldAlg -> [RngElt]`

<a id="function-eltseq-fldalgelt-rng"></a>
##### `Eltseq(E, k): FldAlgElt, Rng -> [RngElt]`

For an algebraic number $E\in K$ and a ring $k$ which occurs somewhere in the defining tower for $K$, return the list of coefficients of $E$ over $k$, that is, apply `Eltseq` to $E$ and to its coefficients until the list is over $k$.

<a id="function-flat-fldalgelt"></a>
##### `Flat(e): FldAlgElt -> [FldRatElt]`

Given an element in a field $K$, this returns the coordinates of $e$ with respect to the `AbsoluteBasis` of $K$ over ${\mathbb{Q}}$.

<a id="literal-literal-a-i-fldalgelt-rngintelt-fldratelt"></a>
##### `a[i]: FldAlgElt, RngIntElt -> FldRatElt`

<a id="literal-literal-a-i-fldalgelt-rngintelt-fldalgelt"></a>
##### `a[i]: FldAlgElt, RngIntElt -> FldAlgElt`

<a id="literal-literal-a-i-rngordelt-rngintelt-fldratelt"></a>
##### `a[i]: RngOrdElt, RngIntElt -> FldRatElt`

<a id="literal-literal-a-i-rngordelt-rngintelt-fldordelt"></a>
##### `a[i]: RngOrdElt, RngIntElt -> FldOrdElt`

The coefficient of the $i$th basis element in the algebraic field or order element $a$.

<a id="function-productrepresentation-rngordelt"></a>
##### `ProductRepresentation(a): RngOrdElt -> [ RngOrdElt ], [ RngIntElt ]`

<a id="function-productrepresentation-fldalgelt"></a>
##### `ProductRepresentation(a): FldAlgElt -> [ FldAlgElt ], [ RngIntElt ]`

Return sequences $P$ and $E$ such that the product of elements in $P$ to the corresponding exponents in $E$ is the algebraic number $a$.

<a id="function-productrepresentation-fldalgelt-rngintelt"></a>
##### `ProductRepresentation(P, E): [ FldAlgElt ], [ RngIntElt ] -> FldAlgElt`

<a id="function-powerproduct-fldalgelt-rngintelt"></a>
##### `PowerProduct(P, E): [FldAlgElt], [RngIntElt] -> FldAlgElt`

Return the element $a$ of the universe of the sequence $P$ such that $a$ is the product of elements of $P$ to the corresponding exponents in the sequence $E$.

<a id="function-valuation-rngordelt-rngordidl"></a>
##### `Valuation(w, I): RngOrdElt, RngOrdIdl -> RngIntElt`

<a id="function-valuation-fldalgelt-rngordidl"></a>
##### `Valuation(w, I): FldAlgElt, RngOrdIdl -> RngIntElt`

Given a prime ideal $I$ and an element $w$ of an order or algebraic field, this function returns the valuation $v_I(w)$ of $w$ with respect to $I$; this valuation will be a non-negative integer. Ideals are discussed in Section [Ideals and Quotients](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngord-ideal).

<a id="function-decomposition-rngordelt"></a>
##### `Decomposition(a): RngOrdElt -> SeqEnum[<RngOrdIdl, RngIntElt>]`

<a id="function-decomposition-fldordelt"></a>
##### `Decomposition(a): FldOrdElt -> SeqEnum[<RngOrdIdl, RngIntElt>]`

The factorization of the order or algebraic field element $a$ into prime ideals.

<a id="function-divisors-rngordelt"></a>
##### `Divisors(a): RngOrdElt -> SeqEnum[RngOrdElt]`

For an element $a$ in a maximal order return a sequence containing (up to units) all the elements which divide $a$. The elements of the sequence will be generators for all principal ideals returned by `Divisors(Parent(a)*a)`.

<a id="function-index-rngordelt"></a>
##### `Index(a): RngOrdElt -> RngIntElt`

The index of the module ${\mathbb{Z}}[a]$ in $O$ where $a$ lies in $O$, an order over ${\mathbb{Z}}$. If $a$ is not a primitive element the index is infinite.

<a id="function-different-rngordelt"></a>
##### `Different(a): RngOrdElt -> RngOrdElt`

The different of the element $a$ of an order of a number field.

<a id="function-degreeoneprimeideals-rngord-rngintelt"></a>
##### `DegreeOnePrimeIdeals(O, B): RngOrd, RngIntElt -> [ RngOrdIdl ]`

Given an order $O$ as well as a positive integer bound $B$, return a sequence consisting of all prime ideals in $O$ whose norm is a rational prime not exceeding the bound $B$.

<a id="ideal-class-group"></a>
<a id="rngord-clg"></a>
### Ideal Class Groups

This section describes functions for computing the group of ideal classes of the maximal order of an absolute number field. The method usually employed is the *relation* method ([[Coh93](https://docs.magma-maths.org/references.md#cite-cohen1), [Hes96](https://docs.magma-maths.org/references.md#cite-he1)]), basically consisting of the following steps. In the first step a list of prime ideals of norm below a given bound is generated, the *factor basis*. In the second step a search is conducted to find in each of the prime ideals a few elements for which the principal ideals they generate factor completely over the factor basis. Using these *relations*, a generating set for the ideal class group is derived (via matrix echelonization), and in the final step it is verified that the correct orders for the generators have been found. To determine the class group or class number rigorously, one must ensure that all ideals having norm smaller than the Minkowski bound – or smaller than the Bach bound, if one assumes the generalized Riemann hypothesis – are taken into consideration. It should be stressed that, by default, a guaranteed result is computed using the Minkowski bound. Even for innocent looking fields, this may take considerable time. In contrast, Pari (from version 2.0), by default, uses a much smaller bound giving results that are not guaranteed. In Magma, to perform computations comparable to Pari, the user must request a non-rigorous computation. The recommended way is to globally control this by using `SetClassGroupBounds("GRH")`, before calling routines involving class group calculations. Note that it is better to give `"GRH"` here than to give a numerical value for the bound. Starting from version 2.20, a new implementation of the sieve algorithm for finding relations ([[Bia](https://docs.magma-maths.org/references.md#cite-biasse)]) is used automatically, as a subroutine, to the extent it is advantageous. This method is very effective for fields of degree up to $5$, and to a lesser extent degree $6$. When a class group computation has been completed, the results are stored with the order (to avoid repeated computation).

<a id="procedure-setprintclassgroupwarnings-boolelt"></a>
#### `SetPrintClassGroupWarnings(b): BoolElt`

Set whether the class group algorithm prints warnings about expensive computations.

<a id="function-rngord-classgroup"></a>
#### `ClassGroup(O: parameters): RngOrd -> GrpAb, Map`

<a id="function-classgroup-fldnum"></a>
#### `ClassGroup(K: parameters): FldNum -> GrpAb, Map`

```magma
Bound          : RngIntElt                    Default: MinkowskiBound
Proof          : MonStgElt                    Default: "Full"
Al             : MonStgElt                    Default: "Automatic"
UsePowerProduct: BoolElt                      Default: false
ClassGroup     : Verbose                      Default: 3 % internally 5, but > 3 is not useful for users
```

The group of ideal classes in the ring of integers $O$ of a number field $K$ is returned as an abelian group, together with a map from this abstract group to the set of ideal of $O$. The map is defined in both directions: in the inverse direction, it returns the ideal class of a given ideal of $O$. Since V2.28, a distributed parallel version of the main algorithm is available. As usual, one first uses `SetNthreads` and optionally `StartWorkers` to select the number of cores/workers before the class group algorithm is called. By default, all computations are unconditionally rigorous: this means that a final step must be performed, checking all prime ideals up to the Minkowski bound (which is impractical for many fields). To perform conditional computations (under “GRH”, or with a smaller bound), the recommended approach is to set the rigour for all class groups by using `SetClassGroupBounds("GRH")` before calling `ClassGroup`. Note that it is better to give `"GRH"` than to give a numerical value for the bound. The alternative approach is to use the parameters `Proof` and `Bound`, which have the following effect. If `Proof := "GRH"`, a bound for generators of the class group based on the GRH is used to replace the Minkowski bound. Further, a GRH based aopproximation of the residue of the Dedekind zeta function is assumed to be correct. The result will hence be correct under the GRH. If `Bound` is set to some positive integer $M$, $M$ is used instead of the Minkowski bound. The validity of the result still depends on the `"Proof"` parameter. If `Proof := "Bound"`, the maximum of the given bound and a GRH based bound for a generating set of the class group is used. Further, a GRH based aopproximation of the residue of the Dedekind zeta function is assumed to be correct. The result will hence be correct under the GRH. If `Proof := "Subgroup"`, a maximal subset of the relations is constructed. In terms of the result, this means that the group returned will be a subgroup of the class group (i.e. the list of prime ideals considered may be to small). If `Proof := "Full"` (the default) the bound given by `"SetClassGroupBounds"` is used. By default this is the Minkowski bound and a guaranteed result is computed. This is equivalent to `Bound := MinkowskiBound(K)` and `Proof := "Subgroup"`. But, if `SetClassGroupBounds("GRH");` was used, the result is conditional and correct under the GRH.

If only `Bound` is given, the `Proof` defaults to `"Subgroup"`.

Finally, giving `Proof := "Current"` is the same as repeating the last call to `ClassGroup()`, but without the need to explicitly restate the value of `Proof` or `Bound`. If there was no prior call to `ClassGroup`, a fully proven computation will be carried out.

For quadratic fields, alternative algorithms may be selected using the `Al` parameter.

In some previous versions of Magma, use of the sieve algorithm was controlled by setting `Al` to `"Sieve"` or to `"NoSieve"`. This usage is deprecated, as the choice is now made internally: the sieve algorithm is called automatically by the main class group routine to the extent it is advantageous.

If `UsePowerProduct` is set to `true` then images of group elements under the map from the class group will be returned as a power product of ideals.

<a id="function-ringclassgroup-rngord"></a>
#### `RingClassGroup(O): RngOrd -> GrpAb, Map`

<a id="function-picardgroup-rngord"></a>
#### `PicardGroup(O): RngOrd -> GrpAb, Map`

```magma
UsePowerProduct: BoolElt                    Default: false
```

For a (possibly non-maximal) order $O$, compute the ring class group (Picard group) of $O$, ie. the group of invertible ideals in $O$ modulo principal ideals. The algorithm and its implementation are due to Klüners and Pauli, [[PK05](https://docs.magma-maths.org/references.md#cite-kluenerspauli2005)].

If `UsePowerProduct` is set to `true`, any computations using the images of elements of the class group will not evaluate a power product representation of ideals but instead work with this representation. This can be substantially more efficient for some orders.

<a id="function-conditionalclassgroup-rngord"></a>
#### `ConditionalClassGroup(O): RngOrd -> GrpAb, Map`

<a id="function-conditionalclassgroup-fldnum"></a>
#### `ConditionalClassGroup(K): FldNum -> GrpAb, Map`

This is equivalent to calling `ClassGroup(O:Proof := "GRH")`.

<a id="function-classgroupprimerepresentatives-rngord-rngordidl"></a>
#### `ClassGroupPrimeRepresentatives(O, I): RngOrd, RngOrdIdl -> Map`

For the maximal order $O$ of some absolute number field $k$ and an ideal $I$ of $O$, compute a set of prime ideals in $O$ that are coprime to $I$ and represent all ideal classes. The map, mapping elements of the class group to the primes representing the ideal class is returned.

<a id="function-primerepresentatives-rngord-from-class-group"></a>
#### `PrimeRepresentative(c, f: parameters): GrpAbElt, Map -> RngOrdIdl`

```magma
DegreeOne: BoolElt                    Default: false
```

Given an element c of the abelian group A and the map f returned by ClassGroup for a maximal order $O$, this function returns a prime ideal of $O$ lying in the ideal class $c$.
If `DegreeOne` is set to true, the prime ideal returned will have residue degree one over the rationals. If `Minimal` is set to true, the search proceeds by splitting successive rational primes and testing whether a prime above lies in the class $c$, which tends to produce an ideal of small norm. Otherwise, the search enumerates lattice points of $O$ until an ideal in the required class is found.

<a id="function-primerepresentatives-rngord-from-ideal"></a>
#### `PrimeRepresentative(I: parameters): RngOrdIdl -> RngOrdIdl`

```magma
DegreeOne: BoolElt                    Default: false
Minimal  : BoolElt                    Default: false
```

Given an ideal $I$ of a maximal order $O$ of a number field, this function returns a prime ideal of $O$ lying in the same ideal class as $I$. The search is carried out by enumerating lattice points of $O$. If `DegreeOne` is set to true, the prime ideal returned will have residue degree one.

<a id="function-classnumber-rngord"></a>
#### `ClassNumber(O: parameters): RngOrd -> RngIntElt`

<a id="function-classnumber-fldnum"></a>
#### `ClassNumber(K: parameters): FldNum -> RngIntElt`

```magma
Bound     : RngIntElt                    Default: MinkowskiBound
Proof     : MonStgElt                    Default: "Full"
Al        : MonStgElt                    Default: "Automatic"
ClassGroup: Verbose                      Default: 5
```

Return the class number of the ring of integers $O$ of a number field $K$. The options for the parameters are the same as for `ClassGroup`.

<a id="function-minkowskibound-fldnum"></a>
#### `MinkowskiBound(K): FldNum -> RngIntElt`

<a id="function-minkowskibound-rngord"></a>
#### `MinkowskiBound(O): RngOrd -> RngIntElt`

This returns the Minkowski bound for the maximal order of the given field $K$. This is an unconditional integer upper bound for norms of the generators of the ideal class group of the maximal order.

<a id="function-bachbound-fldnum"></a>
#### `BachBound(K): FldNum -> RngIntElt`

<a id="function-bachbound-rngord"></a>
#### `BachBound(O): RngOrd -> RngIntElt`

This returns the Bach bound for the maximal order of the given field $K$. This is an integer upper bound for norms of the generators of the ideal class group of the maximal order which holds if the generalized Riemann hypothesis is true.

<a id="function-grhbound-fldnum"></a>
#### `GRHBound(K): FldNum -> RngIntElt`

<a id="function-grhbound-rngord"></a>
#### `GRHBound(O): RngOrd -> RngIntElt`

This returns an integer upper bound, proven assuming the generalized Riemann hypothesis, for norms of the generators of the ideal class group of the maximal order of the given field $K$. The function returns the best bound obtainable in Magma. In the current version, in addition to the Bach bound, the algorithm uses results of Belabas and Grenie, Molteni, which often produce bounds that are significantly smaller than the Bach bound.

<a id="procedure-factorbasisverify-rngord-rngintelt-rngintelt"></a>
#### `FactorBasisVerify(O, a, b): RngOrd, RngIntElt, RngIntElt`

This verifies that every prime ideal of the order $O$ with norm between $a$ and $b$ is equivalent to an ideal of $O$ with norm smaller than $a$. This function requires that a class group computation has already been done for $O$.

#### Class Group Internals

The results of a class group computation, which are stored internally on the order $O$, are a factor base, a set of relations, and the relation matrix. (Units are also stored, and used in later computations.) Access to this data is provided by functions below. Also listed are functions for independently producing data of the same form; these do not use the same code as the internal class group computation.

<a id="function-eulerproduct-rngord-rngintelt"></a>
##### `EulerProduct(O, B): RngOrd, RngIntElt -> FldReElt`

Computes an approximation of the residue of the Dedekind zeta function of $O$ at $s=1$ via the Euler product for the order $O$ using only prime ideals over prime numbers of norm $\leq B$.

<a id="function-residuegrh-rngord-rngintelt"></a>
##### `ResidueGRH(O, B): RngOrd, RngIntElt -> FldReElt`

Computes an approximation of the residue of the Dedekind zeta function of $O$ at $s=1$ as a sum involving only prime ideals of norm $\leq B$. Assuming GRH, the best known error bounds for `ResidueGRH` are smaller than the error bounds for `EulerProduct`.

<a id="function-residuegrhbound-rngord-fldreelt"></a>
##### `ResidueGRHbound(O, e): RngOrd, FldReElt -> FldReElt`

Assuming GRH, this function computes a bound $B$ such that `ResidueGRH` will have a logarithmic error less than $e$ [[BF15](https://docs.magma-maths.org/references.md#cite-mr3266965)].

<a id="function-factorbasis-fldnum-rngintelt"></a>
##### `FactorBasis(K, B): FldNum, RngIntElt -> [ RngOrdIdl ]`

<a id="function-factorbasis-rngord-rngintelt"></a>
##### `FactorBasis(O, B): RngOrd, RngIntElt -> [ RngOrdIdl ]`

Given the maximal order $O$, or a number field $K$ with maximal order $O$, this function returns a sequence of prime ideals of norm less than a given bound $B$.

<a id="function-factorbasis-rngord"></a>
##### `FactorBasis(O): RngOrd -> [ RngOrdIdl ], Integer`

Given the maximal order $O$ where the class group has previously been computed, this function returns a sequence of prime ideals that have been used as factor basis for the class group computation. In addition the used upper bound for the factor basis is returned. This bound can be different from the bound passed in using the `Bound := bound` parameter.

<a id="function-relationmatrix-rngord"></a>
##### `RelationMatrix(O): RngOrd -> ModHomElt`

Given a maximal order $O$ where the class group has been computed previously, the resulting relation matrix is returned.

<a id="function-relations-rngord"></a>
##### `Relations(O): RngOrd -> ModHomElt`

Given a maximal order $O$ where the class group has been computed previously, the vector containing the order elements used to compute the class group is returned.

<a id="function-classgroupcyclicfactorgenerators-rngord"></a>
##### `ClassGroupCyclicFactorGenerators(O): RngOrd -> ModHomElt`

Let $a_i$ be the generators for the cyclic factors of the class group of $O$. This function returns generators for $a_i^{c_i}$ where $c_i$ is the order of $a_i$ in the class group.

<a id="example-ex-92eeba"></a>
##### `Example: Class Group of a Real Quadratic Field (ex-92eeba)`

We give an example of a class group calculation, illustrating some of the functions.

```magma
> R<x> := PolynomialRing(Integers());
> O := MaximalOrder(x^2-10);
> C, m := ClassGroup(O);
> C;
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*C.1 = 0
> m(C.1);
Prime Ideal of O
Two element generators:
    [2, 0]
    [0, 1]
> p := Decomposition(O, 31)[1][1];
> p;
Prime Ideal of O
Two element generators:
    [31, 0]
    [45, 1]
> p @@ m;
0
> IsPrincipal(p);
true
> p := Decomposition(O, 37)[1][1];
> p @@ m;
C.1
> IsPrincipal(p);
false
> MinkowskiBound(O);
3
> F, B := FactorBasis(O);
> B;
50
```

Note that although the `MinkowskiBound` is only $3$, the algorithm chose a larger bound for the computation internally.

```magma
> r := Relations(O);
> M := RelationMatrix(O);
> [ Valuation(r[1][1], x) : x in F];
[ 0, 0, 0, 0, 0, 1, 1, 0 ]
> M[1];
(0 0 0 0 0 1 1 0)
```

The `RelationMatrix` stores the valuation of the `Relations` at each prime ideal contained in the `FactorBasis`.

```magma
> f,g := IsPrincipal(m(C.1)^2);
> f;
true
> g;
[2, 0]
> ClassGroupCyclicFactorGenerators(O);
[
    [2, 0]
]
```

Now we will consider some larger fields to demonstrate the effect of the `"Bound"` parameter:

```magma
> K := NumberField(x^5-14*x^4+14*x^3-14*x^2+14*x-14);
> MinkowskiBound(K);
21106
> BachBound(K);
7783
> GRHBound(K);
259
> time C := ClassGroup(K);
Time: 0.510
> C;
Abelian Group isomorphic to Z/10
Defined on 1 generator
Relations:
    10*$.1 = 0
```

This is an unconditional result. The conditional computation, assuming GRH, is faster. Note that the `BachBound` should NOT be used – the better `GRHBound` is much smaller. (They both are bounds which guarantee the class group computation is correct assuming GRH.)

```magma
> K := NumberField(x^5-14*x^4+14*x^3-14*x^2+14*x-14);
> time #ClassGroup(K : Proof := "GRH");
10
Time: 0.100
> K := NumberField(x^5-14*x^4+14*x^3-14*x^2+14*x-14);
> time #ClassGroup(K : Bound := BachBound(K));
10
Time: 0.280
```

<a id="class-group-bounds"></a>
#### Setting the Class Group Bounds

These functions control the rigour of all subsequent of class group computations. The recommended way is `SetClassGroupBounds("GRH")`. This is the minimum possible level of rigour with the current implementation – all class groups will be correct if GRH holds, regardless of all settings.

<a id="procedure-setclassgroupbounds-monstgelt"></a>
##### `SetClassGroupBounds(string): MonStgElt`

If this is called with the string “GRH”, all subsequent class group computations will be performed in such a way that either they are correct, or GRH does not hold.

<a id="procedure-setclassgroupbounds-rngintelt"></a>
##### `SetClassGroupBounds(n): RngIntElt`

The integer $n$ is the proof bound to be used in all subsequent calls to `ClassGroup`. That is, each class group computed will be correct if it is generated by ideals of norm at most $n$.

<a id="example-ex-3fbfbd"></a>
##### `Example: Setting Class Group Bounds (ex-3fbfbd)`

We select some bounds which will then be used in all calls to `ClassGroup`. (The class group computations will be rigorous, but will use a relatively small factor base for the first part of the computation).

```magma
> map1 := map< PowerStructure(RngOrd) -> Integers() |
>                             order :-> BachBound(order) div 10 >;
> map2 := map< PowerStructure(RngOrd) -> Integers() |
>                             order :-> MinkowskiBound(order) >;
> SetClassGroupBoundMaps( map1, map2);
```

<a id="id5"></a>
#### Class Group Map Caching

The map returned by `ClassGroup` can be used to compute the ideal class of a given ideal. In applications which involve many repeated calls to this, it may be advantageous to store the results of each call (although this may also use a lot of memory). By default, results are not stored.

For example, if the order $O$ is to be used extensively as a coefficient ring for class field computations, then every time discrete logarithms of ray class groups are computed, a discrete logarithm computation in the class group is triggered. In particular when investigating the cohomology of various extensions over $O$, this involves testing the same ideals over and over again.

<a id="function-classgroupgetusememory-rngord"></a>
##### `ClassGroupGetUseMemory(O): RngOrd -> BoolElt`

<a id="procedure-classgroupsetusememory-rngord-boolelt"></a>
##### `ClassGroupSetUseMemory(O, f): RngOrd, BoolElt`

These functions access and set whether or not the map returned by `ClassGroup(O)` stores the results of calls to the inverse map.

<a id="unit-group"></a>
<a id="rngord-unit"></a>
### Unit Groups

For most number fields, the algorithm used to compute the unit group involves computing the class group and obtaining units from the ‘class group relations’. If a class group has already been computed for the field, these ‘unit relations’ are already stored; otherwise, the standard class group computation will be performed first.

The unit group routine is fully rigorous, even when the class group computation is not. For details see [`UnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-rngord-unitgroup) and `IndependentUnits` below.

Previously, some of the algorithms described in [[PZ89](https://docs.magma-maths.org/references.md#cite-pohst1)], (pp. 343–344), and in [[Poh93](https://docs.magma-maths.org/references.md#cite-pohst2)] were used but since V2.21 the class group, computed assuming GRH if not already computed, is used to compute the independent units.

<a id="function-unitrank-rngord-2"></a>
#### `UnitRank(O): RngOrd -> RngIntElt`

<a id="function-unitrank-fldalg"></a>
#### `UnitRank(K): FldAlg -> RngIntElt`

The free rank of the group of units in the ring of integers $O$ (of a number field $K$).

<a id="function-torsionunitgroup-rngord"></a>
#### `TorsionUnitGroup(O): RngOrd -> GrpAb, Map`

<a id="function-torsionunitgroup-fldnum"></a>
#### `TorsionUnitGroup(K): FldNum -> GrpAb, Map`

The torsion subgroup of the unit group of the order $O$, or, in case of a number field $K$, of its maximal order $O$. The torsion subgroup is returned as an abelian group $T$, together with a map $m$ from the group to the order $O$. The torsion subgroup will be cyclic, and is generated by `m(T.1)`.

<a id="function-rngord-unitgroup"></a>
#### `UnitGroup(O): RngOrd -> GrpAb, Map`

<a id="function-multiplicativegroup-rngord"></a>
#### `MultiplicativeGroup(O): RngOrd -> GrpAb, Map`

```magma
Al       : MonStgElt                    Default: "Automatic"
GRH      : BoolElt                      Default: false
UnitGroup: Verbose                      Default: 6
```

Given an order $O$ in a number field, this function returns an (abstract) abelian group $U$, as well as a bijection $m$ between $U$ and the units of the order. The unit group consists of the torsion subgroup, generated by the image `m(U.1)` and a free part, generated in $O$ by the images `m(U.i)` for $2\leq i\leq r_1+r_2$. By default, `UnitGroup` performs a proof phase, to verify rigorously that the unit group returned is the full unit group rather than a finite index subgroup. This is done even when the class group computation was only heuristic. It is done by a different method than the proof phase for the class group (and it does not prove the class group). When `UnitGroup` is called with the option `GRH` set to `true`, this proof phase is skipped, which means the calculation has the same level of rigour as the class group computation. This is equivalent to doing the following: first compute a class group, specifying the rigour of that computation (see [Ideal Class Groups](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#rngord-clg)), and then call `IndependentUnits` (see below).

<a id="function-unitgroup-fldnum"></a>
#### `UnitGroup(K): FldNum -> GrpAb, Map`

<a id="function-multiplicativegroup-fldnum"></a>
#### `MultiplicativeGroup(K): FldNum -> GrpAb, Map`

This is identical to `UnitGroup(MaximalOrder(K))`.

<a id="function-independentunits-rngord"></a>
#### `IndependentUnits(O): RngOrd -> GrpAb, Map`

<a id="function-independentunits-fldnum"></a>
#### `IndependentUnits(K): FldNum -> GrpAb, Map`

```magma
Al       : MonStgElt                    Default: "Automatic"
UnitGroup: Verbose                      Default: 6
```

This function is an alternative to `UnitGroup` which returns a subgroup of finite index in the unit group. The arguments and return values are the same as for `UnitGroup`. In the current implementation, `IndependentUnits` returns the full unit group whenever the class group computation is correct. This is always the case if the GRH holds. After calling `IndependentUnits(O)`, if [`SetOrderUnitsAreFundamental`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#procedure-rngord-setorderunitsarefundamental)`(O)` is invoked Magma will assume this unit group is the full unit group in all subsequent calculations with the same number field.

<a id="function-pfundamentalunits-rngord-rngintelt"></a>
#### `pFundamentalUnits(O, p): RngOrd, RngIntElt -> GrpAb, Map`

<a id="function-pfundamentalunits-fldnum-rngintelt"></a>
#### `pFundamentalUnits(K, p): FldNum, RngIntElt -> GrpAb, Map`

```magma
Al       : MonStgElt                    Default: "Automatic"
UnitGroup: Verbose                      Default: 6
```

Given a maximal order $O$ in a number field, this function returns an (abstract) abelian group $U$, as well as a map $m$ from $U$ to the order. $U$ will be a subgroup (of finite index) of the unit group $G$ such that $p$ does not divide the index $(G:U)$ where $p$ is the prime number given. If a field $K$ is given rather than an order, the above is computed for the maximal order of $K$.

<a id="function-unitgroupassubgroup-rngord"></a>
#### `UnitGroupAsSubgroup(O): RngOrd -> GrpAb`

For a (possibly non-maximal) order $O$ in some absolute field $K$, return the unit group of $O$ as a subgroup of the unit group of the maximal order of $O$. The algorithm and its implementation is due to Klüners and Pauli, [[PK05](https://docs.magma-maths.org/references.md#cite-kluenerspauli2005)].

<a id="function-mergeunits-fldnum-fldnumelt"></a>
#### `MergeUnits(K, a): FldNum, FldNumElt -> BoolElt`

<a id="function-mergeunits-rngord-rngordelt"></a>
#### `MergeUnits(O, a): RngOrd, RngOrdElt -> BoolElt`

```magma
UnitGroup: Verbose                    Default: 6
```

This function is largely irrelevant in the current implementation.

For an order $O$ or a number field with maximal order $O$ and a unit $a\in O$, add the unit to the already known subgroup of $U_O$ that is stored in $O$. Returns `true` if and only if the rank of the currently known unit group of $O$ or $K$ increases when $a$ is merged with it.

<a id="example-ex-98001b"></a>
#### `Example: Class and Unit Groups of a Quartic Field (ex-98001b)`

In our field defined by $x^4 - 420*x^2 + 40000$, we obtain the class and unit groups as follows.

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> C := ClassGroup(K);
> C;
Abelian Group of order 1
> U := UnitGroup(K);
> U;
Abelian Group isomorphic to Z/2 + Z + Z + Z
Defined on 4 generators
Relations:
      2*U.1 = 0
> T := TorsionUnitGroup(K);
> T;
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*T.1 = 0
```

<a id="function-isexceptionalunit-rngordelt"></a>
#### `IsExceptionalUnit(u): RngOrdElt -> BoolElt`

An element $x$ of an order $O$ is an exceptional unit if both $x$ and $x-1$ are units in $O$. This function returns `true` if and only if the order element $u$ is an exceptional unit.

<a id="function-exceptionalunitorbit-rngordelt"></a>
#### `ExceptionalUnitOrbit(u): RngOrdElt -> [ RngOrdElt ]`

If $u$ is an exceptional unit of an order $O$, then all of the units $u_1=u$, $u_2={1\over u}$, $u_3=1-u$, $u_4={1\over {1-u}}$, $u_5={{u-1}\over u}$, $u_6={u\over {u-1}}$ are exceptional. The set $\Omega(u)$ formed by $u_1, \ldots, u_6$ is called the *orbit* of $u$. Usually it will have 6 elements. This function returns a sequence containing the elements of $\Omega(u)$.

<a id="function-exceptionalunits-rngord"></a>
#### `ExceptionalUnits(O): RngOrd -> [ RngOrdElt ]`

```magma
UnitEq: Verbose                    Default: 5
```

This function returns a sequence $S$ of exceptional units of the order $O$.

<a id="function-unitswithsigns-rngord-plcnumelt-rngint"></a>
#### `UnitsWithSigns(O, oo, Signs): RngOrd, [ PlcNumElt ], [ RngInt ] -> [ RngOrdElt ]`

<a id="function-unitswithsigns-fldalg-plcnumelt-rngint"></a>
#### `UnitsWithSigns(K, oo, Signs): FldAlg, [ PlcNumElt ], [ RngInt ] -> [ FldAlgElt ]`

Returns all units in $O$ (or the ring of integers of $K$) modulo squares that have sign $Signs[i]$ at the i-th real place given in $oo[i]$.

<a id="function-unitswithsigns-rngord-rngelt"></a>
#### `UnitsWithSigns(O, x): RngOrd, RngElt -> [ RngOrdElt ]`

<a id="function-unitswithsigns-fldalg-rngelt"></a>
#### `UnitsWithSigns(K, x): FldAlg, RngElt -> [ FldAlgElt ]`

Returns all units in $O$ (or the ring of integers of $K$) modulo squares that have the same signs at the real places of $O$ as the element $x$.

<a id="function-unitswithsigns-rngordelt"></a>
#### `UnitsWithSigns(x): RngOrdElt -> [ RngOrdElt ]`

<a id="function-unitswithsigns-fldalgelt"></a>
#### `UnitsWithSigns(x): FldAlgElt -> [ FldAlgElt ]`

Given an element $x$ in an order $O$ or a number field $K$, return all units of $O$ (or the ring of integers of $K$) modulo squares that have the same signs at the real places of $O$ as $x$.

<a id="function-hastotallypositivegenerator-rngordfracidl"></a>
#### `HasTotallyPositiveGenerator(I): RngOrdFracIdl -> BoolElt, [ RngOrdElt ]`

Decides if $I$ is generated by some totally positive element. If so, the second return value contains all such generators up to squares.

<a id="function-traceminimalcone-fldnum"></a>
#### `TraceMinimalCone(nf): FldNum -> TorCon`

Given a totally real number field, find the trace-minimal cone, which is a fundamental domain for the action of the totally positive units.

<a id="equation"></a>
<a id="rngord-equations"></a>
### Diophantine Equations

Magma has routines for solving norm equations, Thue equations, index form equations, and unit equations.

<a id="norm-equation"></a>
<a id="rngord-main-norm-equation"></a>
#### Norm Equations

Norm equations in the context of number fields occur in many applications. While Magma contains efficient algorithms to solve norm equations it is important to understand the difference between the various types of norm equations that occur. Given some element $\theta$ in a number field $k$ together with a finite extension $K/k$, there are two different types of norm equations attached to this data:

\- Diophantine norm equations, that is norm equations where a solution $x\in K$ is restricted to a particular order (or any additive subgroup), and

\- field theoretic norm equations where any element in $x\in K$ with $N(x) = \theta$ is a solution.

While in the first case the number of *different* (up to equivalence) solutions is finite, no such restriction holds in the field case. On the other hand, the field case often allows to prove the existence or non-existence of solutions quickly, while no efficient tests exist for the Diophantine case. So it is not surprising that different methods are applied for the different cases. We will discuss the differences with the individual intrinsics.

<a id="function-normequation-rngord-rngintelt"></a>
##### `NormEquation(O, m): RngOrd, RngIntElt -> BoolElt, [ RngOrdElt ]`

<a id="function-normequation-rngord-rngordelt"></a>
##### `NormEquation(O, m): RngOrd, RngOrdElt -> BoolElt, [ RngOrdElt ]`

```magma
All      : BoolElt                      Default: true
Solutions: RngIntElt                    Default: All
Exact    : BoolElt                      Default: false
Ineq     : BoolElt                      Default: false
```

Given an order $O$ and an element $m$ of the ground ring of $O$ which can be a positive integer or an element of a suborder, this intrinsic solves a Diophantine norm equation.

This function returns a boolean indicating whether an element $\alpha\in O$ exists such that $\rm N_{F/L}(\alpha)$, the norm of $\alpha$ with respect to the subfield $L$ of $F$ (the field of fractions of $O$), equals $m$, and if so, a sequence of length at most `Solutions` of solutions $\alpha$. The parameter `Exact` may be used to indicate whether an exact solution is required (with `Exact := true`) or whether a solution up to a torsion unit suffices.

The maximal number of required solutions can be indicated with the `Solutions` parameter, but setting `All := true` will override this and the search will find all solutions.

If the order is absolute, then the parameter `Ineq` may be set to true. If so, all solutions $x$ with $|N(x)| <= m$ will be found using a variation of Fincke’s ellipsoid method ([[Fin84](https://docs.magma-maths.org/references.md#cite-fin1), [PZ89](https://docs.magma-maths.org/references.md#cite-pohst1)]).

Depending on whether the order is absolute maximal, absolute, or (simple) relative, different algorithms are used.

If the order is an absolute maximal order, Magma will, in a first step, enumerate all integral ideals having the required norm (up to sign). Next, all the ideals are tested for principality using the class group based method. If `Exact := true`, then a third step is added: we try to find a unit in $O$ of norm $-1$. This unit is used to sign adjust the solution(s). If there is no such unit, we drop all solutions of the wrong sign.

If the order is absolute, but not maximal, the norm equation is first solved in the maximal order using the above outlined method. In a second step, a complete set of representatives for the unit group of the maximal order modulo the units of $O$ is computed and Magma attempts to combine solutions in the maximal order with those representatives to get solutions in $O$.

If `Solutions` is set, the search stops after the required number of solutions is found.

In case the order is of type `RngOrd` and in some imaginary quadratic field, the norm function is a positive definite quadratic form, thus algorithms based on that property are used. In case the right hand side $m$ equals $\pm1$, lattice based methods are applied.

If `Ineq` is `true`, which is only supported for absolute fields, lattice enumeration techniques ([[Fin84](https://docs.magma-maths.org/references.md#cite-fin1), [PZ89](https://docs.magma-maths.org/references.md#cite-pohst1)]) based on Fincke’s ellipsoid method are used.

If the order is (simply) relative different algorithms are implemented, depending on the number of solutions sought. However, common to all of them is that they (partially) work in the `AbsoluteOrder` of $O$.

If $O$ is a relative maximal order and if we only want to find $1$ solution (or to prove that there is none), Magma first looks for (integral) solutions in the field using an $S$-unit based approach as outlined in [`NormEquation`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/equation.md#function-rngord-normequation-fld). This step gives an affine subspace of the $S$-unit group that contains all integral solutions of our equation. In a second step, a simplex based technique is used to find totally positive elements in the subspace.

In `All` is given or `Solutions` is $>1$, then lattice based methods are used ([[FJP97](https://docs.magma-maths.org/references.md#cite-fijupo), [Fie97](https://docs.magma-maths.org/references.md#cite-fi1), [Jur93](https://docs.magma-maths.org/references.md#cite-jurk)]).

<a id="function-rngord-normequation-fld"></a>
##### `NormEquation(F, m): FldAlg, RngIntElt -> BoolElt, [ FldAlgElt ]`

<a id="function-normequation-fldalg-fldalgelt"></a>
##### `NormEquation(F, m): FldAlg, FldAlgElt -> BoolElt, [ FldAlgElt ]`

<a id="function-normequation-fldalg-fldratelt"></a>
##### `NormEquation(F, m): FldAlg, FldRatElt -> BoolElt, [ FldAlgElt ]`

```magma
Primes: eseq of prime ideals                    Default: []
Nice  : BoolElt                                 Default: true
```

Given a field $F$ and an element $m$ of the base field of $F$, this function returns a boolean indicating whether an element $\alpha\in F$ exists such that $\rm N_{F/L}(\alpha)$, the norm of $\alpha$ with respect to the base field $L$ of $F$ equals $m$, and if so, a sequence of length $1$ of solutions $\alpha$. The field theoretic norm equations are all solved using $S$-units. Before discussing some details, we outline the method.

\- Determine a set $S$ of prime ideals. We try to obtain a solution as a $S$-unit for this set $S$.

\- Compute a basis for the $S$-units

\- Compute the action of the norm-map

\- Obtain a solution as a preimage.

In general, no effective method is known for the first step. If the field is relative normal however, it is known that is $S$ generates the class group of $F$ and if $m$ is a $S$-unit, then $S$ is large enough (*suitable* in ([[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), 7.5]) [[Fie97](https://docs.magma-maths.org/references.md#cite-fi1), [Gar80](https://docs.magma-maths.org/references.md#cite-garbanati), [Sim02](https://docs.magma-maths.org/references.md#cite-simon1)]. Thus to find $S$ we have to compute the class group of $F$. If a (conditional) class group is already known, it is used, otherwise an *unconditional* class group is computed. The initial set $S$ consists of all prime ideals occurring in the decomposition of $m{\mathbb{Z}}_F$. Note that this step includes the factorisation of $m$ and thus can take a long time is $m$ is large.

Next, we determine a basis for the $S$-unit group and the action of the norm on it. This give the norm map as a map on the $S$-unit group as an abstract abelian group.

Finally, the right hand side $m$ is represented as an element of the $S$-unit group and a solution is then obtained as a preimage under the norm map.

If `Nice` is `true`, then Magma attempts to find a smaller solution by applying a LLL reduction to the original solution.

If `Primes` is give it must contain a list of prime ideals of $L$. Together with the primes dividing $m$ it is used to form the set $S$ bypassing the computation of an unconditional class group in this step. If $L$ is not normal this can be used to guarantee that $S$ is large enough. Note that the class group computation is still performed when the $S$-units are computed. Since the correctness of the $S$-unit group (we need only $p$-maximality for all primes dividing the (relative) degree of $L$) can be verified independently of the correctness of the class group, this can be used to derive provable results in cases where the class group cannot be computed unconditionally.

By default, the `MaximalOrder(L)` is used to compute the class group. If the attribute `NeqOrder` is set on $L$ it must contain a maximal order of $L$. If present, this order will be used for all the subsequent computations.

<a id="function-normequation-rngelt-map"></a>
##### `NormEquation(m, N): RngElt, Map -> BoolElt, RngElt`

```magma
Raw   : BoolElt                                 Default: false
Primes: eseq of prime ideals                    Default: []
```

Let $N$ be a map on the multiplicative group of some number field. Formally $N$ may also be defined on the maximal order of the field. This intrinsic tries to find a pre-image for $m$ under $N$.

This function works by realising $N$ as a endomorphism of $S$-units for a suitable set $S$.

If $N$ is a relative norm and if $L$ is (absolutely) normal then the set $S$ as computed for the field theoretic norm equation is guaranteed to be large enough to find a solution if it exists. Note: this condition is not checked.

If `Primes` is given it will be supplemented by the primes dividing $m$ and then used as the set $S$.

If `Raw` is given, the solution is returned as an unevaluated power product. See the example for details.

The main use of this function is for Galois theoretical constructions where the subfields are defined as fields fixed by certain automorphisms. In this situation the norm function can be realised as the product over the fixed group. It is therefore not necessary to compute a (very messy) relative representation of the field.

<a id="function-integralnormequation-rngelt-map-rngord"></a>
##### `IntegralNormEquation(a, N, O): RngElt, Map, RngOrd -> BoolElt, [RngOrdElt]`

```magma
Nice: BoolElt                    Default: true
```

For $a$ an integer or a unit in some number field, $N$ being a multiplicative function on some number field $k$ which is the field of fractions of the order $O$, try to find a unit in $O$ that is the preimage of $a$ under $N$. In particular, $N$ restricted to $O$ must be an endomorphism of $O$. If `Nice` is `true`, the solution will be size-reduced. In particular when the conductor of $O$ in the maximal order of $k$ is large, and therefore the unit index $(Z_k)^* : O^*$ is large as well, this function is much more efficient than the lattice based approach above.

<a id="function-simneq-fldnum-fldnumelt-fldnumelt"></a>
##### `SimNEQ(K, e, f): FldNum, FldNumElt, FldNumElt -> BoolElt, [FldNumElt]`

```magma
S          : [RngOrdIdl]                    Default: false
HasSolution: BoolElt                        Default: false
```

For a number field $K$ and subfield elements $e\in k_1$ and $f\in k_2$, try to find a solution to the simultaneous norm equations $N_{K/k_1}(x) = e$ and $N_{K/k_2}(x) = f$. The algorithm proceeds by first guessing a likely set $S$ of prime ideals that will support a solution - it is exists. Initially $S$ will contain all ramified primes in $K$, the support of $e$ and $f$, and enough primes to generate the class group of $K$. In case $K$ is normal over $Q$ this set is large enough to support a solution if there is a solution at all. For arbitrary fields that is most likely not the case. However, if `S` is passed in as a parameter then the set used internally will contain at least this set. If `HasSolution` is `true`, Magma will add primes to $S$ until a solution has been found. This is useful in situations where for some theoretical reason it is known that there has to be a solution.

<a id="example-ex-a68dc5"></a>
##### `Example: Solving a Relative Norm Equation (ex-a68dc5)`

We try to solve $N(x) = 3$ in some relative extension: (Note that since the larger field is a quadratic extension, the second call tells us that there is no integral element with norm $3$)

```magma
> x := PolynomialRing(Integers()).1;
> O := MaximalOrder(NumberField([x^2-229, x^2-2]));
> NormEquation(O, 3);
false
> NormEquation(FieldOfFractions(O), 3);
true [
  5/1*$.1*O.1 + 2/3*$.1*O.2
]
```

Next we solve the same equation but come from a different angle, we will define the norm map as an element of the group ring and, instead of explicitly computing a relative extension, work instead with the implicit fix-field.

```magma
> K := AbsoluteField(FieldOfFractions(O));
> t := K!NumberField(O).2;
> t^2;
2/1*K.1
> A, _, mA := AutomorphismGroup(K);
> F := sub<A | [ x : x in A | mA(x)(t) eq t]>;
> N := map<K -> K | x:-> &* [ mA(y)(x) : y in F]>;
> NormEquation(3, N);
true [
    5/1*K.1 + 2/3*K.3
]
```

Finally, to show the effect of `Raw`:

```magma
> f, s, base := NormEquation(3, N:Raw);
> s;
[
    (0 -1 0 -2 0 1 0 0 0 -1 0 1 0 0 0 0 0 0 0 0 0 0 0
       0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
       0 0 0 0 0 0 0 0 1 0)
]
> z := PowerProduct(base, s[1]);
> z;
5/1*K.1 + 2/3*K.3
> N(z);
3/1*K.1;
```

#### Thue Equations

Thue equations are Diophantine equations of the form $f(x,y) = k$, where k is some integer constant and $f$ is a homogeneous polynomial in two variables. Methods for computing all solutions to such equations are known, although the search space may be larger than is practical. To work with such equations in Magma a Thue system (category `Thue`) must be created to store information related to the computations. To solve Thue equations the reduction of Bilu and Hanrot ([[BH96](https://docs.magma-maths.org/references.md#cite-biha)]) is used.

<a id="function-thuesystem-rngupolelt"></a>
##### `ThueSystem(f): RngUPolElt -> Thue`

Given a polynomial $f$ of degree at least $2$ over the integers, this function returns the ‘Thue system’ corresponding to $f$; such systems are used by the functions for solving Thue equations. They are printed as the homogeneous version of $f$.

<a id="function-thuesystem-rngord"></a>
##### `ThueSystem(O): RngOrd -> Thue`

Given an order $O$ with ${\mathbb{Z}}$ as its coefficient ring, this function returns the Thue system corresponding to the defining polynomial of $O$.

<a id="function-evaluate-thue-rngintelt-rngintelt"></a>
##### `Evaluate(t, a, b): Thue, RngIntElt, RngIntElt -> RngIntElt`

<a id="function-evaluate-thue-rngintelt"></a>
##### `Evaluate(t, S): Thue, [ RngIntElt ] -> RngIntElt`

Given a Thue system $t$ and integers $a, b$, this function returns the evaluation of the homogeneous polynomial $f$ involved in $t$ at $(a, b)$, that is $f(a,b)$. The second form takes as argument the sequence $[a, b]$ instead. This can be convenient if checking the results from an inexact solution.

<a id="function-solutions-thue-rngintelt"></a>
##### `Solutions(t, a): Thue, RngIntElt -> [ [ RngIntElt, RngIntElt ] ]`

```magma
Exact : BoolElt                    Default: true
ThueEq: Verbose                    Default: 5
```

Given a Thue system $t$ and an integer $a$, this function returns a sequence consisting of all sequences of two integers $[x, y]$ which solve the equation $f(x,y) = a$, where $f$ is the (homogeneous form of) the Thue equation associated with $t$. If the optional parameter `Exact` is set to `false` then solutions to $f(x,y) = -a$ will also be found.

<a id="example-ex-cbfc14"></a>
##### `Example: Solving a Thue Equation (ex-cbfc14)`

A use of thue equations is shown.

```magma
> R<x> := PolynomialRing(Integers());
> f := x^3 + x + 1;
> T := ThueSystem(f);
> T;
Thue system with form:  X^3 + X Y^2 + Y^3
> Evaluate(T, 3, 2);
47
> Solutions(T, 4);
[]
> Solutions(T, 7);
[]
> Solutions(T, 47);
[
    [ -1, 4 ],
    [ 3, 2 ]
]
> S := Solutions(T, -47 : Exact := false);
> S;
[
    [ -3, -2 ],
    [ -1, 4 ],
    [ 1, -4 ],
    [ 3, 2 ]
]
> [Evaluate(T, s) : s in S];
[ -47, 47, -47, 47 ]
```

#### Unit Equations

Unit equations are equations of the form

$$
a\epsilon +b\eta = c
$$

where $a$, $b$, and $c$ are some algebraic numbers and $\epsilon$ and $\eta$ are unknown units in the same field.

<a id="function-unitequation-fldnumelt-fldnumelt-fldnumelt"></a>
##### `UnitEquation(a, b, c): FldNumElt, FldNumElt, FldNumElt -> [ ModHomElt ]`

```magma
UnitEq: Verbose                    Default: 5
```

Return the sequence of $1 \times 2$ matrices ($e1$, $e2$) such that $ae_1 + be_2 = c$ for number field elements $a$, $b$, and $c$, where $e_1$ and $e_2$ are units in the maximal order. The algorithm uses Wildanger’s method ([[Wil97](https://docs.magma-maths.org/references.md#cite-wi2), [Wil00](https://docs.magma-maths.org/references.md#cite-wi3)]).

<a id="example-ex-5cb066"></a>
##### `Example: Solving a Unit Equation (ex-5cb066)`

Usage of `UnitEquation` is shown.

```magma
> R<x> := PolynomialRing(Integers());
> K<a> := NumberField(x^7 - x^6 + 8*x^5 + 2);
> UnitEquation(a^7, 4*a^2 + a^80, a^7 + a^80 + 4*a^2);
[
    [[1, 0, 0, 0, 0, 0, 0] [1, 0, 0, 0, 0, 0, 0]]
]
```

#### Index Form Equations

Given an absolute number field $K$ with some order $O$, index form equations are equations of the form $(O:Z[\alpha]) = k$ where $k$ is some positive integer.

In particular, if $k=1$ this function will find “all” integral power bases.

In this context “all” means up to equivalence, where two solutions $\alpha$ and $\beta$ are equivalent iff $\alpha = \pm \beta +r$ for some integer $r$.

If the field degree is larger than $4$, the field must be normal and an integral power basis must already be known.

The implementation follows [[Wil97](https://docs.magma-maths.org/references.md#cite-wi2), [Wil00](https://docs.magma-maths.org/references.md#cite-wi3)] for large degree equations, [[GPP93](https://docs.magma-maths.org/references.md#cite-gapepo1), [GPP96](https://docs.magma-maths.org/references.md#cite-gapepo2)] for quartics, and [[GS89](https://docs.magma-maths.org/references.md#cite-gasch)] for cubic fields.

<a id="function-indexformequation-rngord-rngintelt"></a>
##### `IndexFormEquation(O, k): RngOrd, RngIntElt -> [ RngOrdElt ]`

```magma
IndexFormEquation: Verbose                    Default: 5
```

Given an absolute order $O$, this function will find “all” (up to equivalence) solutions $\alpha\in O$ to $(O:Z[\alpha])=k$.

In the current implementation, the unit rank must be no more than 10.

<a id="example-ex-a3384f"></a>
##### `Example: Integral Power Bases via Index Forms (ex-a3384f)`

We try to compute all integral power bases of the field defined by a zero of $x^4 - 14x^3 + 14x^2 - 14x + 14$:

```magma
> x := PolynomialRing(Integers()).1;
> O := MaximalOrder(x^4-14*x^3+14*x^2-14*x+14);
> IndexFormEquation(O, 1);
[
    [0, 1, 0, 0]
    [0, 1, -13, 1],
    [0, 1, -1, 1],
]
> [ MinimalPolynomial(x) :x in $1 ];
[
    x^4 - 14*x^3 + 14*x^2 - 14*x + 14,
    x^4 - 28*x^3 + 56*x^2 + 3962*x - 28014,
    x^4 - 2044*x^3 + 6608*x^2 - 7126*x + 2562
]
> [ Discriminant(x) : x in $1 ] ;
[ -80240048, -80240048, -80240048 ]
> Discriminant(O);
-80240048
```

<a id="ideal"></a>
<a id="rngord-ideal"></a>
### Ideals and Quotients

Ideals of orders are of two types. All ideals are fractional and inherit from type `RngOrdFracIdl`. Integral ideals can have (the sub–)type `RngOrdIdl`. Some functions only apply to integral ideals and only ideals with the integral type can be prime. An ideal with fractional type but trivial denominator can be converted to have the integral type and any integral ideal can be converted to fractional type. Ideals can be taken of orders over ${\mathbb{Z}}$ and orders defined over a maximal order. A few functions are not implemented for the latter. Where an element or elements are returned from a function the elements are usually in the field of fractions if the ideal has the fractional type and in the order if it has integral type. Fractional ideals over ${\mathbb{Q}}$ are of type `RngIntFracIdl`, while integral ideals in ${\mathbb{Z}}$ have the type `RngInt`.

#### Creation of Ideals in Orders

The general ideal constructor can be used to create ideals in orders of algebraic fields, as described below. Since ideals in orders are allowed to be *fractional ideals*, algebraic field elements are allowed as generators. Ideals can also be created how they are written on paper: as an element multiplied by an order.

<a id="operation-op-times-rngelt-rngord"></a>
##### `x * O: RngElt, RngOrd -> RngOrdFracIdl`

<a id="operation-op-times-rngelt-rngord-2"></a>
##### `O * x: RngElt, RngOrd -> RngOrdFracIdl`

Create the ideal $x*O$ for element $x$ and order $O$. If the ideal is integral it will be returned with the integral type.

<a id="operation-op-rngord-rngint"></a>
##### `F !! I: RngOrd, RngInt -> RngOrdFracIdl`

<a id="operation-op-fldord-rngordfracidl"></a>
##### `F !! I: FldOrd, RngOrdFracIdl -> RngOrdFracIdl`

<a id="operation-op-fldrat-rngordfracidl"></a>
##### `F !! I: FldRat, RngOrdFracIdl -> RngIntFracIdl`

<a id="operation-op-fldrat-rngintfracidl"></a>
##### `F !! I: FldRat, RngIntFracIdl -> RngIntFracIdl`

<a id="operation-op-fldord-rngintfracidl"></a>
##### `F !! I: FldOrd, RngIntFracIdl -> RngOrdFracIdl`

<a id="operation-op-rngord-rngordfracidl"></a>
##### `O !! I: RngOrd, RngOrdFracIdl -> RngOrdIdl`

<a id="operation-op-rngint-rngint"></a>
##### `O !! I: RngInt, RngInt -> RngInt`

Make the ideal $I$ either fractional (first case where $F$ is a field of fractions compatible with the order of $I$) or integral (second case where $O$ is an order compatible with the order of $I$).

<a id="constructor-constructor-ideal-rngord-rngelt-rngelt-rngordfracidl"></a>
##### `ideal< O | a₁, a₂, ... , aₘ >: RngOrd, RngElt, ..., RngElt -> RngOrdFracIdl`

<a id="constructor-constructor-ideal-rngord-rngintelt-rngordidl"></a>
##### `ideal<O | x>: RngOrd, RngIntElt -> RngOrdIdl`

<a id="constructor-constructor-ideal-rngord-algmatelt-rngintelt-rngordfracidl"></a>
##### `ideal<O | M, d>: RngOrd, AlgMatElt, RngIntElt -> RngOrdFracIdl`

<a id="constructor-constructor-ideal-rngord-modded-rngintelt-rngordfracidl"></a>
##### `ideal<O | M, d>: RngOrd, ModDed, RngIntElt -> RngOrdFracIdl`

<a id="constructor-constructor-ideal-rngord-algmatelt-rngordfracidl-rngordfracidl-rngordfracidl"></a>
##### `ideal<O | M, I1, ..., In>: RngOrd, AlgMatElt, RngOrdFracIdl, ..., RngOrdFracIdl -> RngOrdFracIdl`

<a id="constructor-constructor-ideal-rngord-algmatelt-rngordfracidl-rngordfracidl"></a>
##### `ideal<O | M, [I1, ..., In]>: RngOrd, AlgMatElt, [RngOrdFracIdl] -> RngOrdFracIdl`

Given an order $O$, as well as anything that can be used to produce a sequence of elements of the field of fractions of $O$ return the ideal generated by those elements. If the ideal is integral then it will be returned with the integral type.

A single integer may be given in which case the principal ideal it generates will be returned. A matrix or a module over an order (`ModDed`) (or a matrix and ideals which the module could be created from) can be supplied as the basis for the resulting ideal. An optional second argument is a denominator given as an integer, (except when ideals are given).

<a id="example-ex-dc3704"></a>
##### `Example: Ideal Generated by an Element (ex-dc3704)`

We give an example of the creation of an ideal generated by an element from an order.

```magma
> R<x> := PolynomialRing(Integers());
> f := x^4-420*x^2+40000;
> K<y> := NumberField(f);
> E := EquationOrder(K);
> O := MaximalOrder(K);
> elt := O ! (y^2/40+y/4);
> elt in E;
false
> I := ideal< O | elt >;
> I;
Principal Ideal of O
Generator:
    [0, 1, 1, 0]
> FieldOfFractions(O)!!I;
Principal Ideal of O
Generator:
    O.2 + O.3
> O!!$1 eq I;
true
```

It is also possible to construct fractional ideals in ${\mathbb{Q}}$.

<a id="function-fractionalideal-fldratelt"></a>
##### `FractionalIdeal(x): FldRatElt -> RngIntFracIdl`

<a id="function-fractionalideal-rngintelt"></a>
##### `FractionalIdeal(x): RngIntElt -> RngIntFracIdl`

<a id="function-fractionalideal-fldratelt-2"></a>
##### `FractionalIdeal(x): [ FldRatElt ] -> RngIntFracIdl`

<a id="function-fractionalideal-rngintelt-2"></a>
##### `FractionalIdeal(x): [ RngIntElt ] -> RngIntFracIdl`

The fractional ideal generated by $x$.

<a id="function-fractionalideal-rngint"></a>
##### `FractionalIdeal(I): RngInt -> RngIntFracIdl`

Make $I$ into a fractional ideal.

#### Invariants

Some information describing an ideal can be retrieved.

<a id="function-order-rngordfracidl"></a>
##### `Order(I): RngOrdFracIdl -> RngOrd`

<a id="function-order-rngintfracidl"></a>
##### `Order(I): RngIntFracIdl -> RngInt`

The order $O$ which the ideal $I$ is of.

<a id="function-denominator-rngordfracidl"></a>
##### `Denominator(I): RngOrdFracIdl -> RngIntElt`

<a id="function-denominator-rngintfracidl"></a>
##### `Denominator(I): RngIntFracIdl -> RngIntElt`

The denominator of the fractional ideal $I$. This is the smallest positive integer $d$ such that $d I$ is an integral ideal.

<a id="function-primitiveelement-rngordidl"></a>
##### `PrimitiveElement(I): RngOrdIdl -> RngOrdElt`

<a id="function-primitiveelement-rngordfracidl"></a>
##### `PrimitiveElement(I): RngOrdFracIdl -> FldOrdElt`

<a id="function-uniformizingelement-rngordidl"></a>
##### `UniformizingElement(P): RngOrdIdl -> RngOrdElt`

<a id="function-uniformizingelement-rngint"></a>
##### `UniformizingElement(P): RngInt -> RngIntElt`

A primitive element of an ideal $I$ is an element $a$ which is in $I$ but not in the square of $I$. This function returns such an element $a$. `UniformizingElement` returns the primitive element of a prime ideal.

<a id="function-index-rngord-rngordidl"></a>
##### `Index(O, I): RngOrd, RngOrdIdl -> RngIntElt`

The index of the integral ideal $I$, when viewed as a submodule of the order $O$. This is the same as the cardinality of the finite quotient ring $O/I$.

<a id="function-norm-rngordidl"></a>
##### `Norm(I): RngOrdIdl -> RngIntElt`

<a id="function-norm-rngordfracidl"></a>
##### `Norm(I): RngOrdFracIdl -> FldRatElt`

<a id="function-norm-rngordfracidl-2"></a>
##### `Norm(I): RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-norm-rngintfracidl"></a>
##### `Norm(I): RngIntFracIdl -> RngIntElt`

The norm of the fractional ideal $I$. This returns the index of the ideal if the ideal is integral, and is defined on fractional ideals by multiplicativity so that the norm of $I^{-1}$ equals the reciprocal of the norm of $I$.

<a id="function-minimalinteger-rngordidl"></a>
##### `MinimalInteger(I): RngOrdIdl -> RngElt`

Given an ideal $I$ of an order in some number field, the function returns the least positive integer contained in the ideal.

<a id="function-minimum-rngordfracidl"></a>
##### `Minimum(I): RngOrdFracIdl -> RngElt`

<a id="function-min-rngordfracidl"></a>
##### `Min(I): RngOrdFracIdl -> RngElt`

Given an ideal $I$, this function returns the least positive integer $m$ if the ideal is integral or the least positive rational $r$ if is fractional contained in $I$.

<a id="function-absolutenorm-rngordidl"></a>
##### `AbsoluteNorm(I): RngOrdIdl -> RngIntElt`

<a id="function-absolutenorm-rngordfracidl"></a>
##### `AbsoluteNorm(I): RngOrdFracIdl -> FldRatElt`

<a id="function-normabs-rngordidl"></a>
##### `NormAbs(I): RngOrdIdl -> RngIntElt`

<a id="function-normabs-rngordfracidl"></a>
##### `NormAbs(I): RngOrdFracIdl -> FldRatElt`

The absolute norm of the fractional ideal $I$. This returns the index of the ideal if the ideal is integral, and is defined on fractional ideals by multiplicativity so that the norm of $I^{-1}$ equals the reciprocal of the norm of $I$.

<a id="function-coefficientheight-rngordidl"></a>
##### `CoefficientHeight(I): RngOrdIdl -> RngIntElt`

<a id="function-coefficientheight-rngordfracidl"></a>
##### `CoefficientHeight(I): RngOrdFracIdl -> RngIntElt`

For an ideal $I$ the coefficient height is defined to be the maximum integer occurring in the current representation of the ideal: If the ideal is given via two elements, this will be the maximal coefficient height of the generators, otherwise the maximal entry of the basis matrix.

<a id="function-coefficientlength-rngordidl"></a>
##### `CoefficientLength(I): RngOrdIdl -> RngIntElt`

<a id="function-coefficientlength-rngordfracidl"></a>
##### `CoefficientLength(I): RngOrdFracIdl -> RngIntElt`

For an ideal $I$ the coefficient length is defined to be the size of the current representation: If the ideal is given via two elements, this will be the sum of the coefficient lengths of the generators, otherwise the sum of the entries of the basis matrix.

<a id="function-ramificationindex-rngordidl-rngintelt"></a>
##### `RamificationIndex(I, p): RngOrdIdl, RngIntElt -> RngIntElt`

<a id="function-ramificationdegree-rngordidl-rngintelt"></a>
##### `RamificationDegree(I, p): RngOrdIdl, RngIntElt -> RngIntElt`

For a prime ideal $I$ of an order $O$ such that $p \in I$ returns the maximal exponent $e$ such that $I^e$ divides the principal ideal $pO$. If $p$ is not given it is taken to be the minimal integer of $I$.

<a id="function-ramificationdegree-rngordidl"></a>
##### `RamificationDegree(I): RngOrdIdl -> RngIntElt`

<a id="function-ramificationindex-rngordidl"></a>
##### `RamificationIndex(I): RngOrdIdl -> RngIntElt`

Computes the relative ramification index of the prime ideal $I$ over the coefficient ring. To be more precise: Let $I$ be a prime ideal of some order $O$ with coefficient ring $o$. Then $I \cap o$ is an prime ideal $p$ in $o$. The ramification index $e = e(I|p)$ is the maximal exponent $e$ such that $I^e$ divides $pO$.

<a id="function-absoluteramificationdegree-rngordidl"></a>
##### `AbsoluteRamificationDegree(I): RngOrdIdl -> RngIntElt`

<a id="function-absoluteramificationindex-rndordidl"></a>
##### `AbsoluteRamificationIndex(I): RndOrdIdl -> RngIntElt`

Return the ramification index of the prime ideal $I$ as an extension of the prime integer which is its minimum.

<a id="function-residueclassfield-rngord-rngordidl"></a>
##### `ResidueClassField(O, I): RngOrd, RngOrdIdl -> FldFin, Map`

<a id="function-residueclassfield-rngordidl"></a>
##### `ResidueClassField(I): RngOrdIdl -> FldFin, Map`

If $I$ is a prime ideal of $O$, this function returns the finite field $F$ isomorphic to $O/I$ and the map $O\rightarrow F$.

<a id="function-degree-rngordidl"></a>
##### `Degree(I): RngOrdIdl -> RngIntElt`

<a id="function-inertiadegree-rngordidl"></a>
##### `InertiaDegree(I): RngOrdIdl -> RngIntElt`

Given a prime ideal $I$ this function returns the relative degree $f$ of the residue class field of the ideal $I$. To be more precise: Let $I$ be a prime ideal in some order $O$ with coefficient ring $o$. Then $p := o \cap I$ is a prime ideal in $o$ and the residue class field $O/I$ is a finite extension of degree $f=f(I|p)$ of the residue class field $o/p$.

<a id="function-absoluteinertiadegree-rngordidl"></a>
##### `AbsoluteInertiaDegree(I): RngOrdIdl -> RngIntElt`

<a id="function-absoluteinertiaindex-rngordidl"></a>
##### `AbsoluteInertiaIndex(I): RngOrdIdl -> RngIntElt`

Return the inertia index of the prime ideal $I$ as an extension of the prime integer which is its minimum.

<a id="function-valuation-rngordfracidl-rngordidl"></a>
##### `Valuation(I, p): RngOrdFracIdl, RngOrdIdl -> RngIntElt`

<a id="function-valuation-rngintfracidl-rngint"></a>
##### `Valuation(I, p): RngIntFracIdl, RngInt -> RngIntElt`

Given an ideal $I$ and a prime ideal $p$ in an order $O$, returns the valuation $v_p(I)$ of $I$ at $p$, that is, the number of factors $p$ in the prime ideal decomposition of $I$. Note that, since the ideal $I$ is allowed to be a fractional ideal, the returned value may be a negative integer. If $p$ has been constructed using the Montes algorithm then this valuation computation will also use the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)].

<a id="function-content-rngordfracidl"></a>
##### `Content(I): RngOrdFracIdl -> RngIntElt`

The content of the ideal $I$, i.e. the maximal ideal of the base ring dividing $I$.

<a id="example-ex-f01e3a"></a>
##### `Example: Invariants of an Ideal (ex-f01e3a)`

The retrieval of some properties of an ideal is illustrated.

```magma
> R<x> := PolynomialRing(Integers());
> M := MaximalOrder(x^5 + 4*x^4 - x^3 + 7*x^2 - 1);
> R<x> := PolynomialRing(M);
> O := MaximalOrder(x^3 - 2);
> M;
Maximal Equation Order with defining polynomial x^5 + 4*x^4 - x^3 + 7*x^2 - 1
over Z
> O;
Maximal Order of Equation Order with defining polynomial x^3 - [2, 0, 0, 0, 0]
over M
> I := 19/43*M.4*O.3*O;
> I;
Fractional Principal Ideal of O
Generator:
    19/43*M.4*O.3
> Order(I);
Maximal Order of Equation Order with defining polynomial x^3 - [2, 0, 0, 0, 0]
over M
> Norm(Norm(I));
15545474078591793458176/3177070365797955661914307
> FactorizationOfQuotient($1);
[ <2, 10>, <19, 15>, <43, -15> ]
> Norm(Norm(O.3));
1024
> Norm(M.4);
1
> Denominator(I);
43
> Denominator(O.3);
1
> PrimitiveElement(I);
19/43*M.4*O.3
> Minimum(I);
19/43
> [ Norm(Norm(tuple[1])) : tuple in Factorization(I) ];
[ 2, 4, 4, 43, 43, 43, 6859, 3418801, 3418801, 3418801, 2213314919066161 ]
```

#### Basis Representation

The basis of an ideal can be computed as well as related matrices.

<a id="function-basis-rngordidl"></a>
##### `Basis(I): RngOrdIdl -> [RngOrdElt]`

<a id="function-basis-rngordfracidl"></a>
##### `Basis(I): RngOrdFracIdl -> [FldOrdElt]`

<a id="function-basis-rngintfracidl"></a>
##### `Basis(I): RngIntFracIdl -> [FldRatElt]`

<a id="function-basis-rngordfracidl-rng"></a>
##### `Basis(I, R): RngOrdFracIdl, Rng -> [RngElt]`

Given an ideal $I$ of an order $O$ of the algebraic field $F$, this function returns a basis for $I$ as a sequence of elements of $F$ (if fractional), $O$ (if integral) or the ring $R$ if given.

<a id="function-basismatrix-rngordfracidl"></a>
##### `BasisMatrix(I): RngOrdFracIdl -> MtrxSpcElt`

Returns the basis matrix for the ideal $I$ of the order $O$. The basis matrix consists of the elements of a basis for the ideal written as rows of rational coefficients with respect to the basis of $O$. The entries of the matrix are elements of ${\mathbb{Z}}$ for an integral ideal of an order over ${\mathbb{Z}}$ only or the field of fractions of the coefficient ring of $O$.

<a id="function-transformationmatrix-rngordfracidl"></a>
##### `TransformationMatrix(I): RngOrdFracIdl -> MtrxSpcElt, RngIntElt`

Returns the transformation matrix for the ideal $I$ of the order $O$, as well as a denominator. The transformation matrix consists of the elements of a basis for the ideal written as rows of coefficients with respect to the basis of the order $O$. The entries of the matrix are elements of ${\mathbb{Z}}$ for an integral ideal of an order over ${\mathbb{Z}}$ or the field of fractions of the coefficient ring of $O$.

<a id="function-coefficientideals-rngordfracidl"></a>
##### `CoefficientIdeals(I): RngOrdFracIdl -> [RngOrdFracIdl]`

The coefficient ideals of the ideal $I$ in a relative extension. These are the ideals $\{A_i\}$ of the coefficient ring of the order of $I$ such that for every element $e \in I$, $e = \sum_i a_i*b_i$ where $\{b_i\}$ is the basis returned for $I$ and each $a_i \in A_i$.

<a id="example-ex-49f139"></a>
##### `Example: Basis of an Ideal (ex-49f139)`

Continuing from the last example, the use of the basis functions for ideals is shown.

```magma
> Basis(I);
[
    19/43*M.4*O.3,
    19/86*M.4*O.1,
    19/43*M.4*O.2
]
> Basis(I, NumberField(O));
[
    19/86*$.1^3*$.1^2,
    19/86*$.1^3,
    19/86*$.1^3*$.1
]
> BasisMatrix(I);
[0 0 19/43*M.4]
[19/86*M.4 0 0]
[0 19/43*M.4 0]
> TransformationMatrix(I);
[M.1 0 0]
[0 M.1 0]
[0 0 M.1]
1
```

For relative extensions, a different method is available:

<a id="function-module-rngordfracidl"></a>
##### `Module(I): RngOrdFracIdl -> ModDed, Map`

For an ideal $I$ in some relative extension, return a Dedekind module over the coefficient ring with the “same” basis.

<a id="two-element-presentations"></a>
#### Two–Element Presentations

All ideals of maximal orders can be generated by one or two elements of the field of fractions of the order they are an ideal of.

<a id="function-generators-rngordidl"></a>
##### `Generators(I): RngOrdIdl -> [ RngOrdElt ]`

<a id="function-generators-rngordfracidl"></a>
##### `Generators(I): RngOrdFracIdl -> [ FldOrdElt ]`

<a id="function-generators-rngintfracidl"></a>
##### `Generators(I): RngIntFracIdl -> [ FldRatElt ]`

Given a (fractional) ideal $I$ of $O$, return a sequence containing two elements that generate $I$ as an ideal. The elements will be in the order iff the ideal is integral, otherwise they will come from the field of fractions of $O$.

<a id="function-twoelement-rngordfracidl"></a>
##### `TwoElement(I): RngOrdFracIdl -> FldOrdElt, FldOrdElt`

Given a (fractional) ideal $I$ of $O$, return two elements of (the field of fractions of) $O$ that generate $I$ as an ideal.

<a id="function-twoelementnormal-rngordidl"></a>
##### `TwoElementNormal(I): RngOrdIdl -> RngOrdElt, RngOrdElt, RngIntElt`

Given an integral ideal $I$ of $O$ (a maximal order over ${\mathbb{Z}}$), return two elements of $O$ that form a two-element normal presentation for $I$, as well as an integer $g$ such that $I$ is $g$-normal.

<a id="example-ex-4c86cb"></a>
##### `Example: Two-Element Presentation of an Ideal (ex-4c86cb)`

The generators and two element presentation of $I$ are compared.

```magma
> Generators(I);
[
    19/43*M.4*O.3
]
> TwoElement(I);
19/43*M.4*O.3
19/43*M.4*O.3
```

<a id="ideal-lmfdb"></a>
<a id="rngordidl-lmfdb"></a>
#### Standard Names

These utility functions implement a standard naming convention, which is used in the LMFDB ($L$-function database) and elsewhere. *Important:* the label of an ideal *depends* on the defining polynomial of the field (but not on any other choices).

<a id="function-lmfdblabel-rngordidl"></a>
##### `LMFDBLabel(I): RngOrdIdl -> MonStgElg`

The name of the ideal $I$ of a maximal order. This is a well-defined function of the ideal and the defining polynomial of the number field (which must be a simple extension of ${\mathbb{Q}}$).

<a id="function-lmfdbideal-fldnum-monstgelt"></a>
##### `LMFDBIdeal(K, s): FldNum, MonStgElt -> RngOrdIdl`

The ideal of ${\mathbb{Z}}_K$ that has the name $s$.

<a id="ideal-boolean"></a>
<a id="rngordidl-in"></a>
#### Predicates on Ideals

Ideals may be tested for various properties and whether given elements lie in the ideal.

<a id="operation-op-eq-rngordfracidl-rngordfracidl"></a>
##### `I eq J: RngOrdFracIdl, RngOrdFracIdl -> BoolElt`

<a id="operation-op-ne-rngordfracidl-rngordfracidl"></a>
##### `I ne J: RngOrdFracIdl, RngOrdFracIdl -> BoolElt`

<a id="operation-op-in-fldordelt-rngordfracidl"></a>
##### `x in I: FldOrdElt, RngOrdFracIdl -> BoolElt`

<a id="operation-op-in-rngordelt-rngordfracidl"></a>
##### `x in I: RngOrdElt, RngOrdFracIdl -> BoolElt`

<a id="operation-op-notin-fldordelt-rngordfracidl"></a>
##### `x notin I: FldOrdElt, RngOrdFracIdl -> BoolElt`

<a id="operation-op-notin-rngordelt-rngordfracidl"></a>
##### `x notin I: RngOrdElt, RngOrdFracIdl -> BoolElt`

<a id="operation-op-subset-rngordidl-rngordidl"></a>
##### `I subset J: RngOrdIdl, RngOrdIdl -> BoolElt`

<a id="function-isintegral-rngordfracidl"></a>
##### `IsIntegral(I): RngOrdFracIdl -> BoolElt`

<a id="function-isintegral-rngintfracidl"></a>
##### `IsIntegral(I): RngIntFracIdl -> BoolElt`

Returns `true` if and only if the fractional ideal $I$ is integral.

<a id="function-iszero-rngordfracidl"></a>
##### `IsZero(I): RngOrdFracIdl -> BoolElt`

Returns `true` if the ideal $I$ is the zero ideal, `false` otherwise.

<a id="function-isone-rngordidl"></a>
##### `IsOne(I): RngOrdIdl -> BoolElt`

<a id="function-isone-rngordfracidl"></a>
##### `IsOne(I): RngOrdFracIdl -> BoolElt`

<a id="function-isone-rngintfracidl"></a>
##### `IsOne(I): RngIntFracIdl -> BoolElt`

Returns `true` if the ideal $I$ is the ideal generated by $1$, `false` otherwise.

<a id="function-isprime-rngordidl"></a>
##### `IsPrime(I): RngOrdIdl -> BoolElt, RngOrdIdl`

<a id="function-isprime-rngordfracidl"></a>
##### `IsPrime(I): RngOrdFracIdl -> BoolElt`

Returns `true` if and only if the ideal $I$ is a prime ideal of `Order(I)`. If `Order(I)` is maximal and $I$ is a proper ideal of type `RngOrdIdl`, then in the case $I$ is not prime, the function also returns a proper divisor.

<a id="function-isprincipal-rngordfracidl"></a>
##### `IsPrincipal(I): RngOrdFracIdl -> BoolElt, FldOrdElt`

```magma
ClassGroup: Verbose                    Default: 5
```

Returns `true` if the fractional ideal $I$ of the order $O$ is a principal ideal, otherwise `false`. If $I$ is principal, a generator (as an element of the field of fractions of $O$) is also returned. If it is known or easy to decide whether $I$ is principal the function will return quickly. If it is necessary to compute the class group of $O$ the function will be slower. If the generator is required this may cause the function to take longer as well. If $I$ is an ideal of a non-maximal order the Unit group may be required also. Class group and unit group computations will be carried out to the most rigorous proof level, if this level of proof is not required then the [`UnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/unit-group.md#function-rngord-unitgroup) should be precomputed and [`ClassGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-rngord-classgroup) bounds set before calling `IsPrincipal`.

<a id="function-isramified-rngordidl"></a>
##### `IsRamified(P): RngOrdIdl -> BoolElt`

Returns `true` iff the ramification index of the prime ideal $P$ is greater than $1$.

<a id="function-isramified-rngordidl-rngord"></a>
##### `IsRamified(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-isramified-rngintelt-rngord"></a>
##### `IsRamified(P, O): RngIntElt, RngOrd -> BoolElt`

<a id="function-isramified-rngint-rngord"></a>
##### `IsRamified(P, O): RngInt, RngOrd -> BoolElt`

Returns `true` iff for any prime ideal $Q$ lying above $P$ in the order $O$, the ramification index of $Q$ is greater than $1$. $P$ must be a prime ideal of the base ring of $O$ or a prime number (if $O$ is an absolute order).

<a id="function-issquarefree-rngordidl"></a>
##### `IsSquarefree(I): RngOrdIdl -> BoolElt`

<a id="function-issquarefree-rngint"></a>
##### `IsSquarefree(I): RngInt -> BoolElt`

Returns `true` iff the ideal $I$ has no repeated factors.

<a id="function-istotallyramified-rngordidl"></a>
##### `IsTotallyRamified(P): RngOrdIdl -> BoolElt`

Returns `true` iff the ramification index of the prime ideal $P$ equals the degree of its order over the base field.

<a id="function-istotallyramified-rngordidl-rngord"></a>
##### `IsTotallyRamified(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-istotallyramified-rngintelt-rngord"></a>
##### `IsTotallyRamified(P, O): RngIntElt, RngOrd -> BoolElt`

Returns `true` iff for any prime ideal $Q$ lying above $P$ in the order $O$, the ramification index of $Q$ equals the field degree. $P$ must be a prime ideal of the base ring of $O$ or a prime number (if $O$ is an absolute order).

<a id="function-istotallyramified-fldalg"></a>
##### `IsTotallyRamified(K): FldAlg -> BoolElt`

Returns `true` if all primes dividing the discriminant the maximal order of the algebraic field $K$ are totally ramified over the coefficient field of $K$.

<a id="function-istotallyramified-rngord"></a>
##### `IsTotallyRamified(O): RngOrd -> BoolElt`

Returns `true` if all primes dividing the discriminant of the maximal order $O$ are totally ramified over the coefficient ring of $O$.

<a id="function-iswildlyramified-rngordidl"></a>
##### `IsWildlyRamified(P): RngOrdIdl -> BoolElt`

Returns `true` iff the ramification index of the prime ideal $P$ is a multiple of the characteristic of the residue class field of $P$.

<a id="function-iswildlyramified-rngordidl-rngord"></a>
##### `IsWildlyRamified(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-iswildlyramified-rngintelt-rngord"></a>
##### `IsWildlyRamified(P, O): RngIntElt, RngOrd -> BoolElt`

Returns `true` iff for any prime ideal $Q$ of the order $O$ lying above $P$, the ramification index $e(Q|P)$ is a multiple of the characteristic of the residue class field of $Q$. $P$ must be a prime ideal of the base ring of $O$ or a prime number (if $O$ is an absolute order).

<a id="function-istamelyramified-rngordidl"></a>
##### `IsTamelyRamified(P): RngOrdIdl -> BoolElt`

Returns `true` iff the prime ideal $P$ is not wildly ramified.

<a id="function-istamelyramified-rngordidl-rngord"></a>
##### `IsTamelyRamified(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-istamelyramified-rngintelt-rngord"></a>
##### `IsTamelyRamified(P, O): RngIntElt, RngOrd -> BoolElt`

Returns `true` iff the prime ideal or integer $P$ is not wildly ramified in the order $O$.

<a id="function-isunramified-rngordidl"></a>
##### `IsUnramified(P): RngOrdIdl -> BoolElt`

Returns `true` iff the ramification index of the prime ideal $P$ is $1$.

<a id="function-isunramified-rngordidl-rngord"></a>
##### `IsUnramified(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-isunramified-rngintelt-rngord"></a>
##### `IsUnramified(P, O): RngIntElt, RngOrd -> BoolElt`

Returns `true` iff for all prime ideals $Q$ lying above $P$ in the order $O$, the ramification index of $Q$ is $1$. $P$ must be a prime ideal of the base ring of $O$ or a prime number (if $O$ is an absolute order).

<a id="function-isinert-rngordidl"></a>
##### `IsInert(P): RngOrdIdl -> BoolElt`

Returns `true` iff the inertia degree of the prime ideal $P$ is the field degree.

<a id="function-isinert-rngordidl-rngord"></a>
##### `IsInert(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-isinert-rngintelt-rngord"></a>
##### `IsInert(P, O): RngIntElt, RngOrd -> BoolElt`

<a id="function-isinert-rngint-rngord"></a>
##### `IsInert(P, O): RngInt, RngOrd -> BoolElt`

Returns `true` iff the prime integer or ideal $P$ in the base ring of the order $O$ is inert, i.e. $PO$ is an unramified prime ideal of $O$.

<a id="function-issplit-rngordidl"></a>
##### `IsSplit(P): RngOrdIdl -> BoolElt`

Returns `true` iff the prime ideal $P$ is not the only prime ideal which lies above its intersection with the base ring of its order.

<a id="function-issplit-rngordidl-rngord"></a>
##### `IsSplit(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-issplit-rngintelt-rngord"></a>
##### `IsSplit(P, O): RngIntElt, RngOrd -> BoolElt`

<a id="function-issplit-rngint-rngord"></a>
##### `IsSplit(P, O): RngInt, RngOrd -> BoolElt`

Returns `true` iff at least two prime ideals in the order $O$ lie above the prime integer or ideal $P$ of the base ring of $O$.

<a id="function-istotallysplit-rngordidl"></a>
##### `IsTotallySplit(P): RngOrdIdl -> BoolElt`

Returns `true` iff there are as many prime ideals lying above the intersection of the prime ideal $P$ with the base ring of its order as the degree of the order of $P$.

<a id="function-istotallysplit-rngordidl-rngord"></a>
##### `IsTotallySplit(P, O): RngOrdIdl, RngOrd -> BoolElt`

<a id="function-istotallysplit-rngintelt-rngord"></a>
##### `IsTotallySplit(P, O): RngIntElt, RngOrd -> BoolElt`

<a id="function-istotallysplit-rngint-rngord"></a>
##### `IsTotallySplit(P, O): RngInt, RngOrd -> BoolElt`

Returns `true` iff as many prime ideals in the order $O$ lying above the prime integer or ideal $P$ of the base ring of $O$ as the degree of $O$.

<a id="rngordidl-arith"></a>
<a id="id2"></a>
#### Ideal Arithmetic

Ideals can be multiplied in several ways, divided, and added. Powers of ideals, the least common multiple, and the intersection of two ideals can also be calculated.

<a id="operation-op-times-rngordfracidl-rngordfracidl"></a>
##### `I * J: RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="operation-op-times-rngintfracidl-rngordfracidl"></a>
##### `I * J: RngIntFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="operation-op-times-rngintfracidl-rngintfracidl"></a>
##### `I * J: RngIntFracIdl, RngIntFracIdl -> RngIntFracIdl`

The product $IJ$ of the (fractional) ideals $I$ and $J$, generated by the products of elements in $I$ and elements in $J$.

<a id="operation-op-times-rngelt-rngordfracidl"></a>
##### `x * I: RngElt, RngOrdFracIdl -> RngOrdFracIdl`

<a id="operation-op-times-fldratelt-rngintfracidl"></a>
##### `x * I: FldRatElt, RngIntFracIdl -> RngIntFracIdl`

<a id="operation-op-times-rngintelt-rngintfracidl"></a>
##### `x * I: RngIntElt, RngIntFracIdl -> RngIntFracIdl`

<a id="operation-op-times-rngordfracidl-rngelt"></a>
##### `I * x: RngOrdFracIdl, RngElt -> RngOrdFracIdl`

Given an element $x$ of (or coercible into) a field of fractions $F$, and a (fractional) ideal $I$ in the order of $F$, return the product of the ideal and the principal ideal generated by $x$.

<a id="operation-operation-rngordfracidl-rngordfracidl"></a>
##### `&* L: [RngOrdFracIdl] -> RngOrdFracIdl`

<a id="operation-operation-rngordfracidl-rngordfracidl-2"></a>
##### `&* L: { RngOrdFracIdl } -> RngOrdFracIdl`

The product of all ideals in the sequence or set $L$.

<a id="operation-operation-div-rngordidl-rngordidl-rngordidl"></a>
##### `I div J: RngOrdIdl, RngOrdIdl -> RngOrdIdl`

<a id="operation-operation-div-rngordfracidl-rngordfracidl-rngordidl"></a>
##### `I div J: RngOrdFracIdl, RngOrdFracIdl -> RngOrdIdl`

<a id="operation-operation-div-rngint-rngint-rngint"></a>
##### `I div J: RngInt, RngInt -> RngInt`

For ideals $I$ and $J$ of some maximal order such that $J$ divides $I$ (or equivalently that $J$ is contained in $I$), return the integral ideal $K$ such that $JK=I$.

<a id="operation-op-div-rngordfracidl-rngordfracidl"></a>
##### `I / J: RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

The quotient of the (fractional) ideals $I$ and $J$ of a maximal order $O$. This is the fractional ideal $K$ of $O$ with the property that $JK=I$.

There are some considerations to be made here. Firstly, the “$I/J$” notation is interpreted as above, and not (say) as an ideal of the quotient $O/J$ (see also the example with ${\bf Z}$ as a number field order in Section [Ideals of ${\mathbb{Z}}$](https://docs.magma-maths.org/BasicRings/ResidueClassRings/integer-ideals.md#rngintres-ideal-division) and [${\mathbb{Z}}$ as a Number Field Order](https://docs.magma-maths.org/BasicRings/ResidueClassRings/number-field-like.md#rngintres-zasnford)). Secondly, since $I/J$ is only defined (in Magma) for *maximal* orders, this is the same (in Magma) as the `ColonIdeal` (or `IdealQuotient`) as noted below. Thirdly, $I/J$ and `I div J` are not synonyms, as $I/J$ will work even when $J$ does not divide $I$, while `I div J` will give an error in that case.

<a id="operation-op-div-rngordfracidl-rngelt"></a>
##### `I / x: RngOrdFracIdl, RngElt -> RngOrdFracIdl`

Given an ideal $I$ and an element $x$ construct the fractional ideal $I / x$.

<a id="operation-op-plus-rngordfracidl-rngordfracidl"></a>
##### `I + J: RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="operation-op-plus-rngintfracidl-rngintfracidl"></a>
##### `I + J: RngIntFracIdl, RngIntFracIdl -> RngIntFracIdl`

<a id="operation-op-plus-rngintfracidl-rngint"></a>
##### `I + J: RngIntFracIdl, RngInt -> RngIntFracIdl`

The sum of the (fractional) ideals $I$ and $J$, generated by the sums of elements in $I$ and elements in $J$.

<a id="operation-op-pow-rngordfracidl-rngintelt"></a>
##### `I ^ k: RngOrdFracIdl, RngIntElt -> RngOrdFracIdl`

<a id="operation-op-pow-rngintfracidl-rngintelt"></a>
##### `I ^ k: RngIntFracIdl, RngIntElt -> RngIntFracIdl`

The $k$-th power of the (fractional) ideal $I$ (for an integer $k$). If $I$ has integral type and $k$ is negative the result will have fractional type.

<a id="operation-op-eq-rngordfracidl-rngordfracidl-2"></a>
##### `I eq J: RngOrdFracIdl, RngOrdFracIdl -> BoolElt`

<a id="operation-op-eq-rngintfracidl-rngintfracidl"></a>
##### `I eq J: RngIntFracIdl, RngIntFracIdl -> BoolElt`

<a id="operation-op-eq-rngintfracidl-rngint"></a>
##### `I eq J: RngIntFracIdl, RngInt -> BoolElt`

Tests if the ideals $I$ and $J$ are equal.

<a id="operation-op-subset-rngordidl-rngordidl-2"></a>
##### `I subset J: RngOrdIdl, RngOrdIdl -> BoolElt`

Tests if the two ideals $I$ and $J$ of the same order are contained in each other. For invertible ideals this is equivalent to checking if $J$ divides $I$,

<a id="operation-op-in-rngordelt-rngordidl"></a>
##### `E in I: RngOrdElt, RngOrdIdl -> BoolElt`

<a id="operation-op-in-rngordelt-rngordfracidl-2"></a>
##### `E in I: RngOrdElt, RngOrdFracIdl -> BoolElt`

<a id="operation-op-in-fldalgelt-rngordfracidl"></a>
##### `E in I: FldAlgElt, RngOrdFracIdl -> BoolElt`

Tests if the element $E$ is actually in the ideal $I$. The element and the ideal have to be compatible, i.e., live in the same number field.

<a id="function-lcm-rngordfracidl-rngordfracidl"></a>
##### `LCM(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-lcm-rngordfracidl-rngordfracidl-2"></a>
##### `Lcm(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-leastcommonmultiple-rngordfracidl-rngordfracidl"></a>
##### `LeastCommonMultiple(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

Return the least common multiple of ideals $I$ and $J$. They must both be of the same maximal order.

<a id="function-gcd-rngordfracidl-rngordfracidl"></a>
##### `GCD(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-gcd-rngordfracidl-rngordfracidl-2"></a>
##### `Gcd(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-greatestcommondivisor-rngordfracidl-rngordfracidl"></a>
##### `GreatestCommonDivisor(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

The greatest common divisor of the ideals $I$ and $J$ of some maximal order of an algebraic number field.

<a id="function-content-mtrx"></a>
##### `Content(M): Mtrx -> RngOrdFracIdl`

For a matrix $M$ with entries in some number field $k$, compute the gcd of all elements as principal ideals in the maximal order of $k$.

<a id="operation-op-meet-rngordfracidl-rngordfracidl"></a>
##### `I meet J: RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

The intersection of the (fractional) ideals $I$ and $J$. For ideal in the maximal order this is the same as the ${\operatorname{lcm}}$.

<a id="operation-operation-meet-rngordfracidl-rngordfracidl"></a>
##### `&meet S: [RngOrdFracIdl] -> RngOrdFracIdl`

<a id="operation-operation-meet-rngordfracidl-rngordfracidl-2"></a>
##### `&meet S: { RngOrdFracIdl } -> RngOrdFracIdl`

The intersection of all ideals $I$ of the sequence or set $S$. For ideals in some maximal order this is the same as the ${\operatorname{lcm}}$.

<a id="operation-op-meet-rngordfracidl-rng"></a>
##### `I meet R: RngOrdFracIdl, Rng -> Any`

<a id="operation-op-meet-rng-rngordfracidl"></a>
##### `R meet I: Rng, RngOrdFracIdl -> Any`

The intersection of the ideal $I$ with the compatible ring $R$. If $R = {\mathbb{Q}}$ an error will occur since ideals of ${\mathbb{Q}}$ cannot be created. If such information is required use `Minimum` instead. An ideal of $R$ is returned.

<a id="operation-operation-mod-rngordelt-rngordidl-rngordelt"></a>
##### `a mod I: RngOrdElt, RngOrdIdl -> RngOrdElt`

A representative of the element $a$ of an order $O$ in the quotient $O/I$.

<a id="function-inversemod-rngordelt-rngintelt"></a>
##### `InverseMod(E, M): RngOrdElt, RngIntElt -> RngOrdElt`

<a id="function-inversemod-rngordelt-rngordidl"></a>
##### `InverseMod(E, M): RngOrdElt, RngOrdIdl -> RngOrdElt`

<a id="function-modinv-rngordelt-rngordidl"></a>
##### `Modinv(E, M): RngOrdElt, RngOrdIdl -> RngOrdElt`

<a id="function-modinv-rngordelt-rngintelt"></a>
##### `Modinv(E, M): RngOrdElt, RngIntElt -> RngOrdElt`

An element $y$ such that $y*E = 1$ mod $M$ where $M$ is an integral ideal or an integer and $E$ is an element of an order.

<a id="function-colonideal-rngordfracidl-rngordfracidl"></a>
##### `ColonIdeal(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-idealquotient-rngordfracidl-rngordfracidl"></a>
##### `IdealQuotient(I, J): RngOrdFracIdl, RngOrdFracIdl -> RngOrdFracIdl`

In Magma, the colon ideal (or ideal quotient) $[I:J]$ for two fractional ideals $I,J$ is defined as the fractional ideal $(I:J)=\{ x\in {\rm Frac}(O) : x J \subseteq I\}$, where $O$ is the order to which $I$ and $J$ belong. In this definition we have $x\in {\rm Frac}(O)$ rather than $x\in O$, and so this differs from `ColonIdeal` for other structures, where the result would be an ideal rather than a fractional ideal.

For ideals of a maximal order (or in general for *invertible* ideals) the `ColonIdeal` is equivalent to $I/J$ (see above), otherwise only $J(I:J)\subset I$ holds. Below is an example of the latter.

Currently `ColonIdeal` and `IdealQuotient` do not exist for `RngInt` types, so there is a slight incompatibility for **Z** as a number field order (see §[${\mathbb{Z}}$ as a Number Field Order](https://docs.magma-maths.org/BasicRings/ResidueClassRings/number-field-like.md#rngintres-zasnford)).

<a id="example-ex-9af5d2"></a>
##### `Example: Colon Ideal of a Noninvertible Ideal (ex-9af5d2)`

```magma
> O := EquationOrder(Polynomial([4,0,1]));
> z := O.2; // z^2 = -4
> I := ideal<O|1>; // O as an ideal
> J := ideal<O|[2,z]>; // noninvertible ideal
> ColonIdeal(I,J)*J eq I;
false
```

<a id="function-integralsplit-rngordfracidl"></a>
##### `IntegralSplit(I): RngOrdFracIdl -> RngOrdIdl, RngElt`

Given an ideal $I$, return an integral ideal $J$ and a minimal positive integer $d$ such that $I = J/d$.

<a id="function-different-rngordfracidl"></a>
##### `Different(I): RngOrdFracIdl -> RngOrdFracIdl`

The different of the (possibly fractional) ideal $I$ of an order of an algebraic number field.

<a id="function-codifferent-rngordfracidl"></a>
##### `Codifferent(I): RngOrdFracIdl -> RngOrdFracIdl`

The codifferent of the ideal $I$. This will be the inverse of the different of $I$ if I is an ideal of a maximal order.

#### Roots of Ideals

It is possible to ask for the $k$-th root of an ideal where $k$ is a positive integer.

<a id="function-root-rngordfracidl-rngintelt"></a>
##### `Root(I, k): RngOrdFracIdl, RngIntElt -> RngOrdFracIdl`

Find the $k$th root of the ideal $I$ if it exists.

<a id="function-ispower-rngordfracidl-rngintelt"></a>
##### `IsPower(I, k): RngOrdFracIdl, RngIntElt -> BoolElt, RngOrdFracIdl`

Return `true` if the ideal $I$ is a $k$th power of an ideal and the ideal it is a power of otherwise `false`.

<a id="function-squareroot-rngordfracidl"></a>
##### `SquareRoot(I): RngOrdFracIdl -> RngOrdFracIdl`

<a id="function-sqrt-rngordfracidl"></a>
##### `Sqrt(I): RngOrdFracIdl -> RngOrdFracIdl`

Return the square root of the ideal $I$ if $I$ is square.

<a id="function-issquare-rngordfracidl"></a>
##### `IsSquare(I): RngOrdFracIdl -> BoolElt, RngOrdFracIdl`

Return `true` if the ideal $I$ is the square of an ideal and the ideal it is a square of otherwise `false`.

<a id="factorization"></a>
<a id="rngord-fact-prime"></a>
#### Factorization and Primes

The factorization of an ideal into prime ideals and the divisors of an ideal can be determined.

<a id="function-decomposition-rngord-rngintelt"></a>
##### `Decomposition(O, p): RngOrd, RngIntElt -> [<RngOrdIdl, RngIntElt>]`

```magma
Al: MonStgElt                    Default: 
```

<a id="function-decomposition-rngord-rngordidl"></a>
##### `Decomposition(O, p): RngOrd, RngOrdIdl -> [ <RngOrdIdl, RngIntElt> ]`

```magma
IdealDecompose: Verbose                    Default: 5
```

Given an order $O$ and a rational prime number $p$ or a prime ideal $p$ of the coefficient ring of $O$, return a sequence of tuples consisting of prime ideals and exponents, according to the decomposition of $p$ in $O$. The parameter `Al` can be set to `"Montes"` when $O$ is an extension of ${\mathbb{Z}}$ by a single monic integral polynomial and $p$ is an integer, in which case the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used to compute the decomposition.

<a id="function-decompositiontype-rngord-rngintelt"></a>
##### `DecompositionType(O, p): RngOrd, RngIntElt -> [<RngIntElt, RngIntElt>]`

<a id="function-decompositiontype-fldalg-rngintelt"></a>
##### `DecompositionType(O, p): FldAlg, RngIntElt -> [<RngIntElt, RngIntElt>]`

<a id="function-decompositiontype-fldalg-rngordidl"></a>
##### `DecompositionType(O, p): FldAlg, RngOrdIdl -> [<RngIntElt, RngIntElt>]`

<a id="function-decompositiontype-rngord-rngordidl"></a>
##### `DecompositionType(O, p): RngOrd, RngOrdIdl -> [ <RngIntElt, RngIntElt> ]`

```magma
IdealDecompose: Verbose                    Default: 5
```

Given an order $O$ and a rational prime number $p$ or a prime ideal $p$ of the coefficient ring of $O$, return the decomposition type, ie. a sequence of tuples consisting of the degree of the prime ideals and their ramification index, according to the decomposition of $p$ in $O$.

<a id="function-factorization-rngordfracidl"></a>
##### `Factorization(I): RngOrdFracIdl -> [<RngOrdIdl, RngIntElt>]`

<a id="function-factorisation-rngordfracidl"></a>
##### `Factorisation(I): RngOrdFracIdl -> [<RngOrdIdl, RngIntElt>]`

<a id="function-factorization-rngintfracidl"></a>
##### `Factorization(I): RngIntFracIdl -> [<RngInt, RngIntElt>]`

<a id="function-factorisation-rngintfracidl"></a>
##### `Factorisation(I): RngIntFracIdl -> [<RngInt, RngIntElt>]`

```magma
IdealDecompose: Verbose                    Default: 5
```

Returns the prime ideal factorization of an ideal $I$ in a maximal order $O$, as a sequence of 2-tuples (prime ideal and integer exponent).

<a id="example-ex-4f7652"></a>
##### `Example: Factorization in a Non-Maximal Order (ex-4f7652)`

We provide an example of `Factorization`. An ideal in an order which is not maximal can only be decomposed into primary ideals. We illustrate how to compute some prime “factors” of an ideal of an order which is not maximal.

```magma
> R<x>:=PolynomialRing(Integers());
> f:=x^3+4*x+15;
> K<y>:=NumberField(f);
> E:=EquationOrder(K);
> O:=MaximalOrder(K);
> c:=4*y^2+6*y+4;
> I:=c*O;
> Factorisation(I);
[
    <Prime Ideal of E
    Two element generators:
        [2, 0, 0]
        [1, 1, 0], 1>,
    <Prime Ideal of E
    Two element generators:
        [2, 0, 0]
        [3, 1, 1], 1>,
    <Prime Ideal of E
    Two element generators:
        [3, 0, 0]
        [1, 0, 1], 1>,
    <Prime Ideal of E
    Two element generators:
        [151, 0, 0]
        [262, 1, 0], 1>
]
> J := c*E;
> Factorisation(J);
>>     Factorisation(J);
                    ^
Runtime error in 'Factorisation': Order associated with ideal argument 1 is not
known to be maximal
> E2 := Decomposition(E, 2);
> E2;
[
    <Prime Ideal of E
    Two element generators:
        [2, 0, 0]
        [1, 1, 0], 1>,
    <Prime Ideal of E
    Two element generators:
        [2, 0, 0]
        [3, 1, 1], 1>
]
> Valuation(J, E2[1][1]);
1
> Valuation(J, E2[2][1]);
1
> J := ColonIdeal(J, E2[1][1]); J;
Ideal of E
Basis:
[  1   3 403]
[  0   6 702]
[  0   0 906]
> J := ColonIdeal(E!!J, E2[2][1]); J;
Ideal of E
Basis:
[  1   0  52]
[  0   3 351]
[  0   0 453]
> E3 := Decomposition(E, 3);
> E3;
[
    <Prime Ideal of E
    Two element generators:
        [3, 0, 0]
        [0, 1, 0], 1>,
    <Prime Ideal of E
    Two element generators:
        [3, 0, 0]
        [1, 0, 1], 1>
]
> Valuation(J, E3[1][1]);
0
> Valuation(J, E3[2][1]);
1
> J := ColonIdeal(E!!J, E3[2][1]); J;
Ideal of E
Basis:
[  1   0  52]
[  0   1 117]
[  0   0 151]
> E151 := Decomposition(E, 151);
> E151;
[
    <Prime Ideal of E
    Two element generators:
        [151, 0, 0]
        [18, 1, 0], 1>,
    <Prime Ideal of E
    Two element generators:
        [151, 0, 0]
        [22, 1, 0], 1>,
    <Prime Ideal of E
    Two element generators:
        [151, 0, 0]
        [262, 1, 0], 1>
]
> Valuation(J, E151[1][1]);
0
> Valuation(J, E151[2][1]);
0
> Valuation(J, E151[3][1]);
1
> J := ColonIdeal(E!!J, E151[3][1]); J;
Ideal of E
Basis:
[1 0 0]
[0 1 0]
[0 0 1]
```

It will not always be the case that an ideal of a non maximal order will be able to be factorized into powers of prime ideals, although in this example it is the case.

<a id="function-divisors-rngordidl"></a>
##### `Divisors(I): RngOrdIdl -> [<RngOrdIdl, RngIntElt>]`

Return the ideals which divide the ideal $I$ which must be of a maximal order.

<a id="function-support-rngordfracidl"></a>
##### `Support(I): RngOrdFracIdl -> {RngOrdIdl}`

<a id="function-support-rngintfracidl"></a>
##### `Support(I): RngIntFracIdl -> {RngInt}`

For a non-zero ideal $I$ of some maximal order, return the set of prime ideals $p$ dividing $I$.

<a id="function-support-rngordfracidl-2"></a>
##### `Support(L): [RngOrdFracIdl] -> {RngOrdIdl}`

<a id="function-support-fldalgelt"></a>
##### `Support(L): [FldAlgElt] -> {RngOrdIdl}`

```magma
GaloisStable: BoolElt                    Default: false
CoprimeOnly : BoolElt                    Default: false
UseBernstein: BoolElt                    Default: false
```

For a sequence $L$ of ideals in some maximal order (or of number field elements representing principal ideals), return the set of prime ideals dividing at least one of the ideals. If `CoprimeOnly` is given, the set returned will not in general be containing prime ideals, but will satisfy the following:

- Every ideal in $L$ can be uniquely decomposed into a power product of ideals in the set returned
- The set is minimal and closed under gcd, ie. for two elements in the set, their gcd will be one.

If the number field is normal and if `GaloisStable` is given, then the set returned will be closed under the action of the galois group. Depending on the (unknown) factorisation pattern of the ideals, taking the Galois action into account will in general refine the coprime factorisation.

In general, this function will first construct a coprime basis, and the factorise the result of this step.

If `UseBernstein` is given, then Dan Berstein’s asymptoically fast algorithm ([[Ber05](https://docs.magma-maths.org/references.md#cite-bernstein2005)], which runs in time essentially linear in $\#L$) is used.

<a id="function-coprimebasis-rngordfracidl"></a>
##### `CoprimeBasis(L): [RngOrdFracIdl] -> RngOrdIdl`

```magma
GaloisStable: BoolElt                    Default: false
UseBernstein: BoolElt                    Default: false
```

Given a sequence $L$ of ideals in some maximal order, a coprime basis $C$ for $L$ is constructed. That means

\- every element in $L$ has a unique representation as a power product with elements in $C$

\- $C$ is closed under gcd, the ideals in $C$ are pairwise coprime.

If the field is normal and if `GaloisStable` is given, the input sequence is supplemented by the action of the automorphism group, thus potentially refining the coprime basis.

If `UseBernstein` is given then instead of the naive algorithm with quadratic complexity in $\#L$, an asymptotically fast, almost linear algorithm by Dan Berstein is used, [[Ber05](https://docs.magma-maths.org/references.md#cite-bernstein2005)].

<a id="procedure-coprimebasisinsert-rngordidl-rngordfracidl-ref"></a>
##### `CoprimeBasisInsert(~L, I): [RngOrdIdl], RngOrdFracIdl`

```magma
GaloisStable: BoolElt                    Default: false
UseBernstein: BoolElt                    Default: false
```

Given a coprime basis in the sequence $L$, enlarge it by the ideal $I$, ie. enlarge $L$ in such a way that $L$ stays a coprime basis but allows the decomposition of $I$ as well. If the ideals are in a normal field and if `GaloisStable` is given, then in addition of $I$ all its Galois conjugates are inserted as well. Furthermore, a fractional ideal is always decomposed into the numerator and denominator ideal, ach of which is inserted independently.

If `UseBernstein` is given then instead of the naive algorithm with quadratic complexity in $\#L$, an asymptotically fast, almost linear algorithm by Dan Berstein is used, [[Ber05](https://docs.magma-maths.org/references.md#cite-bernstein2005)].

<a id="function-powerproduct-rngordfracidl-rngintelt"></a>
##### `PowerProduct(B, E): [RngOrdFracIdl], [RngIntElt] -> RngOrdFracIdl`

Given sequences $B$ of ideals of some maximal order and $E$ of integers, compute the ideal $\prod B[i]^{E[i]}$.

#### Other Ideal Operations

Various other functions can be applied to ideals. In addition to those listed, the completion of an order at a prime ideal can also be taken (see [`Completion`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-completion1) and Chapter [$p$-Adic Rings and Their Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/index-padic-rings-and-their-extensions.md#rngloc)).

<a id="function-chineseremaindertheorem-rngordidl-rngordidl-rngordelt-rngordelt"></a>
##### `ChineseRemainderTheorem(I1, I2, e1, e2): RngOrdIdl, RngOrdIdl, RngOrdElt, RngOrdElt -> RngOrdElt`

<a id="function-chineseremaindertheorem-seqenum-rngordelt-seqenum-rngordidl"></a>
##### `ChineseRemainderTheorem(X, M): SeqEnum[RngOrdElt], SeqEnum[RngOrdIdl] -> RngOrdElt`

<a id="function-crt-rngordidl-rngordidl-rngordelt-rngordelt"></a>
##### `CRT(I1, I2, e1, e2): RngOrdIdl, RngOrdIdl, RngOrdElt, RngOrdElt -> RngOrdElt`

<a id="function-crt-seqenum-rngordelt-seqenum-rngordidl"></a>
##### `CRT(X, M): SeqEnum[RngOrdElt], SeqEnum[RngOrdIdl] -> RngOrdElt`

Returns an element $e$ of the order $O$ such that $(e_1 - e)$ is in the ideal $I_1$ of $O$ and $(e_2 - e)$ is in the ideal $I_2$. If a sequence of elements $X$ and a sequence of ideals $M$ is given then the element $e$ will be such that $(X[i] - e)$ is in $M[i]$ for all $i$.

<a id="function-rngord-chineseremaindertheoreminf"></a>
##### `CRT(I1, L1, e1, L2): RngOrdIdl, [RngIntElt], RngOrdElt, [RngIntElt] -> RngOrdElt`

<a id="function-chineseremaindertheorem-rngordidl-rngintelt-rngordelt-rngintelt"></a>
##### `ChineseRemainderTheorem(I1, L1, e1, L2): RngOrdIdl, [RngIntElt], RngOrdElt, [RngIntElt] -> RngOrdElt`

Returns an element $e$ of the order $O$ such that $(e_1 - e)$ is in the ideal $I_1$ of $O$ and the signs of the conjugates listed in $L1$ are the same as in $L2$.

$L1$, a sorted sequence of integers $0<l_i<= r1$, is meant to be formal product of infinite places. The signs of the $l_i$’th conjugate of $e$ will be the same as the sign of $L2[i]$.

<a id="function-weakapproximation-rngordidl-rngintelt"></a>
##### `WeakApproximation(I, V): [RngOrdIdl], [RngIntElt] -> FldOrdElt`

<a id="function-weakapproximation-rngint-rngintelt"></a>
##### `WeakApproximation(I, V): [RngInt], [RngIntElt] -> FldRatElt`

Compute an element in the field of fractions of the order of the ideals in $I$ which has valuation $V[i]$ at the prime ideal $I[i]$.

<a id="function-idempotents-rngordidl-rngordidl"></a>
##### `Idempotents(I, J): RngOrdIdl, RngOrdIdl -> BoolElt, RngOrdElt, RngOrdElt`

For coprime integral ideals $I$ and $J$ return `true` and elements $i\in I$ and $j\in J$ such that $i+j=1$.

<a id="function-coprimerepresentative-rngordidl-rngordidl"></a>
##### `CoprimeRepresentative(I, J): RngOrdIdl, RngOrdIdl -> FldOrdElt`

<a id="function-makecoprime-rngordidl-rngordidl"></a>
##### `MakeCoprime(I, J): RngOrdIdl, RngOrdIdl -> FldOrdElt`

Given two integral ideals $I$ and $J$ in the same maximal order, find an element $q$ in the field of fractions of this order such that $qI$ is coprime to $J$.

<a id="function-idealsupto-rngintelt-rngord"></a>
##### `IdealsUpTo(B, O): RngIntElt, RngOrd -> [RngOrdIdl]`

<a id="function-idealsupto-rngintelt-fldnum"></a>
##### `IdealsUpTo(B, K): RngIntElt, FldNum -> [RngOrdIdl]`

```magma
CoprimeTo: RngOrdIdl                    Default: 
```

Given a number field $K$ or a maximal order $O$, returns a sequence containing the ideals of $O$ or the maximal order of $K$ with norm at most $B$ which are coprime to any ideals given in `CoprimeTo`.

<a id="function-classrepresentative-rngordfracidl"></a>
##### `ClassRepresentative(I): RngOrdFracIdl -> RngOrdFracIdl`

Let $I$ be an ideal in the absolute maximal order $O$ of the number field $K$. Further, assume that the class group of $O$ has been computed. The class group calculation will have chosen a set of ideal class representatives. This function returns the representative ideal for the ideal class to which $I$ belongs.

<a id="function-sunitgroup-rngordfracidl"></a>
##### `SUnitGroup(I): RngOrdFracIdl -> GrpAb, Map`

<a id="function-rngord-sunitgroup"></a>
##### `SUnitGroup(S): [ RngOrdIdl ] -> GrpAb, Map`

```magma
Raw       : BoolElt                    Default: false
ClassGroup: Verbose                    Default: 5
```

This function computes the group of $S$-units for the set $S$ of prime ideals, where $S$ may be input as a sequence or as an ideal (in which case $S$ is the set of primes appearing in its factorization). An element $mu$ is an $S$-unit iff $v_p(mu) = 0$ for all primes $p$ not in $S$.

The function returns (by default) an abstract abelian group $A$, and a map from $A$ to the field.

When `Raw` is `true`, the $S$-units are represented as power-products rather than as ordinary elements. A fixed sequence $L$ of field elements is given, and each unit is specified as a vector of integers $e$ (of the same length as $L$) such that the unit equals $\prod L_i^{e_i}$. Three values are returned in the `Raw` case: an abstract abelian group $A$, a map from $A$ to exponent vectors, and the sequence $L$.

<a id="example-ex-062dcc"></a>
##### `Example: S-Units of a Real Quadratic Field (ex-062dcc)`

First we compute the $3$-units of ${\mathbb{Q}}(\sqrt 10)$.

```magma
> K := QuadraticField(10);
> M := MaximalOrder(K);
> U, mU := SUnitGroup(3*M);
> U;
Abelian Group isomorphic to Z/2 + Z + Z + Z
Defined on 4 generators
Relations:
    2*U.1 = 0
> mU;
Mapping from: GrpAb: U to Field of Fractions of M
> u := mU(U.3); u;
7/1*M.1 - 2/1*M.2
> Decomposition(u);
[
  <Prime Ideal of M
    Two element generators:
      3
      $.2 + 1, 2>
]
```

So $u$ is indeed a $3$ unit, as the factorization contains only prime ideals over $3$. Next we do the same computation but using the `Raw` option:

```magma
> U, mU, base := SUnitGroup(3*M:Raw);
> mU;
Mapping from: GrpAb: U to Full RSpace of degree 14 over Integer Ring
> mU(U.3);
( 0  2  1  0  0  0  0  0  0  0 -2)
> PowerProduct(base, $1);
7/1*M.1 - 2/1*M.2
> base[2]^2 * base[3]^1 * base[11]^-2;
7/1*M.1 - 2/1*M.2
```

This representation is of particular importance for large degree fields or fields with large units. To illustrate this, consider the following field from the pari-mailing list:

```magma
> K := NumberField(Polynomial([ 13824, -3894, -1723, 5, 1291, 1 ]));
> L := LLL(MaximalOrder(K));
> C, mC := ClassGroup(L : Proof:="GRH");
> U, mU, base := SUnitGroup(1*L:Raw);
> logs := Matrix([Logs(x) : x in Eltseq(base)]);
> mU(U.3)*logs;
(2815256.998090806477937318458440358713392011019115562
    -636746.05251910981832558348350489744160309616673457
    -770882.44652629342064307574571528191509290934280166)
```

As the logarithm of the absolute value of the real embeddings is of the order $10^6$, we expect that a basis representation will have coefficients requiring roughly $10^6$ digits. While it is feasible to compute them (using `PowerProduct`), this will take a long time.

<a id="function-sunitaction-map-map-seqenum-rngordidl"></a>
##### `SUnitAction(SU, Act, S): Map, Map, SeqEnum[RngOrdIdl] -> Map`

```magma
Base: SeqEnum[RngOrdElt]                    Default: []
```

Given a description of the $S$-unit group as computed by [`SUnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-sunitgroup) and a (multiplicative) map of the underlying number field, this function computes the induced map on the abstract abelian group.

The argument $S$ should be a sequence of ideals as in `SUnitGroup`. The argument $SU$ should either be the map returned by [`SUnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-sunitgroup)`(S)` as second return value - in which case `Base` is trivial (and not specified) or the second return value of [`SUnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-sunitgroup)`(S:Raw)` in which case `Base` should equal the third computed value.

The argument $Act$ must be any (multiplicative) function of the underlying number field or any order, that acts on the $S$-unit group.

On return, a endomorphism of the domain of $SU$ is obtained.

<a id="function-sunitaction-map-seqenum-map-seqenum-rngordidl"></a>
##### `SUnitAction(SU, Act, S): Map, SeqEnum[Map], SeqEnum[RngOrdIdl] -> [Map]`

```magma
Base: SeqEnum[RngOrdElt]                    Default: []
```

Given a description of the $S$-unit group as computed by `SUnitGroup` and a sequence of (multiplicative) maps of the underlying number field, this function computes the induced maps on the abstract abelian group.

The argument $S$ should be a sequence of ideals as in `SUnitGroup`. The argument $SU$ should either be the map returned by `SUnitGroup(S)` as second return value - in which case `Base` is trivial (and not specified) or the second return value of `SUnitGroup(S:Raw)` in which case `Base` should equal the third computed value.

The argument $Act$ must be a sequence of (multiplicative) functions of the underlying number field or any order, that acts on the $S$-unit group.

On return, a sequence of endomorphisms of the domain of $SU$ is obtained.

<a id="function-sunitdisclog-map-fldalgelt-seqenum-rngordidl"></a>
##### `SUnitDiscLog(SU, x, S): Map, FldAlgElt, SeqEnum[RngOrdIdl] -> GrpAbElt`

<a id="function-sunitdisclog-map-seqenum-fldalgelt-seqenum-rngordidl"></a>
##### `SUnitDiscLog(SU, L, S): Map, SeqEnum[FldAlgElt], SeqEnum[RngOrdIdl] -> GrpAbElt`

```magma
Base: SeqEnum[RngOrdElt]                    Default: []
```

Given a description of the $S$-unit group as computed by `SUnitGroup` and a (multiplicative) map of the underlying number field, this function computes the induced map on the abstract abelian group.

The argument $S$ should be a sequence of ideals as in `SUnitGroup`. The argument $SU$ should either be the map returned by `SUnitGroup(S)` as second return value - in which case `Base` is trivial (and not specified) or the second return value of `SUnitGroup(S:Raw)` in which case `Base` should equal the third computed value.

This function solves the discrete logarithm problem for the $S$-unit group and the algebraic number $x$. That is, an element in the abstract abelian group representing the $S$-unit group is computed which corresponds to $x$. If a list of algebraic numbers $L$ is passed into this function, the discrete logarithm is computed for each of them.

<a id="example-ex-95d956"></a>
##### `Example: Galois Action on S-Units (ex-95d956)`

```magma
> M := MaximalOrder(Polynomial([ 25, 0, -30, 0, 1 ]));
> S := [ x[1] : x in Factorisation(30*M)];
> U, mU := SUnitGroup(S);
> L := Automorphisms(NumberField(M));
> s2 := SUnitAction(mU, L[2], S);
> s2;
Mapping from: GrpAb: U to GrpAb: U
> L[2](mU(U.2)) eq mU(s2(U.2));
```

Now the same in `Raw` representation:

```magma
> R, mR, Base := SUnitGroup(S:Raw);
> S2 := SUnitAction(mR, L[2], S:Base := Base);
> [S2(R.i) : i in [1..Ngens(R)]];
[
    R.1,
    R.1 - R.2,
    R.3,
    R.1 + R.3 - R.4,
    R.1 + R.5,
    R.1 + R.3 + R.7,
    R.1 - R.3 + R.6,
    R.8
]
```

If we combine `SUnitAction` with `SUnitDiscLog` we can solve norm equations:

```magma
> N := map<FieldOfFractions(M) -> M | x:-> L[1](x) * L[2](x)>;
> NR := SUnitAction(mR, N, S:Base := Base);
```

Now `NR` is the norm function with respect to the field fixed by `L[2]`.

```magma
> SUnitDiscLog(mR, FieldOfFractions(M)!5, S:Base := Base);
2*R.5
> $1 in Image(NR);
true
> $2 @@ NR;
R.2 + R.5
> PowerProduct(Base, mR($1));
-3/1*M.1 - 2/1*M.2 + M.4
> N($1);
[5, 0, 0, 0]
```

#### Quotient Rings

Quotients of orders defined over maximal orders and their integral ideals can be formed resulting in an object with type `RngOrdRes`. Elements of such orders can be created and elementary arithmetic and predicates may be applied to them.

##### Operations on Quotient Rings

The creation of quotient rings and the functions which may be applied to them are described.

<a id="constructor-constructor-quo-rngord-rngordidl-rngordres"></a>
###### `quo< O | I >: RngOrd, RngOrdIdl -> RngOrdRes`

<a id="constructor-constructor-quo-rngord-modded-rngordres"></a>
###### `quo< O | M >: RngOrd, ModDed -> RngOrdRes`

<a id="constructor-constructor-quo-rngord-algmatelt-rngordres"></a>
###### `quo< O | M >: RngOrd, AlgMatElt -> RngOrdRes`

<a id="constructor-constructor-quo-rngord-rngelt-rngelt-rngordres"></a>
###### `quo< O | S >: RngOrd, RngElt, ..., RngElt -> RngOrdRes`

Creates the quotient ring $Q=O/I$ of the order $O$. The right hand side of the constructor may contain an ideal or anything that the ideal constructor can create an ideal from.

<a id="constructor-constructor-quo-rngord-rngintelt-rngordres"></a>
###### `quo< O | m >: RngOrd, RngIntElt -> RngOrdRes`

Construct the quotient ring $Q=O/m$ where $m$ is a prime power.

<a id="function-unitgroup-rngordres"></a>
###### `UnitGroup(OQ): RngOrdRes -> GrpAb, Map`

<a id="function-multiplicativegroup-rngordres"></a>
###### `MultiplicativeGroup(OQ): RngOrdRes -> GrpAb, Map`

Returns an abelian group and the map from the group into $OQ$, a quotient of an absolute maximal order.

<a id="function-modulus-rngordres"></a>
###### `Modulus(OQ): RngOrdRes -> RngOrdIdl`

Return the denominator of the quotient ring $OQ$, i.e. $I$ where $OQ = O/I$.

<a id="example-ex-d59aa1"></a>
###### `Example: Quotient Rings of an Order (ex-d59aa1)`

Creation of quotient rings is shown. The orders are the same as for the ideal examples, however an integral ideal is now required.

```magma
> I := Denominator(I)*I;
> I;
Principal Ideal of O
Generator:
    38/1*M.4*O.3
> Basis(I);
[
    38/1*M.4*O.3,
    19/1*M.4*O.1,
    38/1*M.4*O.2
]
> Q := quo<Order(I) | I>;
> Q;
Quotient Ring of Principal Ideal of O
Generator:
    [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 38, 0]]
> Modulus(Q);
Principal Ideal of O
Generator:
    [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 38, 0]]
```

##### Elements of Quotients

Functions for elements of the quotient rings are predominantly arithmetic. Elements of quotient rings can be looped through using `for x in OQ do ... end for`.

<a id="operation-op-rngordres-elt"></a>
###### `OQ ! a: RngOrdRes, Elt -> RngOrdResElt`

Coerce the element $a$ into the quotient $OQ$ where $a$ is anything that can be coerced into the order $OQ$ is a quotient of.

<a id="function-random-rngordres"></a>
###### `Random(OQ): RngOrdRes -> RngOrdResElt`

A random element of the quotient ring $OQ$.

<a id="operation-operation-mod-rngordelt-rngordidl-rngordelt-2"></a>
###### `a mod I: RngOrdElt, RngOrdIdl -> RngOrdElt`

A canonical representative of the element $a$ (belonging to an order $O$) in the quotient ring $O/I$.

<a id="operation-op-times-rngordreselt-rngordreselt"></a>
###### `a * b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="operation-op-plus-rngordreselt-rngordreselt"></a>
###### `a + b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="operation-op-minus-rngordreselt-rngordreselt"></a>
###### `a - b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="operation-op-div-rngordreselt-rngordreselt"></a>
###### `a / b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="operation-operation-rngordreselt-rngordreselt"></a>
###### `- a: RngOrdResElt -> RngOrdResElt`

<a id="operation-op-pow-rngordreselt-rngintelt"></a>
###### `a ^ n: RngOrdResElt, RngIntElt -> RngOrdResElt`

<a id="operation-op-eq-rngordreselt-rngordreselt"></a>
###### `a eq b: RngOrdResElt, RngOrdResElt -> BoolElt`

<a id="operation-op-ne-rngordreselt-rngordreselt"></a>
###### `a ne b: RngOrdResElt, RngOrdResElt -> BoolElt`

<a id="operation-operation-div-rngordreselt-rngordreselt-rngordreselt"></a>
###### `a div b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="operation-operation-mod-rngordreselt-rngordreselt-rngordreselt"></a>
###### `a mod b: RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="function-quotrem-rngordreselt-rngordreselt"></a>
###### `Quotrem(a, b): RngOrdResElt, RngOrdResElt -> RngOrdResElt, RngOrdResElt`

<a id="function-lcm-rngordreselt-rngordreselt"></a>
###### `Lcm(a, b): RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="function-gcd-rngordreselt-rngordreselt"></a>
###### `Gcd(a, b): RngOrdResElt, RngOrdResElt -> RngOrdResElt`

<a id="function-xgcd-rngordreselt-rngordreselt"></a>
###### `XGcd(a, b): RngOrdResElt, RngOrdResElt -> RngOrdResElt, RngOrdResElt, RngOrdResElt`

<a id="function-iszero-rngordreselt"></a>
###### `IsZero(a): RngOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the zero element of the quotient ring $OQ$.

<a id="function-isone-rngordreselt"></a>
###### `IsOne(a): RngOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the one element of the quotient ring $OQ$.

<a id="function-isminusone-rngordreselt"></a>
###### `IsMinusOne(a): RngOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the minus one element of the quotient ring $OQ$.

<a id="function-isunit-rngordreselt"></a>
###### `IsUnit(a): RngOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ has an inverse in the quotient ring $OQ$.

<a id="function-eltseq-rngordreselt"></a>
###### `Eltseq(a): RngOrdResElt -> []`

<a id="function-elementtosequence-rngordreselt"></a>
###### `ElementToSequence(a): RngOrdResElt -> []`

The coefficients of the quotient ring element $a$ in the field of fractions of the coefficient ring of the order of the quotient ring containing $a$.

<a id="function-euclideannorm-rngordreselt"></a>
###### `EuclideanNorm(a): RngOrdResElt -> RngIntElt`

Return the Euclidean norm of the element $a$ of a quotient ring $OQ$, where the Euclidean norm is the function that makes $OQ$ into a Euclidean ring.

<a id="function-annihilator-rngordreselt"></a>
###### `Annihilator(a): RngOrdResElt -> RngOrdResElt`

The annihilator of the element $a$ in the quotient ring $OQ$.

##### Reconstruction

Given an element $e$ in some order $O$, known modulo some ideal $I$, a common problem in several algorithms is to recover $e$, ie. a unique minimal element $f\in O$ such that $e-f\in I$ and $f$ is as “small” as possible. An equally common variation would be to ask for some field element $f/d$ with $d$ an integer, such that $f-de \in I$ and $f$ as well as $d$ are small.

In the case of $O$ being the ring of integers and $I$ a power of a prime (ideal), this is usually done by moving to the symmetric residue system in the first case and by rational reconstruction in the second. Here, we use techniques based on the LLL algorithm as described in [[FF](https://docs.magma-maths.org/references.md#cite-fifi2000)].

Since the method is more complicated than in the case of the integer ring, one first has to create a “reconstruction environment” of type `RngOrdRecoEnv`, which is subsequently used to reconstruct any number of elements.

<a id="function-reconstructionenvironment-rngordidl-rngintelt"></a>
###### `ReconstructionEnvironment(p, k): RngOrdIdl, RngIntElt -> RngOrdRecoEnv`

<a id="function-reconstructionenvironment-rngintelt-rngintelt"></a>
###### `ReconstructionEnvironment(p, k): RngIntElt, RngIntElt -> RngOrdRecoEnv`

Given a (prime) ideal $p$ and an exponent $k$, initialize the reconstruction process for the ideal $I=p^k$, that is, the object returned can be used to reconstruct elements from “approximations” modulo $p^k$.

<a id="function-reconstruct-rngordelt-rngordrecoenv"></a>
###### `Reconstruct(x, R): RngOrdElt, RngOrdRecoEnv -> RngOrdElt`

<a id="function-reconstruct-rngintelt-rngordrecoenv"></a>
###### `Reconstruct(x, R): RngIntElt, RngOrdRecoEnv -> RngIntElt`

```magma
UseDenominator: BoolElt                    Default: false
```

Given an order element $e$, thought to be an approximation modulo $p^k$ where $p$ and $k$ are stored in the reconstruction environment $R$, return the unique minimal $f$ in the same order such that $e-g\in p^k$. Is `UseDenominator` is `true`, then a field element is computed, otherwise a ring element will be found.

<a id="procedure-changeprecision-rngordrecoenv-rngintelt-ref"></a>
###### `ChangePrecision(~R, k): RngOrdRecoEnv, RngIntElt`

Change the ideal $I=p^l$ stored in $R$ to $p^k$.

<a id="example-ex-c0c980"></a>
###### `Example: Roots via Order Reconstruction (ex-c0c980)`

We illustrate the use of the reconstruction environment to find roots of some polynomial over a number field. We will first compute the roots over some completion, up to some precision, then “list” the elements back from the completion into the starting order and finally use reconstruction to get the roots.

```magma
> f := Polynomial([1,1,1,1,1]);
> M := MaximalOrder(f);
> P := Decomposition(M, 11)[1][1]; P;
Prime Ideal of M
Two element generators:
    [11, 0, 0, 0]
    [2, 1, 0, 0]
> C, mC := Completion(M, P:Precision :=  10);
> fC := Polynomial([c@ mC : c in Eltseq(f)]);
> rt := Roots(fC); rt;
> R := ReconstructionEnvironment(P, 10);
> [Reconstruct((x[1]) @@ mC, R) : x in rt];
[
    M.4,
    M.3,
    -M.1 - M.2 - M.3 - M.4,
    M.2
]
> [ Evaluate(f, x) : x in $1];
[
    0,
    0,
    0,
    0
 ]
```

### Places and Divisors

A place of a number field $K$ is a class of absolute values (valuations) that induce the same topology on the field. By a famous theorem of Ostrowski, places of number fields are either finite, in which case they are in a one-to-one correspondence with the on-zero prime ideals of the maximal order, or infinite. The infinite places are identified with the embedding of $K$ into ${\mathbb{R}}$ or with pairs of embeddings into ${\mathbb{C}}$.

The group of divisors is formally the free group generated by the finite places and the ${\mathbb{R}}$-vectorspace generated by the infinite ones.

For more information see Section [Places and Divisors](https://docs.magma-maths.org/GlobalFields/NumberFields/divisors.md#fldnum-plcnum).

#### Creation of Structures

<a id="function-places-fldnum"></a>
##### `Places(K): FldNum -> PlcNum`

<a id="function-divisorgroup-fldnum"></a>
##### `DivisorGroup(K): FldNum -> DivNum`

The set of places of the number field $K$ and the group of divisors of $K$ respectively.

#### Operations on Structures

<a id="operation-op-eq-divnum-divnum"></a>
##### `d1 eq d2: DivNum, DivNum -> BoolElt`

<a id="operation-op-eq-plcnum-plcnum"></a>
##### `p1 eq p2: PlcNum, PlcNum -> BoolElt`

<a id="function-numberfield-plcnum"></a>
##### `NumberField(P): PlcNum -> FldNum`

<a id="function-numberfield-divnum"></a>
##### `NumberField(D): DivNum -> FldNum`

The number field for which $P$ is the set of places or $D$ is the group of divisors.

<a id="div-create-e"></a>
<a id="rngord-divisors"></a>
#### Creation of Elements

<a id="function-place-rngordidl"></a>
##### `Place(I): RngOrdIdl -> PlcNumElt`

The place corresponding to prime ideal $I$.

<a id="function-decomposition-fldalg-infty"></a>
##### `Decomposition(K, I): FldAlg, Infty -> SeqEnum`

<a id="function-decomposition-fldalg-rngintelt"></a>
##### `Decomposition(K, p): FldAlg, RngIntElt -> SeqEnum`

```magma
Al: MonStgElt                    Default: 
```

A sequence of tuples of places and multiplicities. When a finite prime (integer) $p$ is given, the places and multiplicities correspond to the decomposition of $p$ in the maximal order of $K$. When the infinite prime is given, a sequence of all infinite places is returned. When $K$ is an extension of ${\mathbb{Q}}$ by a single monic integral polynomial and $p$ is an integer, `Al` can be set to `"Montes"` to use the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] for this computation.

<a id="function-decomposition-fldnum-plcnumelt"></a>
##### `Decomposition(K, p): FldNum, PlcNumElt -> SeqEnum`

For a number field $K$ and a place $p$ of the coefficient field of $K$, compute all places (and their multiplicity) that extend $p$. For finite places this is equivalent to the decomposition of the underlying prime ideal. The sequence returned will contain the places of $K$ extending $p$ and their ramification index.

For an infinite place $p$, this function will compute all extensions of $p$ in $K$. In this case, the integer returned in the second component of the tuples will be 1 if $p$ is complex or if $p$ is real and extends to a real place and $2$ otherwise.

<a id="function-decomposition-map-fldrat-fldalg-rngintelt"></a>
##### `Decomposition(m, p): Map[FldRat, FldAlg], RngIntElt -> SeqEnum[<PlcNumElt, RngIntElt>]`

<a id="function-decomposition-map-fldalg-fldalg-plcnumelt"></a>
##### `Decomposition(m, p): Map[FldAlg, FldAlg], PlcNumElt -> SeqEnum[<PlcNumElt, RngIntElt>]`

For an extension $K/k$ of number fields (where $k$ can be $Q$ as well), given by the embedding map $m: k \to K$, decompose the place $p$ of $k$ in the larger field. In case $k=Q$, the place is given as either a prime number or zero to indicate the infinite place. The sequence returned contains pairs where the first component is a place above $p$ via $m$ and the second is the ramification index.

<a id="function-infiniteplaces-fldalg-2"></a>
##### `InfinitePlaces(K): FldAlg -> [PlcNumElt]`

<a id="function-infiniteplaces-rngord-2"></a>
##### `InfinitePlaces(O): RngOrd -> [PlcNumElt]`

A sequence containing all the infinite places of the number field $K$ or the order $O$ is returned.

<a id="function-realplaces-fldalg"></a>
##### `RealPlaces(K): FldAlg -> [PlcNumElt]`

The sequence of infinite places of $K$ which correspond to real embeddings.

<a id="function-divisor-plcnumelt"></a>
##### `Divisor(pl): PlcNumElt -> DivNumElt`

The divisor $1*pl$ for a place $pl$.

<a id="function-divisor-rngordfracidl"></a>
##### `Divisor(I): RngOrdFracIdl -> DivNumElt`

The divisor which is the linear combination of the places corresponding to the factorization of the ideal $I$ and the exponents of that factorization.

<a id="function-divisor-fldnumelt"></a>
##### `Divisor(x): FldNumElt -> DivNumElt`

The principal divisor $xO$ where $O$ is the maximal order of the underlying number field of which $x$ is an element. In particular, this computes a finite divisor.

#### Arithmetic with Places and Divisors

Divisors and places can be added, negated, subtracted and multiplied and divided by integers.

<a id="operation-op-plus-divnumelt-divnumelt"></a>
##### `d1 + d2: DivNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-plus-plcnumelt-divnumelt"></a>
##### `p + d: PlcNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-plus-divnumelt-plcnumelt"></a>
##### `d + p: DivNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-plus-plcnumelt-plcnumelt"></a>
##### `p1 + p2: PlcNumElt, PlcNumElt -> DivNumElt`

<a id="operation-operation-plcnumelt-divnumelt"></a>
##### `- p: PlcNumElt -> DivNumElt`

<a id="operation-operation-divnumelt-divnumelt"></a>
##### `- d: DivNumElt -> DivNumElt`

<a id="operation-op-minus-divnumelt-plcnumelt"></a>
##### `d - p: DivNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-minus-plcnumelt-divnumelt"></a>
##### `p - d: PlcNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-minus-divnumelt-divnumelt"></a>
##### `d1 - d2: DivNumElt, DivNumElt -> DivNumElt`

<a id="operation-op-minus-plcnumelt-plcnumelt"></a>
##### `p1 - p2: PlcNumElt, PlcNumElt -> DivNumElt`

<a id="operation-op-times-plcnumelt-rngintelt"></a>
##### `p * k: PlcNumElt, RngIntElt -> DivNumElt`

<a id="operation-op-times-divnumelt-rngintelt"></a>
##### `d * k: DivNumElt, RngIntElt -> DivNumElt`

<a id="operation-operation-div-plcnumelt-rngintelt-divnumelt"></a>
##### `p div k: PlcNumElt, RngIntElt -> DivNumElt`

<a id="operation-operation-div-divnumelt-rngintelt-divnumelt"></a>
##### `d div k: DivNumElt, RngIntElt -> DivNumElt`

#### Other Functions for Places and Divisors

<a id="function-valuation-fldnumelt-plcnumelt"></a>
##### `Valuation(a, p): FldNumElt, PlcNumElt -> RngElt`

<a id="function-valuation-rngelt-plcnumelt"></a>
##### `Valuation(a, p): RngElt, PlcNumElt -> RngElt`

The valuation of the element $a$ of a number field or order at the place $p$. If $p$ was constructed using the Montes algorithm then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will also be used to compute the valuation.

<a id="function-valuation-rngordfracidl-plcnumelt"></a>
##### `Valuation(I, p): RngOrdFracIdl, PlcNumElt -> RngElt`

The valuation of the ideal $I$ at the finite place $p$.

<a id="function-support-divnumelt"></a>
##### `Support(D): DivNumElt -> SeqEnum, SeqEnum`

The support of the divisor $D$ as a sequence of places and a sequence of the corresponding exponents.

<a id="function-ideal-divnumelt"></a>
##### `Ideal(D): DivNumElt -> RngOrdIdl`

<a id="function-ideal-plcnumelt"></a>
##### `Ideal(D): PlcNumElt -> RngOrdIdl`

The ideal corresponding to the finite part of the divisor $D$.

<a id="function-isfinite-plcnumelt"></a>
##### `IsFinite(p): PlcNumElt -> BoolElt`

For a place $p$ of a number field, return if the place is finite, i.e. if it corresponds to a prime ideal.

<a id="function-isinfinite-plcnumelt"></a>
##### `IsInfinite(p): PlcNumElt -> BoolElt, RngIntElt`

For a place $p$ of a number field return if the place is infinite, ie. if it corresponds to an embedding of the number field into the real or complex numbers. If the place is infinite, the index of the embedding it corresponds to is returned as well.

<a id="function-isreal-plcnumelt"></a>
##### `IsReal(p): PlcNumElt -> BoolElt`

For an infinite place, returns `true` if the image of the embedding is contained in the real numbers.

<a id="function-iscomplex-plcnumelt"></a>
##### `IsComplex(p): PlcNumElt -> BoolElt`

For an infinite place, return `true` if the image of the embedding is not contained in the real numbers.

<a id="function-extends-plcnumelt-plcnumelt"></a>
##### `Extends(P, p): PlcNumElt, PlcNumElt -> BoolElt`

For two places $P$ of $K$ and $p$ of $k$ where $K$ is an extension of $k$, check whether $P$ extends $p$. For finite places, this is equivalent to checking if the prime ideal corresponding to $P$ divides, in the maximal order of $K$ the prime ideal of $p$. For infinite places `true` implies that for elements of $k$, evaluation at $P$ and $p$ will give identical results.

<a id="function-inertiadegree-plcnumelt"></a>
##### `InertiaDegree(P): PlcNumElt -> RngIntElt`

<a id="function-degree-plcnumelt"></a>
##### `Degree(P): PlcNumElt -> RngIntElt`

For a place $P$ of a number field, return the inertia degree of $P$. That is for a finite place, return the degree of the residue class field over it’s prime field, for infinite places it is always $1$.

<a id="function-degree-divnumelt"></a>
##### `Degree(D): DivNumElt -> RngElt`

For a divisor $D$ of a number field, the degree is the weighted sum of the degrees of the supporting places, the weights being the multiplicities.

<a id="function-numberfield-plcnumelt"></a>
##### `NumberField(P): PlcNumElt -> FldNum`

<a id="function-numberfield-divnumelt"></a>
##### `NumberField(D): DivNumElt -> FldNum`

For a place $P$ or divisor $D$ of a number field, return the underlying number field.

<a id="function-residueclassfield-plcnumelt"></a>
##### `ResidueClassField(P): PlcNumElt -> Fld`

For a place $P$ of a number field, compute the residue class field of $P$. For a finite place this will be a finite field, namely the residue class field of the underlying prime ideal. For an infinite place, the residue class field will be the field of real or complex numbers.

<a id="function-uniformizingelement-plcnumelt"></a>
##### `UniformizingElement(P): PlcNumElt -> FldNumElt`

For a finite place $P$ of a number field, return an element of valuation $1$. This will be the uniformizing element of the underlying prime ideal as well.

<a id="function-localdegree-plcnumelt"></a>
##### `LocalDegree(P): PlcNumElt -> RngIntElt`

The degree of the completion at the place $P$, ie. the product of the inertia degree times the ramification index.

<a id="function-ramificationindex-plcnumelt"></a>
##### `RamificationIndex(P): PlcNumElt -> RngIntElt`

The ramification index of the place $P$. For infinite real places this is $1$ and $2$ for complex places.

<a id="function-decompositiongroup-plcnumelt"></a>
##### `DecompositionGroup(P): PlcNumElt -> GrpPerm`

For a place $P$ of a normal number field, return the decomposition group as a subgroup of the (abstract) automorphism group.

<a id="montes"></a>
<a id="montes-fld-num"></a>
### The Montes Algorithm

The Montes algorithm can be considered as a factorization algorithm for polynomials over local fields. For a defining polynomial $f$ of a number field $K$ and a prime number $p$ the Montes algorithm produces OM representations for all prime ideals of $K$ lying of over $p$, which parametrize the irreducible factors of $f$ over the $p$-adic numbers. The OM representation for prime ideals leads to an OM presentation of fractional ideals. The basic algorithms are explained in [[GMN13](https://docs.magma-maths.org/references.md#cite-montes-new-approach)] These OM representations allow the construction of ideals and divisors without the computation of a maximal order, which the construction of ideals of types `RngOrdIdl` and `RngOrdFracIdl` require. The Montes algorithm can also be used to efficiently compute integral bases which can be use to construct maximal orders.

This section explains the use of the Montes Algorithm. For how to use the Montes algorithm to compute maximal orders of number fields see Section [Maximal Orders](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/creation.md#rngord-max-ord), maximal orders of function fields see Section [Construction of Orders of Algebraic Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#fldfung-max-ord), decomposition of primes in number fields see Sections [Factorization and Primes](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#rngord-fact-prime) and  [Creation of Elements](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/divisors.md#rngord-divisors) and decomposition of primes in function fields see Sections [Further Ideal Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#fldfung-ideal-ops) and [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#fldfung-places).

<a id="function-montes-rngupolelt-rngelt"></a>
#### `Montes(f, p): RngUPolElt, RngElt -> SeqEnum, SeqEnum, RngIntElt`

```magma
Field: BoolElt                    Default: false
```

Let $f$ be a monic polynomial with integer or polynomial coefficients and $p$ be a prime number. The Montes algorithm outputs the triple:

1. A sequence of OM representations for the $p$-adic irreducible factors of $f$.
2. A sequence of intervals with the position of the prime ideals in each disconnected tree of OM representations.
3. The $p$-index of $f$.

If the parameter `Field` is set to `true` the $\psi$ polynomial at the last level of each type of each OM representation will be computed.

<a id="example-ex-25d08e"></a>
#### `Example: Montes Algorithm on a Polynomial (ex-25d08e)`

Here’s an example of how to use it:

```magma
> _<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> p := 7;
> Montes(f,p);
[
    ,

]
[
    [ 1 ],
    [ 2 ]
]
0
```

The Montes algorithm can also be called for a number field $K$ if it is defined by a monic polynomial with integer coefficients.

<a id="procedure-montes-fldarith-rngelt"></a>
#### `Montes(K, p): FldArith, RngElt`

The Montes algorithm is applied to the defining polynomial of the number field $K$ at the prime $p$.

1. A sequence of OM representations for the prime ideals of $K$ is stored in ``K`PrimeIdeals[p]``.
2. The $p$-adic valuation of the index $[{\mathbb{Z}}_K:{\mathbb{Z}}[\theta]]$ is stored in ``K`LocalIndex[p]``

<a id="example-ex-cb9d42"></a>
#### `Example: Montes Algorithm on a Number Field (ex-cb9d42)`

Here’s an example of how to use it:

```magma
> _<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> K := NumberField(f);
> p := 7;
> Montes(K,p);
> K`PrimeIdeals[p];
[
    OM prime ideal over   7
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   1
    and ramification index   1
    Last phi polynomial is x + 6,
    OM prime ideal over   7
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   4
    and ramification index   1
    Last phi polynomial is x^4 + x^3 + x^2 + x + 1
]
> K`LocalIndex[p];
0
```

<a id="procedure-sfl-omidl-rngintelt"></a>
#### `SFL(P, s): OMIdl, RngIntElt`

Perform the single factor lifting algorithm, [[GNP12](https://docs.magma-maths.org/references.md#cite-guardia20121318)], on the prime ideal $P$ in OM representation until the slope is at least $s$.

<a id="example-ex-e93eb7"></a>
#### `Example: Single Factor Lifting of an OM Prime (ex-e93eb7)`

```magma
> Ax<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> L := NumberField(f);
> p := 7;
> Montes(L,p);
> P := L`PrimeIdeals[p,1];
> P`Type[#P`Type]`slope;
1
> P`Type[#P`Type]`Phi; // the approximation
x + 6
> slope := 50;
> SFL(~P,slope:update := true);
> P`Type[#P`Type]`slope;
50
> P`Type[#P`Type]`Phi; // the approximation
x + 332598606638994184508401217986166728134618
```

<a id="procedure-setusemontes-boolelt"></a>
#### `SetUseMontes(f): BoolElt`

<a id="procedure-setusemontes-cat-boolelt"></a>
#### `SetUseMontes(t, f): Cat, BoolElt`

Set whether the Montes algorithm is to be used for maximal order and prime decomposition calculations. The type $t$ can be a type which inherits from `FldNum`. This setting can be overwritten by setting the `Al` parameter of the `MaximalOrder` and `Decomposition` intrinsics to `"Montes"`.

<a id="function-getusemontes-cat"></a>
#### `GetUseMontes(t): Cat -> BoolElt`

Return whether the Montes algorithm will be used by default for computations of maximal orders and decompositions for types inheriting from type $t$, where $t$ is a type which inherits from `FldNum`.

<a id="procedure-setverbose-monstgelt-rngintelt-montes"></a>
#### `SetVerbose("Montes", v): MonStgElt, RngIntElt`

Set the level for verbose printing for the Montes algorithm to be $v \le 3$.

### Ideals in OM Representation

Ideals of type `RngOrdFracIdl` can have an OM representation computed from them. Similarly ideals constructed from the Montes algorithm in OM representation can be converted into ideals of type `RngOrdFracIdl`.

<a id="function-ideal-omidl"></a>
#### `Ideal(I): OMIdl -> RngOrdIdl`

Translates ideal $I$ in OM representation into a Magma representation.

<a id="function-omrepresentation-rngfunordidl"></a>
#### `OMRepresentation(I): RngFunOrdIdl -> OMIdl`

<a id="function-omrepresentation-rngordfracidl"></a>
#### `OMRepresentation(I): RngOrdFracIdl -> OMIdl`

Computes the OM representation of the ideal $I$ in a number field.

<a id="function-omrepresentation-fldarith-fldarithelt"></a>
#### `OMRepresentation(L, S): FldArith, [FldArithElt] -> OMIdl`

<a id="function-omrepresentation-fldarith-fldarithelt-2"></a>
#### `OMRepresentation(L, a): FldArith, FldArithElt -> OMIdl`

<a id="function-omrepresentation-fldarith-rngelt"></a>
#### `OMRepresentation(L, a): FldArith, RngElt -> OMIdl`

Given a number field $L$ and an element $a$ or sequence $S$ of elements in $L$, construct, in OM representation, the ideal generated by these elements.

<a id="example-ex-738d2c"></a>
#### `Example: Converting to and from OM Representation (ex-738d2c)`

```magma
>      Ax<x> := PolynomialRing(Integers());
>      f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
>      L := NumberField(f);
>      p := 7;
>      Montes(L,p);
> Ideal(L`PrimeIdeals[p,1]);
Prime Ideal
Two element generators:
    [7, 0, 0, 0, 0]
    [6, 1, 0, 0, 0]
> OMRepresentation(L, [7, 1 + L.1 + L.1^2 + L.1^3 + L.1^4]);
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
generated by [
7,
$.1^4 + $.1^3 + $.1^2 + $.1 + 1
]

> Ideal($1);
Ideal
Two element generators:
    [7, 0, 0, 0, 0]
    [1, 1, 1, 1, 1]
```

#### Ideal Arithmetic

<a id="operation-op-plus-omidl-omidl"></a>
##### `I + J: OMIdl, OMIdl -> OMIdl`

<a id="operation-op-times-omidl-omidl"></a>
##### `I * J: OMIdl, OMIdl -> OMIdl`

<a id="operation-op-div-omidl-omidl"></a>
##### `I / J: OMIdl, OMIdl -> OMIdl`

The sum, product or quotient of ideals $I$ and $J$ in OM representation.

<a id="operation-op-pow-omidl-rngintelt"></a>
##### `I ^ n: OMIdl, RngIntElt -> OMIdl`

The $n$-th power of the ideal $I$ in OM representation.

<a id="example-ex-58ff3a"></a>
##### `Example: Arithmetic of OM Ideals (ex-58ff3a)`

```magma
> Ax<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> L := NumberField(f);
> Montes(L,7);
> P := L`PrimeIdeals[7,1];
> I := OMRepresentation(L,[L.1]);
> I;
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
generated by [
$.1
]

> J := P^-2;
> I*J;
> I^2;
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
having the factorization [ <2, 1, 2>, <3, 1, 2> ]

> I/J;
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
having the factorization [ <2, 1, 1>, <3, 1, 1>, <7, 1, 2> ]

> I+J;
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
having the factorization  []
generated by [
1,
0
]
```

#### Ideal Predicates

<a id="function-isone-omidl"></a>
##### `IsOne(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether the ideal is generated by the $1$ element of the field.

<a id="function-iszero-omidl"></a>
##### `IsZero(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether the ideal contains only the $0$ element of the field.

<a id="operation-op-eq-omidl-omidl"></a>
##### `I eq J: OMIdl, OMIdl -> BoolElt`

Given two ideals $I$ and $J$ in OM representation returns whether these ideals are the same.

<a id="operation-op-in-rngelt-omidl"></a>
##### `a in I: RngElt, OMIdl -> BoolElt`

Given an element $a$ coercible into the field containing the ideal $I$ in OM representation return whether $a$ is contained in the ideal.

<a id="operation-op-subset-omidl-omidl"></a>
##### `I subset J: OMIdl, OMIdl -> BoolElt`

Given two ideals $I$ and $J$ in OM representation returns whether $I$ is contained in $J$.

<a id="function-isprime-omidl"></a>
##### `IsPrime(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether only the $1$ ideal and $I$ contain $I$.

<a id="function-isintegral-omidl"></a>
##### `IsIntegral(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether all elements in the ideal $I$ are integral.

### Ideal Operations

<a id="function-pintegralbasis-omidl-rngelt"></a>
#### `pIntegralBasis(I, p): OMIdl, RngElt -> SeqEnum`

Given an ideal $I$ in OM representation and a prime element $p$ in the field containing $I$, compute a $p$-integral basis for $I$.

<a id="function-sintegralbasis-omidl-seqenum"></a>
#### `SIntegralBasis(I, S): OMIdl, SeqEnum -> SeqEnum`

<a id="function-sintegralbasis-rngordfracidl-rngintelt"></a>
#### `SIntegralBasis(I, S): RngOrdFracIdl, [RngIntElt] -> SeqEnum`

<a id="function-sintegralbasis-rngfunordidl-rngupolelt"></a>
#### `SIntegralBasis(I, S): RngFunOrdIdl, [RngUPolElt] -> SeqEnum`

Given an ideal $I$ in either representation and a sequence $S$ of primes in the field containing $I$, compute an $S$-integral basis of $I$ for the given set of primes $S$.

<a id="function-basis-omidl"></a>
#### `Basis(I): OMIdl -> SeqEnum`

```magma
HNF      : BoolElt                    Default: false
Separated: BoolElt                    Default: false
```

Given an ideal $I$ in OM representation, return a basis for $I$.

If `HNF` is set to `true` a triangular basis in Hermite form is returned.

If `Separated` is set to `true` the basis will be returned as a sequence of numerators and denominators.

<a id="example-ex-a203ed"></a>
#### `Example: p-Integral Basis of an OM Ideal (ex-a203ed)`

```magma
> Ax<x> := PolynomialRing(Integers());
> f := x^4 + 12*x^3 + 54*x^2 + 108*x + 89;
> L := NumberField(f);
> p := 2;
> I := OMRepresentation(L,[L.1,p^12]);
> pIntegralBasis(I,p);
[
    1,
    L.1 + 1,
    1/2*(L.1^2 + 2*L.1 + 1),
    1/4*(L.1^3 + 3*L.1^2 + 3*L.1 + 1)
]
> pIntegralBasis(I,p:HNF:=true); // In HNF
[
    1,
    L.1,
    1/2*(L.1^2 + 1),
    1/4*(L.1^3 + L.1^2 + 3*L.1 + 3)
]
> Basis(I);
[
    1,
    L.1 + 1,
    1/2*(L.1^2 + 2*L.1 + 1),
    1/4*(L.1^3 + 3*L.1^2 + 3*L.1 + 1)
]
> Basis(I : HNF := true);
[
    1,
    L.1,
    1/2*(L.1^2 + 1),
    1/4*(L.1^3 + L.1^2 + 3*L.1 + 3)
]
```

<a id="function-twoelement-omidl"></a>
#### `TwoElement(I): OMIdl -> FldArithElt, FldArithElt`

Given an ideal $I$ in OM representation, return $a, b$ such that $e = a*e_1 + b*e_2$ for some $e_1, e_2$ for all $e \in I$.

<a id="function-norm-omidl"></a>
#### `Norm(I): OMIdl -> RngElt`

Given an ideal $I$ in OM representation, compute the norm of $I$.

<a id="function-valuation-fldarithelt-omidl"></a>
#### `Valuation(alpha, P : parameters): FldArithElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-fldratelt-omidl"></a>
#### `Valuation(alpha, P : parameters): FldRatElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-rngintelt-omidl"></a>
#### `Valuation(alpha, P : parameters): RngIntElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-rngupolelt-omidl"></a>
#### `Valuation(alpha, P : parameters): RngUPolElt, OMIdl -> RngIntElt, FldElt`

```magma
RED    : BoolElt                    Default: false,
MoreSFL: BoolElt                    Default: false
```

Compute the $P$-valuation $v$ of $\alpha$ at the prime ideal $P$.

Setting the parameter `MoreSFL` to `true` selects a single factor lifting algorithm. Setting the parameter `RED` to `true` returns also the class of $\alpha$ in $P^v/P^{(v+1)}$.

<a id="function-valuation-omidl-omidl"></a>
#### `Valuation(I, P): OMIdl, OMIdl -> RngIntElt`

Given ideals $I$ and $P$ in OM representation, return the valuation of $I$ at $P$.

<a id="operation-operation-mod-fldarithelt-omidl-fldarithelt"></a>
#### `a mod P: FldArithElt, OMIdl -> FldArithElt`

<a id="function-reduction-fldarithelt-omidl"></a>
#### `Reduction(a, P): FldArithElt, OMIdl -> FldArithElt`

<a id="function-reduction-fldarithelt-omidl-rngintelt"></a>
#### `Reduction(a, P, m): FldArithElt, OMIdl, RngIntElt -> [FldArithElt]`

Given an element $a$ of the field containing the prime ideal $P$, which is in OM representation, return $a'$ such that $a = a' + I$ and $a' \in P^0/P$.

If $m > 0$ is given then a sequence of length $m$ of elements in $P^0/P$ is returned representing the local expansion of $a$ at $P$ up to precision $m$.

<a id="function-factorization-omidl"></a>
#### `Factorization(I): OMIdl -> SeqEnum`

<a id="function-factorisation-omidl"></a>
#### `Factorisation(I): OMIdl -> SeqEnum`

Given an ideal $I$ in OM representation returns a sequence of tuples of primes $P_i$ and exponents $e_i$ such that $I = \prod_i P_i^{e_i}$.

<a id="example-ex-b5c67b"></a>
#### `Example: Operations on OM Ideals (ex-b5c67b)`

```magma
> Ax<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> L := NumberField(f);
> I := OMRepresentation(L,[1/L.1^2,12]);
> I;
OM ideal of the field Number Field with defining polynomial x^5 + 343*x^4 +
49*x^3 + 343*x^2 + 7*x + 6 over the Rational Field
generated by [
1/36*(7*$.1^4 + 2395*$.1^3 - 1715*$.1^2 + 2107*$.1 - 2009),
12
]

> TwoElement(I);
1
1/36*(91*L.1^4 + 211*L.1^3 + 169*L.1^2 + 175*L.1 + 55)
> Norm(I);
1/36
> Factorization(I);
[
    <OM prime ideal over   2
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   1
    and ramification index   1
    Last phi polynomial is   x, -2>,
    <OM prime ideal over   3
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   1
    and ramification index   1
    Last phi polynomial is   x, -2>
]
> Valuation(I, L`PrimeIdeals[2][1]);
-2
> Valuation(I, L`PrimeIdeals[3][1]);
-2
```

<a id="function-residuefield-omidl"></a>
#### `ResidueField(I): OMIdl -> Fld`

Given an ideal $I$ in OM representation returns the field $P^0/P$.

<a id="example-ex-7694e8"></a>
#### `Example: Residual Degree and Ramification of OM Primes (ex-7694e8)`

```magma
> Ax<x> := PolynomialRing(Integers());
> f := x^5 + 343*x^4 + 49*x^3 + 343*x^2 + 7*x + 6;
> L := NumberField(f);
> p := 7;
> Montes(L,p);
> L`PrimeIdeals[p];
[
    OM prime ideal over   7
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   1
    and ramification index   1
    Last phi polynomial is x + 6,
    OM prime ideal over   7
    of Number Field with defining polynomial x^5 + 343*x^4 + 49*x^3 + 343*x^2 +
    7*x + 6 over the Rational Field
    having residual degree   4
    and ramification index   1
    Last phi polynomial is x^4 + x^3 + x^2 + x + 1
]
> ResidueField($1[2]);
Finite field of size 7^4
```

<a id="galois-theory"></a>
<a id="rngordgal-main"></a>
## Galois Groups and Automorphisms

This chapter deals with Galois groups and automorphism of number fields and several kinds of function fields. It also deals with computing the subfields of these kinds of fields. While these problems are closely related from a theoretical point of view (basically, everything is determined by the Galois group), as algorithmic problems they are quite different.

The first task, that of computing automorphisms of normal extensions of ${\mathbb{Q}}$ (and of abelian extensions of number fields) can be thought of a special case of factorisation of polynomials over number fields: the automorphisms of a number field are in one-to-one correspondence with the roots of the defining equation in the field. However, the computation follows a different approach and is based on some combinatorial properties. It should be noted, though, that the algorithms only apply to normal fields; i.e., they cannot be used to find non-trivial automorphisms of non-normal fields!

The second task, namely that of computing the Galois group of the normal closure of a number field, is of course closely related to the problem of computing the Galois group of a polynomial. The method implemented in Magma allows the computation of Galois groups of polynomials (and number fields) of arbitrarily high degrees and is independent of the classification of transitive permutation groups. The result of the computation of a Galois group will be a permutation group acting on the roots of the (defining) polynomial, where the roots (or approximations of them) are explicitly computed in some suitable $p$-adic field; thus the splitting field is not (directly) part of the computation. The explicit action on the roots allows one, for example, to compute algebraic representations of arbitrary subfields of the splitting field, even the splitting field itself, provided the degree is not too large.

The last main task dealt with in this chapter is the computation of subfields of a number field. While of course this can be done using the main theorem of Galois theory (the correspondence between subgroups and subfields), the computation is completely independent; in fact, the computation of subfields is usually the first step in the computation of the Galois group. The algorithm used here is mainly combinatorical.

Finally, this chapter also deals with applications of the Galois theory:

- the computation of subfields and subfield towers of the splitting field
- solvability by radicals: if the Galois group of a polynomial is solvable, the roots of the polynomial can be represented by (iterated) radicals.
- basic Galois-cohomology; i.e., the action of the automorphisms on the ideal class group, the multiplicative group of the field, and derived objects.

- [Automorphism Groups](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md)
  - [`Automorphisms(F): FldAlg → [ Map ]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-automorphisms-fldalg)
  - [`AutomorphismGroup(F): FldAlg → GrpPerm, PowMap, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-automorphismgroup)
  - [Example: Automorphisms of a Quartic Field](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#example-ex-7b9102)
  - [`AutomorphismGroup(K, F): FldAlg, FldAlg → GrpPerm, PowMap, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-automorphismgroup-fldalg-fldalg)
  - [`AutomorphismGroup(K, F): FldRat, FldAlg → GrpPerm, PowMap, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-automorphismgroup-fldrat-fldalg)
  - [`AutomorphismGroup(K, F): FldAlg, FldRat → GrpPerm, PowMap, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-automorphismgroup-fldalg-fldrat)
  - [`DecompositionGroup(p): RngIntElt → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-decompositiongroup-rngintelt)
  - [`DecompositionGroup(p): RngOrdIdl → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-decompositiongroup-rngordidl)
  - [`RamificationGroup(p, i): RngOrdIdl, RngIntElt → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-ramificationgroup-rngordidl-rngintelt)
  - [`RamificationGroup(p): RngOrdIdl → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-ramificationgroup-rngordidl)
  - [`InertiaGroup(p): RngOrdIdl → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-inertiagroup-rngordidl)
  - [`FixedField(K, U): FldAlg, GrpPerm → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-fixedfield)
  - [`FixedField(K, S): FldAlg, [Map] → FldAlg, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-fixedfield-fldalg-map)
  - [`FixedGroup(K, L): FldAlg, FldAlg → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-fixedgroup)
  - [`FixedGroup(K, L): FldAlg, [FldAlgElt] → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-fixedgroup-fldalg-fldalgelt)
  - [`FixedGroup(K, a): FldAlg, FldAlgElt → GrpPerm`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-fixedgroup-fldalg-fldalgelt-2)
  - [`DecompositionField(p): RngOrdIdl → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-decompositionfield-rngordidl)
  - [`RamificationField(p, i): RngOrdIdl, RngIntElt → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-ramificationfield-rngordidl-rngintelt)
  - [`RamificationField(p): RngOrdIdl → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-ramificationfield-rngordidl)
  - [`InertiaField(p): RngOrdIdl → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-inertiafield-rngordidl)
  - [Example: Ramification Groups of a Normal Field](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#example-ex-3b0e83)
  - [`FrobeniusElement(K, p): FldNum, RngIntElt → GrpPermElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-frobeniuselement-fldnum-rngintelt)
  - [Example: Frobenius Elements in a Galois Group](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#example-ex-87fbb9)
- [Galois Groups](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md)
  - [`GaloisGroup(f): RngUPolElt[RngInt] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroup)
  - [`GaloisGroup(f): RngUPolElt[FldRat] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroup-rngupolelt-fldrat)
  - [`GaloisGroup(f): RngUPolElt[FldAlg] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroup-rngupolelt-fldalg)
  - [`GaloisGroup(f): RngUPolElt[RngOrd] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroup-rngupolelt-rngord)
  - [`IsEasySnAn(f): RngUPolElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-iseasysnan-rngupolelt)
  - [`GaloisGroup(K): FldNum → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroup-fld)
  - [`GaloisGroup(K): FldNum[FldRat] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroup-fldnum-fldrat)
  - [`GaloisGroup(K): FldNum[FldNum[FldRat]] → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroup-fldnum-fldnum-fldrat)
  - [`GaloisProof(f, S): RngUPolElt, GaloisData → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisproof)
  - [`GaloisProof(K, S): FldAlg, GaloisData → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisproof-fldalg-galoisdata)
  - [`GaloisRoot(f, i, S): RngUPolElt, RngIntElt, GaloisData → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisroot-rngupolelt-rngintelt-galoisdata)
  - [`GaloisRoot(i, S): RngIntElt, GaloisData → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisroot)
  - [`GaloisGroupConjugation(S, T): GaloisData, GaloisData → GrpPermElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisgroupconjugation-galoisdata-galoisdata)
  - [`GaloisAutomorphismGroup(K): FldNum[FldRat] → GrpPerm, Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisautomorphismgroup-fldnum-fldrat)
  - [`Stauduhar(G, H, S, B): GrpPerm, GrpPerm, GaloisData, RngIntElt → RngIntElt, GrpPermElt, BoolElt, RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-stauduhar-grpperm-grpperm-galoisdata-rngintelt)
  - [`IsInt(x, B, S): RngElt, RngIntElt, GaloisData → BoolElt, RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-isint-rngelt-rngintelt-galoisdata)
  - [Example: Galois Group of a Sextic Polynomial](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#example-ex-cc334e)
  - [Straight-line Polynomials](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#straight-line-polynomials)
    - [`SLPolynomialRing(R, n): Rng, RngIntElt → RngSLPol`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-slpolynomialring-rng-rngintelt)
    - [`Name(R, i): RngSLPol, RngIntElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-name-rngslpol-rngintelt)
    - [`R . i: RngSLPol, RngIntElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#operation-operation-rngslpol-rngintelt-rngslpolelt)
    - [`ElementarySymmetricPolynomial(R, i): RngSLPol, RngIntElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-elementarysymmetricpolynomial-rngslpol-rngintelt)
    - [`BaseRing(R): RngSLPol → Rng`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-basering-rngslpol)
    - [`CoefficientRing(R): RngSLPol → Rng`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-coefficientring-rngslpol)
    - [`Rank(R): RngSLPol → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rank-rngslpol)
    - [`SetEvaluationComparison(R, F, n): RngSLPol, FldFin, RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#procedure-setevaluationcomparison-rngslpol-fldfin-rngintelt)
    - [`GetEvaluationComparison(R): RngSLPol → FldFin, RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-getevaluationcomparison-rngslpol)
    - [`InitializeEvaluation(R, S): RngSLPol, [RngElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#procedure-slpol-init-eval)
    - [`x * y: RngSLPolElt, RngSLPolElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#operation-op-times-rngslpolelt-rngslpolelt)
    - [`x + y: RngSLPolElt, RngSLPolElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#operation-op-plus-rngslpolelt-rngslpolelt)
    - [`x - y: RngSLPolElt, RngSLPolElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#operation-op-minus-rngslpolelt-rngslpolelt)
    - [`- x: RngSLPolElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#operation-operation-rngslpolelt-rngslpolelt)
    - [`Derivative(x, i): RngSLPolElt, RngIntElt → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-derivative-rngslpolelt-rngintelt)
    - [`Evaluate(f): RngSLPolElt → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-evaluate-rngslpolelt)
    - [`Evaluate(f, S): RngSLPolElt, [RngElt] → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-evaluate-rngslpolelt-rngelt)
    - [`Evaluate(f, S, m): RngSLPolElt, [RngElt], Map → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-evaluate-rngslpolelt-rngelt-map)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#invariants)
    - [`GaloisGroupInvariant(G, H): GrpPerm, GrpPerm → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroupinvariant)
    - [`RelativeInvariant(G, H): GrpPerm, GrpPerm → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-relativeinvariant)
    - [`CombineInvariants(R, G, H1, H2, H3): Rng, GrpPerm, Tup<GrpPerm, RngSLPolElt>, Tup<GrpPerm, RngSLPolElt>, GrpPerm → RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-combineinvariants-rng-grpperm-tup-grpperm-rngslpolelt-tup-grpperm-rngslpolelt-grpperm)
    - [`IsInvariant(F, p): RngSLPolElt, GrpPermElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-isinvariant-rngslpolelt-grppermelt)
    - [`Bound(I, B): RngSLPolElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-bound-rngslpolelt-rngintelt)
    - [`Bound(I, B): RngSLPolElt, RngElt → RngElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-bound-rngslpolelt-rngelt)
    - [`PrettyPrintInvariant(I): RngSLPolElt → MonStgElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-prettyprintinvariant-rngslpolelt)
  - [Subfields and Subfield Towers](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#subfields-and-subfield-towers)
    - [`GaloisSubgroup(K, U): FldNum, GrpPerm → RngUPolElt, RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoissubgroup-fldnum-grpperm)
    - [`GaloisSubgroup(S, U): GaloisData, GrpPerm → RngUPolElt, RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngordgal-galoissubgroup)
    - [`GaloisSubgroup(f, U): RngUPolElt, GrpPerm → RngUPolElt, RngSLPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoissubgroup-rngupolelt-grpperm)
    - [`GaloisSibling(S, phi): GaloisData, Map → RngUPolElt, RngSLPolElt, RngUPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoissibling-hom)
    - [`RelativeResolvent(S, U): GaloisData, GrpPerm → RngUPolElt, RngSLPolElt, RngUPolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-relativeresolvent-grpperm)
    - [`GaloisQuotient(K, Q): FldNum, GrpPerm → SeqEnum[RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisquotient-fldnum-grpperm)
    - [`GaloisQuotient(f, Q): RngUPolElt, GrpPerm → SeqEnum[RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisquotient-rngupolelt-grpperm)
    - [`GaloisQuotient(S, Q): GaloisData, GrpPerm → SeqEnum[RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoisquotient-galoisdata-grpperm)
    - [`GaloisSubfieldTower(S, L): GaloisData, [GrpPerm] → FldNum, [Tup<RngSLPolElt, RngUPolElt, [GrpPermElt]>], UserProgram, UserProgram`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoissubfieldtower-galoisdata-grpperm)
    - [`GaloisSplittingField(f): RngUPolElt → FldNum, [FldNumElt], GrpPerm, [[FldNumElt]]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-galoissplittingfield-rngupolelt)
    - [Example: Galois Splitting Field of a Cubic](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#example-ex-4f61da)
  - [Solvability by Radicals](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#solvability-by-radicals)
    - [`SolveByRadicals(f): RngUPolElt → FldNum, [FldNumElt], [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-solvebyradicals-rngupolelt)
    - [`CyclicToRadical(K, a, z): FldNum, FldNumElt, RngElt → FldNum, [FldNumElt], [FldNumElt]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-cyclictoradical-fldnum-fldnumelt-rngelt)
    - [Example: Solving a Polynomial by Radicals](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#example-ex-f5133d)
  - [Linear Relations](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#linear-relations)
    - [`LinearRelations(f): RngUPolElt → Mtrx, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-linearrelations-rngupolelt)
    - [`LinearRelations(f, I): RngUPolElt, [RngSLPolElt] → Mtrx, GaloisData`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-linearrelations-rngupolelt-rngslpolelt)
    - [`VerifyRelation(f, F): RngUPolElt, RngSLPolElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-verifyrelation-rngupolelt-rngslpolelt)
    - [Example: Linear Relations among Roots](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#example-ex-2acfb0)
  - [Other](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#other)
    - [`ConjugatesToPowerSums(I): [] → []`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-conjugatestopowersums)
    - [`PowerSumToElementarySymmetric(I): [] → []`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-powersumtoelementarysymmetric)
- [Subfields](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md)
  - [`Subfields(K, n): FldAlg, RngIntElt → [ < FldAlg, Hom > ]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-subfields-fldalg-rngintelt)
  - [`Subfields(K): FldAlg → [ < FldAlg, Hom > ]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-rngord-subfields)
  - [The Subfield Lattice](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#the-subfield-lattice)
    - [`SubfieldLattice(K): FldNum → SubFldLat`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-subfieldlattice-fldnum)
    - [`# L: SubFldLat → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-operation-subfldlat-rngintelt)
    - [`Representative(L): SubFldLat → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-representative-subfldlat)
    - [`Rep(L): SubFldLat → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-rep-subfldlat)
    - [`Bottom(L): SubFldLat → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-bottom-subfldlat)
    - [`Top(L): SubFldLat → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-top-subfldlat)
    - [`Random(L): SubFldLat → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-random-subfldlat)
    - [`L ! n: SubFldLat, RngIntElt → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-op-subfldlat-rngintelt)
    - [`L[n]: SubFldLat, RngIntElt → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#literal-literal-l-n-subfldlat-rngintelt-subfldlatelt)
    - [`NumberField(e): SubFldLatElt → FldNum`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-numberfield-subfldlatelt)
    - [`EmbeddingMap(e): SubFldLatElt → Map`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-embeddingmap-subfldlatelt)
    - [`Degree(e): SubFldLatElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-degree-subfldlatelt)
    - [`e eq f: SubFldLatElt, SubFldLatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-op-eq-subfldlatelt-subfldlatelt)
    - [`e subset f: SubFldLatElt, SubFldLatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-op-subset-subfldlatelt-subfldlatelt)
    - [`e * f: SubFldLatElt, SubFldLatElt → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-op-times-subfldlatelt-subfldlatelt)
    - [`e meet f: SubFldLatElt, SubFldLatElt → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-op-meet-subfldlatelt-subfldlatelt)
    - [`&meet S: [ SubFldLatElt ] → SubFldLatElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#operation-operation-meet-subfldlatelt-subfldlatelt)
    - [`MaximalSubfields(e): SubFldLatElt → [ SubFldLatElt ]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-maximalsubfields-subfldlatelt)
    - [`MinimalOverfields(e): SubFldLatElt → [ SubFldLatElt ]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#function-minimaloverfields-subfldlatelt)
    - [Example: Subfield Lattice of an Octic Field](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/subfields.md#example-ex-c7abdb)
- [Galois Cohomology](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md)
  - [`Hilbert90(a, M): FldNumElt, Map[FldNum, FldNum] → FldNumElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md#function-hilbert90-fldnumelt-map-fldnum-fldnum)
  - [`SUnitCohomologyProcess(S, U): {RngOrdIdl}, GrpPerm → {1}`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md#function-rngord-sunitcohomologyprocess)
  - [`IsGloballySplit(C, l): {}, UserProgram → BoolElt, UserProgram`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md#function-isgloballysplit-userprogram)
  - [`IsSplitAsIdealAt(I, l): RngOrdFracIdl, UserProgram → BoolElt, UserProgram, [RngOrdIdl]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md#function-issplitasidealat-rngordfracidl-userprogram)
- [Automorphisms of Fields](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md)
  - [Creation of Field Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#creation-of-field-automorphisms)
    - [`FieldAutomorphism(F, g): Fld, GrpPermElt → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-fld-grppermelt)
    - [`FieldAutomorphism(F, g): AlgAss[Fld], GrpPermElt → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-algass-fld-grppermelt)
    - [`FieldAutomorphism(F, a): Fld, Map[Fld,Fld] → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-fld-map-fld-fld)
    - [`FieldAutomorphism(F, a): Fld, Intrinsic → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-fld-intrinsic)
    - [`FieldAutomorphism(F, a): Fld, UserProgram → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-fld-userprogram)
    - [`FieldAutomorphism(F, a): AlgAss[Fld], Map[AlgAss[Fld],AlgAss[Fld]] → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-algass-fld-map-algass-fld-algass-fld)
    - [`IdentityAutomorphism(F): Fld → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-identityautomorphism-fld)
    - [`FieldAutomorphism(K): AlgAss[Fld] → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fieldautomorphism-algass-fld)
    - [`ChangeRing(a, K): FldAut, Fld → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-changering-fldaut-fld)
    - [`ChangeRing(a, K): FldAut, AlgAss[Fld] → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-changering-fldaut-algass-fld)
  - [Properties of Field Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#properties-of-field-automorphisms)
    - [`BaseField(a): FldAut → Fld`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-basefield-fldaut)
    - [`Order(a): FldAut → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-order-fldaut)
    - [`FixedField(a): FldAut → Fld`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fixedfield-fldaut)
    - [`Automorphism(a): FldAut → Map[Fld, Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-automorphism-fldaut)
    - [`FixedFieldSymbol(a, P): FldAut, RngOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fixedfieldsymbol-fldaut-rngordidl)
    - [`FixedFieldSymbol(a, P): FldAut, RngInt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-fixedfieldsymbol-fldaut-rngint)
  - [Predicates on Field Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#predicates-on-field-automorphisms)
    - [`IsIdentity(a): FldAut → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-isidentity-fldaut)
  - [Arithmetic of Field Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#arithmetic-of-field-automorphisms)
    - [`a * b: FldAut, FldAut → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-op-times-fldaut-fldaut)
    - [`a ^ n: FldAut, RngIntElt → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-op-pow-fldaut-rngintelt)
    - [`Inverse(a): FldAut → FldAut`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-inverse-fldaut)
    - [`a eq b: FldAut, FldAut → BoolElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-op-eq-fldaut-fldaut)
    - [`x @ a: FldElt, FldAut → FldElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-fldelt-fldaut-fldelt)
    - [`x @ a: RngOrdElt, FldAut → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-rngordelt-fldaut-rngordelt)
    - [`x @ a: RngIntElt, FldAut → RngIntElt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-rngintelt-fldaut-rngintelt)
    - [`x @ a: AlgAssElt[Fld], FldAut → AlgAssElt[Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-algasselt-fld-fldaut-algasselt-fld)
    - [`v @ a: ModTupFldElt[Fld], FldAut → ModTupFldElt[Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-modtupfldelt-fld-fldaut-modtupfldelt-fld)
    - [`M @ a: ModMatFldElt[Fld], FldAut → ModMatFldElt[Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-modmatfldelt-fld-fldaut-modmatfldelt-fld)
    - [`M @ a: AlgMatElt[Fld], FldAut → AlgMatElt[Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-algmatelt-fld-fldaut-algmatelt-fld)
    - [`M @ a: GrpMatElt[Fld], FldAut → GrpMatElt[Fld]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-grpmatelt-fld-fldaut-grpmatelt-fld)
    - [`M @ a: AlgMatElt[AlgAss[Fld]], FldAut → AlgMatElt[AlgAss[Fld]]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-algmatelt-algass-fld-fldaut-algmatelt-algass-fld)
    - [`I @ a: RngOrdFracIdl[FldOrd], FldAut → RngOrdFracIdl[FldOrd]`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-rngordfracidl-fldord-fldaut-rngordfracidl-fldord)
    - [`I @ a: RngInt, FldAut → RngInt`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-rngint-fldaut-rngint)
    - [`I @ a: RngIntFracIdl, FldAut → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#operation-operation-rngintfracidl-fldaut-rngintfracidl)
    - [`Trace(P, a): RngOrdFracIdl, FldAut → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-trace-rngordfracidl-fldaut)
    - [`Trace(P, a): RngIntFracIdl, FldAut → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-trace-rngintfracidl-fldaut)
    - [`Norm(P, a): RngOrdFracIdl, FldAut → RngOrdFracIdl`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-norm-rngordfracidl-fldaut)
    - [`Norm(P, a): RngIntFracIdl, FldAut → RngIntFracIdl`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/fld_auts.md#function-norm-rngintfracidl-fldaut)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/bibliography.md)

<a id="automorphism"></a>
<a id="rngord-automorphismgroup-main"></a>
### Automorphism Groups

Automorphisms of an algebraic field and the group they form can be calculated. Furthermore, field invariants that relate to the automorphism group can be determined.

<a id="function-automorphisms-fldalg"></a>
#### `Automorphisms(F): FldAlg -> [ Map ]`

```magma
Abelian          : BoolElt                    Default: false
AutomorphismGroup: Verbose                    Default: 3
```

Given an algebraic field $F$, return the automorphisms of $F$ as a sequence of maps. If the extension is known to be abelian, the parameter `Abelian` should be set to `true` in which case a much more efficient algorithm [[AK99](https://docs.magma-maths.org/references.md#cite-ackl1), [Klu97](https://docs.magma-maths.org/references.md#cite-kl2)] will be employed. If $F$ is not a normal extension, the automorphisms are obtained by a variation of the polynomial factorisation algorithm.

<a id="function-rngord-automorphismgroup"></a>
#### `AutomorphismGroup(F): FldAlg -> GrpPerm, PowMap, Map`

```magma
Abelian          : BoolElt                    Default: false
UseGalois        : BoolElt                    Default: false
AutomorphismGroup: Verbose                    Default: 3
```

Given an algebraic field $F$, that is either a simple normal extension of ${\mathbb{Q}}$ or simple abelian extension of ${\mathbb{Q}}$, return the automorphism group $G$ of $K$ as a permutation group of degree $n$, where $n$ is the degree of the extension. If the extension is known to be abelian, the parameter `Abelian` should be set to `true` in which case a much more efficient algorithm [[AK99](https://docs.magma-maths.org/references.md#cite-ackl1), [Klu97](https://docs.magma-maths.org/references.md#cite-kl2)] will be employed. If `UseGalois` is set, `GaloisGroup` will be called and the result will be derived from that. If $F$ is not a normal extension of ${\mathbb{Q}}$ an error will occur. In addition to returning $G$, the function also returns the power structure $Aut$ of all automorphisms of $F$, and the transfer map $\phi$ from $G$ into $Aut$.

<a id="example-ex-7b9102"></a>
#### `Example: Automorphisms of a Quartic Field (ex-7b9102)`

We consider the extension obtained by adjoining a root of the irreducible polynomial $x^4 - 4x^2 + 1$ to ${\mathbb{Q}}$.

```magma
> Q := RationalField();
> R<x> := PolynomialRing(Q);
> K<w> := NumberField(x^4 - 4*x^2 + 1);
> A := Automorphisms(K);
> A;
[
    Mapping from: FldNum: K to FldNum: K,
    Mapping from: FldNum: K to FldNum: K,
    Mapping from: FldNum: K to FldNum: K,
    Mapping from: FldNum: K to FldNum: K
]
> for phi in A do phi(w); end for;
w
w^3 - 4*w
-w^3 + 4*w
-w
```

Taking the same field $K$ we use instead the function `AutomorphismGroup`:

```magma
> G, Aut, tau := AutomorphismGroup(K);
> for x in G do tau(x)(w); end for;
w
w^3 - 4*w
-w^3 + 4*w
-w
```

<a id="function-automorphismgroup-fldalg-fldalg"></a>
#### `AutomorphismGroup(K, F): FldAlg, FldAlg -> GrpPerm, PowMap, Map`

<a id="function-automorphismgroup-fldrat-fldalg"></a>
#### `AutomorphismGroup(K, F): FldRat, FldAlg -> GrpPerm, PowMap, Map`

<a id="function-automorphismgroup-fldalg-fldrat"></a>
#### `AutomorphismGroup(K, F): FldAlg, FldRat -> GrpPerm, PowMap, Map`

Computes the group of $K$ automorphisms of $F$ as a permutation group together with a list of all automorphisms and a map between the permutation group and explicit automorphisms of the field.

This function computes the automorphism group of $F$ over ${\mathbb{Q}}$ first.

<a id="function-decompositiongroup-rngintelt"></a>
#### `DecompositionGroup(p): RngIntElt -> GrpPerm`

<a id="function-decompositiongroup-rngordidl"></a>
#### `DecompositionGroup(p): RngOrdIdl -> GrpPerm`

For an ideal $p$ of the maximal order of some absolute normal field $F$ with group of automorphisms $G$, compute the decomposition group, i.e. the subgroup $U$ of the automorphism group such that:

$$
U := \{ s \in G | s(p) = p \}
$$

If $F$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-ramificationgroup-rngordidl-rngintelt"></a>
#### `RamificationGroup(p, i): RngOrdIdl, RngIntElt -> GrpPerm`

For an ideal $p$ of the maximal order $M$ of some absolute normal field $F$ with group of automorphisms $G$, compute the $i$-th ramification group, i.e. the subgroup $U$ of the automorphism group such that:

$$
U := \{ s \in G | s(x) - x \in p^{i+1} \text{for all }x\text{ in }M \}
$$

If $F$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-ramificationgroup-rngordidl"></a>
#### `RamificationGroup(p): RngOrdIdl -> GrpPerm`

This is just an abbreviation for `RamificationGroup(p, 1)`.

<a id="function-inertiagroup-rngordidl"></a>
#### `InertiaGroup(p): RngOrdIdl -> GrpPerm`

This is just an abbreviation for `RamificationGroup(p, 0)`.

<a id="function-rngord-fixedfield"></a>
#### `FixedField(K, U): FldAlg, GrpPerm -> FldNum, Map`

Given a normal field $K$ over ${\mathbb{Q}}$ and a subgroup $U$ of `AutomorphismGroup(K)`, this returns the largest subfield of $K$ that is fixed by $U$.

This function is inverse to [`FixedGroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-fixedgroup).

If $K$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-fixedfield-fldalg-map"></a>
#### `FixedField(K, S): FldAlg, [Map] -> FldAlg, Map`

Given a field $K$ and a sequence of automorphisms of $K$, this returns the largest subfield of $K$ that is fixed by the given automorphisms.

<a id="function-rngord-fixedgroup"></a>
#### `FixedGroup(K, L): FldAlg, FldAlg -> GrpPerm`

Given a normal field $K$ over ${\mathbb{Q}}$ and a subfield $L$, compute the subgroup $U$ of the `AutomorphismGroup(K)` that fixes $L$.

This function is inverse to [`FixedField`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-fixedfield).

If $K$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-fixedgroup-fldalg-fldalgelt"></a>
#### `FixedGroup(K, L): FldAlg, [FldAlgElt] -> GrpPerm`

Given a normal field $K$ over ${\mathbb{Q}}$ and a sequence of number field elements $L$, compute the subgroup $U$ of the `AutomorphismGroup(K)` that fixes $L$.

If $K$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-fixedgroup-fldalg-fldalgelt-2"></a>
#### `FixedGroup(K, a): FldAlg, FldAlgElt -> GrpPerm`

Given a normal field $K$ over ${\mathbb{Q}}$ and a number field element $a$, compute the subgroup $U$ of the `AutomorphismGroup(K)` that fixes $a$.

This function is inverse to [`FixedField`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-fixedfield).

If $K$ is not a normal extension of ${\mathbb{Q}}$ an error will occur.

<a id="function-decompositionfield-rngordidl"></a>
#### `DecompositionField(p): RngOrdIdl -> FldNum, Map`

This is an abbreviation for `FixedField(K, DecompositionGroup(p))` where $K$ is the number field of the order of $p$.

<a id="function-ramificationfield-rngordidl-rngintelt"></a>
#### `RamificationField(p, i): RngOrdIdl, RngIntElt -> FldNum, Map`

This is an abbreviation for `FixedField(K, RamificationGroup(p, i))` where $K$ is the number field of the order of $p$.

<a id="function-ramificationfield-rngordidl"></a>
#### `RamificationField(p): RngOrdIdl -> FldNum, Map`

This is an abbreviation for `FixedField(K, RamificationGroup(p))` where $K$ is the number field of the order of $p$.

<a id="function-inertiafield-rngordidl"></a>
#### `InertiaField(p): RngOrdIdl -> FldNum, Map`

This is an abbreviation for `FixedField(K, InertiaField(p))` where $K$ is the number field of the order of $p$.

<a id="example-ex-3b0e83"></a>
#### `Example: Ramification Groups of a Normal Field (ex-3b0e83)`

We will demonstrate the various groups and fields. In order to do so, we first construct a non-trivial normal field.

```magma
> o := MaximalOrder(ext<Rationals()|>.1^4-3);
> os := MaximalOrder(SplittingField(NumberField(o)));
> P := Decomposition(os, 2)[1][1];
> G, M := RayClassGroup(P^3);
> G;
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*G.1 = 0
```

Since $G$ is cyclic and the module $P$ invariant under the automorphisms of $os$, the class field corresponding to $G$ will be normal over $Q$. It Galois group over $Q$ will be an extension of $D_4$ by $C_2$.

```magma
> A := AbelianExtension(M);
> O := MaximalOrder(EquationOrder(A));
> Oa := AbsoluteOrder(O);
> Ka := NumberField(Oa);
> Gal, _, Map := AutomorphismGroup(Ka);
> Gal;
Permutation group Gal acting on a set of cardinality 16
Order = 16 = 2^4
    (1, 2, 7, 5)(3, 8, 6, 10)(4, 12, 14, 9)(11, 16, 13, 15)
    (1, 3, 7, 6)(2, 8, 5, 10)(4, 13, 14, 11)(9, 16, 12, 15)
    (1, 4)(2, 9)(3, 11)(5, 12)(6, 13)(7, 14)(8, 15)(10, 16)
```

Now, let us pick some ideals. The only interesting primes are the primes dividing the discriminant, which in this case will be the primes over $2$ and $3$.

```magma
> P2 := Decomposition(Oa, 2)[1][1];
> P3 := Decomposition(Oa, 3)[1][1];
```

First, the valuation of the different of $Oa$ at $P2$ should be $\sum_{i=0}^\infty (\#G(P2, i)-1)$ where $G(P2, i)$ is the $i$-th ramification group.

```magma
> s := 0; i := 0;
> repeat
>   G := RamificationGroup(P2, i);
>   s +:= #G-1;
>   print i, "-th ramification group is of order ", #G;
>   i +:= 1;
> until #G eq 1;
0 -th ramification group is of order  8
1 -th ramification group is of order  8
2 -th ramification group is of order  2
3 -th ramification group is of order  2
4 -th ramification group is of order  2
5 -th ramification group is of order  2
6 -th ramification group is of order  1
> s;
18
> Valuation(Different(Oa), P2);
18
```

According to the theory, $P2$ should be totally ramified over the inertia field and unramified over $Q$:

```magma
> K2 := InertiaField(P2);
> M2 := MaximalOrder(K2);
> K2r := RelativeField(K2, Ka);
> M2r := MaximalOrder(K2r);
> p2 := M2 meet (MaximalOrder(K2r)!!P2);
> IsInert(p2);
true
> IsTotallyRamified(M2r!!P2);
true
```

Now we try the same for $P3$. Since $3$ is split in $Ka$, we may consider an additional field: the decomposition field. It should be the maximal subfield if $K$ such that $3$ is neither inert ($f=1$) nor ramified ($e=1$), therefore $3$ has to split totally.

```magma
> D3 := DecompositionField(P3);
> D3M := MaximalOrder(D3);
> IsTotallySplit(3, D3M);
true
```

The inertia field is the maximal subfield such that $3$ is unramified. It has to be an extension of $D3$.

```magma
> I3 := InertiaField(P3);
> I3;
Number Field with defining polynomial $.1^4 +
    80346384509631057182412*$.1^3 +
    2256835583037881432653115137736209396615693022*$.\\
    1^2 + 2795818092855476469056989739955845736579291605177\\
    3809455107173769804*$.1 +
    2207787685682553980385342263526644079975418801375161428\\
    41147104301325760481728833650060994 over the Rational
Field
> Discriminant($1);
10700005925626216180895747020647047166414333000723923591882\\
57829873417638072117114945163507537844711544617147344227643\\
21408503489566949866295669400825222748660907808235401444104\\
29329493645714658394673579309893726532999745496689571082958\\
8286937125090034449967033769822464
```

This (polynomial) discriminant is huge, in fact it is so large that we should avoid the factorisation. We already know the discriminant of $Ka$. The discriminant of $I3$ has to be a divisor - so we can use the `Discriminant` parameter to `MaximalOrder`: (We are going to need the `MaximalOrder` for the following embedding.)

```magma
> I3M := MaximalOrder(EquationOrder(I3):
> Discriminant := Discriminant(Oa));
> I3M := MaximalOrder(I3);
```

$D3$ should be a subfield of $I3$, so lets verify it:

```magma
> IsSubfield(D3, I3);
true Mapping from: FldNum: D3 to FldNum: I3
```

As a side-effect, Magma is now aware of the embedding and will use it. Without the `IsSubfield` call, the `RelativeField` function will fail.

```magma
> I3r := RelativeField(D3, I3);
> I3rM := MaximalOrder(I3r);
> K3r := RelativeField(D3, Ka);
> K3rM := MaximalOrder(K3r);
> IsInert(K3rM!!P3 meet D3M, I3rM);
true
```

The last step: verify that $P3$ is totally ramified over $I3$:

```magma
> K3r := RelativeField(I3, Ka);
> K3rM := MaximalOrder(K3r);
> IsTotallyRamified(K3rM!!P3 meet I3M, K3rM);
true
```

Using the decomposition group, we can get the splitting behaviour of any prime in any subfield of $Ka$.

```magma
> L := SubgroupLattice(Gal);
> [ IsNormal(Gal, L[x]) : x in [1..#L]];
[ true, true, true, true, false, false, false, false, true,
true, true, true, true, true, true, false, false, false,
false, true, true, true, true, true, true, true, true ]
> U := L[5];
> k := FixedField(Ka, U);
> kM := MaximalOrder(EquationOrder(k) :
>                    Discriminant := Discriminant(Oa));
> kM := MaximalOrder(k);
> Kr := RelativeField(k, Ka);
> KrM := MaximalOrder(Kr);
> P43 := Decomposition(Oa, 43)[1][1];
> V := DecompositionGroup(P43);
```

The splitting behaviour is determined by the double coset decomposition of $Gal$ with respect to $U$ and $V$:

```magma
> f, I := CosetAction(Gal, U);
> orbs := Orbits(f(V));
> reps := [];
> for o in orbs do
>   _, x := IsConjugate(I, 1, Rep(o));
>   Append(~reps, x @@ f);
> end for;
> reps;
[
    Id(G),
    (1, 2, 7, 5)(3, 8, 6, 10)(4, 12, 14, 9)(11, 16, 13, 15),
    (1, 7)(2, 5)(3, 6)(4, 14)(8, 10)(9, 12)(11, 13)(15, 16),
    (1, 8)(2, 6)(3, 5)(4, 15)(7, 10)(9, 13)(11, 12)(14, 16),
]
> #reps;
4
```

So there will be at least $4$ prime ideals over $43$ in $k$:

```magma
> L := [ ];
> for i in reps do
>   Append(~L, kM meet KrM !! Map(i)(P43));
> end for;
> [ IsPrime(x) : x in L];
[ true, true, true, true ]
> LL := Decomposition(kM, 43);#LL;
4
> [ Position(L, x[1]) : x in LL];
[ 4, 3, 1, 2 ]
```

<a id="function-frobeniuselement-fldnum-rngintelt"></a>
#### `FrobeniusElement(K, p): FldNum, RngIntElt -> GrpPermElt`

Compute a Frobenius element at $p$ in the Galois group of the Galois closure of $K$. This is a permutation on the roots of a polynomial defining $K$, which can be recovered as `DefiningPolynomial(A)` for any Artin representation $A$ of $K$; the Frobenius element is well-defined up to conjugacy and modulo inertia.

<a id="example-ex-87fbb9"></a>
#### `Example: Frobenius Elements in a Galois Group (ex-87fbb9)`

We take a polynomial whose Galois group is $D_5$ and compute Frobenius elements at $p=2$ and $p=5$. They in two different conjugacy classes of 5-cycles in the Galois group.

```magma
> load galpols;
> f:=PolynomialWithGaloisGroup(5,2);
> assert IsIsomorphic(GaloisGroup(f),DihedralGroup(5));
> K:=NumberField(f);
> FrobeniusElement(K,2);
(1, 5, 4, 3, 2)
> FrobeniusElement(K,5);
(1, 3, 5, 2, 4)
```

<a id="galois"></a>
<a id="rngord-galoisgroup-main"></a>
### Galois Groups

Finding Galois groups (of normal closures) of algebraic fields is a hard problem, in general. All practical currently-used algorithms fall into two groups: The absolute resolvent method [[SM85](https://docs.magma-maths.org/references.md#cite-mk2)] and the method of Stauduhar [[Sta73](https://docs.magma-maths.org/references.md#cite-stau)].

The Magma implementation is based on an extension of the method of Stauduhar by [[Gei03](https://docs.magma-maths.org/references.md#cite-geissler), [GK00](https://docs.magma-maths.org/references.md#cite-gk1)] and recent work by Klüners and Fieker [[FK14](https://docs.magma-maths.org/references.md#cite-fieker-galois)], Elsenhans [[Els12](https://docs.magma-maths.org/references.md#cite-elsenhans-paper), [Els14](https://docs.magma-maths.org/references.md#cite-elsenhans-short), [Els16](https://docs.magma-maths.org/references.md#cite-elsenhans-improved-relative-invariants)], and Sutherland [[Sut15](https://docs.magma-maths.org/references.md#cite-suth-galois)].

For polynomials over ${\mathbb{Z}}, {\mathbb{Q}}$, number fields and global function fields and irreducible polynomials over function fields over ${\mathbb{Q}}$, Magma is able to compute the Galois group without any a-priori restrictions on the degree. Note, however, that the running time and memory constraints can make computations in degree $>50$ impossible, although computations in degree $>200$ have been successful as well. In contrast to the absolute resolvent method, it also provides the explicit action on the roots of the polynomial $f$ which generates the algebraic field. On demand, the older version which is restricted to a maximum degree of $23$, is still available.

Roughly speaking, the method of Stauduhar traverses the subgroup lattice of transitive permutation groups of degree $n$ from the symmetric group to the actual Galois group. This is done by using so-called relative resolvents. Resolvents are polynomials whose splitting fields are subfields of the splitting field of the given polynomial which are computed using approximations of the roots of the polynomial $f$.

If the field (or the field defined by a polynomial) has subfields (i.e. the Galois group is imprimitive) the current implementation changes the starting point of the algorithm in the subgroup lattice, to get as close as possible to the actual Galois group. This is done via computation of subfields of a stem field of $f$, that is the field extension of ${\mathbb{Q}}$ which we get by adjoining a root of $f$ to ${\mathbb{Q}}$. Using this knowledge of the subfields, the Galois group is found as a subgroup of the intersection of suitable wreath products which may be easily computed. This intersection is a good starting point for the algorithm.

If the field (or the field defined by a polynomial) does not have subfields (i.e. the Galois group is primitive) we use a combination of the method of Stauduhar and the absolute resolvent method. The Frobenius automorphism of the underlying $p$-adic field or the complex conjugation, when using complex approximations of the roots of the polynomial $f$, already determines a subgroup of the Galois group, which is used to speed up computations in the primitive case.

<a id="function-rngord-galoisgroup"></a>
#### `GaloisGroup(f): RngUPolElt[RngInt] -> GrpPerm, SeqEnum, GaloisData`

<a id="function-galoisgroup-rngupolelt-fldrat"></a>
#### `GaloisGroup(f): RngUPolElt[FldRat] -> GrpPerm, SeqEnum, GaloisData`

<a id="function-galoisgroup-rngupolelt-fldalg"></a>
#### `GaloisGroup(f): RngUPolElt[FldAlg] -> GrpPerm, SeqEnum, GaloisData`

<a id="function-galoisgroup-rngupolelt-rngord"></a>
#### `GaloisGroup(f): RngUPolElt[RngOrd] -> GrpPerm, SeqEnum, GaloisData`

```magma
Prime      : RngElt                         Default: 
ShortOK    : BoolElt                        Default: false
Ring       : GaloisData                     Default: 
NextPrime  : UserProgram                    Default: 
GaloisGroup: Verbose                        Default: 5
Invariant  : Verbose                        Default: 3
```

Given a polynomial $f$ over the integers, rationals, a number field, or an order thereof, compute the Galois group of a splitting field for $f$, ie. determine the subgroup of the permutations of the roots of $f$ in a splitting field that correspond to field automorphisms. The method applied here is a variant of Stauduhar’s algorithm, but with no dependency on the explicit classification of transitive groups and thus no a-priori degree limitation. It must be stated though that this function does not return proven results, if such results are necessary, one needs to call [`GaloisProof`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisproof) afterwards.

Along with the Galois group of a splitting field for $f$, the roots of $f$, scaled to be algebraic integers, in a local splitting field and a `GaloisData` structure are returned.

The prime to use for splitting field computations can be given via the parameter `Prime`. The method of choosing of primes for splitting field computations can be given by the parameter `NextPrime`. If the `Prime` given ramifies and the polynomial is defined over the rationals, the computation will be done in an expensive ramified splitting field. If the polynomial is not defined over the rationals, an unramfied one larger than that given will be chosen.

If a `GaloisData` structure has been computed for this polynomial it can be provided in `Ring`. If `ShortOK` is set to `true` then the results of a descent using short cosets [[Els14](https://docs.magma-maths.org/references.md#cite-elsenhans-short)] will be assumed to be as reliable as a descent which did not use short cosets.

<a id="function-iseasysnan-rngupolelt"></a>
#### `IsEasySnAn(f): RngUPolElt -> RngIntElt`

```magma
Trials              : RngIntElt                    Default: 50
AssumeIrreducibility: BoolElt                      Default: false
Rigorous            : BoolElt                      Default: true
```

Given a rational polynomial $f$, attempt some cheap tests to determine if the Galois group is easily determinable as $S_n$ or $A_n$. Returns 1 if $S_n$ is proven, 2 is $A_n$ is proven, and 0 otherwise. The computation is done by factoring reductions modulo $p$ and an inspection of the discriminant (if necessary). If `Rigorous` is set to `false`, the discriminant will not be computed.

<a id="function-rngord-galoisgroup-fld"></a>
#### `GaloisGroup(K): FldNum -> GrpPerm, SeqEnum, GaloisData`

<a id="function-galoisgroup-fldnum-fldrat"></a>
#### `GaloisGroup(K): FldNum[FldRat] -> GrpPerm, SeqEnum, GaloisData`

<a id="function-galoisgroup-fldnum-fldnum-fldrat"></a>
#### `GaloisGroup(K): FldNum[FldNum[FldRat]] -> GrpPerm, SeqEnum, GaloisData`

```magma
Prime      : RngElt                         Default: 
ShortOK    : BoolElt                        Default: false
Ring       : GaloisData                     Default: 
NextPrime  : UserProgram                    Default: 
Current    : BoolElt                        Default: false
Subfields  : BoolElt                        Default: true
Deflation  : BoolElt                        Default: false
Old        : BoolElt                        Default: false
Type       : MonStgElt                      Default: "p-Adic"
Prec       : RngIntElt                      Default: 20
Time       : BoolElt                        Default: true
GaloisGroup: Verbose                        Default: 5
Invariant  : Verbose                        Default: 3
```

Given a number field $K$, compute the Galois group of a normal closure of $K$. The group is returned as an abstract permutation group acting on the roots of the defining polynomial of $K$ in a suitable splitting field. The method applied here is a variant of Stauduhar’s algorithm, but with no dependency on the explicit classification of transitive groups and thus no a-priori degree limitation. It must be stated though that this function does not return proven results, if such results are necessary, one needs to call [`GaloisProof`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisproof) afterwards.

Along with the Galois group of a splitting field for $K$, the roots of the defining polynomial of $K$, scaled to be algebraic integers, in a local splitting field and a `GaloisData` structure are returned.

The prime to use for splitting field computations can be given via the parameter `Prime`. The method of choosing of primes for splitting field computations can be given by the parameter `NextPrime`. If the `Prime` given ramifies in $K$ and $K$ is not an absolute number field then an unramfied one larger than that given will be chosen.

If a `GaloisData` structure has been computed for the defining polynomial it can be provided in `Ring`. If `Old` is set to `true` the older version of [[Gei03](https://docs.magma-maths.org/references.md#cite-geissler), [GK00](https://docs.magma-maths.org/references.md#cite-gk1)] will be used for the computation.

If `Subfields` is set to `false` then the `Subfields` of $K$ will not be used during the computation of the Galois group. If `Current` is set to `true` then the previously computed subfields of $K$ only will be used in the Galois group computation and no more will be computed.

If `Deflation` is set to `true` and the defining polynomial is of the shape $g(X^d)$ for some $d > 1$, not all subfields of $K$ will be computed. Instead, $K$ will be viewed as a degree $d$ radical extension of the subfield $W$ given by $g$. Only the subfields of $W$ will be computed.

If `Type` is set to `"Complex"` then roots of $f$ in the complex field will be used rather than roots of $f$ in a $p$-adic completion. If `Type` is set to `"Complex"`, the parameter `Prec` can be set to the minimum precision required in the roots of $f$.

If `ShortOK` is set to `true` then the results of a descent using short cosets [[Els14](https://docs.magma-maths.org/references.md#cite-elsenhans-short)] will be assumed to be as reliable as a descent which did not use short cosets. If `Time` is set to `true` then the time taken for lifting of roots will be stored in the attribute `Time` of the third return value.

<a id="function-rngord-galoisproof"></a>
#### `GaloisProof(f, S): RngUPolElt, GaloisData -> BoolElt`

<a id="function-galoisproof-fldalg-galoisdata"></a>
#### `GaloisProof(K, S): FldAlg, GaloisData -> BoolElt`

Given the resulting `GaloisData` structure $S$ of a (conditional) computation by `GaloisGroup` for either a polynomial $f$ over the integers or an absolute number field $K$, try to find proofs for the conditional steps of the algorithm. The method employed here is to show that a suitable resolvent polynomial has a factor of a specific degree that can be used to differentiate between the possible groups.

<a id="function-galoisroot-rngupolelt-rngintelt-galoisdata"></a>
#### `GaloisRoot(f, i, S): RngUPolElt, RngIntElt, GaloisData -> RngElt`

<a id="function-rngord-galoisroot"></a>
#### `GaloisRoot(i, S): RngIntElt, GaloisData -> RngElt`

```magma
Prec  : RngIntElt                    Default: 20
Bound : RngIntElt                    Default: 0
Scaled: BoolElt                      Default: true
```

Given a polynomial $f$ (optional) and the resulting `GaloisData` $S$ of a computation of a Galois group, return the $i$th root of $f$ in the ordering obtained from the Galois process or compute the $i$th conjugate of the primitive element used during the computation, to the given precision.

The precision can be specified either directly by setting `Prec` to the desired $p$-adic precision or by giving a bound $B$ in `Bound`. In the latter case the $p$-adic precision $k$ will be calculated such that $p^k > B$. If `Scaled` is set to `false` a root of $f$ is returned. Otherwise the result is a scalar multiple of the root which is an algebraic integer.

<a id="function-galoisgroupconjugation-galoisdata-galoisdata"></a>
#### `GaloisGroupConjugation(S, T): GaloisData, GaloisData -> GrpPermElt`

Given `GaloisData` obtained from two runs of `GaloisGroup` with the same polynomial but different primes, this function returns a permutation of the roots of S that induces an isomorphism of the splitting fields.

<a id="function-galoisautomorphismgroup-fldnum-fldrat"></a>
#### `GaloisAutomorphismGroup(K): FldNum[FldRat] -> GrpPerm, Map`

```magma
Galois: Tup                    Default: false
```

Given a number field $K$, this function returns the automorphism group of the field $K$ as an abstract group and a map that maps group elements to field automorphisms. The computation is done by calling `GaloisGroup` and converting the result. If `GaloisGroup` has been called before, the result can be supplied via `Galois`. This function is also available via `AutomorphismGroup` with the parameter `UseGalois`.

<a id="function-stauduhar-grpperm-grpperm-galoisdata-rngintelt"></a>
#### `Stauduhar(G, H, S, B): GrpPerm, GrpPerm, GaloisData, RngIntElt -> RngIntElt, GrpPermElt, BoolElt, RngSLPolElt`

```magma
GaloisGroup    : Verbose                        Default: 5
Invariant      : Verbose                        Default: 3
AlwaysTransform: BoolElt                        Default: false
Coset          : SeqEnum                        Default: 
PreCompInvar   : UserProgram                    Default: 
```

This function gives access to a single step of the Stauduhar method: Let $G$ be a permutation group known to contain the Galois group of the object under investigation with the numbering of the “roots” determined by $S$. Furthermore, let $B$ be a bound on the absolute value of the complex roots of the object and $H$ be a (maximal) subgroup of $G$. Under these circumstances, the intrinsic will decide if there is some $g\in G$ such that the Galois group is contained in $H^g$. The primary return value can be:

1 if the Galois group is proven to be a subgroup of $H^g$ up to precision problems, indicated by the 3rd value

-1 if there is a proof that the Galois group is contained in a proper subgroup of $G$ and maybe in $H^g$

-2 if the Galois group may be in $H^g$, but we could not prove that it is in a proper subgroup of $G$

0 the Galois group is not contained in a conjugate of $H$.

In case of a non-zero result, the second return value will be the element $g$ conjugating $H$, the third value will be `true` or `false`, depending on whether the $p$-adic bound used were proven or heuristic and the fourth value is the invariant used to separate the groups.

The optional parameter `Coset` can be used to pass a transversal of $G/H$ in, while `PreCompInvar` should contain a suitable invariant separating $G$ and $H$ if set. If `AlwaysTransform` is set to `true` then a transformation will always be applied to the roots.

<a id="function-isint-rngelt-rngintelt-galoisdata"></a>
#### `IsInt(x, B, S): RngElt, RngIntElt, GaloisData -> BoolElt, RngElt`

Given an element $x$ in the splitting field determined by the `GaloisData` structure $S$ and a bound $B$ on the complex absolute value, determine if there exists an element $y \in {\mathbb{Z}}$ or an extension of ${\mathbb{Z}}$ defined by the polynomial the Galois group is being computed for, such that $y=x$ up the precision of $x$ and such that $|y|<B$. In case such a $y$ exists, it is returned as a second return value.

<a id="example-ex-cc334e"></a>
#### `Example: Galois Group of a Sextic Polynomial (ex-cc334e)`

A Galois group computation is shown below.

```magma
> Z:= Integers();
> P<x>:= PolynomialRing(Z);
> G, R, S := GaloisGroup(x^6-108);
> G;
Permutation group G acting on a set of cardinality 6
Order = 6 = 2 * 3
    (1, 5, 3)(2, 6, 4)
    (1, 2)(3, 6)(4, 5)
> R;
[ -58648*$.1 + 53139 + O(11^5), 58648*$.1 - 19478 +
O(11^5), -43755*$.1 - 72617 + O(11^5), 58648*$.1 -
    53139 + O(11^5), -58648*$.1 + 19478 + O(11^5),
    43755*$.1 + 72617 + O(11^5) ]
> S;
GaloisData over Z_11

> time G, _, S := GaloisGroup(x^32-x^16+2);
Time: 65.760
> #G;
2048
```

Some examples for the relative case

```magma
> load galpols;
> f := PolynomialWithGaloisGroup(9, 14);
> G := GaloisGroup(f);
> TransitiveGroupIdentification(G);
14 9
> M := MaximalOrder(f);
> kM := FieldOfFractions(M);
> f:= Factorisation(Polynomial(kM, f))[2][1];
> f;
$.1^8 + (-2/1*kM.1 + kM.2)*$.1^7 + (-60/1*kM.1 -
    2/1*kM.2 + kM.3)*$.1^6 + (120/1*kM.1 - 60/1*kM.2 -
    2/1*kM.3 + kM.4)*$.1^5 + (980/1*kM.1 + 120/1*kM.2 -
    60/1*kM.3 - 2/1*kM.4 + kM.5)*$.1^4 + (-1808/1*kM.1
    + 980/1*kM.2 + 120/1*kM.3 - 60/1*kM.4 - 2/1*kM.5 +
    kM.6)*$.1^3 + (-4012/1*kM.1 - 1808/1*kM.2 +
    980/1*kM.3 + 120/1*kM.4 - 60/1*kM.5 - 2/1*kM.6 +
    kM.7)*$.1^2 + (4936/1*kM.1 - 4013/1*kM.2 -
    1809/1*kM.3 + 979/1*kM.4 + 118/1*kM.5 - 60/1*kM.6 -
    4/1*kM.7 + 3/1*kM.8)*$.1 - 208769062021/1*kM.1 +
    51146604497/1*kM.2 - 30878218588/1*kM.3 +
    50063809507/1*kM.4 - 52067647419/1*kM.5 -
    94281823910/1*kM.6 + 69906801827/1*kM.7 -
    182364865509/1*kM.8 + 214706745867/1*kM.9
> g, r, p:= GaloisGroup(f);
> TransitiveGroupIdentification(g);
5 8
```

Since $g$ is derived from a factor of the original $f$, the Galois group should be isomorphic to a subgroup of $G$:

```magma
> Subgroups(G:OrderEqual := #g);
Conjugacy classes of subgroups
------------------------------

[1]     Order 8            Length 9
        Permutation group acting on a set of
        cardinality 9
        Order = 8 = 2^3
            (2, 4, 5, 3)(6, 8, 7, 9)
            (2, 7, 5, 6)(3, 9, 4, 8)
            (2, 5)(3, 4)(6, 7)(8, 9)
> IsIsomorphic(g, $1[1]`subgroup);
true Homomorphism of GrpPerm: g, Degree 8, Order 2^3
into GrpPerm: $, Degree 9, Order 2^3 induced by
    (1, 2, 3, 8)(4, 5, 6, 7) |--> (2, 4, 5, 3)(6, 8, 7, 9)
    (1, 7, 3, 5)(2, 6, 8, 4) |--> (2, 7, 5, 6)(3, 9, 4, 8)
```

#### Straight-line Polynomials

One of the most important tools in the computational Galois theory are invariants, that is multivariate polynomials that are invariant under some permutation group. While invariant theory in general is a rich and classical branch of mathematics, and is supported by a powerful magma module, Chapter [Invariant Theory](https://docs.magma-maths.org/CommutativeAlgebra/InvariantTheory/index-invariant-theory.md#invar-rings), the more specific needs in the Galois theory are best met with a different set of functions. Invariants, in this chapter are multivariate polynomials in straight-line representation, the polynomials are represented as programs without branches. The category of these polynomials is of type `RngSLPol` and its elements are of type `RngSLPolElt`. A consequence of this representation is that certain operations are very fast, while others are impossible - or at least very difficult. For example, representing $(a-b)^{1000}(a+b)^{1000} - (a^2-b^2)^{1000}$ is trivial, this is a short program with just a few steps:

**1**
subtract $b$ from $a$

**2**
raise to the 1000th power

**3**
add $a$ and $b$

**4**
raise to the 1000th power

**5**
multiply the results of steps $2$ and $4$

**6**
subtract $b^2$ from $a^2$ and raise to the 1000th power

**7**
subtract the result of step $7$ from $5$

Now, while it is trivial to evaluate this polynomial at, for example, any pair of elements in any finite ring, it is very difficult to see that, in fact, the polynomial is identical to zero – when expanded as a polynomial.

<a id="function-slpolynomialring-rng-rngintelt"></a>
##### `SLPolynomialRing(R, n): Rng, RngIntElt -> RngSLPol`

```magma
Global: BoolElt                    Default: false
```

Creates the ring of multivariate straight-line polynomials over the ring $R$ with $n$ indeterminates. If `Global` is set to `true` then an existing straight-line polynomial ring will be returned if one has previously constructed.

<a id="function-name-rngslpol-rngintelt"></a>
##### `Name(R, i): RngSLPol, RngIntElt -> RngSLPolElt`

<a id="operation-operation-rngslpol-rngintelt-rngslpolelt"></a>
##### `R . i: RngSLPol, RngIntElt -> RngSLPolElt`

Return the $i$th indeterminate of the SL-polynomial ring $R$.

<a id="function-elementarysymmetricpolynomial-rngslpol-rngintelt"></a>
##### `ElementarySymmetricPolynomial(R, i): RngSLPol, RngIntElt -> RngSLPolElt`

The $i$-th elementary symmetric polynomial of the SL-polynomial ring $R$.

<a id="function-basering-rngslpol"></a>
##### `BaseRing(R): RngSLPol -> Rng`

<a id="function-coefficientring-rngslpol"></a>
##### `CoefficientRing(R): RngSLPol -> Rng`

Return the coefficient ring of the SL-polynomial ring $R$.

<a id="function-rank-rngslpol"></a>
##### `Rank(R): RngSLPol -> RngIntElt`

Return the rank of the SL-polynomial ring $R$, ie the number of independent indeterminates over the coefficient ring.

<a id="procedure-setevaluationcomparison-rngslpol-fldfin-rngintelt"></a>
##### `SetEvaluationComparison(R, F, n): RngSLPol, FldFin, RngIntElt`

For a SL-polynomial ring $R$, prepare “probabilistic” comparison of straight-line polynomials, using evaluation at $n$ tuples drawn at random from the finite field $F$.

In order to allow a probabilistic test for “equality” of SL-polynomials in places where a strict, deterministic test is not necessary, this allows comparison of SL-polynomials through their values at random evaluation points.

<a id="function-getevaluationcomparison-rngslpol"></a>
##### `GetEvaluationComparison(R): RngSLPol -> FldFin, RngIntElt`

Return the finite field and the number of random samples used to compare polynomials of the SL-polynomial ring $R$. If `SetEvaluationComparison` has not been called, the 1st return value will be `false` while the second is undefined.

<a id="procedure-slpol-init-eval"></a>
##### `InitializeEvaluation(R, S): RngSLPol, [RngElt]`

Store the point to evaluate straight line polynomials with parent $R$ to contain the elements of the sequence $S$ whose length is the rank of $R$ and whose elements are coercible into $R$.

<a id="operation-op-times-rngslpolelt-rngslpolelt"></a>
##### `x * y: RngSLPolElt, RngSLPolElt -> RngSLPolElt`

<a id="operation-op-plus-rngslpolelt-rngslpolelt"></a>
##### `x + y: RngSLPolElt, RngSLPolElt -> RngSLPolElt`

<a id="operation-op-minus-rngslpolelt-rngslpolelt"></a>
##### `x - y: RngSLPolElt, RngSLPolElt -> RngSLPolElt`

<a id="operation-operation-rngslpolelt-rngslpolelt"></a>
##### `- x: RngSLPolElt -> RngSLPolElt`

<a id="function-derivative-rngslpolelt-rngintelt"></a>
##### `Derivative(x, i): RngSLPolElt, RngIntElt -> RngSLPolElt`

The $i$th partial derivative of the SL-polynomial $x$.

<a id="function-evaluate-rngslpolelt"></a>
##### `Evaluate(f): RngSLPolElt -> RngElt`

<a id="function-evaluate-rngslpolelt-rngelt"></a>
##### `Evaluate(f, S): RngSLPolElt, [RngElt] -> RngElt`

<a id="function-evaluate-rngslpolelt-rngelt-map"></a>
##### `Evaluate(f, S, m): RngSLPolElt, [RngElt], Map -> RngElt`

Return the evaluation of the straight-line polynomial $f$ at the elements of the sequence $S$ where $S$ contains the rank of the parent of $f$ many elements coercible into the coefficient ring of $f$ and if not given as an argument to this intrinsic is the sequence which was last input to [`InitializeEvaluation`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#procedure-slpol-init-eval). The map $m$ from the coefficient ring of $f$ into the universe of $S$ can be specified if required.

#### Invariants

At the core of the computation of Galois groups is the single Stauduhar step where, for a group $G$ and a (maximal) subgroup $U$ the programme decides if the Galois group is a subgroup of $U$ - provided it was contained in $G$. This is achieved by evaluating a $G$-relative $U$-invariant polynomial $f\in {\mathbb{Z}}[x_1, \ldots, x_n]$ (or $f \in {\mathbb{F}}_q[t][x_1, \ldots, x_n]$ when the characteristic of the coefficient ring of the input polynomial is prime). In this subsection several functions are collected that allow a user to access Magma’s internally used invariants. In what follows, an invariant is always a multivariate polynomial $f$ in $n$ indeterminates where $n$ is the degree of $G$ i.e. $G<S_n$. Invariants are represented as straight-line polynomials that allow the very compact representation and fast evaluation of polynomials.

<a id="function-rngord-galoisgroupinvariant"></a>
##### `GaloisGroupInvariant(G, H): GrpPerm, GrpPerm -> RngSLPolElt`

```magma
DoCost     : BoolElt                      Default: false
Worklevel  : RngIntElt                    Default: -1
GaloisGroup: Verbose                      Default: 3
```

For subgroups $H<G$ of the symmetric group on $n$ elements, where $H$ is maximal in $G$ and $G$ is transitive, compute a $G$-relative $H$-invariant. This is done by carefully comparing certain group theoretical properties of the group pair in question to find invariant polynomials of special types that are easy to evaluate. If this fails, generic invariants will be used.

If `DoCost` is `true`, two values are returned: the first return value in this case is an estimate for the number of multiplications necessary to evaluate the invariant, while the second value is a function that can be evaluated without arguments to compute the invariant. This is done to allow to compare invariants by their computational complexity before actually committing and computing them explicitly as this can be very time consuming.

If `Worklevel` is set to an integer different from $-1$ only certain types of invariants are tested for suitability for this particular pair of groups. In this case a special return value of `false` indicates that Magma was unable to find an invariant at this level. Roughly speaking, the higher the `Worklevel`, the more time-consuming the invariant will be, both in terms of the time spend in finding as well as the time necessary to evaluate the invariant.

<a id="function-rngord-relativeinvariant"></a>
##### `RelativeInvariant(G, H): GrpPerm, GrpPerm -> RngSLPolElt`

```magma
IsMaximal: BoolElt                    Default: false
Risk     : BoolElt                    Default: false
Invariant: Verbose                    Default: 3
```

For a pair of subgroups $H<G$ of the symmetric group where $H$ is not necessarily maximal in $G$, find a $G$-relative $H$-invariant polynomial. The computation splits into three phases:

\- First, a subgroup chain between $H$ and $G$ is computed such that each step in the chain is a maximal subgroup.

\- Second, for each pair $U_i<U_{i+1}$ of maximal subgroups one fixed invariant is computed

\- Third, in the last step, the invariants are combined to produce a $G$-relative $H$-invariant.

If `IsMaximal` is set to `true`, Magma will not compute a subgroup chain but instead assume that $H$ is a maximal subgroup of $G$. Otherwise Magma will compute all minimal overgroups of $H$ in $G$ and call [`GaloisGroupInvariant`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroupinvariant) for each of them. Finally, Magma will combine these invariants to a relative one.

The parameter `Risk` refers to an old version of the function and does not have an effect.

<a id="function-combineinvariants-rng-grpperm-tup-grpperm-rngslpolelt-tup-grpperm-rngslpolelt-grpperm"></a>
##### `CombineInvariants(R, G, H1, H2, H3): Rng, GrpPerm, Tup<GrpPerm, RngSLPolElt>, Tup<GrpPerm, RngSLPolElt>, GrpPerm -> RngSLPolElt`

Given a subgroup $G<S_n$ and three maximal subgroups $H_1$, $H_2$, and $H_3$ of $G$ two of which have already known invariants, try to derive an invariant for $H_3$ from the known ones over the ring $R$ (usually $\Z$). The input for $H_1$ and $H_2$ consists of a tuple with two (or three) entries, the first specifying the actual subgroup, the second the $G$-relative $H_i$-invariant, and the optional third a Tschirnhaus transformation that should be done before the invariant is evaluated.

The typical situation in which this function is used is the case of $H_1$ and $H_2$ being index $2$ subgroups of $G$. In this case elementary theory immediately guarantees a third subgroup $H_3$ of index $2$. For this function to work, the core of $H_1 \cap H_2$ must be contained in $H_3$. This is only useful if the index of the core is not too large.

<a id="function-isinvariant-rngslpolelt-grppermelt"></a>
##### `IsInvariant(F, p): RngSLPolElt, GrpPermElt -> BoolElt`

```magma
Sign: BoolElt                    Default: false
```

For a multivariate polynomial $F$ in straight-line representation and a permutation $p$ this function tests if $F^p = F$ with a high probability. In particular, this function will evaluate $F$ at random elements in some large finite field, then permute the evaluation points by $p$ and evaluate again. If the values agree, the polynomial is most likely invariant under $p$, if they disagree than the polynomial is definitely not invariant. The probability of failure is related to the probability of guessing a zero of a multivariate polynomial at random.

In order to get a proof for the invariants, one can convert $F$ into a standard multivariate polynomial and check directly that this is invariant. However, for the invariants typically constructed in the Galois package, the conversion into a multivariate polynomial will not be possible due to the large degree of the polynomial and the resulting large number of terms.

If `Sign` is set to `true`, the function checks instead for $F^p = -F$.

<a id="function-bound-rngslpolelt-rngintelt"></a>
##### `Bound(I, B): RngSLPolElt, RngIntElt -> RngIntElt`

Given a multivariate polynomial $I$ in straight-line representation and an integer $B$, compute an integer $M$ such that

$$
|I(x_1, \ldots, x_n)|\le M
$$

for all complex numbers $|x_i|\le B$. This returns a bound for the size of an evaluation of $I$.

<a id="function-bound-rngslpolelt-rngelt"></a>
##### `Bound(I, B): RngSLPolElt, RngElt -> RngElt`

Given a multivariate polynomial $I$ in straight-line representation and $B$, a power series over the integers, compute a power series $M$ such that for all choices of power series $x_i$ such that the coefficients of $x_i$ are bounded in absolute value by those of $B$ we have that the power series

$$
I(x_1, \ldots, x_n)
$$

has coefficients bounded by those of $M$.

<a id="function-prettyprintinvariant-rngslpolelt"></a>
##### `PrettyPrintInvariant(I): RngSLPolElt -> MonStgElt`

Prints the straight-line polynomial $I$ into a string. The printing shows the way the polynomial is stored internally. E.g. the reuse of subexpressions gets visible.

#### Subfields and Subfield Towers

The result of a Galois group computation contains, in addition to the Galois group as an abstract group, the explicit action of the group on the roots of the underlying polynomial in some splitting field. This explicit action, together with the availability of invariants for group pairs, can be used to compute arbitrary subfields of the splitting field.

<a id="function-galoissubgroup-fldnum-grpperm"></a>
##### `GaloisSubgroup(K, U): FldNum, GrpPerm -> RngUPolElt, RngSLPolElt`

<a id="function-rngordgal-galoissubgroup"></a>
##### `GaloisSubgroup(S, U): GaloisData, GrpPerm -> RngUPolElt, RngSLPolElt`

<a id="function-galoissubgroup-rngupolelt-grpperm"></a>
##### `GaloisSubgroup(f, U): RngUPolElt, GrpPerm -> RngUPolElt, RngSLPolElt`

```magma
Invariant: Verbose                    Default: 2
```

Given either a polynomial $f$ or number field $K$ or a successful computation of a Galois group in $S$ and a subgroup $U<G$ where $G$ is the Galois group, find a defining polynomial for the subfield of the splitting field that is fixed by $U$ and return also a $G$-relative $U$-invariant.

<a id="function-galoissibling-hom"></a>
##### `GaloisSibling(S, phi): GaloisData, Map -> RngUPolElt, RngSLPolElt, RngUPolElt`

Given a map $\varphi$ with domain the Galois group associated to $S$ and a transitive permutation group as image, this function returns a resolvent with Galois group $\operatorname{im}(\varphi)$. It also returns the relative invariant and the transformation used.

<a id="function-relativeresolvent-grpperm"></a>
##### `RelativeResolvent(S, U): GaloisData, GrpPerm -> RngUPolElt, RngSLPolElt, RngUPolElt`

Given a subgroup $U$ of the Galois group $G$ associated to $S$, this function returns a relative resolvent for the groups $U<G$. It also returns the relative invariant and the transformation used.

<a id="function-galoisquotient-fldnum-grpperm"></a>
##### `GaloisQuotient(K, Q): FldNum, GrpPerm -> SeqEnum[RngUPolElt]`

<a id="function-galoisquotient-rngupolelt-grpperm"></a>
##### `GaloisQuotient(f, Q): RngUPolElt, GrpPerm -> SeqEnum[RngUPolElt]`

<a id="function-galoisquotient-galoisdata-grpperm"></a>
##### `GaloisQuotient(S, Q): GaloisData, GrpPerm -> SeqEnum[RngUPolElt]`

```magma
Invariant: Verbose                    Default: 2
```

Given either a polynomial $f$ or number field $K$ or a successful computation of a Galois group in $S$ and a permutation group $Q$, find all subfields of the splitting field that have a Galois group isomorphic to $Q$. The defining polynomials of these subfields are returned. This is done by finding all subgroups $U$ of the Galois group $G$ such that the permutation action of $G$ on the cosets $G/U$ is isomorphic to $Q$.

<a id="function-galoissubfieldtower-galoisdata-grpperm"></a>
##### `GaloisSubfieldTower(S, L): GaloisData, [GrpPerm] -> FldNum, [Tup<RngSLPolElt, RngUPolElt, [GrpPermElt]>], UserProgram, UserProgram`

```magma
Risk       : BoolElt                          Default: false
MinBound   : RngIntElt                        Default: 1
MaxBound   : RngIntElt                        Default: Infinity()
Inv        : [RngSLPolElt]                    Default: false
GaloisTower: Verbose                          Default: 2
```

For data computed as the third return value of [`GaloisGroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroup) and a subgroup chain $U_1 > U_2 > \ldots > U_s$, compute the corresponding tower of fixed fields $K_i$ that is fixed by the operation of $U_i$ on the roots of $f$ as ordered in $S$.

Currently, this function only works for polynomials defined over ${\mathbb{Q}}, {\mathbb{F}}_q[t]$ or absolute extensions of ${\mathbb{Q}}$.

The first return value is the largest number field in the tower, that is the field fixed by the smallest group in the chain as an extension of the fixed field of the second group which is an extension of the fixed field of the third group etc. The second return value is a sequence of tuples each containing the data used to generate one step:

\- The first item is the invariant used in this step. This corresponds directly to the choice of the primitive element.

\- The second item is the Tschirnhaus transformation on this level

\- The third item is a transversal of $U_i$ over $U_{i+1}$, the fixed ordering of which gives the ordering of the “relative conjugates”

The third and fourth return values can be used to algebraically identify arbitrary elements of the splitting field that are defined by multivariate polynomials. The third is a function that takes a vector of $p$-adic conjugates and returns an algebraic representation of the element, the fourth takes an invariant and computes precision bounds for the precision necessary so that the algebraic recognition will work.

If `Risk` is set to `true`, then for non-maximal subgroup pairs $U_i> U_{i+1}$ the “risky” version of [`RelativeInvariant`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-relativeinvariant) is used.

The parameter `MinBound` can be used to specify a minimal $p$-adic precision that should be used internally. This can be used to avoid the calculation of an increase in precision which can be costly. On the other hand, to work in larger precision than necessary also incurs a time penalty.

The parameter `MaxBound` can be used to limit the $p$-adic precision used internally. Especially when the chain get longer, the internally used precision estimates become more and more pessimistic thus forcing higher and higher precision. In certain cases when it is possible to verify the correctness of the result independently, a smaller precision can speed the computation up considerably.

If the parameter `Inv` is given it should contain a sequence of invariants, the $i$-th entry need be an $U_i$ relative $U_{i+1}$ invariant. The invariants used correspond almost directly to the relative primitive elements computed at each step in the tower. This is useful in situation where either certain primitive elements are necessary or where certain invariants are known.

<a id="function-galoissplittingfield-rngupolelt"></a>
##### `GaloisSplittingField(f): RngUPolElt -> FldNum, [FldNumElt], GrpPerm, [[FldNumElt]]`

```magma
Galois : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
Roots  : BoolElt                                               Default: true
AllAuto: BoolElt                                               Default: false
Stab   : BoolElt                                               Default: true
Chain  : [GrpPerm]                                             Default: false
Inv    : [RngSLPolElt]                                         Default: false
Name   : MonStgElt                                             Default: false
```

For a polynomial $f$ in ${\mathbb{Z}}[t]$, ${\mathbb{Q}}[t]$ or over an absolute number field or ${\mathbb{F}}_q[t]$, this function computes the splitting field of $f$ as a tower of fields. The various parameter can be used to force certain subfield towers and/ or compute additional data. By default `Stab` is set to `true`, which means that the splitting field will be the tower corresponding to the chain of stabilizers of $\{1\}$, $\{1,2\}$, $\ldots$, $\{1, \ldots, n\}$. Also by default `Roots` is set to `true`, which means that the roots of $f$ are expressed as elements of the splitting field. If `Roots` is set to `false`, only the field is computed and returned.

The third return value will be the Galois group, the optional fourth value the automorphisms.

If the parameter `Galois` is used, it should contain a list or triplet containing the output of `GaloisGroup(f);`.

If `Chain` is set to a sequence of subgroups, this chain is used to compute a subfield tower. In this case the first elements must be $G$, the full Galois group. If `Chain` is used, `Inv` can be used to provide the invariants as well.

If `AllAuto` is set to `true`, the full automorphism group of the splitting field is computed as a sequence of sequences giving the all the roots of the relative polynomials.

If `Name` is given, it should be set to a string. In this case the primitive element of the $i$-subfield in the tower will be called `Name.i`.

<a id="example-ex-4f61da"></a>
##### `Example: Galois Splitting Field of a Cubic (ex-4f61da)`

We start with a small example, to illustrate some of the parameters and their influence:

```magma
> P<x> := PolynomialRing(IntegerRing());
> f := x^3-2;
> GaloisSplittingField(f);
Number Field with defining polynomial $.1^2 +
    $.1*$.1 + $.1^2 over its ground field
[
    $.1,
    $.1,
    -$.1 - $.1
]
Symmetric group acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
> K, R, G := $1;
> K:Maximal;

  K
  |
  |
  $1
  |
  |
  Q

K  : $.1^2 + $.1*$.1 + $.1^2
$1 : x^3 - 2
> [x^3 : x in R];
[
    2,
    2,
    2
]
```

The fact that by default all generators are called `$.1` makes this hard to read, so let us assign other names:

```magma
> GaloisSplittingField(f:Name := "K");
Number Field with defining polynomial K1^2 + K2*K1
    + K2^2 over its ground field
[
    K2,
    K1,
    -K1 - K2
]
Symmetric group G acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
> (K where K := $1):Maximal;

  $1<K1>
    |
    |
  $2<K2>
    |
    |
    Q

$1 : K1^2 + K2*K1 + K2^2
$2 : x^3 - 2
```

So now we can easily see that the splitting field is a relative quadratic extension of the degree $3$ stem field. Now we try a different subgroup chain:

```magma
> G, r, S := GaloisGroup(f);
> GaloisSplittingField(f:Galois := <G, r, S>,
>     Chain := CompositionSeries(G), Name := "K", AllAuto);
Number Field with defining polynomial K1^3 - 2
over its ground field
[
    K1,
    1/6*K2*K1,
    1/6*(-K2 - 6)*K1
]
Symmetric group G acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
[
    [
        K2,
        -K2 - 6
    ],
    [
        K1,
        1/6*K2*K1,
        1/6*(-K2 - 6)*K1
    ]
]
> (K where K := $1):Maximal;

  $1<K1>
    |
    |
  $2<K2>
    |
    |
    Q

$1 : K1^3 - 2
$2 : x^2 + 6*x + 36
```

```magma
> f := x^10 - 20*x^8 + 149*x^6 - 519*x^4 + 851*x^2 - 529;
> G, r, S := GaloisGroup(f);G,r,S;
> TransitiveGroupIdentification(G);
8 10
> TransitiveGroupDescription(G);
[2^4]5
```

Thus the Galois group of $f$ is isomorphic to ${}_10T_8$ of type `[2^4]5` and order $80$.

We first compute the splitting field directly:

```magma
> time _ := SplittingField(f);
```

This takes a long time, mainly because of the type of the Galois group which will require a field tower involving $5$ steps and factorisation of a polynomial in such a tower. Now, we try the same by using the Galois information:

```magma
> time K, R := GaloisSplittingField(f:Name := "K");
Time: 4.740
> K:Maximal;

  K<K1>
    |
    |
  $1<K2>
    |
    |
  $2<K3>
    |
    |
  $3<K4>
    |
    |
    Q

K  : K1^2 + 1/23*(-12*K4^8 + 217*K4^6 - 1374*K4^4
    + 3606*K4^2 - 3381)
$1 : K2^2 + 1/23*(18*K4^8 - 314*K4^6 + 1877*K4^4 -
    4512*K4^2 + 3588)
$2 : K3^2 + 1/23*(-5*K4^8 + 77*K4^6 - 377*K4^4 +
    663*K4^2 - 437)
$3 : x^10 - 20*x^8 + 149*x^6 - 519*x^4 + 851*x^2 -
    529
> [ Evaluate(f, x) eq 0 : x in R];
[ true, true, true, true, true, true, true, true,
true, true ]
```

From the type of the Galois group, `[2^4]5` we expect $G$ to have a normal subgroup $A$ of type $C_2^4$ such that the quotient $G/A$ is a cyclic group of order $5$. To find that subfield we can for example use the Galois computations again:

```magma
> A := NormalSubgroups(G:OrderEqual := 16)[1]`subgroup;
> GaloisSubgroup(S, A);
x^5 + 1682*x^4 + 715964*x^3 + 99797360*x^2 +
    5206504944*x + 88019915488
(x5 + x10)
```

The second return value $x_5+x_{10}$ also tells us that the primitive element of the subfield is the sum of two roots of $f$, namly the 5-th and 10-th in our fixed ordering.

Suppose we want to work in the degree 16 extension over this field, that is we want to work in the fixed field of the trivial subgroup over the field fixed by $A$:

```magma
> K, D, Reco, Bnd := GaloisSubfieldTower(S, [A, sub<G|>]);
> GK := GaloisGroup(K);
> #GK;
16
> AbelianInvariant(GK);
[ 2, 2, 2, 2 ]
```

As an abstract field, $K$ as the splitting field can be described as a quotient of ${\mathbb{Q}}[x_1, \ldots, x_{10}]/I$ for some suitable ideal $I$ also known as the Galois ideal. On the other hand, by tensoring with some $p$-adic complection ${\mathbb{Q}}_p$ we get an embedding of $K$ into $K_p^{\#G}=:\Gamma$. The sequence $D$ that is returned as the 2nd value contains the information necessary to map elements in ${\mathbb{Z}}[x_1, \ldots, x_{10}]$ via $\Gamma$ to $K$. Suppose we want to find $x_1$, ie. a root of $f$ in $K$. We first have to get the $p$-adic image in $\Gamma$, with appropriate precision. Step one is to define a suitable multivariate polynomial $i$ that will represent $x_1$.

The second step is to compute an integer $B$ such that all complex conjugates if $i$ are bounded by $B$ in absolute value. For this we can use information about the size of the roots of $f$ stored in $S$.

The next step now is to get a bound for the $p$-adic precision.

```magma
> R := SLPolynomialRing(Integers(), 10);
> i := R.1;
> B := S`max_comp;
> bound := Bnd(B);
```

Now, we need to get the $p$-adic conjugates of $x_1$, ie. the image in $\Gamma$. The third entry in each of the elements of $D$ contains coset representatives that give the relative conjugates:

```magma
> rt := [GaloisRoot(i, S:Bound := bound) : i in [1..10]];
> con := CartesianProduct(Reverse([x[3]: x in D]));
> gamma := [Evaluate(i, PermuteSequence(rt, &*p)) : p in con];
> im := Reco(gamma: Bound := B);
> time Evaluate(f, im) eq 0;
```

Before we try to find an automorphism of the base field using this method we want to find the primitive element of the base field of $K$. The primitive element is essentially given by the 1st part of $D$. Note that here a Tschirnhaus-transformation was necessary.

```magma
> i := D[1][1]; t := D[1][2];
> B := Bound(i, Evaluate(t, S`max_comp));
> bound := Bnd(B);
> rt := [GaloisRoot(i, S:Bound := bound) : i in [1..10]];
> rt := [Evaluate(t, x) : x in rt];
> gamma := [Evaluate(i, PermuteSequence(rt, &*p)) : p in con];
> im := Reco(gamma : Bound := B);
> im;
$.1
> im eq K.2;
true;
```

Now for the automorphism - all we have to change is to permute the roots as we already have the permutation group.

```magma
> rt := PermuteSequence(rt, Random(G));
> gamma := [Evaluate(i, PermuteSequence(rt, &*p)) : p in con];
> au := Reco(gamma : Bound := B);
> au;
1/92*(-9*$.1^4 + 386*$.1^3 - 5854*$.1^2 + 37120*$.1 - 82288)
```

In order to “find” arbitrary (integral) elements this way one has to

\- define the element as a multivariate polynomial in the roots, $i$

\- with the aid of `Bound` and the knowledge of the complex roots of $f$, find a bound $B$ of the complex embeddings of $i$ and use `Bnd` as above to find a bound $M$ on the $p$-adic precision

\- use the information in $D$ to compute $i$ in $\Gamma$, ie all $p$-adic conjugates in the “correct” ordering

\- use `Reco` to find the algebraic representation.

#### Solvability by Radicals

For a polynomial $f\in{\mathbb{Z}}[t]$ with solvable Galois group it is well known that the roots of $f$ can be expressed as nested radicals. On the other hand no good algorithm is known to achieve this. Here we use the explicit action of the Galois group of $f$ as a permutation group on the $p$-adic roots to compute such a representation.

<a id="function-solvebyradicals-rngupolelt"></a>
##### `SolveByRadicals(f): RngUPolElt -> FldNum, [FldNumElt], [FldNumElt]`

```magma
Prime      : RngIntElt                                             Default: false
Name       : MonStgElt                                             Default: false
Galois     : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
UseZeta_p  : BoolElt                                               Default: false
MaxBound   : RngIntElt                                             Default: Infinity()
GaloisTower: Verbose                                               Default: 3
```

For a polynomial $f\in {\mathbb{Z}}[x], {\mathbb{F}}_q[t][x]$ with solvable Galois group, a splitting field as a tower of radical extensions is computed together with algebraic representations of the roots of $f$ as elements in the splitting field. The third return value contains the non-trivial roots of unity which are used.

If the parameter `Galois` is used, it should contain a list or triplet containing the output of `GaloisGroup(f);`.

If `Prime` is used, and `Galois` is unspecified, the value of `Prime` is passed onto the Galois group computation and can therefore be used to choose the $p$-adic field. If the `Prime` given ramifies in the extensions defined by $f$ then an unramfied one larger than that given will be chosen.

If `UseZeta_p` is set to `true`, then the expression for the roots of $p$ will contain pure radicals and roots of unity. By default, if `UseZeta_p` is `false`, radical expressions for the roots of unit necessary will also be computed.

If `MaxBound` is given, it will be used as an upper bound for the $p$-adic precision used internally. Especially when the radical tower contains many steps, the internally used precision estimates become more and more pessimistic, thus resulting in larger and larger precision.

If `Name` is set to some string, the $i$-th level primitive element in the tower will be called `Name.i`.

<a id="function-cyclictoradical-fldnum-fldnumelt-rngelt"></a>
##### `CyclicToRadical(K, a, z): FldNum, FldNumElt, RngElt -> FldNum, [FldNumElt], [FldNumElt]`

Let $K/k$ be a number field with cyclic automorphism group of order $n$ generated by $K.1 \to a$ and $z$ be a $n$-th root of unity in $k$. This function will return a field $L$ isomorphic to $K$ such that $L$ is a Kummer extension, ie. the defining polynomial for $L$ will be of the form $t^n - b$ for some $b$ in the coefficient field $k$ of $K$. The second returned value contains the roots of $f$ in $L$ while the third return value contains the roots of unity used.

<a id="example-ex-f5133d"></a>
##### `Example: Solving a Polynomial by Radicals (ex-f5133d)`

```magma
> P<x> := PolynomialRing(IntegerRing());
> f := x^6 - x^5 - 6*x^4 + 7*x^3 + 4*x^2 - 5*x + 1;
> K, R := SolveByRadicals(f:Name := "K.");
> K:Maximal;

   K<K.1>
     |
     |
  $1<K.2>
     |
     |
  $2<K.3>
     |
     |
  $3<K.4>
     |
     |
     Q

K  : K.1^3 + 1/2*(3*K.4 - 11)*K.2 + 1/2*(-27*K.4 + 23)
$1 : K.2^2 - 5
$2 : K.3^3 - 228*K.4 + 532
$3 : K.4^2 + 3

> [ Evaluate(f, x) eq 0 : x in R];
[ true, true, true, true, true, true ]
```

Note that every step in the tower defining $K$ is radical, ie. given by an equation of type $x^n-a$.

#### Linear Relations

An important question for various problems is that of finding all linear (additive) relations between the roots of some integral polynomial. While there is a obvious algorithm if the splitting field can be constructed explicitly, there is no obvious way of doing it in general. In this section we provide two algorithms to find those and more general relations and a third that can verify arbitrary relations.

<a id="function-linearrelations-rngupolelt"></a>
##### `LinearRelations(f): RngUPolElt -> Mtrx, GaloisData`

```magma
Proof       : BoolElt                                               Default: true
Galois      : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
UseAction   : BoolElt                                               Default: false
UseLLL      : BoolElt                                               Default: true
Power       : RngIntElt                                             Default: 1
kMax        : RngIntElt                                             Default: Infinity()
LogLambdaMax: RngIntElt                                             Default: Infinity()
```

Given an integral monic polynomial $f$, this function finds a basis for the module of additive relations between the roots of $f$ in some algebraic closure. The ordering of the roots is the same as chosen by the computation of the Galois group of $f$, in fact, the roots used are precisely the ones returned by [`GaloisRoot`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisroot). The output consists of a basis for the relation module encoded in a matrix and the Galois data encoding the ordering of the roots. The algorithm is described in [[dGF07](https://docs.magma-maths.org/references.md#cite-degraaffieker)].

If `Power` is set to an integer larger than one, the module of relations between the powers of the roots is computed.

<a id="function-linearrelations-rngupolelt-rngslpolelt"></a>
##### `LinearRelations(f, I): RngUPolElt, [RngSLPolElt] -> Mtrx, GaloisData`

```magma
Proof       : BoolElt                                               Default: true
Galois      : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
UseAction   : BoolElt                                               Default: false
UseLLL      : BoolElt                                               Default: true
Power       : RngIntElt                                             Default: 1
kMax        : RngIntElt                                             Default: Infinity()
LogLambdaMax: RngIntElt                                             Default: Infinity()
```

Let $f$ be an integral monic polynomial and $\alpha_1$, $\ldots$, $\alpha_n$ be the roots of $f$ in some splitting field in a fixed ordering. The field and the ordering used here are the ones chosen by the computation of the Galois group of $f$. The splitting field $K$ of $f$ be represented as a quotient ${\mathbb{Q}}[x_1, \ldots, x_n]/J$ for some suitable ideal $J$, thus elements in $K$ can be represented as multivariate polynomials in the roots $\alpha_i$. The sequence $I$ that is passed into this function is interpreted to contain elements in $K$ given via the polynomials in $I$. This function computes a basis for the module of relations between the elements represented by $I$. The algorithm is described in [[dGF07](https://docs.magma-maths.org/references.md#cite-degraaffieker)].

<a id="function-verifyrelation-rngupolelt-rngslpolelt"></a>
##### `VerifyRelation(f, F): RngUPolElt, RngSLPolElt -> BoolElt`

```magma
Galois: Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
kMax  : RngIntElt                                             Default: Infinity()
```

Let $f$ be an integral monic polynomial and $\alpha_1$, $\ldots$, $\alpha_n$ be the roots of $f$ in some splitting field in a fixed ordering. The field and the ordering used here are the ones chosen by the computation of the Galois group of $f$. The splitting field $K$ of $f$ be represented as a quotient ${\mathbb{Q}}[x_1, \ldots, x_n]/J$ for some suitable ideal $J$, thus elements in $K$ can be represented as multivariate polynomials in the roots $\alpha_i$. For a polynomial $F$ in the roots of $f$, this function verifies if $F$ evaluated at the roots of $f$ equals zero, ie. if $F$ describes a relation between the roots. The algorithm is described in [[dGF07](https://docs.magma-maths.org/references.md#cite-degraaffieker)].

<a id="example-ex-2acfb0"></a>
##### `Example: Linear Relations among Roots (ex-2acfb0)`

The following example originates in a paper [[BDE+](https://docs.magma-maths.org/references.md#cite-poonen2004)] where, among other things, polynomials are constructed whose roots have a maximal number of linear dependencies. (This example is not extremal.)

```magma
> ST := ShephardTodd(8);
> R := InvariantRing(ST);
> p := PrimaryInvariants(R);
> p;
[
    x1^8 + (-4*i - 4)*x1^7*x2 + 14*i*x1^6*x2^2 + (-14*i +
        14)*x1^5*x2^3 - 21*x1^4*x2^4 + (14*i + 14)*x1^3*x2^5
        - 14*i*x1^2*x2^6 + (4*i - 4)*x1*x2^7 + x2^8,
    x1^12 + (-6*i - 6)*x1^11*x2 + 33*i*x1^10*x2^2 + (-55*i +
        55)*x1^9*x2^3 - 231/2*x1^8*x2^4 + (66*i +
        66)*x1^7*x2^5 + (-66*i + 66)*x1^5*x2^7 -
        231/2*x1^4*x2^8 + (55*i + 55)*x1^3*x2^9 -
        33*i*x1^2*x2^10 + (6*i - 6)*x1*x2^11 + x2^12
]
> res := Resultant(p[1]-2, p[2]-3, 2);
> f4  := Polynomial(Rationals(), UnivariatePolynomial(res));
> bool, f := IsPower(f4, 4);
> bool, f;
true
27/4*x^24 - 135*x^16 + 405*x^12 - 405*x^8 + 162*x^4 - 1
> G, R, S := GaloisGroup(f);
> #G;
192
> rel := LinearRelations(f : Galois := <G, R, S>);
> #rel;
20
```

There are $20$ linear relations between the $24$ roots, that is, they span a vector space of dimension $4$ over ${\mathbb{Q}}$. We demonstrate how to check one of the relations.

```magma
> v := rel[3];
> v;
[ 0, 0, 0, -1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
> IR := SLPolynomialRing(Integers(), 24);
> r := &+ [v[i]*IR.i : i in [1..24]];
> r;
(x7 + ((-1 * x4) + (-1 * x6)))
> VerifyRelation(f, r : Galois := <G, R, S>);
true
```

Next we give a primitive element in the splitting field (of degree 192 over ${\mathbb{Q}}$) such that the ${\mathbb{Q}}$-vector space spanned by all 192 conjugates has dimension $4$. The element is defined as a linear combination of the $24$ roots (most random choices work). We show that the element is primitive by checking that the 192 $p$-adic conjugates are distinct.

```magma
> I := &+ [ (e[n]-1)*IR.n : n in [1..24]] where e is Eltseq(Random(Sym(24)));
> Iorbit := [Apply(g, I) : g in G];
> #{Evaluate(i, R) : i in Iorbit};
192
```

Thus the $192$ conjugates are distinct, and by construction they lie in the linear span of the $alpha_i$, which has dimension $4$ over ${\mathbb{Q}}$ as shown. It is possible to check this directly (i.e. $p$-adically, using the Galois data).

```magma
> time #LinearRelations(f, Iorbit : Galois := <G, R, S>, Proof := false);
188
Time: 645.450
```

One expects most primitive elements of the field not to share this property. We define one by choosing a polynomial $I = x_1 + x_n^2$ that has trivial stabilizer in $G$.

```magma
> exists(n){n : n in [1..24] | #Orbit(G, [1,n]) eq 192}; n;
true
2
> I := IR.1 + IR.n^2;
> Iorbit := [Apply(g, I) : g in G];
> #{Evaluate(i, R) : i in Iorbit};
192
> time #LinearRelations(f, Iorbit : Galois := <G, R, S>, Proof := false);
182
Time: 816.120
```

#### Other

<a id="function-conjugatestopowersums"></a>
##### `ConjugatesToPowerSums(I): [] -> []`

For elements in a sequence $I$, compute the sequence containing the power sums $\sum I_i^j$ for $j=1$, $\ldots$, $\# I$. If $I$ is interpreted to contain the Galois conjugates of some algebraic number (or the roots of some polynomial) then this computed the power sums.

<a id="function-powersumtoelementarysymmetric"></a>
##### `PowerSumToElementarySymmetric(I): [] -> []`

Given a sequence $I$ of elements, interpreted as power sums of some algebraic number $x$, use Newton’s relations to compute the elementary symmetric functions in the conjugates of $x$. In general for this to succeed, the characteristic of the underlying ring needs to be larger than the length of the sequence.

<a id="rngord-subfields-main"></a>
<a id="id1"></a>
### Subfields

This section contains functions for the computation of all subfields of any number field or all subfields of a given degree of a simple absolute algebraic field or a simple relative extension.

These computations are independent of the computation of the Galois groups, but similarly there is no limit on the degrees of the field.

The algorithms used are Klüner’s method as presented in [[Klu95](https://docs.magma-maths.org/references.md#cite-kl1), [Klu97](https://docs.magma-maths.org/references.md#cite-kl2), [Klu98](https://docs.magma-maths.org/references.md#cite-kl3), [KP97](https://docs.magma-maths.org/references.md#cite-klpo1)] and the newer method of Klüners, van Hoeij, and Novocin [[vHKN11](https://docs.magma-maths.org/references.md#cite-vanhoeijklueners)].

<a id="function-subfields-fldalg-rngintelt"></a>
#### `Subfields(K, n): FldAlg, RngIntElt -> [ < FldAlg, Hom > ]`

```magma
Subfields: Verbose                    Default: 4
```

Given a simple absolute algebraic field or a simple relative extension $K$ and an integer $n$ greater than $1$, this function returns a sequence of pairs (2-tuples) containing the subfields of $K$ of degree $n$ together with the embedding homomorphisms of each subfield into $K$. It is possible that the sequence contains isomorphic fields, but the embeddings will be distinct in such a situation.

<a id="function-rngord-subfields"></a>
#### `Subfields(K): FldAlg -> [ < FldAlg, Hom > ]`

```magma
Al       : MonStgElt                    Default: "Default"
Current  : BoolElt                      Default: false
Proof    : RngIntElt                    Default: 1
Subfields: Verbose                      Default: 4
```

Given an algebraic field $K$, this function returns a sequence of pairs (2-tuples) containing the subfields of $K$ (except ${\mathbb{Q}}$) together with the embedding homomorphisms of each subfield into $K$. It is possible that the sequence contains isomorphic fields.

For fields $K$ which are extensions of an algebraic number field the more recent algorithm developed by Klüners and van Hoeij [[vHKN11](https://docs.magma-maths.org/references.md#cite-vanhoeijklueners)] is used. For fields $K$ which are extensions of ${\mathbb{Q}}$, this algorithm can be selected by setting the parameter `Al` to `"KluenersvanHoeij"` or may be chosen by `"Default"` as the optimal algorithm. By default, the `"Klueners"` algorithm is chosen if the defining polynomial of $K$ factors into large degree factors (with respect to the degree of $K$) over the residue field of some prime or the coefficients of the defining polynomial are large, otherwise `"KluenersvanHoeij"` is used which is optimal when the defining polynomial only has small degree factors (with respect to the degree of $K$) over the residue fields of some number of primes, that is, $K$ has a large number of subfields.

#### The Subfield Lattice

Subfields of number fields can also be retrieved in the form of a lattice from which additional information can be discovered.

<a id="function-subfieldlattice-fldnum"></a>
##### `SubfieldLattice(K): FldNum -> SubFldLat`

```magma
Subfields: Verbose                    Default: 4
```

The lattice of subfields of an absolute number field $K$.

<a id="operation-operation-subfldlat-rngintelt"></a>
##### `# L: SubFldLat -> RngIntElt`

The number of fields in the lattice $L$.

<a id="function-representative-subfldlat"></a>
##### `Representative(L): SubFldLat -> SubFldLatElt`

<a id="function-rep-subfldlat"></a>
##### `Rep(L): SubFldLat -> SubFldLatElt`

<a id="function-bottom-subfldlat"></a>
##### `Bottom(L): SubFldLat -> SubFldLatElt`

The bottom element of the subfield lattice $L$ (this corresponds to ${\mathbb{Q}}$).

<a id="function-top-subfldlat"></a>
##### `Top(L): SubFldLat -> SubFldLatElt`

The top element of the subfield lattice $L$ (this corresponds to the original number field).

<a id="function-random-subfldlat"></a>
##### `Random(L): SubFldLat -> SubFldLatElt`

A random element of the subfield lattice $L$.

<a id="operation-op-subfldlat-rngintelt"></a>
##### `L ! n: SubFldLat, RngIntElt -> SubFldLatElt`

<a id="literal-literal-l-n-subfldlat-rngintelt-subfldlatelt"></a>
##### `L[n]: SubFldLat, RngIntElt -> SubFldLatElt`

The $n$-th element of the subfield lattice $L$.

<a id="function-numberfield-subfldlatelt"></a>
##### `NumberField(e): SubFldLatElt -> FldNum`

The number field corresponding to the given subfield lattice element $e$.

<a id="function-embeddingmap-subfldlatelt"></a>
##### `EmbeddingMap(e): SubFldLatElt -> Map`

The mapping from `NumberField(e)` into the top number field of the subfield lattice.

<a id="function-degree-subfldlatelt"></a>
##### `Degree(e): SubFldLatElt -> RngIntElt`

The (absolute) degree of the number field corresponding to the subfield lattice element $e$.

<a id="operation-op-eq-subfldlatelt-subfldlatelt"></a>
##### `e eq f: SubFldLatElt, SubFldLatElt -> BoolElt`

Returns `true` if and only if the subfield lattice elements $e$ and $f$ are equal.

<a id="operation-op-subset-subfldlatelt-subfldlatelt"></a>
##### `e subset f: SubFldLatElt, SubFldLatElt -> BoolElt`

Returns `true` if and only if $e$ is a subfield of $f$.

<a id="operation-op-times-subfldlatelt-subfldlatelt"></a>
##### `e * f: SubFldLatElt, SubFldLatElt -> SubFldLatElt`

The smallest field containing both $e$ and $f$.

<a id="operation-op-meet-subfldlatelt-subfldlatelt"></a>
##### `e meet f: SubFldLatElt, SubFldLatElt -> SubFldLatElt`

The intersection of $e$ and $f$. This is the largest field common to both of them.

<a id="operation-operation-meet-subfldlatelt-subfldlatelt"></a>
##### `&meet S: [ SubFldLatElt ] -> SubFldLatElt`

The intersection of the subfields in the sequence $S$.

<a id="function-maximalsubfields-subfldlatelt"></a>
##### `MaximalSubfields(e): SubFldLatElt -> [ SubFldLatElt ]`

The sequence of maximal subfield lattice elements contained in $e$.

<a id="function-minimaloverfields-subfldlatelt"></a>
##### `MinimalOverfields(e): SubFldLatElt -> [ SubFldLatElt ]`

The sequence of minimal subfield lattice elements containing $e$.

<a id="example-ex-c7abdb"></a>
##### `Example: Subfield Lattice of an Octic Field (ex-c7abdb)`

A subfield lattice is shown.

```magma
> Zx<x> := PolynomialRing(Integers());
> K<a> := NumberField(x^8 - x^4 + 1);
> L := SubfieldLattice(K);
> L;
Subfield Lattice of K
[1] Rational Field
[2] Subfield generated by a root of x^2 - 4*x + 1
[3] Subfield generated by a root of x^2 - 26*x + 241
[4] Subfield generated by a root of x^2 - 10*x + 241
[5] Subfield generated by a root of x^2 + 1
[6] Subfield generated by a root of x^2 - 10*x + 1
[7] Subfield generated by a root of x^2 - 6*x + 1
[8] Subfield generated by a root of x^2 + x + 1
[9] Subfield generated by a root of x^4 + 4*x^2 + 1
[10] Subfield generated by a root of x^4 - x^2 + 1
[11] Subfield generated by a root of x^4 - 8*x^3 + 20*x^2 - 16*x + 1
[12] Subfield generated by a root of x^4 - 4*x^3 + 8*x^2 - 4*x + 1
[13] Subfield generated by a root of x^4 - 6*x^3 + 13*x^2 - 6*x + 1
[14] Subfield generated by a root of x^4 - 4*x^3 + 8*x^2 + 4*x + 1
[15] Subfield generated by a root of x^4 - 2*x^3 + 5*x^2 + 2*x + 1
[16] Subfield generated by a root of x^8 - x^4 + 1
```

Observe that subfields 2, 5, and 8 give the square roots of $2$, $-1$, and $3$, respectively. Since these are incommensurate radicals the field generated by them has degree $8$ and so must be isomorphic to $K$.

```magma
> K2 := AbsoluteField( NumberField([ x^2 + 1, x^2 - 2, x^2 - 3 ]));
> K2;
Number Field with defining polynomial x^8 - 16*x^6 + 88*x^4 + 192*x^2 + 144
over the Rational Field
> IsIsomorphic(K2, K);
true
```

In fact, K is just a “better” version of K2.

```magma
> OptimizedRepresentation(K2);
Number Field with defining polynomial x^8 - x^4 + 1 over the Rational Field
Mapping from: FldNum: K2 to Number Field with defining polynomial x^8 - x^4 + 1
over the Rational Field
```

### Galois Cohomology

Magma has some rudimentary functions to aid computations in Galois cohomology of number fields.

<a id="function-hilbert90-fldnumelt-map-fldnum-fldnum"></a>
#### `Hilbert90(a, M): FldNumElt, Map[FldNum, FldNum] -> FldNumElt`

```magma
S: [RngOrdIdl]                    Default: false
```

Let $K$ be a number field and $M:K \to K$ be an automorphism of $K$ furthermore, denote by $k$ the fixed field of $M$, thus $M$ generates the automorphism group of the relative cyclic extension $K/k$. For some element $a$ in $K$, such that $N_{K/k}(a) = 1$, this function will find some element $b$ such that $a=b/M(b)$. If `S` is given it should contain a sequence of prime ideals such that there exists some $b$ in the $S$-unit group over $S$.

<a id="function-rngord-sunitcohomologyprocess"></a>
#### `SUnitCohomologyProcess(S, U): {RngOrdIdl}, GrpPerm -> {1}`

```magma
ClassGroup  : BoolElt                    Default: false
Ramification: BoolElt                    Default: false
```

Let $k$ be a normal number field with (abstract) automorphism group $G$. For a set of prime ideals $S$ of $k$, which is closed under the action of the subgroup $U$ of $G$, a process is created that allows working with the cohomology of the multiplicative group of $k$ - partially represented by a group of $S$-units. If `ClassGroup` is given, the set $S$ is enlarged to support the current generators of the class group. If `Ramification` is present, then all ramified primes are also included in $S$.

During the computations with this object the set $S$ can be increased to allow the representation of a larger number of elements.

<a id="function-isgloballysplit-userprogram"></a>
#### `IsGloballySplit(C, l): {}, UserProgram -> BoolElt, UserProgram`

```magma
Sub       : GrpPerm                    Default: false
Cohomology: Verbose                    Default: 2
```

For a cohomology process $C$ as created by [`SUnitCohomologyProcess`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/cohomology.md#function-rngord-sunitcohomologyprocess) and a $2$-cocycle $l:U\times U \to k$ given as a Magma-function, decide if $l$ is split, ie. if there exists a $1$-cochain $m:U \to k$ such that $\delta m = l$ for the cohomological coboundary map $\delta$. If `Sub` is given it has to be a subgroup of the automorphism group of the number field underlying the cohomology process, otherwise the full automorphism group is used. This allows to restrict a cocycle easily.

As a fixed cocycle $l$ assumes only finitely many values, we can consider it as a cocycle with values in some suitable $S$-unit group. Similarly, it is exists, $m$ also has values in some $S'$-unit group for a potentially larger set $S'$. This function first tries to “remove” ideals from the support of $l$, to make the set $S$ as small as possible. Then the set is enlarged to make sure that $m$, if exists, can be found with values in the $S'=S$-unit group. Since the final problem now involves only finitely generated abelian groups, it can be solved by Magma’s general cohomology machinery.

<a id="function-issplitasidealat-rngordfracidl-userprogram"></a>
#### `IsSplitAsIdealAt(I, l): RngOrdFracIdl, UserProgram -> BoolElt, UserProgram, [RngOrdIdl]`

```magma
Sub: GrpPerm                    Default: false
```

Let $U$ be a subgroup of the automorphism group $G$ of some number field $k$, $l:U\times U \to k^*$ a $2$-cocycle, and $I$ some ideal in $k$. If `Sub` is given, $U$ is taken to be `Sub`, otherwise $U := G$. Assuming that each element $l(u,v)$ has a valuation at all ideals in the $U$-orbit of $I$, ie. we have a unique decomposition of ideals $l(u,v) = J^{x(u, v)} A(u, v)$ for integers $x(u, v)$ and ideals $A(u, v)$ coprime to $J$ for all $J$ in $I^U$. Then we can use $l$ to define a cocycle with values in $I^U$ which is a finitely generated group. This function determines if this cocycle splits, and if so, computes a $1$-cochain with values in $I^U$ for some fixed ordering of $I^U$. The cochain and $I^U$ are returned on success.

### Automorphisms of Fields

Magma now (from V2.29) contains a new structure for field automorphisms. A field automorphism is of type `FldAut`. Also supports the swap automorphism of $F \times F$, when constructed as an associative algebra. `DirectSum(Algebra(F,F), Algebra(F,F));`

#### Creation of Field Automorphisms

<a id="function-fieldautomorphism-fld-grppermelt"></a>
##### `FieldAutomorphism(F, g): Fld, GrpPermElt -> FldAut`

<a id="function-fieldautomorphism-algass-fld-grppermelt"></a>
##### `FieldAutomorphism(F, g): AlgAss[Fld], GrpPermElt -> FldAut`

Given an element $g$ of a permutation group $G$, satisfying $G \simeq {\operatorname{Aut}}(F)$, returns an element $\alpha \in {\operatorname{Aut}}(F)$ corresponding to $g$.

<a id="function-fieldautomorphism-fld-map-fld-fld"></a>
##### `FieldAutomorphism(F, a): Fld, Map[Fld,Fld] -> FldAut`

<a id="function-fieldautomorphism-fld-intrinsic"></a>
##### `FieldAutomorphism(F, a): Fld, Intrinsic -> FldAut`

<a id="function-fieldautomorphism-fld-userprogram"></a>
##### `FieldAutomorphism(F, a): Fld, UserProgram -> FldAut`

<a id="function-fieldautomorphism-algass-fld-map-algass-fld-algass-fld"></a>
##### `FieldAutomorphism(F, a): AlgAss[Fld], Map[AlgAss[Fld],AlgAss[Fld]] -> FldAut`

Given a function, an intrinsic, or a map between fields $a$ describing an automorphism $a : F \to F$, returns the corresponding field automorphism.

<a id="function-identityautomorphism-fld"></a>
##### `IdentityAutomorphism(F): Fld -> FldAut`

The identity automorphism of the field $F$.

<a id="function-fieldautomorphism-algass-fld"></a>
##### `FieldAutomorphism(K): AlgAss[Fld] -> FldAut`

If $K = F \times F$, return the swap involution.

<a id="function-changering-fldaut-fld"></a>
##### `ChangeRing(a, K): FldAut, Fld -> FldAut`

<a id="function-changering-fldaut-algass-fld"></a>
##### `ChangeRing(a, K): FldAut, AlgAss[Fld] -> FldAut`

If $F \simeq K$, return the element of ${\operatorname{Aut}}(K)$ corresponding to $a \in {\operatorname{Aut}}(F)$.

#### Properties of Field Automorphisms

<a id="function-basefield-fldaut"></a>
##### `BaseField(a): FldAut -> Fld`

The field $F$ for which $a \in {\operatorname{Aut}}(F)$.

<a id="function-order-fldaut"></a>
##### `Order(a): FldAut -> RngIntElt`

The order of $a$.

<a id="function-fixedfield-fldaut"></a>
##### `FixedField(a): FldAut -> Fld`

The fixed field of $a$.

<a id="function-automorphism-fldaut"></a>
##### `Automorphism(a): FldAut -> Map[Fld, Fld]`

The map defined by $a : F \to F$.

<a id="function-fixedfieldsymbol-fldaut-rngordidl"></a>
##### `FixedFieldSymbol(a, P): FldAut, RngOrdIdl -> RngIntElt`

<a id="function-fixedfieldsymbol-fldaut-rngint"></a>
##### `FixedFieldSymbol(a, P): FldAut, RngInt -> RngIntElt`

Returns $-1,0$ or $1$ if $P$ is inert, ramified, or split, respectively in the fixed field of $a$.

#### Predicates on Field Automorphisms

<a id="function-isidentity-fldaut"></a>
##### `IsIdentity(a): FldAut -> BoolElt`

Returns `true` iff $a$ is the identity automorphism.

#### Arithmetic of Field Automorphisms

<a id="operation-op-times-fldaut-fldaut"></a>
##### `a * b: FldAut, FldAut -> FldAut`

The automorphism given by $a \circ b$, namely $x \mapsto a(b(x))$.

<a id="operation-op-pow-fldaut-rngintelt"></a>
##### `a ^ n: FldAut, RngIntElt -> FldAut`

The automorphism $a^n$.

<a id="function-inverse-fldaut"></a>
##### `Inverse(a): FldAut -> FldAut`

The automorphism $a^{-1}$.

<a id="operation-op-eq-fldaut-fldaut"></a>
##### `a eq b: FldAut, FldAut -> BoolElt`

Returns `true` iff $a$ and $b$ are automorphisms of the same field $F$, and $a = b$.

<a id="operation-operation-fldelt-fldaut-fldelt"></a>
##### `x @ a: FldElt, FldAut -> FldElt`

<a id="operation-operation-rngordelt-fldaut-rngordelt"></a>
##### `x @ a: RngOrdElt, FldAut -> RngOrdElt`

<a id="operation-operation-rngintelt-fldaut-rngintelt"></a>
##### `x @ a: RngIntElt, FldAut -> RngIntElt`

<a id="operation-operation-algasselt-fld-fldaut-algasselt-fld"></a>
##### `x @ a: AlgAssElt[Fld], FldAut -> AlgAssElt[Fld]`

Evaluate $a(x)$.

<a id="operation-operation-modtupfldelt-fld-fldaut-modtupfldelt-fld"></a>
##### `v @ a: ModTupFldElt[Fld], FldAut -> ModTupFldElt[Fld]`

Given a vector $v = (x_1, ...., x_n)$ in an $F$-vector space $V$, apply $a$ to each coordinate, to get $a(v) = (a(x_1), \ldots, a(x_n))$.

<a id="operation-operation-modmatfldelt-fld-fldaut-modmatfldelt-fld"></a>
##### `M @ a: ModMatFldElt[Fld], FldAut -> ModMatFldElt[Fld]`

<a id="operation-operation-algmatelt-fld-fldaut-algmatelt-fld"></a>
##### `M @ a: AlgMatElt[Fld], FldAut -> AlgMatElt[Fld]`

<a id="operation-operation-grpmatelt-fld-fldaut-grpmatelt-fld"></a>
##### `M @ a: GrpMatElt[Fld], FldAut -> GrpMatElt[Fld]`

<a id="operation-operation-algmatelt-algass-fld-fldaut-algmatelt-algass-fld"></a>
##### `M @ a: AlgMatElt[AlgAss[Fld]], FldAut -> AlgMatElt[AlgAss[Fld]]`

Given a matrix $M = (x_{ij})$ with entries in $F$, apply $a$ to each coordinate, to get $a(M) = (a(x_{ij}))$.

<a id="operation-operation-rngordfracidl-fldord-fldaut-rngordfracidl-fldord"></a>
##### `I @ a: RngOrdFracIdl[FldOrd], FldAut -> RngOrdFracIdl[FldOrd]`

<a id="operation-operation-rngint-fldaut-rngint"></a>
##### `I @ a: RngInt, FldAut -> RngInt`

<a id="operation-operation-rngintfracidl-fldaut-rngintfracidl"></a>
##### `I @ a: RngIntFracIdl, FldAut -> RngIntFracIdl`

Given a fraction ideal $I$ of an order $R$, and an automorphism $a$ of the fraction field of $R$, return the fractional ideal $a(I)$.

<a id="function-trace-rngordfracidl-fldaut"></a>
##### `Trace(P, a): RngOrdFracIdl, FldAut -> RngOrdFracIdl`

<a id="function-trace-rngintfracidl-fldaut"></a>
##### `Trace(P, a): RngIntFracIdl, FldAut -> RngIntFracIdl`

```magma
Mult: RngIntElt                    Default: Order(a)
```

The image of the map $x \mapsto \sum_{j=0}^{m-1} \sum a^j(x)$ on $P$, where $m$ is determined by `Mult`.

<a id="function-norm-rngordfracidl-fldaut"></a>
##### `Norm(P, a): RngOrdFracIdl, FldAut -> RngOrdFracIdl`

<a id="function-norm-rngintfracidl-fldaut"></a>
##### `Norm(P, a): RngIntFracIdl, FldAut -> RngIntFracIdl`

```magma
Mult: RngIntElt                    Default: Order(a)
```

The image of the map $x \mapsto \prod_{j=0}^{m-1} \sum a^j(x)$ on $P$, where $m$ is determined by `Mult`.

<a id="abelian-extension"></a>
<a id="fldab-main"></a>
## Class Field Theory

- [Introduction](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/introduction.md)
  - [Overview](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/introduction.md#overview)
  - [Magma](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/introduction.md#magma)
    - [Example: Hilbert Class Field of a Cubic Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/introduction.md#example-ex-546938)
- [Creation](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md)
  - [Ray Class Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#ray-class-groups)
    - [`RayClassGroup(I): RngOrdIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-rayclassgroup)
    - [`RayClassGroup(I, T): RngOrdIdl, SeqEnum[RngIntElt] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassgroup-rngordidl-seqenum-rngintelt)
    - [`RayClassGroup(D): DivNumElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassgroup-divnumelt)
    - [`RayClassGroup(P): PlcNumElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassgroup-plcnumelt)
    - [Example: Growth of Ray Class Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#example-ex-0ba809)
    - [`RayResidueRing(I): RngOrdIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayresiduering-rngordidl)
    - [`RayResidueRing(I, T): RngOrdIdl, SeqEnum[RngIntElt] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayresiduering-rngordidl-seqenum-rngintelt)
    - [`RayResidueRing(D): DivNumElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayresiduering-divnumelt)
    - [`RayResidueRing(P): PlcNumElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayresiduering-plcnumelt)
  - [Selmer Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#selmer-groups)
    - [`pSelmerGroup(p, S): RngIntElt, { RngOrdIdl } → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-pselmergroup)
    - [Example: 3-Selmer Group of a Real Quadratic Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#example-ex-2ae671)
  - [Maps](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#maps)
    - [`InducedMap(m1, m2, h, c): Map, Map, Map, RngIntElt → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-inducedmap-map-map-map-rngintelt)
    - [`InducedAutomorphism(r, h, c): Map, Map, RngIntElt → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-inducedautomorphism-map-map-rngintelt)
    - [Example: Induced Map on Ray Class Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#example-ex-110f86)
  - [Abelian Extensions](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#abelian-extensions)
    - [`RayClassField(m): Map → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassfield-map)
    - [`AbelianExtension(m): Map → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-abelianextension-map)
    - [`RayClassField(m, I, T): Map, RngOrdIdl, [RngIntElt] → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassfield-map-rngordidl-rngintelt)
    - [`AbelianExtension(m, I, T): Map, RngOrdIdl, [RngIntElt] → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-abelianextension)
    - [`RayClassField(m, I): Map, RngOrdIdl → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassfield-map-rngordidl)
    - [`AbelianExtension(m, I): Map, RngOrdIdl → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianextension-map-rngordidl)
    - [`AbelianExtension(I): RngOrdIdl → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianextension-rngordidl)
    - [`RayClassField(D): DivNumElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassfield-divnumelt)
    - [`RayClassField(P): PlcNumElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-rayclassfield-plcnumelt)
    - [`AbelianpExtension(m, p): Map, RngIntElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianpextension-map-rngintelt)
    - [Example: Cyclotomic Field as a Class Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#example-ex-cfc4e4)
    - [`AbelianExtension(I, P): RngOrdIdl, [RngIntElt] → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianextension-rngordidl-rngintelt)
    - [`HilbertClassField(K): FldAlg → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-hilbertclassfield-fldalg)
    - [`MaximalAbelianSubfield(M): RngOrd → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-maximalabeliansubfield-rngord)
    - [`MaximalAbelianSubfield(F): FldOrd → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-maximalabeliansubfield-fldord)
    - [`MaximalAbelianSubfield(K): FldNum → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-maximalabeliansubfield-fldnum)
    - [`AbelianExtension(K): FldAlg → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianextension-fldalg)
    - [`AbelianExtension(M): RngOrd → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-abelianextension-rngord)
    - [Example: Hilbert Class Field of a Sextic Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#example-ex-1fc01e)
  - [Binary Operations](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#binary-operations)
    - [`A eq B: FldAb, FldAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#operation-op-eq-fldab-fldab)
    - [`A subset B: FldAb, FldAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#operation-op-subset-fldab-fldab)
    - [`A * B: FldAb, FldAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#operation-op-times-fldab-fldab)
    - [`A meet B: FldAb, FldAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#operation-op-meet-fldab-fldab)
- [Galois Module Structure](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md)
  - [Predicates](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#predicates)
    - [`IsAbelian(A): FldAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-isabelian)
    - [`IsNormal(A): FldAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-isnormal)
    - [`IsCentral(A): FldAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-iscentral)
  - [Constructions](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#constructions)
    - [`GenusField(A): FldAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-genusfield-fldab)
    - [`H2_G_A(A): FldAb → ModTupRng`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-h2-g-a-fldab)
    - [`NormalSubfields(A): FldAb → []`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-normalsubfields-fldab)
    - [`AbelianSubfield(A, U): FldAb, GrpAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-abeliansubfield-fldab-grpab)
    - [`FixedField(A, U): FldAb, GrpAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fixedfield-fldab-grpab)
    - [`CohomologyModule(A): FldAb → ModGrp, Map, Map, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-cohomologymodule)
- [Conversion to Number Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md)
  - [`EquationOrder(A): FldAb → RngOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-equationorder-fldab)
  - [`NumberField(A): FldAb → FldNum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-numberfield-fldab)
  - [`MaximalOrder(A): FldAb → RngOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-maximalorder-fldab)
  - [`Components(A): FldAb → [RngOrd]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-fldab-components)
  - [`Generators(A): FldAb → [ ], [ ], [ ]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-generators-fldab)
  - [Character Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#character-theory)
    - [`AbelianExtension(psi): GrpHecke → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-abelianextension-grphecke)
    - [`AbelianExtension(psi): GrpHeckeElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-abelianextension-grpheckeelt)
    - [`AbelianExtension(chi): GrpDrchNFElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-abelianextension-grpdrchnfelt)
    - [`AbelianExtension(chi): GrpDrchElt → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-abelianextension-grpdrchelt)
    - [`HeckeCharacterGroup(L): FldNum → GrpHecke`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-heckecharactergroup-fldnum)
    - [`HeckeCharacterGroup(A): FldAb → GrpHecke`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-heckecharactergroup-fldab)
    - [Example: Hecke Characters of a Class Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#example-ex-d88d5d)
- [Invariants](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md)
  - [`Discriminant(A): FldAb → RngOrdIdl, [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-discriminant-fldab)
  - [`AbsoluteDiscriminant(A): FldAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-absolutediscriminant-fldab)
  - [`Conductor(A): FldAb → RngOrdIdl, [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-fldab-conductor)
  - [`Degree(A): FldAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-degree-fldab)
  - [`AbsoluteDegree(A): FldAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-absolutedegree-fldab)
  - [`CoefficientRing(A): FldAb → Fld`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-coefficientring-fldab)
  - [`CoefficientField(A): FldAb → Fld`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-coefficientfield-fldab)
  - [`BaseField(A): FldAb → Fld`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-basefield-fldab)
  - [`BaseRing(A): FldAb → Rng`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-basering-fldab)
  - [`CoefficientRing(A): FldAb → Rng`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-coefficientring-fldab-2)
  - [`NormGroup(A): FldAb → Map, RngOrdIdl, [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-normgroup-fldab)
  - [`DecompositionField(p, A): RngOrdIdl, FldAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositionfield-rngordidl-fldab)
  - [`DecompositionField(p, A): PlcNumElt, FldAb → FldAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositionfield-plcnumelt-fldab)
  - [`DecompositionGroup(p, A): RngIntElt, FldAb → GrpAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiongroup-rngintelt-fldab)
  - [`DecompositionGroup(p, A): RngOrdIdl, FldAb → GrpAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiongroup-rngordidl-fldab)
  - [`DecompositionGroup(p, A): PlcNumElt, FldAb → GrpAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiongroup-plcnumelt-fldab)
  - [`DecompositionType(A, p): FldAb, RngOrdIdl → [Tpl]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiontype-fldab-rngordidl)
  - [`DecompositionType(A, p): FldAb, PlcNumElt → [Tpl]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiontype-fldab-plcnumelt)
  - [`DecompositionType(A, p): FldAb, RngIntElt → [Tpl]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiontype-fldab-rngintelt)
  - [`DecompositionTypeFrequency(A, l): FldAb, [ ] → Mset`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiontypefrequency-fldab)
  - [`DecompositionTypeFrequency(A, a, b): FldAb, RngIntElt, RngIntElt → Mset`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-decompositiontypefrequency-fldab-rngintelt-rngintelt)
- [Automorphisms](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md)
  - [`ArtinMap(A): FldAb → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-artinmap-fldab)
  - [`FrobeniusAutomorphism(A, p): FldAb, RngOrdIdl → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-frobeniusautomorphism-fldab-rngordidl)
  - [`AutomorphismGroup(A): FldAb → GrpFP, [Map], Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-fldab-automorphismgroup)
  - [`ProbableAutomorphismGroup(A): FldAb → GrpFP, SeqEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-probableautomorphismgroup-fldab)
  - [`ImproveAutomorphismGroup(F, E): FldAb, SeqEnum → GrpFP, SeqEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-fldab-improveautomorphismgroup)
  - [Example: Probable Automorphism Group of a Class Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#example-ex-b351e9)
  - [`AbsoluteGaloisGroup(A): FldAb → GrpPerm, SeqEnum, GaloisData`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-absolutegaloisgroup-fldab)
  - [`TwoCocycle(A): FldAb → UserProgram`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-twococycle-fldab)
- [Norm Equations](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md)
  - [`IsLocalNorm(A, x, p): FldAb, RngOrdElt, RngOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-islocalnorm-fldab-rngordelt-rngordidl)
  - [`IsLocalNorm(A, x, p): FldAb, RngIntElt, RngInt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-islocalnorm-fldab-rngintelt-rngint)
  - [`IsLocalNorm(A, x, i): FldAb, RngOrdElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-islocalnorm-fldab-rngordelt-rngintelt)
  - [`IsLocalNorm(A, x, p): FldAb, RngOrdElt, PlcNumElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-islocalnorm-fldab-rngordelt-plcnumelt)
  - [`IsLocalNorm(A, x): FldAb, RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-islocalnorm-fldab-rngordelt)
  - [`Knot(A): FldAb → GrpAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-knot-fldab)
  - [`NormEquation(A, x): FldAb, RngOrdElt → BoolElt, [RngOrdElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-normequation-fldab-rngordelt)
  - [`IsNorm(A, x): FldAb, RngOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#function-isnorm-fldab-rngordelt)
  - [Example: Norm Equations via Class Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/norm-equations.md#example-ex-56eb0a)
- [Attributes](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md)
  - [Orders](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#orders)
    - [``o`CyclotomicExtensions: RngOrd → [Rec]``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-o-cyclotomicextensions-rngord-rec)
    - [Example: Hilbert Class Field of an Imaginary Quadratic Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#example-ex-44588f)
  - [Abelian Extensions](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#abelian-extensions)
    - [``A`Components: FldAb → [Rec]``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-components-fldab-rec)
    - [``A`DefiningGroup: FldAb → Rec``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-defininggroup-fldab-rec)
    - [``A`NormGroup: FldAb → Rec``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-normgroup-fldab-rec)
    - [``A`IsAbelian: FldAb → Bool``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-isabelian-fldab-bool)
    - [``A`IsNormal: FldAb → Bool``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-isnormal-fldab-bool)
    - [``A`IsCentral: FldAb → Bool``](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#attribute-attribute-a-iscentral-fldab-bool)
    - [Example: Attributes of a Ray Class Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/attributes.md#example-ex-63b1eb)
- [Group Theoretic Functions](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/group-theory.md)
  - [Generic Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/group-theory.md#generic-groups)
    - [`GenericGroup(X): [] → GrpFp, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/group-theory.md#function-genericgroup)
    - [`AddGenerator(G, x): GrpFP, . → BoolElt, GrpFP, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/group-theory.md#function-addgenerator-grpfp)
    - [`FindGenerators(G): GrpFP → []`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/group-theory.md#function-findgenerators-grpfp)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/bibliography.md)

### Introduction

This chapter presents the facilities provided in Magma for class field theory. The main objects of interest are abelian extensions of number fields (`FldAb`) and maps between abelian groups and ideal groups.

Class field theory is concerned with the classification of all abelian extensions of a given field. In particular, this covers abelian extensions of number fields, local fields, and global function fields. While this chapter deals with the number field case only, Magma can also perform computations in the other cases. For the case of global function fields, see Chapter [Class Field Theory for Global Function Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/index-class-field-theory-for-global-function-fields.md#fldfunab) and for the case of $p$-adic local fields, Section [Class Field Theory](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#rngloc-fldab).

Abstractly, class field theory parametrizes abelian extensions in terms of abelian groups defined with respect to the base field. In Magma, ray class groups and their quotients are used to define the extensions. Ray class groups and their quotients are always represented as maps between a finite abelian group (`GrpAb`) and the power structure of ideals (`PowIdeal`). The maps are usually obtained as products of the map returned by ray class groups and quotient maps.

In theory, a class field is completely determined by the corresponding class group (map). Currently there is only a small number of invariants that can be computed directly from the map; for most other properties the class field has to be converted into a number field by computing a set of defining equations.

<a id="fldab-norm-group"></a>
#### Overview

Class field theory classifies all abelian extensions of a given number field $k$ in terms of quotients of ray class groups. Ray class groups should be thought of as generalized class groups in that they can be defined similarly to class groups:

$$
1 \to U\to k^* \to I \to {\operatorname{Cl}}\to 1
$$

where $k^*$ is the multiplicative group of $k$, $U$ is the group of units, and $I$ the group of fractional ideals. (Recall, the class group is defined as the quotient of the ideals modulo the principal ideals). To define ray class groups we need to refine all of the above terms. Let $o = {\mathbb{Z}}_k$ be the ring of integers in $k$ and fix an integral ideal ${\mathfrak{m}}_0$ in $o$. Furthermore, let ${\mathfrak{m}}_\infty$ be a subset of the real embeddings of $k$ into ${\mathbb{C}}$ and, formally, ${\mathfrak{m}}:= ({\mathfrak{m}}_0, {\mathfrak{m}}_\infty)$. Then for $x \in k$ define

$$
x \mathop{\rm mod}\nolimits^* {\mathfrak{m}}= 1 \quad\hbox{\rm iff}\Biggl\{
{{v_{\mathfrak{p}}(x-1) \geq v_{\mathfrak{p}}({\mathfrak{m}}_0) \quad\text{\rm for all prime ideals }{\mathfrak{p}}}
    \atop
{s(x)>0 \quad\text{\rm for }s \in {\mathfrak{m}}_\infty}}
$$

Let $I^{\mathfrak{m}}$ denote the group of fractional ideals that are coprime to ${\mathfrak{m}}_0$, $U_{\mathfrak{m}}$ the units $u$ such that $u \mathop{\rm mod}\nolimits^* {\mathfrak{m}}= 1$ and $P_{\mathfrak{m}}$ the elements $x\in k$ such that $x\mathop{\rm mod}\nolimits^*{\mathfrak{m}}= 1$. Then

$$
1 \to U_{\mathfrak{m}}\to P_{\mathfrak{m}}\to I^{\mathfrak{m}}\to {\operatorname{Cl}}_{\mathfrak{m}}\to 1
$$

defines the ray class groups modulo ${\mathfrak{m}}$. For ${\mathfrak{m}}= (1o, \emptyset)$, this corresponds to the usual class group. Given two moduli ${\mathfrak{m}}$ and ${\mathfrak{n}}$ such that ${\mathfrak{m}}_0|{\mathfrak{n}}_0$ and ${\mathfrak{m}}_\infty\subseteq{\mathfrak{n}}_\infty$ we have canonical surjections

$$
{\operatorname{Cl}}_{\mathfrak{n}}\to {\operatorname{Cl}}_{\mathfrak{m}}.
$$

Now, let $H$ be a subgroup such that $P_{\mathfrak{m}}< H < I^{\mathfrak{m}}$. There exists a minimal ${\mathfrak{n}}$ such that the canonical embedding ${\operatorname{Cl}}_{\mathfrak{m}}/H \to {\operatorname{Cl}}_{\mathfrak{n}}$ is injective. This ${\mathfrak{n}}$ is called the conductor of $H$.

The main theorem of class field theory asserts the following correspondence between abelian extensions $K/k$ of $k$ and quotients of ray class groups: Let $K/k$ be abelian and $G := {\operatorname{Gal}}(K/k)$ the group of $k$-automorphisms of $K$. For each prime ideal ${\mathfrak{p}}$ of $k$ that is unramified in $K$, let ${\operatorname{Frob}}({\mathfrak{p}}, K/k)$ be the Frobenius automorphism, i.e. the unique $s\in G$ such that $s(x) = x^N \mathop{\rm mod}\nolimits{\mathfrak{p}}$ for all $x\in k$. Extend this map multiplicatively to all ideals coprime to $d_{K/k}$, the discriminant of $K/k$. This is known as the Artin-map and is denoted by $(b, K/k)$. Class field theory asserts the existence of some modulus ${\mathfrak{m}}$ and a subgroup $H$ such that $G \cong {\operatorname{Cl}}_{\mathfrak{m}}/H$ by the Artin-map.

Conversely, for each ray class group ${\operatorname{Cl}}_{\mathfrak{m}}$ and each subgroup $P_{\mathfrak{m}}< H$ there is an abelian extension $K/k$ with the above property.

The correspondence is one-to-one if one restricts to pairs ${\operatorname{Cl}}_{\mathfrak{m}}$ and $H$ such that ${\mathfrak{m}}$ is the conductor of $H$.

For ${\mathfrak{m}}= (1o, \emptyset)$, the corresponding field $K$ is called the Hilbert class field of $k$ (in the wide sense).

Perhaps best understood is the Hilbert class field. As conjectured by Hilbert and proved by Furtwängler, all ideals of $k$ become principal in the Hilbert class field $H_k$. Furthermore, $H_k$ is the maximal unramified abelian extension of $k$.

A different interpretation of $H$ is provided by norm groups. We have

$$
H = \langle N_{K/k}(b) | b\in I_K^{\mathfrak{m}}\rangle
$$

This result may be used to convert an abelian number field into an abelian extension. In addition, class field theory asserts that, for an arbitrary normal extension $K/k$, the norm group defined above corresponds to the maximal abelian subfield.

#### Magma

In Magma maps are used to represent the ideal groups. If necessary, the map can be augmented by supplying ${\mathfrak{m}}$ i.e. an integral ideal ${\mathfrak{m}}_0$ and a sequence of indices of the real places in ${\mathfrak{m}}_\infty$. The map returned as a second return value from [`ClassGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal-class-group.md#function-rngord-classgroup) or [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-rayclassgroup) carries the necessary information to recover ${\mathfrak{m}}$, even if this is hidden from the user. As an example, we consider the Hilbert class field of $k := {\mathbb{Q}}(\alpha)$ with $\alpha^3 + \alpha^2 + 3\alpha - 6 = 0$ with class group $C_4$.

<a id="example-ex-546938"></a>
##### `Example: Hilbert Class Field of a Cubic Field (ex-546938)`

```magma
> k := NumberField(Polynomial([ -6, 3, 1, 1 ]));
```

Now, the easiest way to get the Hilbert class field is to call `HilbertClassField` directly on $k$:

```magma
> K := HilbertClassField(k);
> K;
Number Field with defining polynomial $.1^4 + (76*k.1^2 - 420*k.1 - 488)*$.1^2\\
 +    32080*k.1^2 + 41984*k.1 + 95168 over k
```

Let us now verify some of the properties, starting with the discriminant. Since $K/k$ is totally unramified, the discriminant of the maximal order should be $1$:

```magma
> O := MaximalOrder(K);
> O;
Maximal Order of Equation Order with defining polynomial x^4 + [-488, -420,
    76]*x^2 + [95168, 41984, 32080] over its ground order
> Discriminant(O);
Ideal
Basis:
[1 0 0]
[0 1 0]
[0 0 1]
```

Now let us check that all ideals of $k$ are principal in $K$. In order to do so, it is sufficient to demonstrate that a generator of the class group becomes principal:

```magma
> g, m := ClassGroup(k);
> g;m;
Abelian Group isomorphic to Z/4
Defined on 1 generator
Relations:
    4*g.1 = 0
Mapping from: GrpAb: g to Set of ideals of Maximal Equation Order with
defining polynomial x^3 + x^2 + 3*x - 6 over its ground order

> i := m(g.1);
> I := O!!i;
> IsPrincipal(I);
true
> f,g := IsPrincipal(I);
> g;
[[2193497788678474035456, -1238066307883451022336,
-2319265120953032748288], [394272965034846395136,
-222653406238254306432, -417025104282566694144],
[167087257584, 71708840496, 32825469008], [495632919,
-279332235, -523526213]] / 10917386545536
```

However, to use the more sophisticated functions, the construction of the class fields needs to be done step–by–step. We first create an abelian extension as an object of type `FldAb`. Since we wish to see how much of the class group becomes trivial in the quadratic subfield $K_1$ of $K$ (capitulates in $K_1$), we also define this.

```magma
> aK := AbelianExtension(m);
> g, m := ClassGroup(k);
> q, mq := quo<g | 2*g.1>;
> m2 := Inverse(mq)*m;m2;
Mapping from: GrpAb: q to Set of ideals of Maximal
Equation Order with defining polynomial x^3 + x^2 + 3*x
    - 6 over Z
Composition of Mapping from: GrpAb: q to GrpAb: g and
Mapping from: GrpAb: g to Set of ideals of Maximal
Equation Order with defining polynomial x^3 + x^2 + 3*x
    - 6 over Z
> aK2 := AbelianExtension(m2);
```

This demonstrates a very important technique: the creation of a quotient group of the class group together with the corresponding map.

A few invariants such as degree and discriminant may be calculated directly from `aK` without the (costly) computation of a defining equation.

```magma
> Discriminant(aK);
Principal Ideal
Generator:
    [1, 0, 0]
[ 4, 4 ]
```

The second return value denotes the signature of the field as an extension of ${\mathbb{Q}}$.

Now we compute a defining equation for `aK2` and see what happens to the class group of $k$.

```magma
> O := MaximalOrder(aK2);O;
Maximal Order of Equation Order with defining
polynomial x^2 + [-5, -2, -1] over its ground order
> O!!m(g.1);
> IsPrincipal($1);
false
> IsPrincipal($2^2);
true
```

So only “half” of the class group capitulates in `aK2`, the remaining part collapses in `aK`.

### Creation

The most powerful way to create class fields or abelian extensions in Magma is to use the [`AbelianExtension`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-abelianextension) function that enables the user to create the extension corresponding to some ideal group.

So, before we can describe the creation functions for the class fields, we have to deal with the ideal groups.

#### Ray Class Groups

The classical approach to class field theory, which is well suited for computation, is based on *ideal groups* which are generalisations of the ideal class group.

In this section we describe in detail how to create *full* ideal groups, mainly ray class groups. As ray class groups are closely related to the unit groups of residue class rings of maximal order, these too are presented here.

In addition to the functions listed here, the [`CRT`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-chineseremaindertheoreminf) is relevant in this context.

<a id="function-fldab-rayclassgroup"></a>
##### `RayClassGroup(I): RngOrdIdl -> GrpAb, Map`

<a id="function-rayclassgroup-rngordidl-seqenum-rngintelt"></a>
##### `RayClassGroup(I, T): RngOrdIdl, SeqEnum[RngIntElt] -> GrpAb, Map`

```magma
Al: MonStgElt                    Default: "Extension"
```

Given an integral ideal $I$ belonging to the maximal order of a number field, the *ray class group modulo* $I$ is the quotient of the subgroup generated by the ideals coprime to $I$ by the subgroup generated by the principal ideals generated by elements congruent to $1$ modulo $I$ and $T$ if present.

The sequence $T$ contains the numbers $[ i_1, \ldots, i_r]$ of certain real infinite places. When the sequence is supplied, the generators of the principal ideals must take positive values at the places indicated by $T$. The sequence $T$ must be strictly ascending containing only positive integers, each not exceeding the number of real embeddings.

This function requires the class group to be known. If it is not already stored, it will be computed in such a way that its correctness is not guaranteed. However, it will almost always be correct. If the user requires a guaranteed result, then the class group must be verified by the user or computed up to the proof level required beforehand.

The ray class group is returned as an abelian group $A$, together with a mapping between $A$ and a set of representatives for the ray classes.

Setting `Al` to `Extension` uses a mixture of Pauli’s approach following Hasse ([[HPP97](https://docs.magma-maths.org/references.md#cite-pau2), [Pau96](https://docs.magma-maths.org/references.md#cite-pau1)]) and Cohen’s method ([[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), [CDO](https://docs.magma-maths.org/references.md#cite-cdoants), [CDO98](https://docs.magma-maths.org/references.md#cite-cdo1)]). Setting `Al` to `Relations` uses a modification of the relation matrix to determine the ray class group. Currently, the second approach performs better in large examples.

<a id="function-rayclassgroup-divnumelt"></a>
##### `RayClassGroup(D): DivNumElt -> GrpAb, Map`

<a id="function-rayclassgroup-plcnumelt"></a>
##### `RayClassGroup(P): PlcNumElt -> GrpAb, Map`

Given a divisor (or place) of an absolute number field, compute the Ray class group defined modulo the divisor.

This function requires the class group to be known. If it is not already stored, it will be computed in such a way that its correctness is not guaranteed. However, it will almost always be correct. If the user requires a guaranteed result, then the class group must be verified by the user or computed up to the proof level required beforehand.

The ray class group is returned as an abelian group $A$, together with a mapping between $A$ and a set of representatives for the ray classes.

The algorithm used is a mixture of Pauli’s approach following Hasse ([[HPP97](https://docs.magma-maths.org/references.md#cite-pau2), [Pau96](https://docs.magma-maths.org/references.md#cite-pau1)]) and Cohen’s method ([[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), [CDO](https://docs.magma-maths.org/references.md#cite-cdoants), [CDO98](https://docs.magma-maths.org/references.md#cite-cdo1)]).

<a id="example-ex-0ba809"></a>
##### `Example: Growth of Ray Class Groups (ex-0ba809)`

Some ray class groups are computed below. The example merely illustrates the fact that ray class groups tend to grow if their defining module grows and can be arbitrarily large. This should be compared to class groups where it is rather difficult to give examples of fields having “large” class groups — unless one takes imaginary quadratic fields.

```magma
> R<x> := PolynomialRing(Integers());
> o := MaximalOrder(x^2-10);
> RayClassGroup(2*o, [1,2]);
Abelian Group isomorphic to Z/2 + Z/2
Defined on 2 generators
Relations:
    2*$.1 = 0
    2*$.2 = 0
Mapping from: Abelian Group isomorphic to Z/2 + Z/2
Defined on 2 generators
Relations:
    2*$.1 = 0
    2*$.2 = 0 to Set of ideals of o
> RayClassGroup(2*o);
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*$.1 = 0
Mapping from: Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
    2*$.1 = 0 to Set of ideals of o
```

As one can see, the inclusion of the infinite places only added a $C_2$ factor to the group. In general, a set of infinite places containing $n$ elements can at most add $n$ $C_2$ factors to the group without infinite places.

Now we enlarge the modulus by small primes. As one can see, the ray class group gets bigger.

```magma
> RayClassGroup(8*3*5*7*11*13*101*o);
Abelian Group isomorphic to Z/2 + Z/2 + Z/2 + Z/4 + Z/4 + Z/24 + Z/24 + Z/120 +
Z/600
Defined on 9 generators
Relations:
    2*$.1 = 0
    2*$.2 = 0
    2*$.3 = 0
    8*$.4 = 0
    24*$.5 = 0
    4*$.6 = 0
    120*$.7 = 0
    12*$.8 = 0
    600*$.9 = 0
Mapping from: Abelian Group isomorphic to Z/2 + Z/2 + Z/2 + Z/4 + Z/4 + Z/24 +
Z/24 + Z/120 + Z/600
Defined on 9 generators
Relations:
    2*$.1 = 0
    2*$.2 = 0
    2*$.3 = 0
    8*$.4 = 0
    24*$.5 = 0
    4*$.6 = 0
    120*$.7 = 0
    12*$.8 = 0
    600*$.9 = 0 to Set of ideals of o
```

<a id="function-rayresiduering-rngordidl"></a>
##### `RayResidueRing(I): RngOrdIdl -> GrpAb, Map`

<a id="function-rayresiduering-rngordidl-seqenum-rngintelt"></a>
##### `RayResidueRing(I, T): RngOrdIdl, SeqEnum[RngIntElt] -> GrpAb, Map`

Given an integral ideal $I$ belonging to the maximal order of a number field, the *ray residue ring modulo* $I$ is the unit group of the maximal order modulo $I$ extended by one $C_2$ factor for each element of $T$. The sequence $T$ should be viewed as a condition on the signs of the numbers factored out.

Let $I$ be an integral ideal of an absolute maximal order and let $T$ be a set of real places given by an increasing sequence containing integers $i$, $1\leq i\leq r_1$ where $r_1$ is the number of real zeros of the defining polynomial of the field. This function computes the group of units $\mathop{\rm mod}\nolimits^* (I, T)$. The result is a finite abelian group and a map from the group to the order to which the ideal belongs.

When $T$ is not given the unit group of the residue ring mod $m$ is returned. This is equivalent to formally setting $T := [\,]$ to be the empty sequence.

<a id="function-rayresiduering-divnumelt"></a>
##### `RayResidueRing(D): DivNumElt -> GrpAb, Map`

<a id="function-rayresiduering-plcnumelt"></a>
##### `RayResidueRing(P): PlcNumElt -> GrpAb, Map`

Given an effective divisor $D$ of a number field, compute the unit group of the residue class ring defined modulo the divisor, ie. compute the group of elements that for the finite places in the support of $D$ approximate $1$ and have positive sign at the real infinite places of the support of $D$.

#### Selmer Groups

Let $S$ be a finite set of prime ideals in a number field $K$. For an integer $p$, the $p$-Selmer group of $S$ is defined as

$$
K_p(S) := \{ x \in K^{\times}/(K^{\times})^p \mid v_Q(x) = 0 \mathop{\rm mod}\nolimits p\ \forall Q \notin S \}
$$

$K_p(S)$ is a finite abelian group of exponent $p$.

<a id="function-fldab-pselmergroup"></a>
##### `pSelmerGroup(p, S): RngIntElt, { RngOrdIdl } -> GrpAb, Map`

```magma
Integral: BoolElt                    Default: true
Nice    : BoolElt                    Default: true
Raw     : BoolElt                    Default: false
```

For a prime integer $p$ and a set of prime ideals $S$ in a number field $K$, the function returns the $p$-Selmer group of $S$ as an abstract group $G$, together with a map $m$ from $K$ to $G$. The map comes with an inverse.

In principle, the domain of $m$ is the set of $x$ in $K$ satisfying the condition in the definition of $K_p(S)$ above. When $m(x)$ is invoked for $x$ in $K$, it is assumed without checking that $x$ satisfies the condition. If $x$ does not, either a runtime error occurs, or the map returns a random element of $G$. (Checking the condition would require a far more expensive computation. The algorithm identifies the class of $x$ in $K_p(S)$ by computing the multiplicative orders of residues of $x$, and of the group generators, modulo some unrelated primes.)

The role of the optional parameters is as follows. The $p$-Selmer group is realized as a subgroup of a quotient of a suitable group of $\tilde S$-units of the number field, the images of the map returned by `pSelmerGroup` are $\tilde S$-units. Initially, $\tilde S$ is chosen as $S$ and then enlarged until the $p$-part of the ideal class group of $K$ is generated by the ideals in $S$. The parameter `Raw` is related to the same parameter in `SUnitGroup`, see [`SUnitGroup`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/ideal.md#function-rngord-sunitgroup) for more information. If the parameter is set to `true`, the objects returned as images of the `pSelmerGroup` map are exponent vectors that are applied to a fixed sequence of elements to get actual $S$-units, see the following example for a demonstration.

In addition to changing the return type, `Raw` also implies a reduction of the results, elements returned under `Raw` are reduced by removing the projection of the lattice generated by $p$th powers of $\tilde S$-units. As a side effect of this reduction, elements are no longer guaranteed to be integral. To offset this, the parameter `Integral` can be set to `true`, in which case the sequence of multiplicative generators will be extended to contain uniformizing elements for all ideals in $\tilde S$ and the exponent vectors will be supplemented accordingly to achieve integrality.

<a id="example-ex-2ae671"></a>
##### `Example: 3-Selmer Group of a Real Quadratic Field (ex-2ae671)`

We compute the $3$-Selmer group of ${\mathbb{Q}}(\sqrt {10})$ with respect to the primes above $2$, $3$, $11$:

```magma
> k := NumberField(Polynomial([-10, 0,1]));
> m := MaximalOrder(k);
> lp := Factorization(2*3*11*m);
> S := [ i[1] : i in lp];
> KpS, mKpS := pSelmerGroup(3, Set(S));
> KpS;
Abelian Group isomorphic to Z/3 + Z/3 + Z/3 + Z/3 + Z/3
Defined on 5 generators
Relations:
    3*KpS.1 = 0
    3*KpS.2 = 0
    3*KpS.3 = 0
    3*KpS.4 = 0
    3*KpS.5 = 0
> mKpS;
Mapping from: RngOrd: m to GrpAb: KpS given by a rule
> mKpS(m!11);
KpS.2
> mKpS(m!11*2);
KpS.2 + 2*KpS.3 + 2*KpS.5
> mKpS(m!11*2*17^3);
KpS.2 + 2*KpS.3 + 2*KpS.5
```

So as long as the argument to `mKpS` is only multiplied by cubes, the image will be stable. Next, we do the same again, but this time using `Raw`:

```magma
> KpS, mKpS, mB, B := pSelmerGroup(3, Set(S):Raw);
> B;
(-m.1 -11/1*m.1 3/1*m.1 2/1*m.1 13/1*m.1 5/1*m.1 31/1*m.1
    3/1*m.1 - 2/1*m.2 3/1*m.1 + 2/1*m.2 m.1 - 2/1*m.2 m.1
    + 2/1*m.2 m.2 m.1 + m.2 m.1 - m.2 -2/1*m.1 - m.2 m.2
    3/1*m.1 3/1*m.1 11/1*m.1)
> #Eltseq(B);
19
> mB;
Mapping from: GrpAb: KpS to Full RSpace of degree 19 over
Integer Ring given by a rule [no inverse]
> r := KpS.1 + KpS.2 + 2*KpS.4 + KpS.5;
> r @@ mKpS;
396/1*m.1 + 99/1*m.2
> r @ mB;
( 0  1 -2  0  0  0  0  0  0  0  0  0  1  0  1  0  3  0  0)
> PowerProduct(B, $1);
396/1*m.1 + 99/1*m.2
```

#### Maps

<a id="function-inducedmap-map-map-map-rngintelt"></a>
##### `InducedMap(m1, m2, h, c): Map, Map, Map, RngIntElt -> Map`

Given maps $m_1: G_1 \to I_1$, $m_2: G_2 \to I_2$ from some finite abelian groups into the ideals of some maximal order, and a map $h:I_1 \to I_2$ on the ideals, compute the map induced by $h$ on the abelian groups.

For this to work, $m_1$, and $m_2$ need to be maps that can be used to define abelian extensions. This implies that $m_i$ has to be a composition of maps where the last component is either the map returned by `ClassGroup` or by `RayClassGroup`. The argument $c$ should be a multiple of the minima of the defining moduli.

The result is the map as defined by

```magma
hom<G_1 -> G_2 | [ h(m_1(G_1.x)) @@ m_2 : x in [1..Ngens(G_1)]]>
```

For larger modules however, this function is much faster than the straightforward approach. This function tries to find a set of “small” generators for both groups. Experience shows that ray class groups (and their quotients) can usually defined by a “small” set of “small” prime ideals. Since solving the discrete logarithm in ray class groups depends upon solving the discrete logarithm for class groups which is quite slow for “large” ideals, it is much faster in general to use this rather roundabout approach. “Small” ideal in this context means “small” norm.

<a id="function-inducedautomorphism-map-map-rngintelt"></a>
##### `InducedAutomorphism(r, h, c): Map, Map, RngIntElt -> Map`

An abbreviation for `InducedMap(r, r, h, c)`.

<a id="example-ex-110f86"></a>
##### `Example: Induced Map on Ray Class Groups (ex-110f86)`

Consider a “large” ray class group over $k := {\mathbb{Q}}[\sqrt{10}, \zeta_{16}]$

```magma
> k := NumberField([Polynomial([-10, 0, 1]), CyclotomicPolynomial(16)]);
> k := OptimizedRepresentation(AbsoluteField(k));
> o := MaximalOrder(k);
> ClassGroup(o : Proof := "GRH");
Abelian Group of order 1
Mapping from: Abelian Group of order 1 to Set of ideals of o
> IndependentUnits(o);
Abelian Group isomorphic to Z/16 + Z (7 copies)
Defined on 8 generators
Relations:
    16*$.1 = 0
Mapping from: Abelian Group isomorphic to Z/16 + Z (7 copies)
Defined on 8 generators
Relations:
    16*$.1 = 0 to RngOrd: o
> SetOrderUnitsAreFundamental(o);
> p := &* [113, 193, 241];
> r, mr := RayClassGroup(p*o);
> #r; Ngens(r);
1706131176377019905236218856143547400125963963181004962861678592\\
000000000
26
```

The automorphisms of $k$ act on this group. One way of obtaining the action is:

```magma
> autk := Automorphisms(k);
> time m1 := hom<r -> r | [ autk[2](mr(r.i))@@ mr : i in [1..Ngens(r)]]>;
Time: 1.080
```

In contrast, using `InducedAutomorphism`:

```magma
> time InducedAutomorphism(mr, autk[2], p);
Time: 1.010
```

Now we increase $p$:

```magma
> p *:= 257*337;
> r, mr := RayClassGroup(p*o);
> #r; Ngens(r);
3831748420755023278212540125628635035038808247955859769266388851\\
8259419871708134228623706727453425990974892633470189282997043200\\
0000000
42
> time m1 := hom<r -> r | [ autk[2](mr(r.i))@@ mr : i in [1..Ngens(r)]]>;
Time: 2.950
> time InducedAutomorphism(mr, autk[2], p);
Time: 6.200
```

For “small” examples the direct approach is much faster, but for large ones, especially if one is only interested in certain quotients, the other approach is faster.

#### Abelian Extensions

The ultimate goal of class field theory is the classification of all abelian extensions of a given number field. Although the theoretical question was settled in the 1930’s, it is still difficult to explicitly compute defining equations for class fields. For extensions of imaginary quadratic fields, there are well known analytic methods available. This section explains the basic operations implemented to create class fields in Magma.

<a id="function-rayclassfield-map"></a>
##### `RayClassField(m): Map -> FldAb`

<a id="function-fldab-abelianextension-map"></a>
##### `AbelianExtension(m): Map -> FldAb`

<a id="function-rayclassfield-map-rngordidl-rngintelt"></a>
##### `RayClassField(m, I, T): Map, RngOrdIdl, [RngIntElt] -> FldAb`

<a id="function-fldab-abelianextension"></a>
##### `AbelianExtension(m, I, T): Map, RngOrdIdl, [RngIntElt] -> FldAb`

<a id="function-rayclassfield-map-rngordidl"></a>
##### `RayClassField(m, I): Map, RngOrdIdl -> FldAb`

<a id="function-abelianextension-map-rngordidl"></a>
##### `AbelianExtension(m, I): Map, RngOrdIdl -> FldAb`

Given a map $m : G \to I_k$ where $G$ is a finite abelian group and $I_k$ is the set of ideals of some absolute maximal order construct the class field defined by $m$.

More formally, $m^{-1}$ must be a homomorphism from some ray class group $R$ onto a finite abelian group $G$. If either $I$ or $I$ and $T$ are given, they must define $R$. This implies that $I$ has to be an integral ideal and that $T$ has to be a sequence containing the relevant infinite places. Otherwise, Magma will try to extract this information from $m$. The class field defined by $m$ has Galois group isomorphic to $R/\ker(m^{-1})$ under the Artin map.

Note that Magma cannot check whether the map passed in is valid. If an invalid map is supplied, the output will most likely be garbage.

Maps commonly given as $m$ are class group maps, ray class group maps, and the composition of the inverse of the canonical map from a ray class group into the quotient of that ray class group by a subgroup and the ray class group map.

<a id="function-abelianextension-rngordidl"></a>
##### `AbelianExtension(I): RngOrdIdl -> FldAb`

Creates the full ray class field modulo the ideal $I$.

<a id="function-rayclassfield-divnumelt"></a>
##### `RayClassField(D): DivNumElt -> FldAb`

<a id="function-rayclassfield-plcnumelt"></a>
##### `RayClassField(P): PlcNumElt -> FldAb`

Create the full Ray class field defined modulo the divisor $D$, ie. an abelian extension that is unramified outside the support of $D$ and such that the (abelian) automorphism group is canonically isomorphic to the ray class group modulo $D$.

<a id="function-abelianpextension-map-rngintelt"></a>
##### `AbelianpExtension(m, p): Map, RngIntElt -> FldAb`

For a map $m$ as in [`AbelianExtension`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-abelianextension-map) and a prime number $p$, create the maximal $p$-field, i.e. the maximal subfield having degree a $p$–power.

<a id="example-ex-cfc4e4"></a>
##### `Example: Cyclotomic Field as a Class Field (ex-cfc4e4)`

The abelian extensions of ${\mathbb{Q}}$ are known to lie in some cyclotomic field.

We demonstrate this by computing the $12$-th cyclotomic field using class fields:

Unfortunately, as ray class groups are not defined for ${\mathbb{Z}}$ in Magma, we must work in a degree $1$ extension of ${\mathbb{Q}}$:

```magma
> x := ext<Rationals()|>.1;
> Q := ext<Rationals()| x-1 :DoLinearExtension>;
> M := MaximalOrder(Q);
```

The ray class group that defines ${\mathbb{Q}}(\zeta_{12})$ is defined $\mathop{\rm mod}\nolimits(12, \infty)$ where $\infty$ is the unique infinite place of ${\mathbb{Q}}$. There are at least two ways of looking at this: First, since $Q(\zeta_{12})$ is a totally complex field, the infinite place of ${\mathbb{Q}}$ must ramify (by convention: ${\mathbb{C}}$ is ramified over ${\mathbb{R}}$), so we must include the infinite place in the definition of the ray class group.

Secondly, the ray class group $\mathop{\rm mod}\nolimits(12)$ without the infinite place is too small. We know $\phi(12) = 4$, $({\mathbb{Z}}/12{\mathbb{Z}})^* = \{1, 5, 7, 11\} = \{\pm 1, \pm 5\}$. As ideals we have $(1) = o = (-1) = (11)$ and $(5) = (-5) = (7)$ so that ${\operatorname{Cl}}_{12} \cong C_2$. By introducing $T = [1]$, we distinguish $\pm1$ and $\pm 5$.

```magma
> G, m := RayClassGroup(12*M, [1]);
> G;
Abelian Group isomorphic to Z/2 + Z/2
Defined on 2 generators
Relations:
    2*G.1 = 0
    2*G.2 = 0
> A := AbelianExtension(m);
> E := EquationOrder(A);
> Ea := SimpleExtension(E);
> Ma := MaximalOrder(Ea);
> Discriminant(Ma);
144
> Factorization(Polynomial(Ma, CyclotomicPolynomial(12)));
[
    <ext<Ma|>.1 + [0, 1, 0, -1], 1>,
    <ext<Ma|>.1 + [0, -1, 0, 0], 1>,
    <ext<Ma|>.1 + [0, 1, 0, 0], 1>,
    <ext<Ma|>.1 + [0, -1, 0, 1], 1>
]
```

The main advantage of this method over the use of the cyclotomic polynomials is the fact that we can directly construct certain subfields:

```magma
> x := ext<Integers()|>.1;
> M := MaximalOrder(x^2-10);
> G, m := RayClassGroup(3615*M, [1,2]);
> G; m;
Abelian Group isomorphic to Z/2 + Z/2 + Z/4 + Z/80 + Z/240
Defined on 5 generators
Relations:
    4*G.1 = 0
    80*G.2 = 0
    240*G.3 = 0
    2*G.4 = 0
    2*G.5 = 0
Mapping from: GrpAb: G to Set of ideals of M
```

We will only compute the $5$-part of this field:

```magma
> h := hom<G -> G | [5*G.i : i in [1..#Generators(G)]]>;
> Q, mq := quo<G|Image(h)>;
> mm := Inverse(mq) * m;
> mm;
Mapping from: GrpAb: Q to Set of ideals of M
> A := AbelianExtension(mm);
> E := EquationOrder(A);
> E;
Non-simple Equation Order defined by x^5 - [580810, 0]*x^3 +
    [24394020, -40656700]*x^2 + [15187310285, 2799504200]*x
    + [1381891263204, 530506045900], x^5 - [580810, 0]*x^3 +
    [-109192280, 34848600]*x^2 + [30584583385,
    16797025200]*x + [-341203571896, 109180663800] over its
ground order
> C := Components(A);
```

The function [`Components`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/conversion.md#function-fldab-components) gives a list of cyclic extensions of $M$ that correspond to the cyclic factors of $G$.

```magma
> GaloisGroup(NumberField(C[1]));
Permutation group acting on a set of cardinality 5
Order = 5
    (1, 4, 2, 5, 3)
[ -9 + O(41), 15 + O(41), 6 + O(41), 18 + O(41), 11 + O(41) ]
GaloisData over Z_Prime Ideal
Two element generators:
[41, 0]
[25, 1] - relative case
> GaloisGroup(NumberField(C[2]));
Order = 5
    (1, 4, 2, 5, 3)
[ 38 + O(79), -28 + O(79), -31 + O(79), 27 + O(79), -6 + O(79) ]
GaloisData over Z_Prime Ideal
Two element generators:
[79, 0]
[57, 1] - relative case
```

Thus the Galois group is indeed proven to be $C_5 \times C_5$.

<a id="function-abelianextension-rngordidl-rngintelt"></a>
##### `AbelianExtension(I, P): RngOrdIdl, [RngIntElt] -> FldAb`

Creates the full ray class field modulo the ideal $I$ and the infinite places in $P$.

<a id="function-hilbertclassfield-fldalg"></a>
##### `HilbertClassField(K): FldAlg -> FldAb`

Creates the Hilbert class field of $K$, i.e. the maximal unramified abelian extension of $K$. This is equivalent to `AbelianExtension(1*MaximalOrder(K))`.

<a id="function-maximalabeliansubfield-rngord"></a>
##### `MaximalAbelianSubfield(M): RngOrd -> FldAb`

<a id="function-maximalabeliansubfield-fldord"></a>
##### `MaximalAbelianSubfield(F): FldOrd -> FldAb`

<a id="function-maximalabeliansubfield-fldnum"></a>
##### `MaximalAbelianSubfield(K): FldNum -> FldAb`

```magma
Conductor: [RngOrdIdl, [RngIntElt]]                    Default: [ ]
```

Let $k$ be the coefficient field of the given number field $K$. This function creates the maximal abelian extension $A$ of $k$ inside $K$. If `Conductor` is given, it must contain a multiple of the true conductor. If no value is specified, the discriminant of $K$ is used.

The correctness of this function is based on some heuristics. The algorithm is similar to [[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), Algorithm 4.4.3]

<a id="function-abelianextension-fldalg"></a>
##### `AbelianExtension(K): FldAlg -> FldAb`

<a id="function-abelianextension-rngord"></a>
##### `AbelianExtension(M): RngOrd -> FldAb`

```magma
Conductor: [RngOrdIdl, [RngIntElt]]                    Default: [ ]
```

Creates an abelian extension $A$ of $k$ the coefficient field of the input $K$ that is isomorphic to $K$. If a value for `Conductor` is given, it must contain a multiple of the true conductor, otherwise the discriminant of $K$ is used to be more specific, in case $K$ is a number field, the discriminant of it’s maximal order is used as an initial guess, while for field of fractions of orders ($K$ of type `FldOrd`), the defining order gives the initial guess.

In contrast to `MaximalAbelianSubfield`, provided the field is abelian, this function always computes a correct answer.

<a id="example-ex-1fc01e"></a>
##### `Example: Hilbert Class Field of a Sextic Field (ex-1fc01e)`

We will compute the Hilbert class field of the sextic field defined by a zero of the polynomial $x^6 - 3x^5 + 6x^4 + 93x^3 - 144x^2 - 153x + 2601$ which has a class group isomorphic to $C_3\times C_3$.

```magma
> m := LLL(MaximalOrder(Polynomial([2601, -153, -144, 93, 6, -3, 1 ])));
```

The call to LLL is not necessary, but quite frequently class group computations are faster if the order basis is LLL-reduced first.

```magma
> a, b := ClassGroup(m : Proof := "GRH");
> a;
Abelian Group isomorphic to Z/3 + Z/3
Defined on 2 generators
Relations:
    3*a.1 = 0
    3*a.2 = 0
```

`HilbertClassField` on `m` computes a Non-simple number field defining the Hilbert class field of `m`.

```magma
> H := HilbertClassField(NumberField(m)); H;
Number Field with defining polynomial [ $.1^3 + 1/595*(-460*$.1^5
    + 2026*$.1^4 - 4052*$.1^3 - 52572*$.1^2 + 229338*$.1 -
    529159), $.1^3 + 1/37485*(82*$.1^5 + 4344*$.1^4 + 8805*$.1^3
    + 15990*$.1^2 + 410931*$.1 + 1098693)] over its ground field
> time _ := MaximalOrder(H);
Time: 2.200
```

However, in order to access more of the structural information of `H` we have to create it as an abelian extension, using `b`.

```magma
> A := AbelianExtension(b);
> HH := NumberField(A);
```

Now we are able to compute the maximal order of `HH` using `A` and verify the discriminant:

```magma
> time M := MaximalOrder(A:Al := "Discriminant");
Time: 0.170
> Discriminant(M);
Ideal of m
Basis:
[1 0 0 0 0 0]
[0 1 0 0 0 0]
[0 0 1 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 1 0]
[0 0 0 0 0 1]
```

Note, that as a side effect, the maximal order of `HH` is now known:

```magma
> time MaximalOrder(HH);
Maximal Order of Equation Order with defining polynomials x^3 + [841, 841, 312,
    -534, 222, 0], x^3 + [25, -2, -9, 7, -11, -8] over m
Time: 0.000
```

We will continue this example following the next section.

#### Binary Operations

The model underlying the class field theory as implemented in Magma is based on the (generalized) ideal class groups. Based on this group-theoretical description, certain binary operations are easily possible:

<a id="operation-op-eq-fldab-fldab"></a>
##### `A eq B: FldAb, FldAb -> BoolElt`

Gives two abelian extensions with the same base field, decide if they are the same.

<a id="operation-op-subset-fldab-fldab"></a>
##### `A subset B: FldAb, FldAb -> BoolElt`

Gives two abelian extensions with the same base field, decide if they are contained in each other.

<a id="operation-op-times-fldab-fldab"></a>
##### `A * B: FldAb, FldAb -> FldAb`

Given two abelian extensions with the same base field, find the smallest abelian extension containing both.

<a id="operation-op-meet-fldab-fldab"></a>
##### `A meet B: FldAb, FldAb -> FldAb`

Given two abelian extensions with the same base field, find the largest common subfield.

### Galois Module Structure

If the base field $k$ for class field constructions is normal with respect to some subfield $k_0$, i.e. $k/k_0$ is normal with Galois group $G$ and if the defining modulus of the ideal group is $G$–invariant, then $G$ acts on the ideal group. The following functions view ideal groups as Galois modules. Given an abelian extension $A$ and parameters `All` and `Over`, we will consider this setup:

Let $k$ be the `BaseField` of $A$ and $k_1$ the coefficient field of $k$. If `All` is `true`, let $g := {\operatorname{Aut}}(k/k_1)$, otherwise, $g := \langle \hbox{\tt Over}\rangle$. In both cases we define $k_0 := {\operatorname{Fix}}(k, g)$. In particular, if $k$ is normal over the coefficient field $k_1$ then $k_0 = k_1$ and $g$ is the full Galois group.

In general $g$ is not required to contain $k_1$ automorphisms, so that any subset of the ${\mathbb{Q}}$ automorphism group is valid as input. By construction, $k$ is normal over $k_0$, and $g$ acts on the ideals of $k$. In general however, $g$ does not act on the ideal groups used to define $A$.

#### Predicates

<a id="function-fldab-isabelian"></a>
##### `IsAbelian(A): FldAb -> BoolElt`

```magma
All : BoolElt                    Default: false
Over: [Map]                      Default: []
```

Returns `true` if and only if the abelian extension $A$ is abelian over $k_0$.

<a id="function-fldab-isnormal"></a>
##### `IsNormal(A): FldAb -> BoolElt`

```magma
All : BoolElt                    Default: false
Over: [Map]                      Default: []
```

Returns `true` if and only if the abelian extension $A$ is normal over $k_0$. This tests whether the defining ideal group is a $g$-module.

<a id="function-fldab-iscentral"></a>
##### `IsCentral(A): FldAb -> BoolElt`

```magma
All : BoolElt                    Default: false
Over: [Map]                      Default: []
```

Returns `true` if and only if the abelian extension $A$ is central over $k_0$. If $k$ is cyclic over $k_0$ then this is equivalent to checking if $A$ is abelian over $k_0$. This tests whether the defining ideal group is a $g$–module with trivial action: If $N$ is the norm group of $A$, the group extension

$$
1 \to N \to G \to g\to 1
$$

is central.

#### Constructions

<a id="function-genusfield-fldab"></a>
##### `GenusField(A): FldAb -> FldAb`

```magma
All : BoolElt                    Default: false
Over: [Map]                      Default: []
```

The genus field is the maximal abelian extension of $k_0$ that is contained in the abelian extension $A$. The result of this function is an abelian extension of $k_0$.

<a id="function-h2-g-a-fldab"></a>
##### `H2_G_A(A): FldAb -> ModTupRng`

For $A$ such that $A$ is normal over ${\mathbb{Q}}$ with base field $k$ that is normal too, compute the 2nd cohomology group of the Galois group of $k$ acting on the ideal group defining $A$.

<a id="function-normalsubfields-fldab"></a>
##### `NormalSubfields(A): FldAb -> []`

```magma
Quot: SeqEnum[RngIntElt]                    Default: []
```

For an abelian extension, normal over $Q$ and defined over a normal number field $k$ as base field, return a list of all normal intermediate fields. If `Quot` is given, restrict to fields where the norm group has the abelian invariants as specified in `Quot`.

<a id="function-abeliansubfield-fldab-grpab"></a>
##### `AbelianSubfield(A, U): FldAb, GrpAb -> FldAb`

<a id="function-fixedfield-fldab-grpab"></a>
##### `FixedField(A, U): FldAb, GrpAb -> FldAb`

```magma
IsNormal: BoolElt                    Default: false
```

For an abelian extension $A$ with norm group map $G \to I$ for some finite abelian group $G$ and a subgroup $U<G$, define the field corresponding to $G/U$, ie. the field fixed by $U$. If `IsNormal` is given then any cohomology information that is present is transferred to the new field - if possible.

<a id="function-fldab-cohomologymodule"></a>
##### `CohomologyModule(A): FldAb -> ModGrp, Map, Map, Map`

For an abelian extension $A$ defined over some normal field $k/Q$, compute the cohomology module (see Chapter [Cohomology and Extensions](https://docs.magma-maths.org/FiniteGroups/CohomologyAndExtensions/index-cohomology-and-extensions.md#grpcohom-main)). The maps returned give the transition between the $Z$-modules used in the cohomology package and the ideal groups used to define $A$.

The first map returned maps between the automorphism group of $k$ (as an permutation group) and the actual automorphisms of the field. It is obtained as the third return value of [`AutomorphismGroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/automorphism.md#function-rngord-automorphismgroup).

The second map maps between the ideal group used to create $A$ and a standart representation of the same group.

The third map maps between the standart representation of the norm group and the $Z$-module.

### Conversion to Number Fields

Although in theory an abelian extension “uniquely” defines a number field and therefore all its properties, not all of them are directly accessible (in Magma at least). The functions listed here perform the conversion to a number field, the most important being of course the function that computes defining equations.

<a id="function-equationorder-fldab"></a>
#### `EquationOrder(A): FldAb -> RngOrd`

```magma
ClassField: Verbose                    Default: 5
```

Given an abelian extension $A$ of a number field, using the algorithm of Fieker ([[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), [Fie00](https://docs.magma-maths.org/references.md#cite-fiekerartin)]) defining equations for $A$ are computed. For each cyclic factor of prime power degree, one polynomial will be constructed. Depending on the size of the cyclic factors encountered, this may be a very lengthy process.

<a id="function-numberfield-fldab"></a>
#### `NumberField(A): FldAb -> FldNum`

Converts the abelian extension $A$ into a number field. This is equivalent to `NumberField(EquationOrder(A))`.

<a id="function-maximalorder-fldab"></a>
#### `MaximalOrder(A): FldAb -> RngOrd`

```magma
Al     : MonStgElt                    Default: "Kummer"
Partial: BoolElt                      Default: false
```

Computes the maximal order of the abelian extension $A$. The result is the same as that given by `MaximalOrder(EquationOrder(A))` but this functions uses the special structure of $A$ and should be much faster in general.

The first step involves computing the maximal orders of each component.

If `Al eq "Kummer"` the maximal order computation uses Kummer theory to compute maximal orders of kummer extensions known to each component then intersects these with the component to gain the maximal order of that component [[Sut12](https://docs.magma-maths.org/references.md#cite-suth-max-kummer)].

If `Al eq "Round2"`, the ordinary round 2 maximal order function is used on the components.

If `Al eq "Discriminant"`, the discriminant of the components is passed into the maximal order computation.

In the second step, the components are combined into an approximation of the full maximal order of $A$.

If `Partial` is `true`, the computations stop at this point, otherwise `MaximalOrder` is again called and the discriminant of $A$ is passed in.

<a id="function-fldab-components"></a>
#### `Components(A): FldAb -> [RngOrd]`

```magma
ClassField: Verbose                    Default: 5
```

A list of relative extensions is determined. One extension per cyclic factor is computed.

<a id="function-generators-fldab"></a>
#### `Generators(A): FldAb -> [ ], [ ], [ ]`

The first return value is a sequence of generating elements for `NumberField(A)`, the second contains the same elements but viewed as elements of the Kummer extension used in the construction. The third list contains the images of the second list under the action of a generator of the automorphism group corresponding to this cyclic factor.

#### Character Theory

Given a Hecke character $\psi$ of a number field $K$, one can compute an associated abelian extension $L/K$, and vice-versa. The same is true for Dirichlet characters over the rationals. The number field $K$ must be given as an absolute field. See Chapter [Dirichlet and Hecke Characters](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/index-dirichlet-and-hecke-characters.md#char-main) for more about Dirichlet and Hecke characters.

<a id="function-abelianextension-grphecke"></a>
##### `AbelianExtension(psi): GrpHecke -> FldAb`

<a id="function-abelianextension-grpheckeelt"></a>
##### `AbelianExtension(psi): GrpHeckeElt -> FldAb`

<a id="function-abelianextension-grpdrchnfelt"></a>
##### `AbelianExtension(chi): GrpDrchNFElt -> FldAb`

<a id="function-abelianextension-grpdrchelt"></a>
##### `AbelianExtension(chi): GrpDrchElt -> FldAb`

Given a Hecke character group (or a generator if cyclic) over a number field $K$, or a Dirichlet character over the rationals (possibly represented as a number field), compute the corresponding Abelian field.

<a id="function-heckecharactergroup-fldnum"></a>
##### `HeckeCharacterGroup(L): FldNum -> GrpHecke`

Given an abelian relative extension $L/K$ where $K$ is absolute, compute the corresponding Hecke character group over $K$.

<a id="function-heckecharactergroup-fldab"></a>
##### `HeckeCharacterGroup(A): FldAb -> GrpHecke`

Given an abelian field, compute the corresponding Hecke character group.

<a id="example-ex-d88d5d"></a>
##### `Example: Hecke Characters of a Class Field (ex-d88d5d)`

We construct a cyclic cubic extension of a quartic field (of class number 2, it happens), and compute the corresponding Hecke character group, then check that the process inverts correctly. Finally we check the $L$-series of a Hecke character that generates this character group.

```magma
> _<x> := PolynomialRing(Integers());
> K := NumberField(x^4+4*x^3+7*x^2+2*x+1);
> f := Polynomial([1, 1-K.1, 1+K.1+K.1^2, 1]);
> E := ext<K|f>; // E/K is cyclic of deg 3
> G := HeckeCharacterGroup(E); psi:=G.1;
> A := AbelianExtension(psi); // either psi or G
> assert IsIsomorphic(E,NumberField(A));
> L := LSeries(psi);
> CFENew(L);
-2.36658271566303541623518569585E-30
```

Here is an example that is not cyclic, namely the Hilbert class field of ${\bf Q}(\sqrt{-4027})$.

```magma
> K := QuadraticField(-4027);
> ClassGroup(K);
Abelian Group isomorphic to Z/3 + Z/3
> G := HeckeCharacterGroup(1*Integers(K));
> L := AbelianExtension(G);
> assert G eq HeckeCharacterGroup(L);
> assert IsIsomorphic(HilbertClassField(K),NumberField(L));
> L1 := AbelianExtension(G.1); // L1/K cyclic deg 3
> L2 := AbelianExtension(G.2); // L2/K cyclic deg 3
> assert L1*L2 eq L;
```

### Invariants

Several invariants of an abelian extension can easily be obtained from the ideal groups without first computing defining equations for the field.

<a id="function-discriminant-fldab"></a>
#### `Discriminant(A): FldAb -> RngOrdIdl, [RngIntElt]`

Let $A$ be an abelian extension. Based on the conductor-discriminant relation made explicit by [[Coh00](https://docs.magma-maths.org/references.md#cite-cohen2), Section 3.5.2], the discriminant of the class field $A$ is computed. This does not involve the computation of defining equations. The second return value is the signature of the resulting field.

<a id="function-absolutediscriminant-fldab"></a>
#### `AbsoluteDiscriminant(A): FldAb -> RngIntElt`

The absolute discriminant of $A$ as a number field over ${\mathbb{Q}}$.

<a id="function-fldab-conductor"></a>
#### `Conductor(A): FldAb -> RngOrdIdl, [RngIntElt]`

Computes the conductor of the abelian extension $A$, i.e. the smallest ideal and the smallest set of infinite places that are necessary to define $A$. The algorithm used is based on [[HPP97](https://docs.magma-maths.org/references.md#cite-pau2), [Pau96](https://docs.magma-maths.org/references.md#cite-pau1)].

<a id="function-degree-fldab"></a>
#### `Degree(A): FldAb -> RngIntElt`

The degree of the abelian extension $A$.

<a id="function-absolutedegree-fldab"></a>
#### `AbsoluteDegree(A): FldAb -> RngIntElt`

The degree of the abelian extension $A$ over ${\mathbb{Q}}$.

<a id="function-coefficientring-fldab"></a>
#### `CoefficientRing(A): FldAb -> Fld`

<a id="function-coefficientfield-fldab"></a>
#### `CoefficientField(A): FldAb -> Fld`

<a id="function-basefield-fldab"></a>
#### `BaseField(A): FldAb -> Fld`

The base field of the abelian extension $A$, that is `FieldOfFractions(BaseRing(A))`.

<a id="function-basering-fldab"></a>
#### `BaseRing(A): FldAb -> Rng`

<a id="function-coefficientring-fldab-2"></a>
#### `CoefficientRing(A): FldAb -> Rng`

The base ring of the abelian extension $A$, that is the maximal order used to define the underlying ray class group.

<a id="function-normgroup-fldab"></a>
#### `NormGroup(A): FldAb -> Map, RngOrdIdl, [RngIntElt]`

The norm group (see the definition of [norm groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/introduction.md#fldab-norm-group)) used to define the abelian extension $A$.

<a id="function-decompositionfield-rngordidl-fldab"></a>
#### `DecompositionField(p, A): RngOrdIdl, FldAb -> FldAb`

The decomposition field of the finite prime $p$ in the abelian extension $A$ as an abelian (sub)extension.

<a id="function-decompositionfield-plcnumelt-fldab"></a>
#### `DecompositionField(p, A): PlcNumElt, FldAb -> FldAb`

The decomposition field of the place $p$ in the abelian extension $A$ as an abelian extension.

<a id="function-decompositiongroup-rngintelt-fldab"></a>
#### `DecompositionGroup(p, A): RngIntElt, FldAb -> GrpAb`

<a id="function-decompositiongroup-rngordidl-fldab"></a>
#### `DecompositionGroup(p, A): RngOrdIdl, FldAb -> GrpAb`

The decomposition group of the finite prime $p$ in the abelian extension $A$. The abelian group returned is a subgroup of the norm group.

<a id="function-decompositiongroup-plcnumelt-fldab"></a>
#### `DecompositionGroup(p, A): PlcNumElt, FldAb -> GrpAb`

The decomposition group of the place $p$ in the abelian extension $A$. The abelian group returned is a subgroup of the `NormGroup`.

<a id="function-decompositiontype-fldab-rngordidl"></a>
#### `DecompositionType(A, p): FldAb, RngOrdIdl -> [Tpl]`

The “type” of the decomposition of the finite prime ideal $p$ in the abelian extension $A$ as a sequence of pairs $\langle f, e\rangle$ giving the degrees and the ramification indices.

<a id="function-decompositiontype-fldab-plcnumelt"></a>
#### `DecompositionType(A, p): FldAb, PlcNumElt -> [Tpl]`

The “type” of the decomposition of the place $p$ in the abelian extension $A$ as a sequence of pairs $\langle f, e\rangle$ giving the degrees and the ramification indices.

<a id="function-decompositiontype-fldab-rngintelt"></a>
#### `DecompositionType(A, p): FldAb, RngIntElt -> [Tpl]`

```magma
Normal: BoolElt                    Default: false
```

The “type” of the decomposition over ${\mathbb{Q}}$ of the prime number $p$ in the abelian extension $A$ as a sequence of pairs $\langle f, e\rangle$ giving the degrees and the ramification indices. If `Normal` is set to `true` then the algorithm assumes that the base field of $A$ is normal. This is used to speed up the computations.

<a id="function-decompositiontypefrequency-fldab"></a>
#### `DecompositionTypeFrequency(A, l): FldAb, [ ] -> Mset`

```magma
Normal: BoolElt                    Default: false
```

Computes the decomposition type of all elements in $l$ and returns them as a multi-set. The list $l$ must only contain objects for which `DecompositionType` is defined. If `Normal eq true` then the underlying `DecompositionType` function must be able to deal with it too. If `Normal` is set to `true` then the algorithm assumes that the base field of the abelian extension $A$ is normal. This is used to speed up the computations.

<a id="function-decompositiontypefrequency-fldab-rngintelt-rngintelt"></a>
#### `DecompositionTypeFrequency(A, a, b): FldAb, RngIntElt, RngIntElt -> Mset`

```magma
Normal: BoolElt                    Default: false
```

Computes the decomposition type over ${\mathbb{Q}}$ in the abelian extension $A$ of all prime numbers $a \leq p \leq b$ and returns them as a multi set.

If `Normal` is set to `true` then the algorithm assumes that the base field of $A$ is normal. This is used to speed up the computations.

### Automorphisms

The group of relative automorphisms of the abelian extension is isomorphic via the Artin map to the ideal group used to define the field. After defining equations are computed, the user can explicitly map ideals that are coprime to the defining modulus to automorphisms of the field.

<a id="function-artinmap-fldab"></a>
#### `ArtinMap(A): FldAb -> Map`

For an abelian extension $A$ of $F$, this returns the Artin map as a map from the set of ideals of $F$ to the group of automorphisms of $A$ over $F$. (This induces an isomorphism from the defining group of $A$ to the group of automorphisms).

Since this function constructs the number field defined by $A$, this may involve a lengthy calculation.

<a id="function-frobeniusautomorphism-fldab-rngordidl"></a>
#### `FrobeniusAutomorphism(A, p): FldAb, RngOrdIdl -> Map`

Computes the relative automorphism of the abelian extension $A$ that is the Frobenius automorphism of $p$. Since this function constructs the number field defined by $A$, this may involve a lengthy calculation.

<a id="function-fldab-automorphismgroup"></a>
#### `AutomorphismGroup(A): FldAb -> GrpFP, [Map], Map`

```magma
All : BoolElt                    Default: false
Over: [Map]                      Default: [ ]
```

If `IsNormal` is true for the abelian extension $A$ with the given parameters, then the automorphism group of $A$ over $k_0$ is computed. Since this function constructs the number field defined by $A$, this may involve a lengthy calculation.

<a id="function-probableautomorphismgroup-fldab"></a>
#### `ProbableAutomorphismGroup(A): FldAb -> GrpFP, SeqEnum`

```magma
Factor: RingIntElt                    Default: 1
```

In case of $A$ and it’s base field $k$ both begin normal over ${\mathbb{Q}}$, the automorphism group $G$ of $A/{\mathbb{Q}}$ is a group extension of the abelian group coming from the definition of $A$ and the automorphism group of $k/{\mathbb{Q}}$. This functions sets up the corresponding group extension problem and uses [`DistinctExtensions`](https://docs.magma-maths.org/FiniteGroups/CohomologyAndExtensions/extensions-2.md#function-grpcoh-distinctextensions) to compute all group theoretical possibilities for $G$. In case of several possible groups, a further selection based on cycle types and their frequencies is attempted. The optional parameter `Factor` is passed on to [`ImproveAutomorphismGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-fldab-improveautomorphismgroup) to control the amount of time spent on improving the guess.

While this function can be much faster than the direct computation of the automorphism group, the result of this computation is in general not guaranteed. Furthermore, as there are groups that cannot be distinguished by cycle types and their frequencies alone, correctness cannot be achieved by increasing the value of `Factor`. The intended use of this function is to have a (reasonable fast) method of checking is the field under consideration has an interesting group before an unnecessary long call to [`AutomorphismGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/automorphisms.md#function-fldab-automorphismgroup) is attempted.

<a id="function-fldab-improveautomorphismgroup"></a>
#### `ImproveAutomorphismGroup(F, E): FldAb, SeqEnum -> GrpFP, SeqEnum`

```magma
Factor: RngIntElt                    Default: 1
```

Given the output of `ProbableAutomorphismGroup` or `ImproveAutomorphismGroup` try to improve the quality of the guess by splitting more primes to get more data for a cycle-type frequency analysis.

<a id="example-ex-b351e9"></a>
#### `Example: Probable Automorphism Group of a Class Field (ex-b351e9)`

We will demonstrate the use of `ProbableAutomorphismGroup` by investigating extensions of ${\mathbb{Q}}(\sqrt {10})$:

```magma
> k := NumberField(Polynomial([-10, 0, 1]));
> R, mR := RayClassGroup(4*3*5*MaximalOrder(k));
> s := [x`subgroup : x in Subgroups(R:Quot := [2,2])];
> a := [ AbelianExtension(Inverse(mq)*mR) where
>                             _, mq := quo<R|x> : x in s ];
> n := [ x : x in a | IsNormal(x:All)];
> ProbableAutomorphismGroup(n[2]);
Finitely presented group on 3 generators
Relations
    $.2^2 = Id($)
    $.3^2 = Id($)
    ($.2, $.3) = Id($)
    ($.1, $.2^-1) = Id($)
    $.1^-1 * $.3 * $.1 * $.3^-1 * $.2^-1 = Id($)
    $.1^2 = Id($)
```

This shows that since there is only one group extension of a $V_4$ by $C_2$ with the action induced from the action of the Galois group of $k$ on $R$, the Automorphism group is already determined. On the other hand, for the first subgroup there are more possibilities:

```magma
> g, c := ProbableAutomorphismGroup(n[1]);
> #c;
2
```

We will try to find the “correct” guess by looking at the orders of elements which correspond to decomposition types and their frequencies:

```magma
> {* Order(x) : x in CosetImage(c[1], sub<c[1]|>) *};
{* 1, 2^^7 *}
> {* Order(x) : x in CosetImage(c[2], sub<c[2]|>) *};
{* 1, 2^^3, 4^^4 *}
```

So, if we find a prime of degree 4 we know it’s the second group. Looking at the frequencies, we can be pretty confident that we should be able to find a suitable prime - if it exists. Since among the first 100 primes there is not a single prime with a factor of degree 4 we are pretty confident that the first group is the correct one. By setting the verbose level, we can see how the decision is made:

```magma
> _ := ImproveAutomorphismGroup(n[1], c:Factor := 2);
Orders and multiplicities are  [
    {* 1, 2^^7 *},
    {* 1, 2^^3, 4^^4 *}
]
Probable orders and multiplicities are  {* 1^^3, 2^^34 *}
Error terms are  [ 0.00699329636679632541587354133907,
0.993006703633203674584126458661 ]
```

This indicates that out of 37 primes considered, non had a degree 4 factor, thus we are confident that the first group is the correct one.

<a id="function-absolutegaloisgroup-fldab"></a>
#### `AbsoluteGaloisGroup(A): FldAb -> GrpPerm, SeqEnum, GaloisData`

Given an abelian extension, compute its Galois group over ${\mathbb{Q}}$, ie. the abstract automorphism group of a ${\mathbb{Q}}$-normal closure of $A$. This function requires the defining equations for $A$ as a number field to be known, but is considerably faster than calling [`GaloisGroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngord-galoisgroup-fld) for the number field directly. The group is returned as a permutation group. All roots of the defining polynomial of the coefficient field of $A$ as well as of the defining polynomials of $A$ itself are returned in some local field. The zeros as well as data required for further computations are contained in the 3rd return value.

<a id="function-twococycle-fldab"></a>
#### `TwoCocycle(A): FldAb -> UserProgram`

For an abelian extension that is normal over $Q$ and defined over a normal base field $k/Q$, the automorphism group of $A/Q$ is a group extension of the Galois group of $k$ by $A$. As a group extension it corresponds to an element in the second cohomology group and can be represented by an explicit $2$-cocycle with values in the norm group. This function computes such a cocycle. It can be used as an element of the second cohomology group of the cohomology module of $A$, see [`CohomologyModule`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-cohomologymodule).

### Norm Equations

For cyclic fields Hasse’s famous norm theorem states that when considering the solvability of norm equations, local solvability everywhere is equivalent to global solvability. Unfortunately, this local-global principle fails in general even for fields with Galois group isomorphic to Klein’s group $V_4$. The extent of this failure is measured by the number knot which is the quotient of the numbers that are everywhere local norms by the global norms. As it turns out, the structure and size of this quotient can be easily computed, so that it is possible to test if Hasse’s theorem is sufficient.

As a second consequence, solvability can be decided by looking at the maximal $p$-subfields for all primes that divide the degree of the field. Even better, a global solution can be obtained by combining solutions from the maximal $p$-subfields.

It is important to note that local solvability can be decided by analyzing the ideal groups only. Thus, all the “local” functions will avoid computing defining equations and are therefore reasonably fast.

<a id="function-islocalnorm-fldab-rngordelt-rngordidl"></a>
#### `IsLocalNorm(A, x, p): FldAb, RngOrdElt, RngOrdIdl -> BoolElt`

<a id="function-islocalnorm-fldab-rngintelt-rngint"></a>
#### `IsLocalNorm(A, x, p): FldAb, RngIntElt, RngInt -> BoolElt`

Returns `true` if and only if $x$ is a local norm in the abelian extension $A$ at the finite prime $p$, i.e. if $x$ is a norm in the extension of the local field obtained by taking the completion at $p$. The second signature applies when the base field is the rationals, so that $x$ is a rational integer and $p$ a prime ideal of the integers.

<a id="function-islocalnorm-fldab-rngordelt-rngintelt"></a>
#### `IsLocalNorm(A, x, i): FldAb, RngOrdElt, RngIntElt -> BoolElt`

Returns `true` if and only if $x$ is a local norm in the abelian extension $A$ at the infinite prime $i$.

<a id="function-islocalnorm-fldab-rngordelt-plcnumelt"></a>
#### `IsLocalNorm(A, x, p): FldAb, RngOrdElt, PlcNumElt -> BoolElt`

Returns `true` if and only if $x$ is a local norm in the abelian extension $A$ at the place $p$, i.e. if $x$ is a norm in the extension of the local fields obtained by taking the completion at $p$.

<a id="function-islocalnorm-fldab-rngordelt"></a>
#### `IsLocalNorm(A, x): FldAb, RngOrdElt -> BoolElt`

Returns `true` if and only if $x$ is a local norm everywhere in the abelian extension $A$.

<a id="function-knot-fldab"></a>
#### `Knot(A): FldAb -> GrpAb`

The (number) knot is defined as the quotient group of the group consisting of those elements of the base field of the abelian extension $A$ that are local norms everywhere modulo the elements that are norms. Therefore, if the knot is trivial, an element is a local norm if and only if it is a norm.

Hasse’s norm theorem states that for cyclic fields $A$ the knot is always trivial. In general, this is not true for non-cyclic fields.

<a id="function-normequation-fldab-rngordelt"></a>
#### `NormEquation(A, x): FldAb, RngOrdElt -> BoolElt, [RngOrdElt]`

Checks if $x$ is a norm, and if so returns an element of the pre-image. As a first step this function verifies if $x$ is a local norm. If $x$ passes this test, the number field of $A$ is computed and by combining solutions of the norm equation in certain subfields a solution in $A$ is constructed. If the knot is non-trivial, the last step may fail.

This function can be extremely time consuming as not only defining equations for $A$ are computed but class groups in some of them. For large $A$ this is much more efficient than just solving the norm equation in the number field.

<a id="function-isnorm-fldab-rngordelt"></a>
#### `IsNorm(A, x): FldAb, RngOrdElt -> BoolElt`

As a first step, this function verifies if $x$ is a local norm. If $x$ passes this test, Magma verifies whether the knot is trivial. If it is, `true` is returned. However, if the knot is non-trivial, then the function `NormEquation` is invoked.

<a id="example-ex-56eb0a"></a>
#### `Example: Norm Equations via Class Fields (ex-56eb0a)`

We illustrate the power of the class field theoretic approach with the following example from group theory. We want to solve for elements of norm $2$ or $5$ in the field ${\mathbb{Q}}(\zeta_5)(\eta)$ where $\eta^{20} - \zeta_5\eta^{10}+\zeta_5^2= 0$ over the cyclotomic field. This field has degree $80$ over ${\mathbb{Q}}$ and is therefore far too large for a direct method.

```magma
> k := CyclotomicField(5);
> kt := ext<k|>;
> K := NumberField(kt.1^20 - k.1*kt.1^10 +k.1^2);
```

Now we convert $K$ into an abelian extension of $k$:

```magma
> A := AbelianExtension(K);
> A;
FldAb, defined by (<[5904900000000000000000000, 0, 0, 0]>, [])
of structure: Z/2 + Z/10

> Conductor(A);
Ideal
Two element generators:
    [37500, 0, 0, 0]
    [12060, 15120, 7440, 1680]
[]
```

We now recreate $A$ using the smaller conductor. This will significantly speed up the following computations.

```magma
> m_0, m_inf := $1;
> A := AbelianExtension(K : Conductor := [* m_0, m_inf *]);
```

We first check the local solvability:

```magma
> IsLocalNorm(A, BaseRing(A)!2);
false
> IsLocalNorm(A, BaseRing(A)!5);
true
> Knot(A);
Abelian Group isomorphic to Z/2
Defined on 1 generator in supergroup:
    $.1 = $.1
Relations:
    2*$.1 = 0
```

Since the knot is isomorphic to a $C_2$, the local solvability is not sufficient, but we can attempt to solve the equation:

```magma
> NormEquation(A, BaseRing(A)!5);
true [
    1/10*(-3*zeta_5^3 - 6*zeta_5^2 + zeta_5 -
        7)*$.1*$.2*$.3^4 + 1/10*(9*zeta_5^3 + 3*zeta_5^2 +
        2*zeta_5 + 6)*$.1*$.2*$.3^3 + 1/10*(-6*zeta_5^3 +
        3*zeta_5^2 - 3*zeta_5 + 1)*$.1*$.2*$.3^2 +
        1/10*(-3*zeta_5^3 - 6*zeta_5^2 + zeta_5 -
        7)*$.1*$.2*$.3 + 1/2*(2*zeta_5^3 + zeta_5^2 + zeta_5
        + 2)*$.1*$.2 + 1/10*(-12*zeta_5^3 - 4*zeta_5^2 -
        6*zeta_5 - 13)*$.1*$.3^4 + 1/10*(11*zeta_5^3 +
        2*zeta_5^2 + 13*zeta_5 + 4)*$.1*$.3^3 +
        1/10*(zeta_5^3 + 2*zeta_5^2 - 7*zeta_5 +
        9)*$.1*$.3^2 + 1/10*(-12*zeta_5^3 - 4*zeta_5^2 -
        6*zeta_5 - 13)*$.1*$.3 + 1/2*(2*zeta_5^3 - zeta_5^2
        + 2*zeta_5 + 1)*$.1 + 1/10*(-zeta_5^3 + 3*zeta_5^2 -
        3*zeta_5 + 1)*$.2*$.3^4 + 1/10*(-2*zeta_5^3 +
        zeta_5^2 + 4*zeta_5 - 3)*$.2*$.3^3 +
        1/10*(3*zeta_5^3 - 4*zeta_5^2 - zeta_5 +
        2)*$.2*$.3^2 + 1/10*(-zeta_5^3 + 3*zeta_5^2 -
        3*zeta_5 + 1)*$.2*$.3 + 1/2*(-zeta_5^3 - zeta_5^2 -
        1)*$.2 + 1/10*(-14*zeta_5^3 - 13*zeta_5^2 - 2*zeta_5
        - 21)*$.3^4 + 1/10*(22*zeta_5^3 + 4*zeta_5^2 +
        11*zeta_5 + 13)*$.3^3 + 1/10*(-8*zeta_5^3 +
        9*zeta_5^2 - 9*zeta_5 + 8)*$.3^2 +
        1/10*(-14*zeta_5^3 - 13*zeta_5^2 - 2*zeta_5 -
        21)*$.3 + 1/2*(5*zeta_5^3 + zeta_5^2 + 3*zeta_5 + 4)
]
> _, s := $1;
> Norm(s[1]);
5
```

Thus, the largest field we had to work in was of degree $16$.

### Attributes

In this rather technical section, we describe the programming interface to the abelian extension module. Most of the internal representation is available as attributes and may be used to extend the package.

#### Orders

The only attribute of orders `RngOrd` that is of interest here concerns cyclotomic extensions. The first and usually most time consuming step while computing defining extensions is to adjoin certain roots of unity and to compute class groups of these rather large fields.

The cyclotomic extensions are stored and are available via an attribute. This attribute is a read-only attribute.

<a id="attribute-attribute-o-cyclotomicextensions-rngord-rec"></a>
##### ``o`CyclotomicExtensions: RngOrd -> [Rec]``

If defined, `CyclotomicExtensions` is a list of records, each containing data for one cyclotomic extension, i.e. for an order $o$ this is an extension of the form $O := o[\zeta_l]$ for a prime power $l = p^n$. The components are

**`Abs`**
a maximal order $Oa$ of $O$ given as an absolute extension

**`Rel`**
$O$ as an extension of $o$

**`p2n`**
the “$l$”, i.e. the cyclotomic order

**`Zeta`**
a primitive $l$th root of unity as an element of the absolute extension `Abs`

**`Aut`**
a list of records describing generators for the automorphism group of $O$ over $o$. If $p$ is an odd prime then the list will always be of length $1$. This list consists of the following components:

**``Aut`Abs``**
the automorphism as an automorphism of $Oa$

**``Aut`Rel``**
the automorphism as an automorphism of $O$. Note that in general this is not an $o$-automorphism, as $o$ itself may contain roots of unity.

**``Aut`Order``**
the order of the automorphism

**``Aut`r``**
the image of $\zeta_l$, this automorphism sends $\zeta_l$ to $\zeta_l^r$.

Due to possible common subfields of $o$ and ${\mathbb{Q}}(\zeta_k)$, the degree of $O$ over $o$ may be smaller than expected. Furthermore, $Oa$ will be in optimized representation.

<a id="example-ex-44588f"></a>
##### `Example: Hilbert Class Field of an Imaginary Quadratic Field (ex-44588f)`

We will demonstrate this with the Hilbert class field of ${\mathbb{Q}}(\sqrt{-1001})$:

```magma
> Zx<x> := PolynomialRing(Integers());
> k := NumberField(x^2+1001);
> g, m :=ClassGroup(k); g;
Abelian Group isomorphic to Z/2 + Z/2 + Z/10
Defined on 3 generators
Relations:
    2*$.1 = 0
    2*$.2 = 0
    10*$.3 = 0
> K := HilbertClassField(k);
Number Field with defining polynomial [ $.1^2 - 2*k.1 + 136,
    $.1^2 - 4*k.1 - 47, $.1^2 + 2*k.1 - 136, $.1^5 + 37210*$.1^3
    + (-2104500*k.1 + 61148840)*$.1^2 + (-292068000*k.1 +
    14636593760)*$.1 + 305212632000*k.1 - 1779009360128] over k
> o := MaximalOrder(k);
> c := o`CyclotomicExtensions;
> #c;
2
```

Since there are two non-isomorphic direct cyclic factors of prime power order in the class group of $k$, we have two cyclotomic extensions stored in $o$. One has order $2$ and the other has order $5$:

```magma
> c[1]`p2n;
2
> c[2]`p2n;
5
```

Since the order $2$ extension is essentially trivial, we will discuss the other extension in detail.

```magma
> c[2]`Abs;
Maximal Order of Equation Order with defining polynomial x^8 +
    4*x^7 + 4016*x^6 + 12034*x^5 + 6032056*x^4 + 12044060*x^3 +
    4016040045*x^2 + 4010020020*x + 1000000005005 over Z
> c[2]`Rel;
Maximal Equation Order with defining polynomial x^4 + x^3 + x^2 +
    x + [1, 0] over o
```

The relative extension is generated by a root of the $5$th-cyclotomic polynomial of degree $4$, so there are no common subfields. The corresponding absolute extension has degree $8$. As one can see, the class group (at least a conditional class group) is known:

```magma
> c[2]`Abs:Maximal;
   F[1]
    |
   F[2]
  /
 /
Q
F  [ 1]     Given by transformation matrix
F  [ 2]     x^8 + 4*x^7 + 4016*x^6 + 12034*x^5 + 6032056*x^4 +
    12044060*x^3 + 4016040045*x^2 + 4010020020*x + 1000000005005
Discriminant: 4016024016004000000
Index: 4100090871676479535981/1
Class Number 12800
Class Group Structure C2 * C4 * C20 * C80
Signature: [0, 4]
```

We will illustrate the `Aut` entries by showing their effect on $\zeta_5$. Since the maps operate between the number fields rather than the orders, we will coerce the results back into the orders for clarity. The only difference between `Rel` and `Abs` is that `Rel` implements the automorphism in the relative extension.

```magma
> Oa := c[2]`Abs;
> z := c[2]`Zeta; z;
[0, 1, 0, 0, 0, 0, 0, 0]
> Oa!c[2]`Aut[1]`Abs(z);
[0, 0, 1, 0, 0, 0, 0, 0]
> z^c[2]`Aut[1]`r;
[0, 0, 1, 0, 0, 0, 0, 0]
```

The `Order` entry gives the order of the automorphism:

```magma
> c[2]`Aut[1]`Order;
4
>  Oa!c[2]`Aut[1]`Abs(z);
[0, 0, 1, 0, 0, 0, 0, 0]
>  Oa!(c[2]`Aut[1]`Abs($1));
[-1, -1, -1, -1, 0, 0, 0, 0]
>  Oa!(c[2]`Aut[1]`Abs($1));
[0, 0, 0, 1, 0, 0, 0, 0]
>  Oa!(c[2]`Aut[1]`Abs($1));
[0, 1, 0, 0, 0, 0, 0, 0]
```

As a by–product one can see the optimized representation: the first four basis elements are clearly $1$, $\zeta_5$, $\zeta_5^2$, $\zeta_5^3$ which are the $T_2$ shortest integral elements in $m$.

#### Abelian Extensions

Abelian extensions have several attributes. Most of them are only useful in programming.

<a id="attribute-attribute-a-components-fldab-rec"></a>
##### ``A`Components: FldAb -> [Rec]``

This read-only attribute contains a record for each cyclic factor of prime power degree that occurs in the abelian extension. In order to describe the contents we have to fix some definitions. Let $o$ be the base ring of the abelian extension $A$. Then $O$ will be the maximal order of the cyclotomic extension $o[\zeta_l]$ as an extensions of ${\mathbb{Z}}$. The algorithm for the computation of defining extensions will firstly compute a generator $a\in O$ such that $O(a^{1/l})$ equals $A(\zeta_l)$. This element will be a certain $S$-unit of $O$.

The components are

**`Basis`**
a matrix $B$ containing order elements. This represents a “multiplicative basis” for the generator $a$ and all the $S$-units that are used.

**`GenRaw`**
the exponent vector $G$ defining $a$, i.e.

$$
a = \prod_i {B_{1,i}}^{G_{i,1}}.
$$

**`UnitsRaw`**
a matrix $U$ defining a basis for the group of $S$-units, i.e.

$$
u_j = \prod_i {B_{1,i}}^{U_{j,i}}.
$$

**`S`**
a list containing the prime ideals of $S$

**`Gen`**
$a$ as an element of $Oa$

**`GenAut`**
the image of a generator for the class field (an image of `ClassField.2`) in the field of fractions of $O$ under a generator for the cyclic group corresponding to this component.

**`GenInv`**
$1/a$ as an element of the field of fractions of $Oa$

**`O`**
the big Kummer extension $Oa(a^{1/l})$

**`ClassField`**
an equation order for the cyclic extension corresponding to this component. This will be an extension of $o$.

**`Artin`**
the Artin map on the big Kummer extension $o[\zeta_l](U_S^{1/l})$ where the automorphisms are represented as elements in some abelian group of type $C_l^{\#S}$.

<a id="attribute-attribute-a-defininggroup-fldab-rec"></a>
##### ``A`DefiningGroup: FldAb -> Rec``

<a id="attribute-attribute-a-normgroup-fldab-rec"></a>
##### ``A`NormGroup: FldAb -> Rec``

These two attributes give access to the ideal group used to define $A$, and they have the same structure. `DefiningGroup` is the group used to create $A$ in the first place whereas `NormGroup` contains the group defined modulo the conductor. The user needs to call the function [`Conductor`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/invariants.md#function-fldab-conductor) in order to define this component. These attributes are read-only.

The records contain the following components:

**`Map`**
the map as passed into the [`AbelianExtension`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-abelianextension) constructor, respectively, an equivalent map.

**`m0`**
the “finite” part of the modulus underlying `Map`

**`m_inf`**
the “infinite” part of the modulus underlying `Map`

**`RcgMap`**
if present, contains the map returned from the call to [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/creation.md#function-fldab-rayclassgroup) with `m0` and `m_inf`.

**`GrpMap`**
if present, the “rest” of `Map`, i.e. `Map` $=$ `RcgMap` $\circ$ `GrpMap`.

<a id="attribute-attribute-a-isabelian-fldab-bool"></a>
##### ``A`IsAbelian: FldAb -> Bool``

Stores the result of a call to [`IsAbelian`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-isabelian) with parameter ```All := ``true```.

<a id="attribute-attribute-a-isnormal-fldab-bool"></a>
##### ``A`IsNormal: FldAb -> Bool``

Stores the result of a call to [`IsNormal`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-isnormal) with parameter ```All := ``true```.

<a id="attribute-attribute-a-iscentral-fldab-bool"></a>
##### ``A`IsCentral: FldAb -> Bool``

Stores the result of a call to [`IsCentral`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/galois-module-structure.md#function-fldab-iscentral) with parameter ```All := ``true```.

<a id="example-ex-63b1eb"></a>
##### `Example: Attributes of a Ray Class Field (ex-63b1eb)`

To illustrate the preceding examples we will investigate the $3$-part of the ray class field modulo $36$ over ${\mathbb{Z}}[\sqrt{-10}]$:

```magma
> Zx<x> := PolynomialRing(Integers());
> o := MaximalOrder(x^2+10);
> r, mr := RayClassGroup(36*o);
> q, mq := quo<r| [r.i*3 : i in [1..Ngens(r)]]>;
> A := AbelianExtension(Inverse(mq)*mr); A;
FldAb, defined by (<[36, 0]>, [])
of structure: Z/3 + Z/3
```

At this stage, the only attribute that is assigned is `DefiningGroup`.

```magma
> la := GetAttributes(FldAb);
> [ <assigned A``i, i> : i in la];
[ <false, Components>, <true, DefiningGroup>, <false, IsAbelian>,
<false, IsCentral>, <false, IsNormal>, <false, NormGroup> ]
```

So let us have a closer look at `DefiningGroup`:

```magma
> d := A`DefiningGroup;
> d;
rec<recformat<Map, m0, m_inf, RcgMap, GrpMap> | Map := Mapping
from: GrpAb: q to Set of ideals of o
Composition of Mapping from: GrpAb: q to GrpAb: r and
Mapping from: GrpAb: r to Set of ideals of o, m0 := Principal
Ideal of o
Generator:
    [36, 0], m_inf := [], RcgMap := Mapping from: GrpAb: r to Set
of ideals of o, GrpMap := Mapping from: GrpAb: q to GrpAb: r>
```

As one can see, `Map` is the original map used to define $A$. Note that this is the composition of `RcgMap` and `GrpMap`, the first being equivalent to `mr`, the second to `mq`. Furthermore, the defining modulus is now available in `m0` and `m_inf`.

After having set up $A$, we now need to transform it into a number field in order for the `Components` to be assigned:

```magma
> K := NumberField(A);
> K;
Number Field with defining polynomial [ $.1^3 - 3*$.1 - 6*$.1 -
    11, $.1^3 - 3*$.1 - 6*$.1 + 11] over its ground field
> c := A`Components;
> #c;
2
```

We will focus on the first component only.

```magma
> B := c[1]`Basis;
> a := &* [ B[1][i] ^ c[1]`GenRaw[i][1] : i in [1..Ncols(B)]];
> a;
-11/1*$.2 + 4/1*$.3 + 2/1*$.4
> c[1]`Gen;
[0, -11, 4, 2]
> c[1]`Gen eq a;
true
> c[1]`GenInv * a eq 1;
true
> c[2]`GenInv * a eq 1;
false
```

In $S$ we need all primes dividing the degree $9$ of our extension, all primes dividing the modulus $36$, and enough primes to generate the $3$-part of the class group. Since the class group can be generated by the prime ideal over $2$, this leaves us with only two prime ideals in $S$. Since $k$ is imaginary quadratic, the base field $k[\zeta_3]$ is totally complex of degree $4$ which implies unit rank $1$. So the free rank of our $S$-unit group will be $3$, and since we have to take care of the torsion unit, `GenRaw` will have $4$ columns.

```magma
> #c[1]`S;
2
> UnitRank(o);
1
> Ncols(c[1]`UnitsRaw);
4
> U := c[1]`UnitsRaw;
> u := [ &* [B[1][i] ^ U[i][j] : i in [1..Ncols(B)]] : j in [1..4]];
```

Now $u_1$ should be a fundamental unit for $Oa$, $u_2$ and $u_3$ are $S$-units and $u_4$ is the torsion unit, since we adjoin the $3$rd-roots of unity, this will be a $6$th root of unity.

```magma
> Oa := Parent(B[1][1]);
> Oa!u[1];
[0, -11, 4, 2]
> IsUnit($1);
true
> Decomposition(u[2]);
[
    <Prime Ideal of Oa
    Two element generators:
        [3, 0, 0, 0]
        [-9, 0, 1, 2], 1>
]
> u[4]^6 eq 1;
```

Now $O$ should be an extension of $Oa$:

```magma
> c[1]`O:Maximal;
         F[1]
           /
          /
      E2[1]
        /
       /
   E1[1]
  /
 /
Q
F  [ 1]     x^3 + [[0, -4], [11, -2]]
E 2[ 1]     x^2 + x + [1, 0]
E 1[ 1]     x^2 + 10
Index : <[[1, 0], [0, 0]]>
```

The class field $K$ we are seeking is a subfield of $O$:

```magma
> c[1]`ClassField;
Equation Order with defining polynomial x^3 + [-3, 0]*x + [-11,
    -6] over o
> g := c[1]`ClassField.2;
> c[1]`O!g;
[[[0, 0], [0, 0]], [[1, 0], [0, 0]], [[11, 2], [11, -2]]]
```

Note that the absolute term of the defining polynomial is $a$. Since `GenAut` is an image of $g$, its minimal polynomial should be the same as that of $g$:

```magma
> MinimalPolynomial(g);
$.1^3 - 3/1*o.1*$.1 - 11/1*o.1 - 6/1*o.2
> Evaluate($1, c[1]`GenAut);
0
```

### Group Theoretic Functions

#### Generic Groups

Quite frequently in computational algebra one constructs a set of objects that generate a group under some operation. Generic groups are finite groups that are defined by generators that have implicit relations. In order to use them, one has to provide a function for the multiplication of two elements and one to check equality. If known, the identity object can also be passed in.

Generic groups are used in the class field package for the automorphism groups. A frequent situation is that one knows certain automorphisms (as maps) and would like to get the group generated by them. If the group is reasonably small, this can be done using the functions in this section.

All functions here rely on the group being small enough to allow complete enumeration of all elements.

The main application are situations where multiplication of the actual objects is time consuming so one would like to transfer as much as possible to some abstract finite group.

<a id="function-genericgroup"></a>
##### `GenericGroup(X): [] -> GrpFp, Map`

```magma
Mult  : Intrinsic                    Default: '*'
Eq    : Intrinsic                    Default: 'eq'
Id    : Any                          Default: 
GrpGen: Verbose                      Default: 3
```

Creates the group $G$ generated by the elements of `X`. The function assumes that the group is finite. The second return value is a map from $G$ onto a list of elements of $G$ which are of the same type as the elements of `X`.

Since this function will enumerate all group elements, the group cannot be too large.

<a id="function-addgenerator-grpfp"></a>
##### `AddGenerator(G, x): GrpFP, . -> BoolElt, GrpFP, Map`

```magma
GrpGen: Verbose                    Default: 3
```

Adds a new generator `x` to $G$. If `x` was already in $G$, the value `false` is returned and the other return values are unassigned. Otherwise, the new group and the corresponding map is returned.

$G$ has to be a generic group as returned by `GenericGroup`.

The function applies a version of Dimino’s algorithm [[Dim](https://docs.magma-maths.org/references.md#cite-dimino)] to find all elements of $G$ with as few operations as possible.

<a id="function-findgenerators-grpfp"></a>
##### `FindGenerators(G): GrpFP -> []`

Given a generic group $G$ as returned by `GenericGroup`, find a small set of generators.

<a id="etale-algebras"></a>
<a id="algetq-main"></a>
<a id="id1"></a>
## Étale Algebras

- [Introduction](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/intro.md)
- [Construction](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md)
  - [`EtaleAlgebra(seq): SeqEnum[FldNum] → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md#function-etalealgebra-seqenum-fldnum)
  - [Example: Etale Algebra of Two Copies of Q](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md#example-ex-e44d0f)
  - [`EtaleAlgebra(f): RngUPolElt[RngInt] → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md#function-etalealgebra-rngupolelt-rngint)
  - [`EtaleAlgebra(f): RngUPolElt[FldRat] → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md#function-etalealgebra-rngupolelt-fldrat)
  - [`DirectProduct(seq): SeqEnum[AlgEtQ] → AlgEtQ, SeqEnum[Map], SeqEnum[Map]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/construct.md#function-directproduct-seqenum-algetq)
- [Attributes](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md)
  - [`DefiningPolynomial(A): AlgEtQ → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-definingpolynomial-algetq)
  - [`Components(A): AlgEtQ → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-components-algetq)
  - [`Dimension(A): AlgEtQ → RngInt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-dimension-algetq)
  - [`AbsoluteDimension(A): AlgEtQ → RngInt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-absolutedimension-algetq)
  - [`HasBaseField(A): AlgEtQ → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-hasbasefield-algetq)
  - [`BaseField(A): AlgEtQ → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-basefield-algetq)
  - [`PrimeField(A): AlgEtQ → FldNum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-primefield-algetq)
  - [`IsNumberField(A): AlgEtQ → BoolElt, FldNum, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#function-isnumberfield-algetq)
  - [`A1 eq A2: AlgEtQ, AlgEtQ → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/attr.md#operation-op-eq-algetq-algetq)
- [Homomorphisms](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md)
  - [`HomsToC(A): AlgEtQ → SeqEnum[Map]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#function-homstoc-algetq)
  - [Example: Complex Embeddings of an Etale Algebra](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#example-ex-58e95c)
  - [`Hom(A, B, img): AlgEtQ, AlgEtQ, SeqEnum[AlgEtQElt] → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#function-hom-algetq-algetq-seqenum-algetqelt)
  - [`DiagonalEmbedding(K, V): AlgEtQ, AlgEtQ → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#function-diagonalembedding-algetq-algetq)
  - [`NaturalAction(K, V): AlgEtQ, AlgEtQ → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#function-naturalaction-algetq-algetq)
  - [Example: Homomorphism into a Product Algebra](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/homs.md#example-ex-aab1bc)
- [Elements](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md)
  - [`Parent(x): AlgEtQElt → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-parent-algetqelt)
  - [`Algebra(x): AlgEtQElt → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-algebra-algetqelt)
  - [`Components(x): AlgEtQElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-components-algetqelt)
  - [`AbsoluteCoordinates(x): AlgEtQElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-absolutecoordinates-algetqelt)
  - [`AbsoluteCoordinates(x, S): AlgEtQElt, AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-absolutecoordinates-algetqelt-algetqord)
  - [`IsCoercible(A, x): AlgEtQ, Any → BoolElt, AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-iscoercible-algetq-any)
  - [`A ! x: AlgEtQ, Any → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-algetq-any)
  - [`One(A): AlgEtQ → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-one-algetq)
  - [`Zero(A): AlgEtQ → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-zero-algetq)
  - [`IsUnit(x): AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-isunit-algetqelt)
  - [`IsZeroDivisor(x): AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-iszerodivisor-algetqelt)
  - [`Random(A, bd): AlgEtQ, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-random-algetq-rngintelt)
  - [`Random(A): AlgEtQ → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-random-algetq)
  - [`RandomUnit(A, bd): AlgEtQ, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-randomunit-algetq-rngintelt)
  - [`x1 eq x2: AlgEtQElt, AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-eq-algetqelt-algetqelt)
  - [`x1 eq x2: RngIntElt, AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-eq-rngintelt-algetqelt)
  - [`x1 eq x2: AlgEtQElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-eq-algetqelt-rngintelt)
  - [`x1 eq x2: FldRatElt, AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-eq-fldratelt-algetqelt)
  - [`x1 eq x2: AlgEtQElt, FldRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-eq-algetqelt-fldratelt)
  - [`x1 + x2: AlgEtQElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-plus-algetqelt-algetqelt)
  - [`x1 + x2: Any, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-plus-any-algetqelt)
  - [`x1 + x2: AlgEtQElt, Any → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-plus-algetqelt-any)
  - [`- x: AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-operation-algetqelt-algetqelt)
  - [`x1 - x2: AlgEtQElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-minus-algetqelt-algetqelt)
  - [`x1 - x2: Any, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-minus-any-algetqelt)
  - [`x1 - x2: AlgEtQElt, Any → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-minus-algetqelt-any)
  - [`x1 * x2: AlgEtQElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-times-algetqelt-algetqelt)
  - [`x1 * x2: Any, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-times-any-algetqelt)
  - [`x1 * x2: AlgEtQElt, Any → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-times-algetqelt-any)
  - [`Inverse(x): AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-inverse-algetqelt)
  - [`x ^ n: AlgEtQElt, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-pow-algetqelt-rngintelt)
  - [`x1 / x2: AlgEtQElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-div-algetqelt-algetqelt)
  - [`x1 / x2: Any, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-div-any-algetqelt)
  - [`x1 / x2: AlgEtQElt, Any → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-op-div-algetqelt-any)
  - [`&+ seq: SeqEnum[AlgEtQElt] → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-operation-seqenum-algetqelt-algetqelt)
  - [`&* seq: SeqEnum[AlgEtQElt] → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-operation-seqenum-algetqelt-algetqelt-2)
  - [`DotProduct(a, b): SeqEnum, SeqEnum → Any`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-dotproduct-seqenum-seqenum)
  - [Example: Components and Idempotents of an Etale Algebra](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#example-ex-1d7031)
  - [`MinimalPolynomial(x): AlgEtQElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-minimalpolynomial-algetqelt)
  - [`MinimalPolynomial(x, F): AlgEtQElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-minimalpolynomial-algetqelt-rng)
  - [`AbsoluteMinimalPolynomial(x): AlgEtQElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-absoluteminimalpolynomial-algetqelt)
  - [`IsIntegral(x): AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-isintegral-algetqelt)
  - [`Evaluate(f, a): RngUPolElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-evaluate-rngupolelt-algetqelt)
  - [`PrimitiveElement(A): AlgEtQ → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-primitiveelement-algetq)
  - [`PowerBasis(A): AlgEtQ → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-powerbasis-algetq)
  - [`Basis(A): AlgEtQ → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-basis-algetq)
  - [`AbsoluteBasis(A): AlgEtQ → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-absolutebasis-algetq)
  - [`A . i: AlgEtQ, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#operation-operation-algetq-rngintelt-algetqelt)
  - [`AbsoluteCoordinates(seq, basis): SeqEnum[AlgEtQElt], SeqEnum[AlgEtQElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-absolutecoordinates-seqenum-algetqelt-seqenum-algetqelt)
  - [`OrthogonalIdempotents(A): AlgEtQ → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-orthogonalidempotents-algetq)
  - [`Idempotents(A): AlgEtQ → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/elements.md#function-idempotents-algetq)
- [Orders of Algebras](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md)
  - [`IsCoercible(S, x): AlgEtQOrd, Any → BoolElt, AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-iscoercible-algetqord-any)
  - [`Order(gens): SeqEnum[AlgEtQElt] → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-order-seqenum-algetqelt)
  - [`Order(A, orders): AlgEtQ, Tup → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-order-algetq-tup)
  - [`Algebra(S): AlgEtQOrd → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-algebra-algetqord)
  - [`ZBasis(S): AlgEtQOrd → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-zbasis-algetqord)
  - [`Generators(S): AlgEtQOrd → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-generators-algetqord)
  - [`O1 eq O2: AlgEtQOrd, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-eq-algetqord-algetqord)
  - [`x in O: AlgEtQElt, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-in-algetqelt-algetqord)
  - [`x in O: RngIntElt, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-in-rngintelt-algetqord)
  - [`x in O: FldRatElt, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-in-fldratelt-algetqord)
  - [`AbsoluteCoordinates(seq, O): SeqEnum[AlgEtQElt], AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-absolutecoordinates-seqenum-algetqelt-algetqord)
  - [`One(S): AlgEtQOrd → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-one-algetqord)
  - [`Zero(S): AlgEtQOrd → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-zero-algetqord)
  - [`Random(O, bd): AlgEtQOrd, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-random-algetqord-rngintelt)
  - [`Random(O): AlgEtQOrd → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-random-algetqord)
  - [`IsKnownOrder(~R): AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#procedure-isknownorder-algetqord-ref)
  - [`EquationOrder(A): AlgEtQ → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-equationorder-algetq)
  - [`ProductOfEquationOrders(A): AlgEtQ → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-productofequationorders-algetq)
  - [`MaximalOrder(A): AlgEtQ → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-maximalorder-algetq)
  - [`IsMaximal(S): AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-ismaximal-algetqord)
  - [`IsProductOfOrders(O): AlgEtQOrd → BoolElt, Tup`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-isproductoforders-algetqord)
  - [`IsProductOfOrdersInComponents(O): AlgEtQOrd → BoolElt, Tup`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-isproductofordersincomponents-algetqord)
  - [`IsProductOfOrdersInFactorAlgebras(S): AlgEtQOrd → BoolElt, SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-isproductofordersinfactoralgebras-algetqord)
  - [Example: Orders in a Product of Number Fields](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#example-ex-f008b6)
  - [`Index(T): AlgEtQOrd → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-index-algetqord)
  - [`Index(S, T): AlgEtQOrd, AlgEtQOrd → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-index-algetqord-algetqord)
  - [`O1 subset O2: AlgEtQOrd, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-subset-algetqord-algetqord)
  - [`O1 * O2: AlgEtQOrd, AlgEtQOrd → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-times-algetqord-algetqord)
  - [`O1 meet O2: AlgEtQOrd, AlgEtQOrd → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#operation-op-meet-algetqord-algetqord)
  - [`MultiplicatorRing(R): AlgEtQOrd → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/orders.md#function-multiplicatorring-algetqord)
- [Ideals](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md)
  - [`Ideal(S, gens): AlgEtQOrd, SeqEnum → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-ideal-algetqord-seqenum)
  - [`Ideal(S, idls): AlgEtQOrd, Tup → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-ideal-algetqord-tup)
  - [`Ideal(S, gen): AlgEtQOrd, Any → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-ideal-algetqord-any)
  - [`S * gen: AlgEtQOrd, AlgEtQElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqord-algetqelt)
  - [`S * gen: AlgEtQOrd, RngIntElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqord-rngintelt)
  - [`S * gen: AlgEtQOrd, FldRatElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqord-fldratelt)
  - [`gen * S: AlgEtQElt, AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqelt-algetqord)
  - [`gen * S: RngIntElt, AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-rngintelt-algetqord)
  - [`gen * S: FldRatElt, AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-fldratelt-algetqord)
  - [`T !! I: AlgEtQOrd, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-algetqord-algetqidl)
  - [`Algebra(I): AlgEtQIdl → AlgEtQ`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-algebra-algetqidl)
  - [`Order(I): AlgEtQIdl → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-order-algetqidl)
  - [`ZBasis(I): AlgEtQIdl → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-zbasis-algetqidl)
  - [`Generators(I): AlgEtQIdl → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-generators-algetqidl)
  - [`I eq J: AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-eq-algetqidl-algetqidl)
  - [`I ne J: AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-ne-algetqidl-algetqidl)
  - [`I eq S: AlgEtQIdl, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-eq-algetqidl-algetqord)
  - [`S eq I: AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-eq-algetqord-algetqidl)
  - [`AbsoluteCoordinates(x, I): AlgEtQElt, AlgEtQIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-absolutecoordinates-algetqelt-algetqidl)
  - [`AbsoluteCoordinates(seq, I): SeqEnum[AlgEtQElt], AlgEtQIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-absolutecoordinates-seqenum-algetqelt-algetqidl)
  - [`x in I: AlgEtQElt, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-in-algetqelt-algetqidl)
  - [`x in I: RngIntElt, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-in-rngintelt-algetqidl)
  - [`x in I: FldRatElt, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-in-fldratelt-algetqidl)
  - [`S subset I: AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-subset-algetqord-algetqidl)
  - [`I subset S: AlgEtQIdl, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-subset-algetqidl-algetqord)
  - [`I1 subset I2: AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-subset-algetqidl-algetqidl)
  - [`Index(T): AlgEtQIdl → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-index-algetqidl)
  - [`Index(J, I): AlgEtQIdl, AlgEtQIdl → Any`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-index-algetqidl-algetqidl)
  - [`Index(S, I): AlgEtQOrd, AlgEtQIdl → Any`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-index-algetqord-algetqidl)
  - [`OneIdeal(S): AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-oneideal-algetqord)
  - [`Conductor(O): AlgEtQOrd → AlgEtQOrdIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-conductor-algetqord)
  - [`I + J: AlgEtQIdl, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-plus-algetqidl-algetqidl)
  - [`I * J: AlgEtQIdl, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqidl-algetqidl)
  - [`I * x: AlgEtQIdl, AlgEtQElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqidl-algetqelt)
  - [`I * x: AlgEtQIdl, RngIntElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqidl-rngintelt)
  - [`I * x: AlgEtQIdl, FldRatElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqidl-fldratelt)
  - [`x * I: AlgEtQElt, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-algetqelt-algetqidl)
  - [`x * I: RngIntElt, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-rngintelt-algetqidl)
  - [`x * I: FldRatElt, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-times-fldratelt-algetqidl)
  - [`I ^ n: AlgEtQIdl, RngIntElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-pow-algetqidl-rngintelt)
  - [`I meet S: AlgEtQIdl, AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-meet-algetqidl-algetqord)
  - [`S meet I: AlgEtQOrd, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-meet-algetqord-algetqidl)
  - [`I meet J: AlgEtQIdl, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-op-meet-algetqidl-algetqidl)
  - [`&+ seq: SeqEnum[AlgEtQIdl] → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#operation-operation-seqenum-algetqidl-algetqidl)
  - [`ColonIdeal(I, J): AlgEtQIdl, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-colonideal-algetqidl-algetqidl)
  - [`ColonIdeal(O, J): AlgEtQOrd, AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-colonideal-algetqord-algetqidl)
  - [`ColonIdeal(I, O): AlgEtQIdl, AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-colonideal-algetqidl-algetqord)
  - [`IsInvertible(I): AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-isinvertible-algetqidl)
  - [`Inverse(I): AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-inverse-algetqidl)
  - [`MultiplicatorRing(I): AlgEtQIdl → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-multiplicatorring-algetqidl)
  - [`IsProductOfIdeals(I): AlgEtQIdl → BoolElt, Tup`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-isproductofideals-algetqidl)
  - [`Random(I, bd): AlgEtQIdl, RngIntElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-random-algetqidl-rngintelt)
  - [`Random(I): AlgEtQIdl → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-random-algetqidl)
  - [`IsCoprime(I, J): AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-iscoprime-algetqidl-algetqidl)
  - [`IsIntegral(I): AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-isintegral-algetqidl)
  - [`MakeIntegral(I): AlgEtQIdl → AlgEtQIdl, RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-makeintegral-algetqidl)
  - [`MinimalInteger(I): AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-minimalinteger-algetqidl)
  - [`CoprimeRepresentative(I, J): AlgEtQIdl, AlgEtQIdl → AlgEtQElt, AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#function-coprimerepresentative-algetqidl-algetqidl)
  - [`ZBasisLLL(~S): AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#procedure-zbasislll-algetqord-ref)
  - [`ZBasisLLL(~S): AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals.md#procedure-zbasislll-algetqidl-ref)
- [Quotients](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md)
  - [`Quotient(I, zbJ): AlgEtQIdl, SeqEnum[AlgEtQElt] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotient-algetqidl-seqenum-algetqelt)
  - [`Quotient(I, J): AlgEtQIdl, AlgEtQIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotient-algetqidl-algetqidl)
  - [`Quotient(S, zbJ): AlgEtQOrd, SeqEnum[AlgEtQElt] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotient-algetqord-seqenum-algetqelt)
  - [`ResidueRing(S, I): AlgEtQOrd, AlgEtQIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-residuering-algetqord-algetqidl)
  - [`ResidueField(P): AlgEtQIdl → FldFin, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-residuefield-algetqidl)
  - [`PrimitiveElementResidueField(P): AlgEtQIdl → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-primitiveelementresiduefield-algetqidl)
  - [`QuotientVS(I, J, P): AlgEtQOrd, AlgEtQOrd, AlgEtQIdl → ModRng, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotientvs-algetqord-algetqord-algetqidl)
  - [Example: Residue Field and Residue Ring](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#example-ex-c0d808)
  - [`QuotientVS(I, J, P): AlgEtQOrd, AlgEtQIdl, AlgEtQIdl → ModRng, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotientvs-algetqord-algetqidl-algetqidl)
  - [`QuotientVS(I, J, P): AlgEtQIdl, AlgEtQOrd, AlgEtQIdl → ModRng, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotientvs-algetqidl-algetqord-algetqidl)
  - [`QuotientVS(I, J, P): AlgEtQIdl, AlgEtQIdl, AlgEtQIdl → ModRng, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/quotients.md#function-quotientvs-algetqidl-algetqidl-algetqidl)
- [Over Orders](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md)
  - [`IsMaximalAtPrime(R, P): AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-ismaximalatprime-algetqord-algetqidl)
  - [`MinimalOverOrdersAtPrime(R, P): AlgEtQOrd, AlgEtQIdl → SetIndx[AlgEtQOrd]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-minimaloverordersatprime-algetqord-algetqidl)
  - [`MinimalOverOrders(R): AlgEtQOrd → SetIndx[AlgEtQOrd]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-minimaloverorders-algetqord)
  - [`OverOrdersAtPrime(R, P): AlgEtQOrd, AlgEtQIdl → SeqEnum[AlgEtQOrd]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-overordersatprime-algetqord-algetqidl)
  - [`OverOrders(R): AlgEtQOrd → SeqEnum[AlgEtQOrd]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-overorders-algetqord)
  - [Example: Over-Orders of an Equation Order](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#example-ex-1d4978)
  - [`FindOverOrders(R): AlgEtQOrd → SetIndx[AlgEtQOrd]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/over_orders.md#function-findoverorders-algetqord)
- [Over Order Graph](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/graph_over_orders.md)
  - [`GraphOverOrders(R): AlgEtQOrd → GrphDir`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/graph_over_orders.md#function-graphoverorders-algetqord)
- [Trace and Norm](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md)
  - [`Trace(x): AlgEtQElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-trace-algetqelt)
  - [`Norm(x): AlgEtQElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-norm-algetqelt)
  - [`AbsoluteTrace(x): AlgEtQElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-absolutetrace-algetqelt)
  - [`AbsoluteNorm(x): AlgEtQElt → FldRatElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-absolutenorm-algetqelt)
  - [`TraceDualIdeal(I): AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-tracedualideal-algetqidl)
  - [`TraceDualIdeal(O): AlgEtQOrd → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/trace_norm.md#function-tracedualideal-algetqord)
- [Completion](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/completion.md)
  - [`Completion(P): AlgEtQIdl → FldPad, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/completion.md#function-completion-algetqidl)
  - [Example: Uniformizers and Completions](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/completion.md#example-ex-ecd376)
- [Intermediate Ideals](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/intermediate_ideals.md)
  - [`IntermediateIdeals(I, J): AlgEtQIdl, AlgEtQIdl → SetIndx[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/intermediate_ideals.md#function-intermediateideals-algetqidl-algetqidl)
  - [`IntermediateIdeals(I, J, O): AlgEtQIdl, AlgEtQIdl, AlgEtQOrd → SetIndx[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/intermediate_ideals.md#function-intermediateideals-algetqidl-algetqidl-algetqord)
  - [`IntermediateIdeals(I, J, N): AlgEtQIdl, AlgEtQIdl, RngIntElt → SetIndx[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/intermediate_ideals.md#function-intermediateideals-algetqidl-algetqidl-rngintelt)
- [Ideals of Index](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md)
  - [`IdealsOfIndex(O, N): RngOrd, RngIntElt → SeqEnum[RngOrdIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md#function-idealsofindex-rngord-rngintelt)
  - [`IdealsOfIndex(I, N): RngOrdIdl, RngIntElt → SeqEnum[RngOrdIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md#function-idealsofindex-rngordidl-rngintelt)
  - [`IdealsOfIndex(I, N): RngOrdFracIdl, RngIntElt → SeqEnum[RngOrdFracIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md#function-idealsofindex-rngordfracidl-rngintelt)
  - [`IdealsOfIndex(I, N): AlgEtQIdl, RngIntElt → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md#function-idealsofindex-algetqidl-rngintelt)
  - [`IdealsOfIndex(O, N): AlgEtQOrd, RngIntElt → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideals_of_index.md#function-idealsofindex-algetqord-rngintelt)
- [Short Element and Small Representative](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/short_elt_small_rep.md)
  - [`ShortElement(I): AlgEtQIdl → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/short_elt_small_rep.md#function-shortelement-algetqidl)
  - [`SmallRepresentative(I): AlgEtQIdl → AlgEtQIdl, AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/short_elt_small_rep.md#function-smallrep)
- [Minimal Generators](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/minimal_generators.md)
  - [`TwoGeneratingSet(I): AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/minimal_generators.md#procedure-twogeneratingset-algetqidl)
- [Chinese Remainder Theorem](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/crt.md)
  - [`ChineseRemainderTheorem(Is, as): SeqEnum[AlgEtQIdl], SeqEnum[AlgEtQElt] → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/crt.md#function-chineseremaindertheorem-seqenum-algetqidl-seqenum-algetqelt)
  - [`ChineseRemainderTheorem(I, J, a, b): AlgEtQIdl, AlgEtQIdl, AlgEtQElt, AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/crt.md#function-chineseremaindertheorem-algetqidl-algetqidl-algetqelt-algetqelt)
  - [`ChineseRemainderTheoremFunctions(Is): SeqEnum[AlgEtQIdl] → Map, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/crt.md#function-chineseremaindertheoremfunctions-seqenum-algetqidl)
  - [Example: Chinese Remainder Theorem Maps](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/crt.md#example-ex-d7dd94)
- [Picard Group](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md)
  - [`ResidueRingUnits(S, I): AlgEtQOrd, AlgEtQIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-residueringunits-algetqord-algetqidl)
  - [`ResidueRingUnits(I): AlgEtQIdl → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-residueringunits-algetqidl)
  - [`ResidueRingUnitsSubgroupGenerators(F): AlgEtQIdl → SeqEnum[AlgEtQElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-residueringunitssubgroupgenerators-algetqidl)
  - [`IsPrincipal(I1): AlgEtQIdl → BoolElt, AlgAssElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-isprincipal-algetqidl)
  - [`PicardGroup(S): AlgEtQOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-picardgroup-algetqord)
  - [`ExtensionHomPicardGroups(S, T): AlgEtQOrd, AlgEtQOrd → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-extensionhompicardgroups-algetqord-algetqord)
  - [`UnitGroup(S): AlgEtQOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-unitgroup-algetqord)
  - [Example: Picard Group and Units of an Order](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#example-ex-034565)
  - [`IsIsomorphic(I, J): AlgEtQIdl, AlgEtQIdl → BoolElt, AlgAssElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/picard_group.md#function-isisomorphic-algetqidl-algetqidl)
- [Factorization and Primes](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md)
  - [`Factorization(I): AlgEtQIdl → Tup`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-factorization-algetqidl)
  - [`PrimesAbove(I): AlgEtQIdl → SeqEnum[AlgAssEtOrdIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-primesabove-algetqidl)
  - [`SingularPrimes(R): AlgEtQOrd → SeqEnum[AlgAssEtOrdIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-singularprimes-algetqord)
  - [`PlacesAboveRationalPrime(E, p): AlgEtQ, RngIntElt → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-placesaboverationalprime-algetq-rngintelt)
  - [`NonInvertiblePrimes(R): AlgEtQOrd → SetIndx`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-noninvertibleprimes-algetqord)
  - [`IsPrime(I): AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-isprime-algetqidl)
  - [`IsMaximal(I): AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-ismaximal-algetqidl)
  - [`IsMaximalIdeal(I): AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-ismaximalideal-algetqidl)
  - [`Valuation(x, P): AlgEtQElt, AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-valuation-algetqelt-algetqidl)
  - [`Valuation(I, P): AlgEtQIdl, AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-valuation-algetqidl-algetqidl)
  - [`InertiaDegree(P): AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-inertiadegree-algetqidl)
  - [`RamificationIndex(P): AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-ramificationindex-algetqidl)
  - [`IsBassAtPrime(S, P): AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-isbassatprime-algetqord-algetqidl)
  - [`IsBass(S): AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-isbass-algetqord)
  - [`IsGorensteinAtPrime(S, P): AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-isgorensteinatprime-algetqord-algetqidl)
  - [`IsGorenstein(O): AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-isgorenstein-algetqord)
  - [`Uniformizers(PPs): SeqEnum[AlgEtQIdl] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/factor_primes.md#function-uniformizers-seqenum-algetqidl)
- [Low Cohen Macauley Type](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/low_cohen_macauley_type.md)
  - [`NonGorensteinPrimes(S): AlgEtQOrd → SeqEnum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/low_cohen_macauley_type.md#function-nongorensteinprimes-algetqord)
  - [`CohenMacaulayTypeAtPrime(S, P): AlgEtQOrd, AlgEtQIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/low_cohen_macauley_type.md#function-cohenmacaulaytypeatprime-algetqord-algetqidl)
  - [`CohenMacaulayType(S): AlgEtQOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/low_cohen_macauley_type.md#function-cohenmacaulaytype-algetqord)
  - [Example: Order of Maximal Cohen-Macaulay Type](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/low_cohen_macauley_type.md#example-ex-442922)
- [Weak Classes](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md)
  - [`WKICM_bar(S): AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-wkicm-bar-algetqord)
  - [`WeakEquivalenceClassesWithPrescribedMultiplicatorRing(S): AlgEtQOrd → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-weakequivalenceclasseswithprescribedmultiplicatorring-algetqord)
  - [`WeakEquivalenceClassMonoid(E): AlgEtQOrd → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-weakequivalenceclassmonoid-algetqord)
  - [`WKICM(E): AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-wkicm-algetqord)
  - [`WeakEquivalenceClassMonoidAbstract(R): AlgEtQOrd → AlgEtQWECM, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-weakequivalenceclassmonoidabstract-algetqord)
  - [`W ! x: AlgEtQWECM, Any → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-algetqwecm-any)
  - [`x in W: AlgEtQWECMElt, AlgEtQWECM → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-in-algetqwecmelt-algetqwecm)
  - [`Parent(x): AlgEtQWECMElt → AlgEtQWECM`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-parent-algetqwecmelt)
  - [`Ideal(x): AlgEtQWECMElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-ideal-algetqwecmelt)
  - [`MultiplicatorRing(x): AlgEtQWECMElt → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-multiplicatorring-algetqwecmelt)
  - [`x1 eq x2: AlgEtQWECMElt, AlgEtQWECMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-eq-algetqwecmelt-algetqwecmelt)
  - [`SetRepresentative(x, J): AlgEtQWECMElt, AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#procedure-setrepresentative-algetqwecmelt-algetqidl)
  - [`MultiplicationTable(W): AlgEtQWECM → Assoc`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-multiplicationtable-algetqwecm)
  - [`x * y: AlgEtQWECMElt, AlgEtQWECMElt → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-times-algetqwecmelt-algetqwecmelt)
  - [`x ^ n: AlgEtQWECMElt, RngIntElt → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-pow-algetqwecmelt-rngintelt)
  - [`IsOne(x): AlgEtQWECMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-isone-algetqwecmelt)
  - [`IsIdempotent(x): AlgEtQWECMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-isidempotent-algetqwecmelt)
  - [`Order(W): AlgEtQWECM → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-order-algetqwecm)
  - [`Array(W): AlgEtQWECM → Assoc`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-array-algetqwecm)
  - [`RepresentativeMap(W): AlgEtQWECM → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-representativemap-algetqwecm)
  - [`W1 eq W2: AlgEtQWECM, AlgEtQWECM → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-op-eq-algetqwecm-algetqwecm)
  - [`# W: AlgEtQWECM → RngInt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#operation-operation-algetqwecm-rngint)
  - [`Classes(W): AlgEtQWECM → SeqEnum[AlgEtQWECMElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-classes-algetqwecm)
  - [`Representatives(W): AlgEtQWECM → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-representatives-algetqwecm)
  - [`One(W): AlgEtQWECM → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-one-algetqwecm)
  - [`Random(W): AlgEtQWECM → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-random-algetqwecm)
  - [`Idempotents(W): AlgEtQWECM → SeqEnum[AlgEtQWECMElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-idempotents-algetqwecm)
  - [`Localization(W, P): AlgEtQWECM, AlgEtQIdl → AlgEtQWECM`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-localization-algetqwecm-algetqidl)
  - [`IsGeneratingSet(W, seq): AlgEtQWECM, SeqEnum[AlgEtQWECMElt] → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-isgeneratingset-algetqwecm-seqenum-algetqwecmelt)
  - [`IsGeneratingSet(W, seq): AlgEtQWECM, SeqEnum[AlgEtQIdl] → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#function-isgeneratingset-algetqwecm-seqenum-algetqidl)
  - [Example: Weak Equivalence Classes](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_classes.md#example-ex-628357)
- [Weak Testing](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md)
  - [`IsWeakEquivalent(I, J): AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweakequivalent-algetqidl-algetqidl)
  - [`IsWeaklyEquivalent(I, J): AlgEtQIdl, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweaklyequivalent-algetqidl-algetqidl)
  - [`IsWeakEquivalent(O1, O2): AlgEtQOrd, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweakequivalent-algetqord-algetqord)
  - [`IsWeaklyEquivalent(O1, O2): AlgEtQOrd, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweaklyequivalent-algetqord-algetqord)
  - [`IsWeakEquivalent(O, J): AlgEtQOrd, AlgEtQIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweakequivalent-algetqord-algetqidl)
  - [`IsWeaklyEquivalent(J, O): AlgEtQIdl, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweaklyequivalent-algetqidl-algetqord)
  - [Example: Testing Weak Equivalence](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#example-ex-6405b0)
  - [`IsWeakEquivalent(J, O): AlgEtQIdl, AlgEtQOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/weak_testing.md#function-isweakequivalent-algetqidl-algetqord)
- [Ideal Class Monoid](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md)
  - [`ICM_bar(S): AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-icm-bar-algetqord)
  - [`ICM(S): AlgEtQOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-icm-algetqord)
  - [`IdealClassMonoidAbstract(R): AlgEtQOrd → AlgEtQICM, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-idealclassmonoidabstract-algetqord)
  - [`icm ! x: AlgEtQICM, Any → AlgEtQICMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-algetqicm-any)
  - [`x in icm: AlgEtQICMElt, AlgEtQICM → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-in-algetqicmelt-algetqicm)
  - [`Parent(x): AlgEtQICMElt → AlgEtQICM`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-parent-algetqicmelt)
  - [`WEClass(x): AlgEtQICMElt → AlgEtQWECMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-weclass-algetqicmelt)
  - [`PicClass(x): AlgEtQICMElt → GrpAbElt, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-picclass-algetqicmelt)
  - [`Ideal(x): AlgEtQICMElt → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-ideal-algetqicmelt)
  - [`MultiplicatorRing(x): AlgEtQICMElt → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-multiplicatorring-algetqicmelt)
  - [`x1 eq x2: AlgEtQICMElt, AlgEtQICMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-eq-algetqicmelt-algetqicmelt)
  - [`x * y: AlgEtQICMElt, AlgEtQICMElt → AlgEtQICMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-times-algetqicmelt-algetqicmelt)
  - [`x ^ n: AlgEtQICMElt, RngIntElt → AlgEtQICMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-pow-algetqicmelt-rngintelt)
  - [`IsOne(x): AlgEtQICMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-isone-algetqicmelt)
  - [`IsInvertibleInMultiplicatorRing(x): AlgEtQICMElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-isinvertibleinmultiplicatorring-algetqicmelt)
  - [`Order(icm): AlgEtQICM → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-order-algetqicm)
  - [`RepresentativeMap(icm): AlgEtQICM → Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-representativemap-algetqicm)
  - [`icm1 eq icm2: AlgEtQICM, AlgEtQICM → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-op-eq-algetqicm-algetqicm)
  - [`# icm: AlgEtQICM → RngInt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#operation-operation-algetqicm-rngint)
  - [`Classes(icm): AlgEtQICM → SeqEnum[AlgEtQICMElt]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-classes-algetqicm)
  - [`Representatives(icm): AlgEtQICM → SeqEnum[AlgEtQIdl]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-representatives-algetqicm)
  - [`One(icm): AlgEtQICM → AlgEtQICMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-one-algetqicm)
  - [`Random(icm): AlgEtQICM → AlgEtQICMElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/ideal_class_monoid.md#function-random-algetqicm)
- [Complex Conjugation](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md)
  - [`HasComplexConjugate(A): AlgEtQ → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-hascomplexconjugate-algetq)
  - [`ComplexConjugate(x): AlgEtQElt → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-complexconjugate-algetqelt)
  - [`IsConjugateStable(O): AlgEtQOrd → BoolElt, AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-isconjugatestable-algetqord)
  - [`ComplexConjugate(O): AlgEtQOrd → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-complexconjugate-algetqord)
  - [`IsConjugateStable(I): AlgEtQIdl → BoolElt, AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-isconjugatestable-algetqidl)
  - [`ComplexConjugate(I): AlgEtQIdl → AlgEtQIdl`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex_conj.md#function-complexconjugate-algetqidl)
- [Complex Multiplication](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md)
  - [`CMType(seq): SeqEnum[Map] → AlgEtQCMType`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-cmtype-seqenum-map)
  - [Example: CM Type of an Etale Algebra](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#example-ex-d5afe8)
  - [`CreateCMType(seq): SeqEnum[Map] → AlgEtQCMType`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-createcmtype-seqenum-map)
  - [`CMType(b): AlgEtQElt → AlgEtQCMType`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-cmtype-algetqelt)
  - [`CreateCMType(b): AlgEtQElt → AlgEtQCMType`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-createcmtype-algetqelt)
  - [`CMPositiveElement(PHI): AlgEtQCMType → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-cmpositiveelement-algetqcmtype)
  - [`CMPosElt(PHI): AlgEtQCMType → AlgEtQElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-cmposelt-algetqcmtype)
  - [`Homs(PHI): AlgEtQCMType → SeqEnum[Map]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-homs-algetqcmtype)
  - [`PHI1 eq PHI2: AlgEtQCMType, AlgEtQCMType → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#operation-op-eq-algetqcmtype-algetqcmtype)
  - [`Precision(PHI): AlgEtQCMType → RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-precision-algetqcmtype)
  - [`ChangePrecision(PHI0, prec): AlgEtQCMType, RngIntElt → AlgEtQCMType`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-changeprecision-algetqcmtype-rngintelt)
  - [`ChangePrecision(~PHI, prec): AlgEtQCMType, RngIntElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#procedure-changeprecision-algetqcmtype-rngintelt-ref)
  - [`AllCMTypes(A): AlgEtQ → SeqEnum[AlgEtQCMType]`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/complex-mult.md#function-allcmtypes-algetq)
- [Totally Real and Positive](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md)
  - [`IsTotallyReal(a): AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md#function-istotallyreal-algetqelt)
  - [`IsTotallyRealPositive(a): AlgEtQElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md#function-istotallyrealpositive-algetqelt)
  - [`TotallyRealSubAlgebra(K): AlgEtQ → AlgEtQ, Map`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md#function-totallyrealsubalgebra-algetq)
  - [`TotallyRealUnitGroup(S): AlgEtQOrd → Grp`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md#function-totallyrealunitgroup-algetqord)
  - [`TotallyRealPositiveUnitGroup(S): AlgEtQOrd → Grp`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/TotRealTotPos.md#function-totallyrealpositiveunitgroup-algetqord)
- [Printing and Saving](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/print_save.md)
  - [`PrintSeqAlgEtQElt(seq): SeqEnum[AlgEtQElt] → SeqEnum, MonStgElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/print_save.md#function-printseqalgetqelt-seqenum-algetqelt)
  - [`PrintWKICM(R): AlgEtQOrd → MonStgElt`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/print_save.md#function-printwkicm-algetqord)
  - [`LoadWKICM(str): MonStgElt → AlgEtQOrd`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/print_save.md#function-loadwkicm-monstgelt)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/bibliography.md)

### Introduction

An *étale algebra* $A$ over a field $K$ is a finite product of finite separable extensions $K_1,\ldots,K_n$ of $K$. Typical examples are:

**(a)**
$A = K\times K$ where $K$ is a number field.

**(b)**
$A = {K[x] / f(x)}$ where $f(x)$ is a polynomial in $K[x]$ and no repeated roots over $\overline{K}$.

We will refer to the field $K$ as the *prime field* of $A$ and to the fields $K_1,\ldots,K_n$ as the *components* of $A$. If $F$ is a finite extension of $K$ such that $K_1,\ldots,K_n$ are all defined as relative extensions of $F$, we call $F$ the *base field* of $A$. If the components $K_1,\ldots,K_n$ of $A$ have distinct defining polynomials, say $f_1(x),\ldots,f_n(x) \in F[x]$ then $A$ is isomorphic to the étale algebra $F[x]/(f(x))$ where $f(x) = f_1(x)\cdot \cdots \cdot f_n(x)$. The polynomial $f(x)$ is then referred to as the *defining polynomial* of $A$.

This section describes functions to work with these algebras, orders inside the algebra, and ideals of the orders.

Currently all number fields involved must be absolute number fields.

An étale algebra has type `AlgEtQ`, an order has type `AlgEtQOrd`, an ideal has type `AlgEtQIdl`, and the elements have type `AlgEtQElt`.

This was released in version 2.29 and the original code was written by Stefano Marseglia. Furthermore, his papers, [[Mar20](https://docs.magma-maths.org/references.md#cite-marseglia20), [Mar24](https://docs.magma-maths.org/references.md#cite-marseglia24), [Mar25](https://docs.magma-maths.org/references.md#cite-marseglia25)], are a good reference for many of the algorithms implemented in this package.

### Construction

<a id="function-etalealgebra-seqenum-fldnum"></a>
#### `EtaleAlgebra(seq): SeqEnum[FldNum] -> AlgEtQ`

Given a sequence of number fields returns the étale algebra corresponding to the direct product. Note: the number fields with `DefiningPolynomial` of degree one should be created with the parameter `DoLinearExtension` set to `true`.

<a id="example-ex-e44d0f"></a>
#### `Example: Etale Algebra of Two Copies of Q (ex-e44d0f)`

We now consider the étale algebra consisting of two copies of the rational field.

```magma
> _<x> := PolynomialRing(Integers());
> QQ := NumberField(x-1:DoLinearExtension);
> A := EtaleAlgebra([QQ,QQ]);
> a := PrimitiveElement(A); a;
<1, 2>
```

<a id="function-etalealgebra-rngupolelt-rngint"></a>
#### `EtaleAlgebra(f): RngUPolElt[RngInt] -> AlgEtQ`

<a id="function-etalealgebra-rngupolelt-fldrat"></a>
#### `EtaleAlgebra(f): RngUPolElt[FldRat] -> AlgEtQ`

Given a squarefree polynomial over the integers or rationals returns the product of the number fields defined by the irreducible factors.

<a id="function-directproduct-seqenum-algetq"></a>
#### `DirectProduct(seq): SeqEnum[AlgEtQ] -> AlgEtQ, SeqEnum[Map], SeqEnum[Map]`

Given a sequence of étale algebras over ${{\Q}}$, returns their direct product, together with the natural inclusions and projections.

### Attributes

<a id="function-definingpolynomial-algetq"></a>
#### `DefiningPolynomial(A): AlgEtQ -> RngUPolElt`

Returns the defining polynomial of the algebra $A$, if the corresponding number fields are distinct.

<a id="function-components-algetq"></a>
#### `Components(A): AlgEtQ -> SeqEnum`

Returns the number fields of which the algebra $A$ is a product of, together with embeddings and projections.

<a id="function-dimension-algetq"></a>
#### `Dimension(A): AlgEtQ -> RngInt`

Returns the dimension of the algebra $A$.

<a id="function-absolutedimension-algetq"></a>
#### `AbsoluteDimension(A): AlgEtQ -> RngInt`

Return the dimension of the algebra $A$ over the prime field.

<a id="function-hasbasefield-algetq"></a>
#### `HasBaseField(A): AlgEtQ -> BoolElt`

Returns whether the components of the algebra $A$ have a common base field.

<a id="function-basefield-algetq"></a>
#### `BaseField(A): AlgEtQ -> FldNum, Map`

Returns the common base field of the algebra $A$, if it exists.

<a id="function-primefield-algetq"></a>
#### `PrimeField(A): AlgEtQ -> FldNum`

Returns the prime field of the algebra $A$.

<a id="function-isnumberfield-algetq"></a>
#### `IsNumberField(A): AlgEtQ -> BoolElt, FldNum, Map`

Returns whether $A$ has a single component (hence is a number field). If so, also returns the number field and an isomorphism from $A$ to it.

<a id="operation-op-eq-algetq-algetq"></a>
#### `A1 eq A2: AlgEtQ, AlgEtQ -> BoolElt`

Returns whether the algebras $A1$ and $A2$ are equal.

### Homomorphisms

<a id="function-homstoc-algetq"></a>
#### `HomsToC(A): AlgEtQ -> SeqEnum[Map]`

```magma
Precision: RngIntElt                    Default: Precision(GetDefaultRealField())
```

Returns the sequence of homomorphisms from the algebra $A$ to a complex field ${{\C}}$. The precision of ${{\C}}$ is given by the optional parameter `Precision`. The default value is 30.

<a id="example-ex-58e95c"></a>
#### `Example: Complex Embeddings of an Etale Algebra (ex-58e95c)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra(x^2+2);
> homs := HomsToC(A : Precision := 30);
> #homs;
2
```

<a id="function-hom-algetq-algetq-seqenum-algetqelt"></a>
#### `Hom(A, B, img): AlgEtQ, AlgEtQ, SeqEnum[AlgEtQElt] -> Map`

```magma
CheckMultiplicative: BoolElt                    Default: false
CheckUnital        : BoolElt                    Default: false
ComputeInverse     : BoolElt                    Default: true
```

Given étale algebras $A$ and $B$ and a sequence `img` of elements of $B$ with length equal to the absolute dimension of $A$, returns the ${{\Q}}$-algebra homomorphism sending the `AbsoluteBasis(A)` to `img`. If `ComputeInverse` is true and the map is invertible, preimages are defined. If `CheckMultiplicative` (resp. `CheckUnital`) is `true`, multiplicativity (resp. unitality) is checked.

<a id="function-diagonalembedding-algetq-algetq"></a>
#### `DiagonalEmbedding(K, V): AlgEtQ, AlgEtQ -> Map`

<a id="function-naturalaction-algetq-algetq"></a>
#### `NaturalAction(K, V): AlgEtQ, AlgEtQ -> Map`

Let $K=K_1\times\cdots\times K_n$ be a product of distinct number fields and $V=K_1^{s_1}\times\cdots\times K_n^{s_n}$. Returns the natural component-wise diagonal embedding $K\to V$.

<a id="example-ex-aab1bc"></a>
#### `Example: Homomorphism into a Product Algebra (ex-aab1bc)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra((x^2+2)*(x^2+3));
> B := EtaleAlgebra(Components(A));
> // Build a hom by mapping AbsoluteBasis(A) into B component-wise
> img := [ B!Components(AbsoluteBasis(A)[i]) : i in [1..AbsoluteDimension(A)] ];
> m := Hom(A,B,img : CheckMultiplicative := false, CheckUnital := false,
> ComputeInverse := true);
> // Diagonal embedding on a suitable power algebra
> V, embs, projs := DirectProduct([A,A]);
> d := DiagonalEmbedding(A,V);
> d(One(A));
<1, 1, 1, 1>
```

### Elements

<a id="function-parent-algetqelt"></a>
#### `Parent(x): AlgEtQElt -> AlgEtQ`

<a id="function-algebra-algetqelt"></a>
#### `Algebra(x): AlgEtQElt -> AlgEtQ`

Returns the algebra to which the element $x$ belongs to.

<a id="function-components-algetqelt"></a>
#### `Components(x): AlgEtQElt -> SeqEnum`

Given an element $x$, returns its components, which are elements of number fields.

<a id="function-absolutecoordinates-algetqelt"></a>
#### `AbsoluteCoordinates(x): AlgEtQElt -> SeqEnum`

Given an element $x$, returns the coordinates relative to the absolute basis, which are elements of the prime rational field.

<a id="function-absolutecoordinates-algetqelt-algetqord"></a>
#### `AbsoluteCoordinates(x, S): AlgEtQElt, AlgEtQOrd -> SeqEnum`

Given an element $x$ and an order $S$, returns the coordinates of $x$ with respect to the stored Z-basis of $S$.

<a id="function-iscoercible-algetq-any"></a>
#### `IsCoercible(A, x): AlgEtQ, Any -> BoolElt, AlgEtQElt`

Return whether the element $x$ is coercible into the algebra $A$ and the result of the coercion if so.

<a id="operation-op-algetq-any"></a>
#### `A ! x: AlgEtQ, Any -> AlgEtQElt`

Coerce $x$ into the algebra $A$.

<a id="function-one-algetq"></a>
#### `One(A): AlgEtQ -> AlgEtQElt`

The multiplicative neutral element of the algebra $A$.

<a id="function-zero-algetq"></a>
#### `Zero(A): AlgEtQ -> AlgEtQElt`

The additive neutral element of the algebra $A$.

<a id="function-isunit-algetqelt"></a>
#### `IsUnit(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ is a unit in its algebra $A$.

<a id="function-iszerodivisor-algetqelt"></a>
#### `IsZeroDivisor(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ is a zero-divisor in its algebra $A$.

<a id="function-random-algetq-rngintelt"></a>
#### `Random(A, bd): AlgEtQ, RngIntElt -> AlgEtQElt`

Returns a random element of the algebra $A$. The coefficients are bounded by the positive integer $bd$.

<a id="function-random-algetq"></a>
#### `Random(A): AlgEtQ -> AlgEtQElt`

```magma
bd: RngIntElt                    Default: 3
```

Returns a random element of the algebra $A$. The coefficients are bounded by the parameter $bd$ (default 3).

<a id="function-randomunit-algetq-rngintelt"></a>
#### `RandomUnit(A, bd): AlgEtQ, RngIntElt -> AlgEtQElt`

Returns a random unit of the algebra $A$. The coefficients are bounded by the positive integer $bd$.

<a id="operation-op-eq-algetqelt-algetqelt"></a>
#### `x1 eq x2: AlgEtQElt, AlgEtQElt -> BoolElt`

<a id="operation-op-eq-rngintelt-algetqelt"></a>
#### `x1 eq x2: RngIntElt, AlgEtQElt -> BoolElt`

<a id="operation-op-eq-algetqelt-rngintelt"></a>
#### `x1 eq x2: AlgEtQElt, RngIntElt -> BoolElt`

<a id="operation-op-eq-fldratelt-algetqelt"></a>
#### `x1 eq x2: FldRatElt, AlgEtQElt -> BoolElt`

<a id="operation-op-eq-algetqelt-fldratelt"></a>
#### `x1 eq x2: AlgEtQElt, FldRatElt -> BoolElt`

Returns whether the elements $x1$ and $x2$ are equal.

<a id="operation-op-plus-algetqelt-algetqelt"></a>
#### `x1 + x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-plus-any-algetqelt"></a>
#### `x1 + x2: Any, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-plus-algetqelt-any"></a>
#### `x1 + x2: AlgEtQElt, Any -> AlgEtQElt`

<a id="operation-operation-algetqelt-algetqelt"></a>
#### `- x: AlgEtQElt -> AlgEtQElt`

<a id="operation-op-minus-algetqelt-algetqelt"></a>
#### `x1 - x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-minus-any-algetqelt"></a>
#### `x1 - x2: Any, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-minus-algetqelt-any"></a>
#### `x1 - x2: AlgEtQElt, Any -> AlgEtQElt`

<a id="operation-op-times-algetqelt-algetqelt"></a>
#### `x1 * x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-times-any-algetqelt"></a>
#### `x1 * x2: Any, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-times-algetqelt-any"></a>
#### `x1 * x2: AlgEtQElt, Any -> AlgEtQElt`

<a id="function-inverse-algetqelt"></a>
#### `Inverse(x): AlgEtQElt -> AlgEtQElt`

The multiplicative inverse of the algebra element $x$.

<a id="operation-op-pow-algetqelt-rngintelt"></a>
#### `x ^ n: AlgEtQElt, RngIntElt -> AlgEtQElt`

<a id="operation-op-div-algetqelt-algetqelt"></a>
#### `x1 / x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-div-any-algetqelt"></a>
#### `x1 / x2: Any, AlgEtQElt -> AlgEtQElt`

<a id="operation-op-div-algetqelt-any"></a>
#### `x1 / x2: AlgEtQElt, Any -> AlgEtQElt`

<a id="operation-operation-seqenum-algetqelt-algetqelt"></a>
#### `&+ seq: SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence of `AlgEtQElt` returns the sum of the entries.

<a id="operation-operation-seqenum-algetqelt-algetqelt-2"></a>
#### `&* seq: SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence of `AlgEtQElt` returns the product of the entries.

<a id="function-dotproduct-seqenum-seqenum"></a>
#### `DotProduct(a, b): SeqEnum, SeqEnum -> Any`

Given two sequences $a=[a_1,\ldots,a_n]$ and $b=[b_1,\ldots,b_n]$, returns $\sum_i a_i\cdot b_i$.

<a id="example-ex-1d7031"></a>
#### `Example: Components and Idempotents of an Etale Algebra (ex-1d7031)`

```magma
> _<x>:=PolynomialRing(Integers());
> f := (x^8+16)*(x^8+81);
> A := EtaleAlgebra(f);
> // We compute the `canonical` primitive element, which is the class of the
> // variable x in A.
> a := PrimitiveElement(A); a;
<$.1, $.1>
> // The algebra A has two components:
> comps, embeddings, projections:=Components(A);
> K1, K2 := Explode(comps);
> // The unit element of each component corresponds to an orthogonal idempotent
> //                                                                       of A:
> [ embeddings[1](K1!1),embeddings[2](K2!1) ] eq OrthogonalIdempotents(A);
true
> // We conclude this example by showing the use of DotProduct and
> //                                              its timings advantages:
> N := 10^5;
> elts1 := [ a+i : i in [1..N] ];
> elts2 := [ a-i : i in [1..N] ];
> time s1 := &+[ elts1[i]*elts2[i] : i in [1..N] ];
Time: 0.450
> time s2 := DotProduct(elts1,elts2);
Time: 0.150
> s1 eq s2;
true
```

<a id="function-minimalpolynomial-algetqelt"></a>
#### `MinimalPolynomial(x): AlgEtQElt -> RngUPolElt`

Returns the minimal polynomial over the common base ring of the number fields defining the algebra $A$ of the element $x$.

<a id="function-minimalpolynomial-algetqelt-rng"></a>
#### `MinimalPolynomial(x, F): AlgEtQElt, Rng -> RngUPolElt`

Returns the minimal polynomial over the ring $F$ of the element $x$.

<a id="function-absoluteminimalpolynomial-algetqelt"></a>
#### `AbsoluteMinimalPolynomial(x): AlgEtQElt -> RngUPolElt`

Returns the minimal polynomial over the prime field of the element $x$ or an algebra.

<a id="function-isintegral-algetqelt"></a>
#### `IsIntegral(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ of an algebra is integral (over the integers).

<a id="function-evaluate-rngupolelt-algetqelt"></a>
#### `Evaluate(f, a): RngUPolElt, AlgEtQElt -> AlgEtQElt`

Evaluate the polynomial $f$ at the algebra element $a$.

<a id="function-primitiveelement-algetq"></a>
#### `PrimitiveElement(A): AlgEtQ -> AlgEtQElt`

Returns the primitive element of the étale algebra $A$. Note that $A$ has a primitive element only if it is the product of distinct number fields.

Given an étale algebra $A$ over ${{\Q}}$ there exists an element $a\in A$ such that $A = {{\Q}}[a]$, that is, every element can be written as a polynomial with rational coefficients in $a$. Such an element is called a *primitive element* of $A$. It is characterized by having a minimal polynomial whose degree equals the absolute dimension of $A$.

The intrinsic `PrimitiveElement` produces such an element of the étale algebra $A$ using a deterministic procedure which we now describe: Let $N$ be the number of components of $A$, each one having primitive element $a_i$. Set $b_1$ = $a_1$. For $i=2,\ldots,N$, set $b_i = a_i+j$ where $j$ is the smallest non-negative integer such that the minimal polynomial of $a_i+j$ is not in the set of minimal polynomials of the elements $b_1,\ldots,b_{i-1}$. The output is the element of $A$ whose components are $b_1,...,b_N$. In particular, if $A$ is a product of number fields with different defining polynomials, then the output is the element of $A$ whose components are the primitive elements of the components.

<a id="function-powerbasis-algetq"></a>
#### `PowerBasis(A): AlgEtQ -> SeqEnum[AlgEtQElt]`

Returns the power basis of the étale algebra $A$, consisting of powers of the primitive element of $A$.

<a id="function-basis-algetq"></a>
#### `Basis(A): AlgEtQ -> SeqEnum`

Returns a basis of the algebra $A$ over the common base field.

<a id="function-absolutebasis-algetq"></a>
#### `AbsoluteBasis(A): AlgEtQ -> SeqEnum`

Returns a basis of the algebra $A$ over the prime field.

<a id="operation-operation-algetq-rngintelt-algetqelt"></a>
#### `A . i: AlgEtQ, RngIntElt -> AlgEtQElt`

Returns the $i$-th element of the absolute basis of $A$.

<a id="function-absolutecoordinates-seqenum-algetqelt-seqenum-algetqelt"></a>
#### `AbsoluteCoordinates(seq, basis): SeqEnum[AlgEtQElt], SeqEnum[AlgEtQElt] -> SeqEnum`

Given a sequence of elements and a basis over the `PrimeField` returns a sequence whose entries are the coordinates in the `PrimeField` with respect to the given basis.

<a id="function-orthogonalidempotents-algetq"></a>
#### `OrthogonalIdempotents(A): AlgEtQ -> SeqEnum`

Returns the orthogonal idempotent element of the étale algebra $A$.

<a id="function-idempotents-algetq"></a>
#### `Idempotents(A): AlgEtQ -> SeqEnum`

Returns the idempotent element of the étale algebra $A$.

### Orders of Algebras

<a id="function-iscoercible-algetqord-any"></a>
#### `IsCoercible(S, x): AlgEtQOrd, Any -> BoolElt, AlgEtQElt`

Return whether $x$ is coercible into the order $S$ and the result if so.

<a id="function-order-seqenum-algetqelt"></a>
#### `Order(gens): SeqEnum[AlgEtQElt] -> AlgEtQOrd`

```magma
Check            : RngIntElt                    Default: 100
CheckIsKnownOrder: BoolElt                      Default: true
```

Construct the order generated by $gens$ over the rationals. The parameter `Check` (default 100) determines how many times the program tries to obtain a multiplicatively closed lattice by adding the product of the generators. If `Check` is 0 then this step is skipped. The parameter `CheckIsKnownOrder` determines whether the program checks if the order is already known, i.e. in the attribute `KnownOrders` of the algebra. This is to avoid the creation of multiple copies of the same order. The default value is `true`.

<a id="function-order-algetq-tup"></a>
#### `Order(A, orders): AlgEtQ, Tup -> AlgEtQOrd`

Given a sequence of orders in the number fields defining the étale algebra A, generates the direct sum order.

<a id="function-algebra-algetqord"></a>
#### `Algebra(S): AlgEtQOrd -> AlgEtQ`

Returns the algebra of the order $S$.

<a id="function-zbasis-algetqord"></a>
#### `ZBasis(S): AlgEtQOrd -> SeqEnum[AlgEtQElt]`

Return a Z-basis of the order $S$.

<a id="function-generators-algetqord"></a>
#### `Generators(S): AlgEtQOrd -> SeqEnum[AlgEtQElt]`

Return a set of generators (as a Z-algebra) of the order $S$.

<a id="operation-op-eq-algetqord-algetqord"></a>
#### `O1 eq O2: AlgEtQOrd, AlgEtQOrd -> BoolElt`

Checks equality of orders in an étale algebra.

Equality of orders is performed using the `Hash` attribute which is constructed as follows. Let $S$ be an order. Let $P$ be the upper triangular Hermite normal form of the integer square matrix $d\cdot M$ where $M$ is the matrix whose rows are the coefficients of a ${{\Z}}$-basis of $S$ and $d$ is the least common denominator of its entries. The `Hash` of $S$ is defined to be the sequence consisting of the least common denominator of ${1\over d}\cdot P$ and the entries of the upper triangular part of ${1\over d}\cdot P$. This hashing method has no collisions and it is independent of the choice of ${{\Z}}$-basis from which we start the procedure.

<a id="operation-op-in-algetqelt-algetqord"></a>
#### `x in O: AlgEtQElt, AlgEtQOrd -> BoolElt`

<a id="operation-op-in-rngintelt-algetqord"></a>
#### `x in O: RngIntElt, AlgEtQOrd -> BoolElt`

<a id="operation-op-in-fldratelt-algetqord"></a>
#### `x in O: FldRatElt, AlgEtQOrd -> BoolElt`

Return whether the element $x$ is contained in the order $O$ of an algebra.

<a id="function-absolutecoordinates-seqenum-algetqelt-algetqord"></a>
#### `AbsoluteCoordinates(seq, O): SeqEnum[AlgEtQElt], AlgEtQOrd -> SeqEnum`

Returns the coordinates of the elements in `seq` with respect to the stored Z-basis of $O$.

<a id="function-one-algetqord"></a>
#### `One(S): AlgEtQOrd -> AlgEtQElt`

Returns the unit element of the order $S$.

<a id="function-zero-algetqord"></a>
#### `Zero(S): AlgEtQOrd -> AlgEtQElt`

Returns the zero element of the order $S$.

<a id="function-random-algetqord-rngintelt"></a>
#### `Random(O, bd): AlgEtQOrd, RngIntElt -> AlgEtQElt`

```magma
ZeroDivisorsAllowed: BoolElt                    Default: false
```

Returns a random element of the order $O$. The coefficients are bounded by the positive integer $bd$. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which is set to `false` by default.

<a id="function-random-algetqord"></a>
#### `Random(O): AlgEtQOrd -> AlgEtQElt`

```magma
CoeffRange         : RngIntElt                    Default: 3
ZeroDivisorsAllowed: BoolElt                      Default: false
```

Returns a random (small coefficient) element of the order $O$. The range of the random coefficients can be increased by giving the optional parameter `CoeffRange`. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which is set to `false` by default.

<a id="procedure-isknownorder-algetqord-ref"></a>
#### `IsKnownOrder(~R): AlgEtQOrd`

This procedure checks whether the order $R$ is already in the list of known orders of the algebra $A$ containing $R$. If so then it replaces $R$ with the copy stored in the attribute `KnownOrders`. If not it adds it to `KnownOrders`. This is done to avoid creating multiple copies of the same order.

<a id="function-equationorder-algetq"></a>
#### `EquationOrder(A): AlgEtQ -> AlgEtQOrd`

Given an étale algebra defined by a polynomial, returns the monogenic order defined by the same polynomial.

<a id="function-productofequationorders-algetq"></a>
#### `ProductOfEquationOrders(A): AlgEtQ -> AlgEtQOrd`

Given an étale algebra $A$, returns the order consisting of the product of the equation orders of the number fields.

<a id="function-maximalorder-algetq"></a>
#### `MaximalOrder(A): AlgEtQ -> AlgEtQOrd`

Returns the maximal order of the étale algebra $A$. It is the direct sum of the ring of integers of the number fields composing the algebra.

<a id="function-ismaximal-algetqord"></a>
#### `IsMaximal(S): AlgEtQOrd -> BoolElt`

Returns whether the order $S$ is the maximal order of the étale algebra.

<a id="function-isproductoforders-algetqord"></a>
#### `IsProductOfOrders(O): AlgEtQOrd -> BoolElt, Tup`

Return if the order $O$ is a product of orders in number fields, and if so return also the sequence of these orders.

<a id="function-isproductofordersincomponents-algetqord"></a>
#### `IsProductOfOrdersInComponents(O): AlgEtQOrd -> BoolElt, Tup`

Returns whether the argument is a product of orders in the components of its parent algebra. If so, it returns also a tuple containing these orders.

<a id="function-isproductofordersinfactoralgebras-algetqord"></a>
#### `IsProductOfOrdersInFactorAlgebras(S): AlgEtQOrd -> BoolElt, SeqEnum[AlgEtQElt]`

Returns whether the given order is a product of orders living in some factor algebras of the parent algebra. This is equivalent to containing some idempotents of the algebra other than $0$ and $1$. If this is the case, it returns also the idempotents.

<a id="example-ex-f008b6"></a>
#### `Example: Orders in a Product of Number Fields (ex-f008b6)`

```magma
> _<x> := PolynomialRing(Integers());
> // We consider the following three number fields
> K1 := NumberField(x^2-2);
> K2 := NumberField(x^2-3);
> K3 := NumberField(x^2-5);
> // We define the product \'etale algebra A and the factor algebras B and C
> // consisting of only the first two components and the last one, respectively.
> B := EtaleAlgebra([K1,K2]);
> C := EtaleAlgebra([K3]);
> A, embs, projs := DirectProduct([B,C]);
> // The maximal order of A is the product of the three ring of integers.
> OA := MaximalOrder(A);
> IsProductOfOrdersInComponents(OA);
true <Maximal Equation Order with defining polynomial x^2 - 2 over its ground
order, Maximal Equation Order with defining polynomial x^2 - 3 over its ground
order, Maximal Order of Equation Order with defining polynomial x^2 - 5 over
its ground order>
> // The equation order of A is not a product in any factor algebra
> EA := EquationOrder(A);
> IsProductOfOrdersInFactorAlgebras(EA);
false []
> // Now we construct an order that is a product of an order in B and one in C,
> // but does not admit further splittings.
> a := PrimitiveElement(A);
> e1 := A![1,0,0];
> e2 := A![0,1,1];
> R := Order([a*e1,a*e2]);
> IsProductOfOrdersInFactorAlgebras(R);
true [ <1, 0, 0>, <0, 1, 1> ]
```

<a id="function-index-algetqord"></a>
#### `Index(T): AlgEtQOrd -> FldRatElt`

Given an order $T$ compute its index with respect to the basis of the algebra of $T$ as a free ${{\Z}}$-module.

<a id="function-index-algetqord-algetqord"></a>
#### `Index(S, T): AlgEtQOrd, AlgEtQOrd -> FldRatElt`

Given two orders $T \subset S$, returns $[S:T] = \#S/T$.

<a id="operation-op-subset-algetqord-algetqord"></a>
#### `O1 subset O2: AlgEtQOrd, AlgEtQOrd -> BoolElt`

Checks whether $O1$ is contained in $O2$.

<a id="operation-op-times-algetqord-algetqord"></a>
#### `O1 * O2: AlgEtQOrd, AlgEtQOrd -> AlgEtQOrd`

Returns the order generated by the orders $O1$ and $O2$.

<a id="operation-op-meet-algetqord-algetqord"></a>
#### `O1 meet O2: AlgEtQOrd, AlgEtQOrd -> AlgEtQOrd`

Return the intersection of orders $O1$ and $O2$.

<a id="function-multiplicatorring-algetqord"></a>
#### `MultiplicatorRing(R): AlgEtQOrd -> AlgEtQOrd`

Returns the multiplicator ring of an order $R$, that is $R$ itself.

### Ideals

<a id="function-ideal-algetqord-seqenum"></a>
#### `Ideal(S, gens): AlgEtQOrd, SeqEnum -> AlgEtQIdl`

Creates an ideal of the order $S$, generated by the elements of $gens$.

<a id="function-ideal-algetqord-tup"></a>
#### `Ideal(S, idls): AlgEtQOrd, Tup -> AlgEtQIdl`

Given an order $S$ which is a product of orders $S_i$ in the number fields generating `Algebra(S)`, and a tuple of ideals $I_i$ of $S_i$, returns the $S$-ideal corresponding to the direct sum of the $I_i$.

<a id="function-ideal-algetqord-any"></a>
#### `Ideal(S, gen): AlgEtQOrd, Any -> AlgEtQIdl`

<a id="operation-op-times-algetqord-algetqelt"></a>
#### `S * gen: AlgEtQOrd, AlgEtQElt -> AlgEtQIdl`

<a id="operation-op-times-algetqord-rngintelt"></a>
#### `S * gen: AlgEtQOrd, RngIntElt -> AlgEtQIdl`

<a id="operation-op-times-algetqord-fldratelt"></a>
#### `S * gen: AlgEtQOrd, FldRatElt -> AlgEtQIdl`

<a id="operation-op-times-algetqelt-algetqord"></a>
#### `gen * S: AlgEtQElt, AlgEtQOrd -> AlgEtQIdl`

<a id="operation-op-times-rngintelt-algetqord"></a>
#### `gen * S: RngIntElt, AlgEtQOrd -> AlgEtQIdl`

<a id="operation-op-times-fldratelt-algetqord"></a>
#### `gen * S: FldRatElt, AlgEtQOrd -> AlgEtQIdl`

Creates an ideal of $S$, generated by $gen$.

<a id="operation-op-algetqord-algetqidl"></a>
#### `T !! I: AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Given an $S$-ideal $I$ and an order $T$, returns the extension $IT$ as a $T$-ideal. Note that if $T$ is a subset of $S$, then $IT=I$.

<a id="function-algebra-algetqidl"></a>
#### `Algebra(I): AlgEtQIdl -> AlgEtQ`

Returns the étale algebra in which the ideal $I$ lives.

<a id="function-order-algetqidl"></a>
#### `Order(I): AlgEtQIdl -> AlgEtQOrd`

Returns the order of definition of the ideal $I$.

<a id="function-zbasis-algetqidl"></a>
#### `ZBasis(I): AlgEtQIdl -> SeqEnum[AlgEtQElt]`

Returns a ${{\Z}}$-basis of the ideal $I$.

<a id="function-generators-algetqidl"></a>
#### `Generators(I): AlgEtQIdl -> SeqEnum[AlgEtQElt]`

Returns the generators of the ideal $I$.

<a id="operation-op-eq-algetqidl-algetqidl"></a>
#### `I eq J: AlgEtQIdl, AlgEtQIdl -> BoolElt`

<a id="operation-op-ne-algetqidl-algetqidl"></a>
#### `I ne J: AlgEtQIdl, AlgEtQIdl -> BoolElt`

Returns whether the ideals $I$ and $J$ are equal, respectively not equal.

Let $I$ a fractional $S$-ideal in an étale algebra over ${{\Q}}$. Let $P$ be the upper triangular Hermite normal form of the integer square matrix $d\cdot M$ where $M$ is the matrix whose rows are the coefficients of a ${{\Z}}$-basis of $I$ and $d$ is the least common denominator of its entries. The `Hash` of $I$ is defined to be the sequence consisting of the least common denominator of ${1\over d}\cdot P$ and the entries of the upper triangular part of ${1\over d}\cdot P$. This hashing method has no collisions and it is independent of the choice of ${{\Z}}$-basis from which we start the procedure.

<a id="operation-op-eq-algetqidl-algetqord"></a>
#### `I eq S: AlgEtQIdl, AlgEtQOrd -> BoolElt`

<a id="operation-op-eq-algetqord-algetqidl"></a>
#### `S eq I: AlgEtQOrd, AlgEtQIdl -> BoolElt`

Return whether $I$ is equal to $S$ when $I$ is an ideal of $S$.

<a id="function-absolutecoordinates-algetqelt-algetqidl"></a>
#### `AbsoluteCoordinates(x, I): AlgEtQElt, AlgEtQIdl -> SeqEnum`

Given an element $x$ and an ideal $I$, returns the coordinates of $x$ with respect to the stored Z-basis of $I$.

<a id="function-absolutecoordinates-seqenum-algetqelt-algetqidl"></a>
#### `AbsoluteCoordinates(seq, I): SeqEnum[AlgEtQElt], AlgEtQIdl -> SeqEnum`

Returns the coordinates of the elements in `seq` with respect to the stored Z-basis of $I$.

<a id="operation-op-in-algetqelt-algetqidl"></a>
#### `x in I: AlgEtQElt, AlgEtQIdl -> BoolElt`

<a id="operation-op-in-rngintelt-algetqidl"></a>
#### `x in I: RngIntElt, AlgEtQIdl -> BoolElt`

<a id="operation-op-in-fldratelt-algetqidl"></a>
#### `x in I: FldRatElt, AlgEtQIdl -> BoolElt`

Returns whether the element $x$ is in the ideal $I$.

<a id="operation-op-subset-algetqord-algetqidl"></a>
#### `S subset I: AlgEtQOrd, AlgEtQIdl -> BoolElt`

Given an ideal $I$ of an order $S$, return whether $S \subseteq I$.

<a id="operation-op-subset-algetqidl-algetqord"></a>
#### `I subset S: AlgEtQIdl, AlgEtQOrd -> BoolElt`

Given an ideal $I$ of an order $S$, return whether $I \subseteq S$.

<a id="operation-op-subset-algetqidl-algetqidl"></a>
#### `I1 subset I2: AlgEtQIdl, AlgEtQIdl -> BoolElt`

Checks if the ideal $I1$ is inside the ideal $I2$. The ideals need to be fractional.

<a id="function-index-algetqidl"></a>
#### `Index(T): AlgEtQIdl -> FldRatElt`

Given an ideal $T$ computes its index with respect to the basis of the algebra of $T$ as a free ${{\Q}}$-module.

<a id="function-index-algetqidl-algetqidl"></a>
#### `Index(J, I): AlgEtQIdl, AlgEtQIdl -> Any`

Given fractional ideals $J$ and $I$ defined over the same order returns $[J:I] = [J:J \cap I]/[I : J \cap I]$.

<a id="function-index-algetqord-algetqidl"></a>
#### `Index(S, I): AlgEtQOrd, AlgEtQIdl -> Any`

Given an ideal $I$ of an order $S$ returns $[S:I] = [S:S \cap I]/[I : S \cap I]$.

<a id="function-oneideal-algetqord"></a>
#### `OneIdeal(S): AlgEtQOrd -> AlgEtQIdl`

Given an order $S$ returns the ideal $1*S$ which will be cached.

<a id="function-conductor-algetqord"></a>
#### `Conductor(O): AlgEtQOrd -> AlgEtQOrdIdl`

Computes the conductor of an order $O$, defined as the colon ideal $(O:O_K)$, where $O_K$ is the maximal order of the algebra.

<a id="operation-op-plus-algetqidl-algetqidl"></a>
#### `I + J: AlgEtQIdl, AlgEtQIdl -> AlgEtQIdl`

Returns the sum of two ideals.

<a id="operation-op-times-algetqidl-algetqidl"></a>
#### `I * J: AlgEtQIdl, AlgEtQIdl -> AlgEtQIdl`

Product of two ideals.

<a id="operation-op-times-algetqidl-algetqelt"></a>
#### `I * x: AlgEtQIdl, AlgEtQElt -> AlgEtQIdl`

<a id="operation-op-times-algetqidl-rngintelt"></a>
#### `I * x: AlgEtQIdl, RngIntElt -> AlgEtQIdl`

<a id="operation-op-times-algetqidl-fldratelt"></a>
#### `I * x: AlgEtQIdl, FldRatElt -> AlgEtQIdl`

<a id="operation-op-times-algetqelt-algetqidl"></a>
#### `x * I: AlgEtQElt, AlgEtQIdl -> AlgEtQIdl`

<a id="operation-op-times-rngintelt-algetqidl"></a>
#### `x * I: RngIntElt, AlgEtQIdl -> AlgEtQIdl`

<a id="operation-op-times-fldratelt-algetqidl"></a>
#### `x * I: FldRatElt, AlgEtQIdl -> AlgEtQIdl`

Returns $x*I$.

<a id="operation-op-pow-algetqidl-rngintelt"></a>
#### `I ^ n: AlgEtQIdl, RngIntElt -> AlgEtQIdl`

Returns the $n$th power of an ideal.

<a id="operation-op-meet-algetqidl-algetqord"></a>
#### `I meet S: AlgEtQIdl, AlgEtQOrd -> AlgEtQIdl`

<a id="operation-op-meet-algetqord-algetqidl"></a>
#### `S meet I: AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Given an ideal $I$ of $S$, return $S \cap I$.

<a id="operation-op-meet-algetqidl-algetqidl"></a>
#### `I meet J: AlgEtQIdl, AlgEtQIdl -> AlgEtQIdl`

Given ideals $I$ and $J$, return $J \cap I$.

<a id="operation-operation-seqenum-algetqidl-algetqidl"></a>
#### `&+ seq: SeqEnum[AlgEtQIdl] -> AlgEtQIdl`

Returns the sum of the fractional ideals in the sequence.

<a id="function-colonideal-algetqidl-algetqidl"></a>
#### `ColonIdeal(I, J): AlgEtQIdl, AlgEtQIdl -> AlgEtQIdl`

Computes the colon ideal $(I:J)$ (as an $O$-ideal) of two $O$-ideals, which is the set of elements $x$ of the algebra such that $x \cdot J \subset I$.

<a id="function-colonideal-algetqord-algetqidl"></a>
#### `ColonIdeal(O, J): AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Computes the colon ideal $(1 \cdot O:J)$ (as an $O$-ideal).

<a id="function-colonideal-algetqidl-algetqord"></a>
#### `ColonIdeal(I, O): AlgEtQIdl, AlgEtQOrd -> AlgEtQIdl`

Computes the colon ideal $(I:1 \cdot O)$ (as an $O$-ideal).

<a id="function-isinvertible-algetqidl"></a>
#### `IsInvertible(I): AlgEtQIdl -> BoolElt`

Checks if the ideal $I$ is invertible in its order of definition $O$.

<a id="function-inverse-algetqidl"></a>
#### `Inverse(I): AlgEtQIdl -> AlgEtQIdl`

Computes the inverse of an invertible ideal $I$.

<a id="function-multiplicatorring-algetqidl"></a>
#### `MultiplicatorRing(I): AlgEtQIdl -> AlgEtQOrd`

Given a fractional ideal $I$ computes its multiplicator ring $(I:I)$.

<a id="function-isproductofideals-algetqidl"></a>
#### `IsProductOfIdeals(I): AlgEtQIdl -> BoolElt, Tup`

Return if the ideal $I$ is a product of ideals in the number fields defining the algebra. If so, it returns also the sequence of these ideals (in the appropriate orders). Note: we require `Order(I)` to be `MultiplicatorRing(I)`.

<a id="function-random-algetqidl-rngintelt"></a>
#### `Random(I, bd): AlgEtQIdl, RngIntElt -> AlgEtQElt`

```magma
ZeroDivisorsAllowed: BoolElt                    Default: false
```

Returns a random element of the ideal $I$. The coefficients are bounded by the positive integer $bd$. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which by default is set to `false`.

<a id="function-random-algetqidl"></a>
#### `Random(I): AlgEtQIdl -> AlgEtQElt`

```magma
CoeffRange         : RngIntElt                    Default: 3
ZeroDivisorsAllowed: BoolElt                      Default: false
```

Returns a random (small coefficient) element of the ideal $I$. The range of the random coefficients can be increased by giving the optional parameter `CoeffRange`. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which by default is set to `false`.

<a id="function-iscoprime-algetqidl-algetqidl"></a>
#### `IsCoprime(I, J): AlgEtQIdl, AlgEtQIdl -> BoolElt`

Given two integral ideals $I$ and $J$ of an order $S$, returns whether $I+J=R$.

<a id="function-isintegral-algetqidl"></a>
#### `IsIntegral(I): AlgEtQIdl -> BoolElt`

Returns whether the ideal $I$ of $S$ is integral, that is $I \subseteq S$.

<a id="function-makeintegral-algetqidl"></a>
#### `MakeIntegral(I): AlgEtQIdl -> AlgEtQIdl, RngIntElt`

Given a fractional $S$ ideal $I$, returns the ideal $d \cdot I, d$ when $d$ is the smallest integer such that $d \cdot I$ is integral in $S$. Compare with [`SmallRepresentative`](https://docs.magma-maths.org/GlobalFields/EtaleAlgebras/short_elt_small_rep.md#function-smallrep).

<a id="function-minimalinteger-algetqidl"></a>
#### `MinimalInteger(I): AlgEtQIdl -> RngIntElt`

Returns the smallest integer contained in the ideal $I$.

<a id="function-coprimerepresentative-algetqidl-algetqidl"></a>
#### `CoprimeRepresentative(I, J): AlgEtQIdl, AlgEtQIdl -> AlgEtQElt, AlgEtQIdl`

Returns an element $x$ such that $x \cdot I$ is an integral ideal coprime with $J$, together with the product $x \cdot I$. The first ideal must be invertible and the second should be integral.

<a id="procedure-zbasislll-algetqord-ref"></a>
#### `ZBasisLLL(~S): AlgEtQOrd`

<a id="procedure-zbasislll-algetqidl-ref"></a>
#### `ZBasisLLL(~S): AlgEtQIdl`

A procedure that replaces the ZBasis with an LLL-reduced one. Note: the attribute inclusion matrix, which depends on the ${{\Z}}$-Basis is modified as well.

### Quotients

<a id="function-quotient-algetqidl-seqenum-algetqelt"></a>
#### `Quotient(I, zbJ): AlgEtQIdl, SeqEnum[AlgEtQElt] -> GrpAb, Map`

Given an ideal $I$ and the ZBasis of an ideal or order $J$ such that $J \subset I$, returns the abelian group $Q=I/J$ together with the quotient map $q:I\mapsto Q$.

<a id="function-quotient-algetqidl-algetqidl"></a>
#### `Quotient(I, J): AlgEtQIdl, AlgEtQIdl -> GrpAb, Map`

Given fractional ideals $J \subset I$, returns the abelian group $Q=I/J$ together with the quotient map $q:I\mapsto Q$.

<a id="function-quotient-algetqord-seqenum-algetqelt"></a>
#### `Quotient(S, zbJ): AlgEtQOrd, SeqEnum[AlgEtQElt] -> GrpAb, Map`

Given an order $S$ and the ZBasis of an ideal $J$ such that $J \subset S$, returns the abelian group $Q=S/J$ together with the quotient map $q:S\mapsto Q$. The ideal $J$ can also be an order.

<a id="function-residuering-algetqord-algetqidl"></a>
#### `ResidueRing(S, I): AlgEtQOrd, AlgEtQIdl -> GrpAb, Map`

Given an integral ideal $I$ of $S$, returns the abelian group $S/I$ and the quotient map $q:S \mapsto S/I$ (with preimages). Important: the domain of $q$ is the Algebra of $S$, since the elements of $S$ are expressed as elements of $A$. We stress that the output is a group and does not have a multiplication. This can be obtained by first taking preimages, doing the multiplication, and then applying the projection.

<a id="function-residuefield-algetqidl"></a>
#### `ResidueField(P): AlgEtQIdl -> FldFin, Map`

Given $P$ a prime of $S$, returns a finite field $F$ isomorphic to $S/P$ and a surjection (with inverse) $S\mapsto F$.

<a id="function-primitiveelementresiduefield-algetqidl"></a>
#### `PrimitiveElementResidueField(P): AlgEtQIdl -> AlgEtQElt`

Returns an element of the ideal $P$ that maps to the primitive element of the residue field $S/P$, that is a multiplicative generator of $(S/P)^*$.

<a id="function-quotientvs-algetqord-algetqord-algetqidl"></a>
#### `QuotientVS(I, J, P): AlgEtQOrd, AlgEtQOrd, AlgEtQIdl -> ModRng, Map`

Let $I, J$ be orders, $P$ a fractional $R$-ideal such that:

- $P$ is prime of some order $R$ with residue field $K$;
- $J$ in $I$ and $I/J$ is a vector space $V$ over $K$, say of dimension $d$.

The function returns the `KModule` $K^d=V$ and the natural surjection $I\mapsto V$ (with preimages).

<a id="example-ex-c0d808"></a>
#### `Example: Residue Field and Residue Ring (ex-c0d808)`

```magma
> _<x> := PolynomialRing(Integers());
> f := (x^8+16)*(x^8+81);
> A := EtaleAlgebra(f);
> O := MaximalOrder(A);
> // Choose a prime above 2
> P := PrimesAbove(2*O)[1];
> // Residue field
> F, pi := ResidueField(P);
> F;
Finite field of size 2
> // Residue ring
> G, q := ResidueRing(O,P);
> G;
Abelian Group isomorphic to Z/2
Defined on 1 generator
Relations:
2*G.1 = 0
```

<a id="function-quotientvs-algetqord-algetqidl-algetqidl"></a>
#### `QuotientVS(I, J, P): AlgEtQOrd, AlgEtQIdl, AlgEtQIdl -> ModRng, Map`

Let $I$ be an order, $J$ and $P$ be fractional $R$-ideals such that:

- $P$ is prime of some order $R$, with residue field $K$;
- $J$ in $I$ and $I/J$ is a vector space $V$ over $K$, say of dimension $d$.

The function returns the `KModule` $K^d=V$ and the natural surjection $I\mapsto V$ (with preimages).

<a id="function-quotientvs-algetqidl-algetqord-algetqidl"></a>
#### `QuotientVS(I, J, P): AlgEtQIdl, AlgEtQOrd, AlgEtQIdl -> ModRng, Map`

Let $J$ be an order, $I$ and $P$ be fractional $R$-ideals such that:

- $P$ is prime of some order $R$, with residue field $K$;
- $J$ in $I$ and $I/J$ is a vector space $V$ over $K$, say of dimension $d$.

The function returns the `KModule` $K^d=V$ and the natural surjection $I\mapsto V$ (with preimages).

<a id="function-quotientvs-algetqidl-algetqidl-algetqidl"></a>
#### `QuotientVS(I, J, P): AlgEtQIdl, AlgEtQIdl, AlgEtQIdl -> ModRng, Map`

Let $I, J, P$ be fractional $R$-ideals such that:

- $P$ is prime of some order $R$;
- $J$ in $I$ and $I/J$ is a vector space over $R/P$, say of dimension $d$;

The function returns the `KModule` $K^d=V$ and the natural surjection $I\mapsto V$ (with preimages).

### Over Orders

<a id="function-ismaximalatprime-algetqord-algetqidl"></a>
#### `IsMaximalAtPrime(R, P): AlgEtQOrd, AlgEtQIdl -> BoolElt`

Returns whether $R$ is maximal at the prime $P$, that is, if $(R:O)$ is not contained in $P$, where $O$ is the maximal order.

<a id="function-minimaloverordersatprime-algetqord-algetqidl"></a>
#### `MinimalOverOrdersAtPrime(R, P): AlgEtQOrd, AlgEtQIdl -> SetIndx[AlgEtQOrd]`

Given an order $R$ and prime $P$ of $R$, it returns the minimal overorders $S$ of $R$ with conductor $(R:S)$ which is $P$-primary. The minimality assumption forces the conductor $(R:S)$ to be exactly $P$. Based on [[HS20](https://docs.magma-maths.org/references.md#cite-hofmannsircana)].

<a id="function-minimaloverorders-algetqord"></a>
#### `MinimalOverOrders(R): AlgEtQOrd -> SetIndx[AlgEtQOrd]`

Computes the minimal overorders of $R$.

<a id="function-overordersatprime-algetqord-algetqidl"></a>
#### `OverOrdersAtPrime(R, P): AlgEtQOrd, AlgEtQIdl -> SeqEnum[AlgEtQOrd]`

Given an order $R$ and prime $P$ of $R$, it returns $R$ and the overorders $S$ of $R$ with conductor $(R:S)$ which is $P$-primary. We recursively produce the minimal $PP$-overorders where $PP$ are primes above $P$. Based on [[HS20](https://docs.magma-maths.org/references.md#cite-hofmannsircana)].

<a id="function-overorders-algetqord"></a>
#### `OverOrders(R): AlgEtQOrd -> SeqEnum[AlgEtQOrd]`

```magma
populateoo_in_oo: BoolElt                    Default: false
```

We compute all the overorders of $R$. The parameter `populateoo_in_oo` (default `false`) determines whether we should fill the attribute ``T`OverOrders`` for every overorder $T$ of $R$. The computation is based on [[HS20](https://docs.magma-maths.org/references.md#cite-hofmannsircana)].

<a id="example-ex-1d4978"></a>
#### `Example: Over-Orders of an Equation Order (ex-1d4978)`

```magma
> _<x> := PolynomialRing(Integers());
> f := (x^4+16)*(x^4+81);
> A := EtaleAlgebra(f);
> E := EquationOrder(A);
> oo := OverOrders(E);
> #oo;
2288
> pp := SingularPrimes(E);
> // We see that the size of the lattice of inclusions of the overorders is the
> // product of the sizes of local component of the lattice.
> #oo eq &*[ #OverOrdersAtPrime(E,P) : P in pp ];
true
> // Now we consider only the P-overorders S for the first singular prime P.
> // We verify that there is always a positive integer i such that (R:S)^i is
> // invertible in its multiplicator ring.
> ooP := OverOrdersAtPrime(E,pp[1]);
> #ooP;
11
> forall{exists{IsInvertible(Ti!!Ci) where Ti:=MultiplicatorRing(Ci)
> where Ci:=C^i : i in [1..10]} where C := ColonIdeal(E,E!!OneIdeal(S))
>                                                             : S in ooP};
true
```

<a id="function-findoverorders-algetqord"></a>
#### `FindOverOrders(R): AlgEtQOrd -> SetIndx[AlgEtQOrd]`

```magma
populateoo_in_oo: BoolElt                    Default: false
```

We compute all the overorders of $R$. The parameter `populateoo_in_oo` (default `false`) determines whether we should fill the attribute ``T`OverOrders`` for every overorder $T$ of $R$. The computation is based on [[HS20](https://docs.magma-maths.org/references.md#cite-hofmannsircana)].

### Over Order Graph

<a id="function-graphoverorders-algetqord"></a>
#### `GraphOverOrders(R): AlgEtQOrd -> GrphDir`

Given an order $R$ returns the graph $G$ of minimal inclusions of the overorders of $R$. More precisely, the vertices of $G$ are integers between 1 and the number of `OverOrders(R)`, and there is an edge $[i,j]$ if and only if `OverOrder(R)[j]` is a minimal overorder of `OverOrders(R)[i]`.

### Trace and Norm

Let $A$ be an étale algebra over ${{\Q}}$, with components $K_1\times\cdots\times K_n$. We define the *(absolute) trace* on $A$ as the additive map ${\rm Tr_{A/{{\Q}}}}\from A\to {{\Q}}$ that sends an element $a\in A$ to $\sum_{i=1}^n {\rm Tr}_{K_i/{{\Q}}}(a)$. Let $m_a$ be the matrix representing the multiplication-by-$a$ on $A$ with respect to any basis of $A$ over ${{\Q}}$. Then ${\rm Tr}_{A/{{\Q}}}(a)$ equals the trace of $m_a$.

We define the *(absolute) norm* on $A$ as the multiplicative map ${\rm N}_{A/{{\Q}}}\from A \to {{\Q}}$ by sending a unit $a \in A$ to $\prod_{i=1}^n {\rm N}_{K_i/{{\Q}}}(a)$ and every zero-divisor to $0$. We have $N_{A/{{\Q}}}(a)$ equals the determinant of the matrix $m_a$.

<a id="function-trace-algetqelt"></a>
#### `Trace(x): AlgEtQElt -> FldRatElt`

Returns the trace of the element $x$ of an étale algebra.

<a id="function-norm-algetqelt"></a>
#### `Norm(x): AlgEtQElt -> FldRatElt`

Returns the norm of the element $x$ of an étale algebra.

<a id="function-absolutetrace-algetqelt"></a>
#### `AbsoluteTrace(x): AlgEtQElt -> FldRatElt`

Returns the absolute trace of the element $x$ of an étale algebra. Since the étale algebra is over the rationals this is the same as `Trace`.

<a id="function-absolutenorm-algetqelt"></a>
#### `AbsoluteNorm(x): AlgEtQElt -> FldRatElt`

Returns the absolute norm of the element $x$ of an étale algebra. Since the étale algebra is over the rationals this is the same as `Norm`.

<a id="function-tracedualideal-algetqidl"></a>
#### `TraceDualIdeal(I): AlgEtQIdl -> AlgEtQIdl`

Returns the trace dual ideal of the ideal $I$, that is, the set of elements $x$ of the algebra such that ${\operatorname{Tr}}(x \cdot I)$ is integer-valued.

Let $I$ be an order or a fractional ideal in an étale algebra $A$ over ${{\Q}}$. We defined the *trace dual ideal* of $I$ as $I^t=\{ a\in A : {\rm Tr}_{A/{{\Q}}}(a\cdot I) \subseteq {{\Z}}\}$. For fractional ideals $I$ and $J$ and a unit $a\in A$, we have:

**(a)**
if $I \subseteq J$ then $J^t \subseteq I^t$ and $\#(J/I) = \#(I^t/J^t)$;

**(b)**
$(aI)^t = {1\over a}I^t$;

**(c)**
$(I+J)^t = I^t \cap J^t$;

**(d)**
$(I\cap J)^t = I^t + J^t$;

**(e)**
$(I:J)^t = I^t\cdot J$.

<a id="function-tracedualideal-algetqord"></a>
#### `TraceDualIdeal(O): AlgEtQOrd -> AlgEtQIdl`

Returns the trace dual ideal of an order in an étale algebra, that is, the set of elements $x$ of the algebra such that ${\operatorname{Tr}}(x \cdot O)$ is integer-valued.

### Completion

<a id="function-completion-algetqidl"></a>
#### `Completion(P): AlgEtQIdl -> FldPad, Map`

```magma
MinPrecision: RngIntElt                    Default: 20
```

Given a prime ideal $P$ of the maximal order of an étale algebra $L$, returns the $p$-adic field corresponding to the completion $L_P$ and a homomorphism $\phi: L\to L_P$ with preimages. The parameter `MinPrecision` is passed to `Completion`.

<a id="example-ex-ecd376"></a>
#### `Example: Uniformizers and Completions (ex-ecd376)`

```magma
> _<x> := PolynomialRing(Integers());
> f := (x^8+16)*(x^8+81);
> A := EtaleAlgebra(f);
> O := MaximalOrder(A);
> // Consider a bunch of prime of O and their uniformizers in O.
> pp := PrimesAbove(2*3*5*7*O);
> unifs := Uniformizers(pp);
> // We now verify that each element is a uniformizer at the correct prime
> // and a unit everywhere else
> assert Matrix([[ Valuation(mP(t)) : t in unifs ] where AP, mP := Completion(P)
>                                                                : P in pp]) eq 1;
```

### Intermediate Ideals

<a id="function-intermediateideals-algetqidl-algetqidl"></a>
#### `IntermediateIdeals(I, J): AlgEtQIdl, AlgEtQIdl -> SetIndx[AlgEtQIdl]`

```magma
Minimal                    : BoolElt                    Default: false
Maximal                    : BoolElt                    Default: false
PrescribedMultiplicatorRing: BoolElt                    Default: false
```

Given fractional $S$-ideals $J \subset I$, returns all the fractional $S$-ideals $K$ such that $J \subset K \subset I$.

If `Minimal` is set true, only the minimal ideals are returned. If `Maximal` is set true, only the maximal ideals are returned. If `PrescribedMultiplicatorRing` is set true, only ideals $K$ with $(K:K) = S$ are returned. The computation is done recursively starting with the minimal or maximal ones.

<a id="function-intermediateideals-algetqidl-algetqidl-algetqord"></a>
#### `IntermediateIdeals(I, J, O): AlgEtQIdl, AlgEtQIdl, AlgEtQOrd -> SetIndx[AlgEtQIdl]`

```magma
PrescribedMultiplicatorRing: BoolElt                    Default: false
```

Given fractional $S$-ideals $I$ and $J$ and an order $O$ such that $S \subseteq O$, $J \subseteq I$, and $O \subseteq (I:I)$, this function returns all the fractional $S$-ideals $K$ such that

- $J \subseteq K \subseteq I$, and
- $O \cdot K = I$.

If `PrescribedMultiplicatorRing` is set true, then the output contains only $K$ such that $(K:K)=S$. Note that the output may contain $I$. The output is produced by recursively computing maximal intermediate ideals.

<a id="function-intermediateideals-algetqidl-algetqidl-rngintelt"></a>
#### `IntermediateIdeals(I, J, N): AlgEtQIdl, AlgEtQIdl, RngIntElt -> SetIndx[AlgEtQIdl]`

Given ideals $J \subset I$ over the same order, and a positive integer $N$, it returns all the ideals $K$ such that

- $J \subset K \subset I$, and
- $[I:K]=N$.

These are computed by recursively searching for maximal submodules.

### Ideals of Index

<a id="function-idealsofindex-rngord-rngintelt"></a>
#### `IdealsOfIndex(O, N): RngOrd, RngIntElt -> SeqEnum[RngOrdIdl]`

Given an order $O$ in a number field and a positive integer $N$, returns all the ideals $I$ of index $[O:I]=N$.

<a id="function-idealsofindex-rngordidl-rngintelt"></a>
#### `IdealsOfIndex(I, N): RngOrdIdl, RngIntElt -> SeqEnum[RngOrdIdl]`

Given an ideal $I$ in an order $O$ in a number field and a positive integer $N$, with $N$ coprime with the conductor, returns all the ideals $J$ contained in $I$ with index $[I:J]=N$.

<a id="function-idealsofindex-rngordfracidl-rngintelt"></a>
#### `IdealsOfIndex(I, N): RngOrdFracIdl, RngIntElt -> SeqEnum[RngOrdFracIdl]`

Given an ideal $I$ in an order $O$ in a number field and a positive integer $N$, with $N$ coprime with the conductor, returns all the ideals $J$ contained in $I$ with index $[I:J]=N$.

<a id="function-idealsofindex-algetqidl-rngintelt"></a>
#### `IdealsOfIndex(I, N): AlgEtQIdl, RngIntElt -> SeqEnum[AlgEtQIdl]`

```magma
Method: MonStgElt                    Default: "Default"
```

Given an $O$-ideal $I$ in $O$ and a positive integer $N$, returns all the subideals $J$ of $I$ with index $[I:J]=N$. The function is very fast if $N$ is coprime to the conductor of $O$. If this condition is not satisfied a slow algorithm is used which doesn’t require additional hypothesis. One can force the slow algorithm by setting the parameter `Method:="Slow"`.

<a id="function-idealsofindex-algetqord-rngintelt"></a>
#### `IdealsOfIndex(O, N): AlgEtQOrd, RngIntElt -> SeqEnum[AlgEtQIdl]`

```magma
Method: MonStgElt                    Default: "Default"
```

Given an order $O$ and a positive integer $N$, returns all the $O$-ideals $J$ with index $[O:J]=N$. The function is very fast if $N$ is coprime to the conductor of $O$. If this condition is not satisfied a slow algorithm is used which doesn’t require additional hypothesis. One can force the slow-naive algorithm by setting the parameter `Method:="Slow"`.

### Short Element and Small Representative

<a id="function-shortelement-algetqidl"></a>
#### `ShortElement(I): AlgEtQIdl -> AlgEtQElt`

Given an ideal $I$ returns a non-zerodivisor in $I$ with small coefficients (in the LLL sense). This is achieved by randomly picking an element with small coefficients in a LLL-reduced basis (wrt the T2 norm as a ${{\Z}}$-lattice).

<a id="function-smallrep"></a>
#### `SmallRepresentative(I): AlgEtQIdl -> AlgEtQIdl, AlgEtQElt`

Given a fractional $R$-ideal $I$, it returns an isomorphic ideal $a \cdot I$, and the element $a$, such that $a \cdot I$ is a subset of $R$, and the cardinality of $R/aI$ is small. This is achieved by computing the `ShortElement` $a$ of $(R:I)$. Note that if $I$ is invertible $R/aI$ is isomorphic to $(R:I)/aR$.

### Minimal Generators

<a id="procedure-twogeneratingset-algetqidl"></a>
#### `TwoGeneratingSet(I): AlgEtQIdl`

A procedure that given an invertible ideal $I$ put in the attribute `Generators` of $I$ two non-zerodivisors in $I$ that generate $I$. If $I$ is known to be principal nothing is done.

### Chinese Remainder Theorem

Let $I$ and $J$ be integral fractional ideals over the same order $S$ in an étale algebra. Assume that $I$ and $J$ are coprime, that is, $I+J=S$. Then $I \cap J = I\cdot J$ and we have a canonical $S$-linear isomorphism

$$
{S\over I \cap J} \simeq {S\over I} \times {S\over J}.
$$

<a id="function-chineseremaindertheorem-seqenum-algetqidl-seqenum-algetqelt"></a>
#### `ChineseRemainderTheorem(Is, as): SeqEnum[AlgEtQIdl], SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence $Is$ of ideals of $S$, pairwise coprime, and a sequence $as$ of elements of $S$, it returns an element $e$ such that $e-as[i] \in Is[i]$ for every $i$.

<a id="function-chineseremaindertheorem-algetqidl-algetqidl-algetqelt-algetqelt"></a>
#### `ChineseRemainderTheorem(I, J, a, b): AlgEtQIdl, AlgEtQIdl, AlgEtQElt, AlgEtQElt -> AlgEtQElt`

Given two coprime ideals $I$ and $J$ of $S$, two elements $a,b \in S$, finds $e$ such that $(e-a) \in I$ and $(e-b) \in J$.

<a id="function-chineseremaindertheoremfunctions-seqenum-algetqidl"></a>
#### `ChineseRemainderTheoremFunctions(Is): SeqEnum[AlgEtQIdl] -> Map, Map`

Given a sequence $Is$ of $N$ integral fractional $S$-ideals $I_1,\ldots,I_N$, pairwise coprime, returns a map $S \to S^N$ representing the natural isomorphism ${S \over I} \to {S \over I_1} \times \cdots \times {S \over I_N}$, where $I=\prod_i I_i$, and a map $S^N \to S$ representing the inverse.

<a id="example-ex-d7dd94"></a>
#### `Example: Chinese Remainder Theorem Maps (ex-d7dd94)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra((x^2+2)*(x^2+3));
> O := MaximalOrder(A);
> I1 := PrimesAbove(2*O)[1];
> I2 := PrimesAbove(3*O)[1];
> toProd, fromProd := ChineseRemainderTheoremFunctions([I1,I2]);
> toProd(One(A));
[
<1, 0>,
<1, 0>
]
```

### Picard Group

Let $R$ be an order in an étale algebra $A$ over ${{\Q}}$ with maximal order ${\cal O}_A$. We say that two fractional $R$-ideals $I$ and $J$ are *isomorphic* if there exists a unit $a\in A$ such that $I=aJ$. Observe that this happens if and only if $I$ and $J$ are isomorphic as $R$-modules. We refer to the isomorphism class $[I]$ of $I$ as its *ideal class*.

The set of ideal classes of invertible fractional $R$-ideals forms a group under the operation induced by ideal multiplication. This group is called the *Picard group* of $R$ and denoted ${\rm Pic}(R)$.

If $K_1\times \ldots \times K_n$ are the components of $A$ then ${\rm Pic}({\cal O}_A) = \prod_{i=1}^n{\rm Cl}({\cal O}_{K_i})$, where ${\rm Cl}({\cal O}_{K_i})$ is the class group of the number field $K_i$. Also, the unit group ${\cal O}_A^\times$ of ${\cal O}_A$ satisfies ${\cal O}_A^\times = {\cal O}_{K_1}^\times \times \ldots \times {\cal O}_{K_n}^\times$.

The Picard group and the unit group of the order $R$ can be computed using the well-known exact sequence:

$$
1 \to R^\times \to {\cal O}_A^\times \to {\left( {\cal O}_A/{\mathfrak{f}} \right)^\times\over\left( R/{\mathfrak{f}} \right)^\times} \to {\rm Pic}(R)\to {\rm Pic}({\cal O}_A) \to 1,
$$

where the first, second, and third map are the natural maps, the fourth is induced by $a \mapsto (a{\cal O}_A \cap R)$ and the last one is induced by the extension map $I \mapsto I{\cal O}_A$.

<a id="function-residueringunits-algetqord-algetqidl"></a>
#### `ResidueRingUnits(S, I): AlgEtQOrd, AlgEtQIdl -> GrpAb, Map`

Returns the group $(S/I)^*$ and a map $(S/I)^* \rightarrow S$. The order $S$ is required to be maximal.

<a id="function-residueringunits-algetqidl"></a>
#### `ResidueRingUnits(I): AlgEtQIdl -> GrpAb, Map`

Given a fractional $S$-ideal $I$, returns the group $(S/I)^*$ and a map $(S/I)^* \to S$ giving representatives. Implemented when $S$ is maximal.

<a id="function-residueringunitssubgroupgenerators-algetqidl"></a>
#### `ResidueRingUnitsSubgroupGenerators(F): AlgEtQIdl -> SeqEnum[AlgEtQElt]`

Given a fractional $S$-ideal $F$, returns generators of $(S/F)^*$.

<a id="function-isprincipal-algetqidl"></a>
#### `IsPrincipal(I1): AlgEtQIdl -> BoolElt, AlgAssElt`

```magma
GRH: BoolElt                    Default: false
```

Return if the argument is a principal ideal; if so the function returns also the generator. The optional parameter `GRH` decides whether the bound for the `IsPrincipal` test should be conditional. The default value is `false`.

<a id="function-picardgroup-algetqord"></a>
#### `PicardGroup(S): AlgEtQOrd -> GrpAb, Map`

```magma
GRH: BoolElt                    Default: false
```

Return the `PicardGroup` of the order $S$, which is not required to be maximal, and a map from the Picard group to a set of representatives of the ideal classes. The optional parameter `GRH` decides the bound for the computations of the Class group and Unit group of the maximal order. The default value is `false`.

<a id="function-extensionhompicardgroups-algetqord-algetqord"></a>
#### `ExtensionHomPicardGroups(S, T): AlgEtQOrd, AlgEtQOrd -> Map`

```magma
GRH: BoolElt                    Default: false
```

Given orders $S$ and $T$ such that $S \subseteq T$, returns the surjective extension map ${\rm Pic}(S) \to {\rm Pic}(T)$. The parameter `GRH` is passed to `PicardGroup`.

<a id="function-unitgroup-algetqord"></a>
#### `UnitGroup(S): AlgEtQOrd -> GrpAb, Map`

```magma
GRH: BoolElt                    Default: false
```

Return the unit group of a order in a étale algebra. The optional parameter `GRH` decides the bound for the computation of the unit group of the maximal order. The default value is `false`.

<a id="example-ex-034565"></a>
#### `Example: Picard Group and Units of an Order (ex-034565)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra((x^4+16)*(x^4+81));
> E := EquationOrder(A);
> P, phi := PicardGroup(E);
> AbelianInvariants(P);
[ 2, 24, 24, 24, 24 ]
> U, psi := UnitGroup(E);
> TorsionInvariants(U);
[ 2 ]
> TorsionFreeRank(U);
2
```

<a id="function-isisomorphic-algetqidl-algetqidl"></a>
#### `IsIsomorphic(I, J): AlgEtQIdl, AlgEtQIdl -> BoolElt, AlgAssElt`

```magma
GRH: BoolElt                    Default: false
```

Checks if $I=x \cdot J$, for some $x$. If so, also $x$ is returned. The optional parameter `GRH` decides whether the bound for the `IsPrincipal` test should be conditional. The default value is `false`.

### Factorization and Primes

<a id="function-factorization-algetqidl"></a>
#### `Factorization(I): AlgEtQIdl -> Tup`

Given an integral $S$-ideal $I$ coprime with the conductor of $S$ (hence invertible in $S$), returns its factorization into a product of primes of $S$.

<a id="function-primesabove-algetqidl"></a>
#### `PrimesAbove(I): AlgEtQIdl -> SeqEnum[AlgAssEtOrdIdl]`

Given an integral $S$-ideal $I$, returns the sequence of maximal ideals $P$ of $S$ above $I$.

<a id="function-singularprimes-algetqord"></a>
#### `SingularPrimes(R): AlgEtQOrd -> SeqEnum[AlgAssEtOrdIdl]`

Returns the non-invertible primes of the order $R$.

<a id="function-placesaboverationalprime-algetq-rngintelt"></a>
#### `PlacesAboveRationalPrime(E, p): AlgEtQ, RngIntElt -> SeqEnum[AlgEtQIdl]`

Given an étale algebra and a rational prime, returns the primes of the maximal order of the algebra containing the rational prime.

<a id="function-noninvertibleprimes-algetqord"></a>
#### `NonInvertiblePrimes(R): AlgEtQOrd -> SetIndx`

Returns the non-invertible primes of the order $R$.

<a id="function-isprime-algetqidl"></a>
#### `IsPrime(I): AlgEtQIdl -> BoolElt`

<a id="function-ismaximal-algetqidl"></a>
#### `IsMaximal(I): AlgEtQIdl -> BoolElt`

<a id="function-ismaximalideal-algetqidl"></a>
#### `IsMaximalIdeal(I): AlgEtQIdl -> BoolElt`

Given an integral $S$-ideal $I$, returns if the ideal is a prime fractional ideal of $S$, that is a maximal $S$ ideal.

<a id="function-valuation-algetqelt-algetqidl"></a>
#### `Valuation(x, P): AlgEtQElt, AlgEtQIdl -> RngIntElt`

<a id="function-valuation-algetqidl-algetqidl"></a>
#### `Valuation(I, P): AlgEtQIdl, AlgEtQIdl -> RngIntElt`

Valuation at the prime $P$ of an element $x$ or of a fractional ideal $I$ of the maximal order.

<a id="function-inertiadegree-algetqidl"></a>
#### `InertiaDegree(P): AlgEtQIdl -> RngIntElt`

<a id="function-ramificationindex-algetqidl"></a>
#### `RamificationIndex(P): AlgEtQIdl -> RngIntElt`

For a prime $P$ of the maximal order ${\cal O}$, returns its inertia degree and ramification index.

<a id="function-isbassatprime-algetqord-algetqidl"></a>
#### `IsBassAtPrime(S, P): AlgEtQOrd, AlgEtQIdl -> BoolElt`

Check if the order is Bass at the prime ideal $P$, that is, if every overorder of $S$ is Gorenstein at the primes above $P$.

<a id="function-isbass-algetqord"></a>
#### `IsBass(S): AlgEtQOrd -> BoolElt`

Check if the order $S$ is Bass, that is, if every overorder of $S$ is Gorenstein.

<a id="function-isgorensteinatprime-algetqord-algetqidl"></a>
#### `IsGorensteinAtPrime(S, P): AlgEtQOrd, AlgEtQIdl -> BoolElt`

Check if the order $S$ is Gorenstein at the prime ideal $P$, that is, if every fractional ideal $I$ with $(I:I)=S$ is locally principal at $P$.

<a id="function-isgorenstein-algetqord"></a>
#### `IsGorenstein(O): AlgEtQOrd -> BoolElt`

Checks if the order $O$ is Gorenstein, that is if the `TraceDualIdeal` of $O$ is invertible, or equivalently, if all fractional ideals $I$ with $(I:I)=O$ are invertible.

<a id="function-uniformizers-seqenum-algetqidl"></a>
#### `Uniformizers(PPs): SeqEnum[AlgEtQIdl] -> SeqEnum`

Given a sequence of primes $P$ of the maximal order, returns a sequence of elements $t_P$ such that $t_P$ is a uniformizer at $P$ and a unit at every other prime in the sequence.

### Low Cohen Macauley Type

<a id="function-nongorensteinprimes-algetqord"></a>
#### `NonGorensteinPrimes(S): AlgEtQOrd -> SeqEnum, SeqEnum`

Given an order $S$ it returns two sequences: the first containis the primes at which $S$ is locally not Gorenstein; the second contains the Cohen Macaulay types of $S$ at these primes, that is, the dimension of $S^t/PS^t$ over $S/P$, where $S^t$ is the `TraceDualIdeal` of $S$.

<a id="function-cohenmacaulaytypeatprime-algetqord-algetqidl"></a>
#### `CohenMacaulayTypeAtPrime(S, P): AlgEtQOrd, AlgEtQIdl -> RngIntElt`

Given an order $S$ and a prime ideal $P$, it returns its Cohen-Macaulay Type at $P$. This integer equals the dimension of $S^t/P*S^t$ where $S^t$ is the trace dual of $S$.

<a id="function-cohenmacaulaytype-algetqord"></a>
#### `CohenMacaulayType(S): AlgEtQOrd -> RngIntElt`

Given an order $S$ returns its Cohen-Macaulay Type. This integer equals the max dimension of $S^t/P*S^t$ where $S^t$ is the trace dual of $S$ and $P$ runs over all (non-Gorenstein) primes of $S$.

<a id="example-ex-442922"></a>
#### `Example: Order of Maximal Cohen-Macaulay Type (ex-442922)`

```magma
> // Given an \'etale algebra A of dimension n over Q, the maximum Cohen-Macaulay
> // type that an order can have is n-1.
> // An order with such maximal Cohen-Macaualay type can be found among the
> // overorders of the order Z+p*O_A where p an arbitrary rational prime.
> // We verify this statement in an example.
> _<x> := PolynomialRing(Integers());
> f := x^4+8;
> A := EtaleAlgebra(f);
> O := MaximalOrder(A);
> p := 7;
> E := Order([p*z : z in ZBasis(O)]);
> n := Dimension(A);
> oo := OverOrders(E);
> exists{ S : S in oo | CohenMacaulayType(S) eq n-1 };
true
```

### Weak Classes

Let $R$ be an order and $I$ and $J$ be fractional $R$-ideals in an étale algebra $A$ over ${{\Q}}$. Then the following statements are equivalent:

**(a)**
$I_{\p} \simeq J_{\p}$ as $R_{\p}$-modules for every maximal ideal $\p$ of $R$.

**(b)**
$I_p \simeq J_p$ as $R_p$-modules for every rational prime $p$.

**(c)**
$1 \in (I:J)(J:I)$.

**(d)**
$I$ and $J$ have the same multiplicator ring, say $S$, and $(I:J)$ is an invertible fractional $S$-ideal.

**(e)**
$I$ and $J$ have the same multiplicator ring, say $S$, and $(J:I)$ is an invertible fractional $S$-ideal. If the previous conditions hold, one says that $I$ and $J$ are *weakly equivalent*. This is an equivalence relation.

Note that if $I$ is an order, then $J$ is weakly equivalent to $I$ if and only if $J$ is an invertible $I$-ideal. If both $I$ and $J$ are orders then they are weakly equivalent if and only if they are equal. In the literature, the same notion sometimes goes under the name *local isomorphism*.

<a id="function-wkicm-bar-algetqord"></a>
#### `WKICM_bar(S): AlgEtQOrd -> SeqEnum`

```magma
Method: MonStgElt                    Default: "Auto"
```

Returns representatives of all the weak equivalence classes $I$ of $S$ satisfying $(I:I)=S$. The parameter `Method` (default `"Auto"`) determines if we should use the `"IntermediateIdeals"` routine or the `"LowIndexProcess"`, which is potentially much slower but more memory efficient.

<a id="function-weakequivalenceclasseswithprescribedmultiplicatorring-algetqord"></a>
#### `WeakEquivalenceClassesWithPrescribedMultiplicatorRing(S): AlgEtQOrd -> SeqEnum[AlgEtQIdl]`

Given an order $S$, returns representatives $I$ of all weak equivalence classes of fractional $S$-ideals with $(I:I)=S$.

We also provide an abstract representation of the weak equivalence class monoid. In this representation the monoid has type `AlgEtQWECM` and classes have type `AlgEtQWECMElt`. Classes can be created via the coercion operator `!`, multiplied with `*` (and exponentiated with `^`), and a representative can be recovered using the `RepresentativeMap`. Additional helpers include `IsOne`, `IsIdempotent`, and `Localization`.

Let $R$ be an order in an étale algebra over ${{\Q}}$. Then ideal multiplication induces a commutative monoid structure on the set of weak equivalence classes of fractional $R$-ideals called the *weak equivalence class monoid* of $R$. This commutative monoid, which we denote by ${\cal W}(R)$, is finite and has unit element given by the class of $R$.

Since the multiplicator ring is an invariant of the weak equivalence class of a fractional $R$-ideal, we have a partitioning ${\cal W}(R) = \bigsqcup_S {\cal W}_S(R)$, where the disjoint union is taken over the overorders $S$ of $R$ and ${\cal W}_S(R)$ is the subset of ${\cal W}(R)$ consisting of the weak equivalence classes of fractional $R$-ideals with multiplicator ring $S$.

Let $S$ be an overorder of $R$. If $S$ is Gorenstein then ${\cal W}_S(R)$ consists only of the class defined by $S$. If $S$ has Cohen-Macaulay type $2$ and $\p$ is a prime of $S$, then each fractional $R$-ideal $I$ with multiplicator ring $S$ satisfies either $I_\p \simeq S_\p$ or $I_\p \simeq S^t_\p$. The second possibility occurs precisely when $S$ has Cohen-Macaulay type $2$ at the primes $\p$. This classification results provide a very efficient method to compute ${\cal W}_S(R)$ for orders $S$ with Cohen-Macaulay type $\leq 2$. For the general case, an algorithm that includes a more expensive enumeration step is provided.

<a id="function-weakequivalenceclassmonoid-algetqord"></a>
#### `WeakEquivalenceClassMonoid(E): AlgEtQOrd -> SeqEnum[AlgEtQIdl]`

<a id="function-wkicm-algetqord"></a>
#### `WKICM(E): AlgEtQOrd -> SeqEnum`

```magma
Method: MonStgElt                    Default: "Auto"
```

Computes the weak equivalence class monoid of $E$. The parameter `Method` (default `"Auto"`) determines if we should use the `"IntermediateIdeals"` routine or the `"LowIndexProcess"`, which is potentially much slower but more memory efficient.

The second method to compute ${\cal W}(R)$ returns an abstract representation of the monoid together with a map giving representatives. The monoid is of type `AlgEtQWECM` and each class is of type `AlgEtQWECMElt`. Classes can be created by feeding to the operator `!` a fractional $S$-ideal, when $S$ is an overorder of $R$, or an overorder of $R$ itself. Whenever a class is created a representative is stored in an attribute. This representative can be changed using the intrinsic `SetRepresentative`. Classes can be multiplied using the operator `*`. Whenever two classes are multiplied, the result is stored in the attribute `MultiplicationTable` of the monoid.

<a id="function-weakequivalenceclassmonoidabstract-algetqord"></a>
#### `WeakEquivalenceClassMonoidAbstract(R): AlgEtQOrd -> AlgEtQWECM, Map`

Given an order $R$, returns the abstract weak equivalence class monoid $W$ of $R$ together with a map (with preimages) sending each class to a representative.

<a id="operation-op-algetqwecm-any"></a>
#### `W ! x: AlgEtQWECM, Any -> AlgEtQWECMElt`

Coerce $x$ into the monoid $W$, when possible, returning a class.

<a id="operation-op-in-algetqwecmelt-algetqwecm"></a>
#### `x in W: AlgEtQWECMElt, AlgEtQWECM -> BoolElt`

Returns whether the class $x$ belongs to the monoid $W$.

<a id="function-parent-algetqwecmelt"></a>
#### `Parent(x): AlgEtQWECMElt -> AlgEtQWECM`

<a id="function-ideal-algetqwecmelt"></a>
#### `Ideal(x): AlgEtQWECMElt -> AlgEtQIdl`

<a id="function-multiplicatorring-algetqwecmelt"></a>
#### `MultiplicatorRing(x): AlgEtQWECMElt -> AlgEtQOrd`

<a id="operation-op-eq-algetqwecmelt-algetqwecmelt"></a>
#### `x1 eq x2: AlgEtQWECMElt, AlgEtQWECMElt -> BoolElt`

<a id="procedure-setrepresentative-algetqwecmelt-algetqidl"></a>
#### `SetRepresentative(x, J): AlgEtQWECMElt, AlgEtQIdl`

Change the stored representative of the class $x$ to the weakly equivalent ideal $J$.

<a id="function-multiplicationtable-algetqwecm"></a>
#### `MultiplicationTable(W): AlgEtQWECM -> Assoc`

<a id="operation-op-times-algetqwecmelt-algetqwecmelt"></a>
#### `x * y: AlgEtQWECMElt, AlgEtQWECMElt -> AlgEtQWECMElt`

<a id="operation-op-pow-algetqwecmelt-rngintelt"></a>
#### `x ^ n: AlgEtQWECMElt, RngIntElt -> AlgEtQWECMElt`

<a id="function-isone-algetqwecmelt"></a>
#### `IsOne(x): AlgEtQWECMElt -> BoolElt`

<a id="function-isidempotent-algetqwecmelt"></a>
#### `IsIdempotent(x): AlgEtQWECMElt -> BoolElt`

<a id="function-order-algetqwecm"></a>
#### `Order(W): AlgEtQWECM -> AlgEtQOrd`

<a id="function-array-algetqwecm"></a>
#### `Array(W): AlgEtQWECM -> Assoc`

<a id="function-representativemap-algetqwecm"></a>
#### `RepresentativeMap(W): AlgEtQWECM -> Map`

<a id="operation-op-eq-algetqwecm-algetqwecm"></a>
#### `W1 eq W2: AlgEtQWECM, AlgEtQWECM -> BoolElt`

<a id="operation-operation-algetqwecm-rngint"></a>
#### `# W: AlgEtQWECM -> RngInt`

<a id="function-classes-algetqwecm"></a>
#### `Classes(W): AlgEtQWECM -> SeqEnum[AlgEtQWECMElt]`

<a id="function-representatives-algetqwecm"></a>
#### `Representatives(W): AlgEtQWECM -> SeqEnum[AlgEtQIdl]`

<a id="function-one-algetqwecm"></a>
#### `One(W): AlgEtQWECM -> AlgEtQWECMElt`

<a id="function-random-algetqwecm"></a>
#### `Random(W): AlgEtQWECM -> AlgEtQWECMElt`

<a id="function-idempotents-algetqwecm"></a>
#### `Idempotents(W): AlgEtQWECM -> SeqEnum[AlgEtQWECMElt]`

<a id="function-localization-algetqwecm-algetqidl"></a>
#### `Localization(W, P): AlgEtQWECM, AlgEtQIdl -> AlgEtQWECM`

<a id="function-isgeneratingset-algetqwecm-seqenum-algetqwecmelt"></a>
#### `IsGeneratingSet(W, seq): AlgEtQWECM, SeqEnum[AlgEtQWECMElt] -> BoolElt`

<a id="function-isgeneratingset-algetqwecm-seqenum-algetqidl"></a>
#### `IsGeneratingSet(W, seq): AlgEtQWECM, SeqEnum[AlgEtQIdl] -> BoolElt`

(More standard intrinsics.)

<a id="example-ex-628357"></a>
#### `Example: Weak Equivalence Classes (ex-628357)`

```magma
> _<x> := PolynomialRing(Integers());
> f := (x^4+16)*(x^4+81);
> A := EtaleAlgebra(f);
> E := EquationOrder(A);
> w := WKICM_bar(E);
> #w;
1
> // Optionally compute full monoid
> W := WKICM(E);
> #W;
```

### Weak Testing

<a id="function-isweakequivalent-algetqidl-algetqidl"></a>
#### `IsWeakEquivalent(I, J): AlgEtQIdl, AlgEtQIdl -> BoolElt`

<a id="function-isweaklyequivalent-algetqidl-algetqidl"></a>
#### `IsWeaklyEquivalent(I, J): AlgEtQIdl, AlgEtQIdl -> BoolElt`

Checks if $I$ and $J$ are weakly equivalent, that is, if $1 \in (I:J) (J:I)$, or equivalently, if $I$ and $J$ are locally equivalent at all prime of their common multiplicator ring. This function does not require that the ideals are defined over the same order.

<a id="function-isweakequivalent-algetqord-algetqord"></a>
#### `IsWeakEquivalent(O1, O2): AlgEtQOrd, AlgEtQOrd -> BoolElt`

<a id="function-isweaklyequivalent-algetqord-algetqord"></a>
#### `IsWeaklyEquivalent(O1, O2): AlgEtQOrd, AlgEtQOrd -> BoolElt`

Check if the two orders $O1$ and $O2$ are weakly equivalent, that is equal.

<a id="function-isweakequivalent-algetqord-algetqidl"></a>
#### `IsWeakEquivalent(O, J): AlgEtQOrd, AlgEtQIdl -> BoolElt`

<a id="function-isweaklyequivalent-algetqidl-algetqord"></a>
#### `IsWeaklyEquivalent(J, O): AlgEtQIdl, AlgEtQOrd -> BoolElt`

Checks if the ideal $J$ is weakly equivalent to order $O$, that is, if $J$ is invertible in $O$.

<a id="example-ex-6405b0"></a>
#### `Example: Testing Weak Equivalence (ex-6405b0)`

```magma
> _<x> := PolynomialRing(Integers());
> f := (x^4+16)*(x^4+81);
> A := EtaleAlgebra(f);
> E := EquationOrder(A);
> I := OneIdeal(E);
> J := I;
> IsWeakEquivalent(I,J);
true
```

<a id="function-isweakequivalent-algetqidl-algetqord"></a>
#### `IsWeakEquivalent(J, O): AlgEtQIdl, AlgEtQOrd -> BoolElt`

Checks if the ideal $J$ is weakly equivalent to order $O$, that is, if $J$ is invertible in $O$.

### Ideal Class Monoid

Let $R$ be an order in an étale algebra $A$ over ${{\Q}}$. Ideal multiplication induces the structure of commutative monoid on the set of ideal classes of $R$, which we then call *ideal class monoid* of $R$. We denote it by ${\cal I}(R)$. The unit element of ${\cal I}(R)$ is the class of any principal fractional $R$-ideal.

We have a partitioning ${\cal I}(R) = \bigsqcup_S {\cal I}_S(R)$ where the disjoint union is taken over the overorders $S$ of $R$ and ${\cal I}_S(R)$ is the subset of ${\cal I}(R)$ consisting of ideal classes with multiplicator ring $S$. The computation is then performed by first computing ${\cal W}(R)$ and then observing that for each overorder $S$ of $R$, the Picard group ${\rm Pic}(S)$ acts freely on ${\cal I}_S(R)$ with quotient space ${\cal W}_S(R)$.

<a id="function-icm-bar-algetqord"></a>
#### `ICM_bar(S): AlgEtQOrd -> SeqEnum`

```magma
GRH: BoolElt                    Default: false
```

Returns the ideal classes of fractional $S$-ideals having Multiplicator Ring equal to $S$. This is the same as the orbit of the action of `PicardGroup(S)` on `WKICM_bar(S)`.

<a id="function-icm-algetqord"></a>
#### `ICM(S): AlgEtQOrd -> SeqEnum`

```magma
GRH: BoolElt                    Default: false
```

Returns the ideal class monoid of the order $S$, that is, a set of representatives for the isomorphism classes of the fractional $S$-ideals.

We also provide an abstract representation of the ideal class monoid. The abstract monoid has type `AlgEtQICM` and classes have type `AlgEtQICMElt`. An ideal class can be created via `!` starting from an overorder or a fractional ideal, and a (deterministic) representative can be recovered using `RepresentativeMap`. Each class is internally a pair consisting of a weak equivalence class and an element of the abstract representation of ${\rm Pic}(S)$.

The second method to compute the ideal class monoid of an order $R$, returns an abstract representation of ${\cal I}(R)$ with type `AlgEtQICM` together with a map to a set of representatives. Each class has type `AlgEtQICMElt`, and it is internally represented as a pair consisting of a weak equivalence class (of type `AlgEtQWECMElt`) and an element of the representation of ${\rm Pic}(S)$ (as an abstract abelian group), where $S$ is the corresponding multiplicator ring. This representation is more efficient than the previous one, since it does not need to compute in advance and store a representative for each ideal class. Ideal classes can be created using the coercion operator `!` starting from an overorder $S$ of $R$ or a fractional $S$-ideal. Ideal classes can be multiplied using the operator `*`.

<a id="function-idealclassmonoidabstract-algetqord"></a>
#### `IdealClassMonoidAbstract(R): AlgEtQOrd -> AlgEtQICM, Map`

Given an order $R$, returns the abstract ideal class monoid ${\rm icm}$ together with a map (with preimages) sending each class to a representative.

<a id="operation-op-algetqicm-any"></a>
#### `icm ! x: AlgEtQICM, Any -> AlgEtQICMElt`

Coerce $x$ into the abstract ideal class monoid when possible, returning an ideal class.

<a id="operation-op-in-algetqicmelt-algetqicm"></a>
#### `x in icm: AlgEtQICMElt, AlgEtQICM -> BoolElt`

<a id="function-parent-algetqicmelt"></a>
#### `Parent(x): AlgEtQICMElt -> AlgEtQICM`

<a id="function-weclass-algetqicmelt"></a>
#### `WEClass(x): AlgEtQICMElt -> AlgEtQWECMElt`

<a id="function-picclass-algetqicmelt"></a>
#### `PicClass(x): AlgEtQICMElt -> GrpAbElt, Map`

<a id="function-ideal-algetqicmelt"></a>
#### `Ideal(x): AlgEtQICMElt -> AlgEtQIdl`

<a id="function-multiplicatorring-algetqicmelt"></a>
#### `MultiplicatorRing(x): AlgEtQICMElt -> AlgEtQOrd`

<a id="operation-op-eq-algetqicmelt-algetqicmelt"></a>
#### `x1 eq x2: AlgEtQICMElt, AlgEtQICMElt -> BoolElt`

<a id="operation-op-times-algetqicmelt-algetqicmelt"></a>
#### `x * y: AlgEtQICMElt, AlgEtQICMElt -> AlgEtQICMElt`

<a id="operation-op-pow-algetqicmelt-rngintelt"></a>
#### `x ^ n: AlgEtQICMElt, RngIntElt -> AlgEtQICMElt`

<a id="function-isone-algetqicmelt"></a>
#### `IsOne(x): AlgEtQICMElt -> BoolElt`

<a id="function-isinvertibleinmultiplicatorring-algetqicmelt"></a>
#### `IsInvertibleInMultiplicatorRing(x): AlgEtQICMElt -> BoolElt`

<a id="function-order-algetqicm"></a>
#### `Order(icm): AlgEtQICM -> AlgEtQOrd`

<a id="function-representativemap-algetqicm"></a>
#### `RepresentativeMap(icm): AlgEtQICM -> Map`

<a id="operation-op-eq-algetqicm-algetqicm"></a>
#### `icm1 eq icm2: AlgEtQICM, AlgEtQICM -> BoolElt`

<a id="operation-operation-algetqicm-rngint"></a>
#### `# icm: AlgEtQICM -> RngInt`

<a id="function-classes-algetqicm"></a>
#### `Classes(icm): AlgEtQICM -> SeqEnum[AlgEtQICMElt]`

<a id="function-representatives-algetqicm"></a>
#### `Representatives(icm): AlgEtQICM -> SeqEnum[AlgEtQIdl]`

<a id="function-one-algetqicm"></a>
#### `One(icm): AlgEtQICM -> AlgEtQICMElt`

<a id="function-random-algetqicm"></a>
#### `Random(icm): AlgEtQICM -> AlgEtQICMElt`

(More standard intrinsics.)

### Complex Conjugation

Let $A$ be an étale algebra over ${{\Q}}$ with components $K_1\times\cdots\times K_n$. We say that $A$ is a *CM-étale algebra* if every component $K_i$ is a CM-field, that is, $K_i$ has an involution that acts as applying complex conjugation after applying any homomorphism to the complex numbers. If $A$ is a CM-étale algebra, then it has an involution with the same property. For this reason, we call this involution *complex conjugation* and denote it as $\overline{\cdot}$.

Given an element of $A$, an order, or a fractional ideal in $A$, we say that it is *conjugate stable* if it equals its complex conjugate. An element $x$ of $A$ is called *totally real* if $x=\overline{x}$ and *totally imaginary* if $x=-\overline{x}$. A totally real element $a$ is called *totally positive* (resp. *totally negative*) if $\varphi(a) > 0$ (resp. $\varphi(a)<0$) for every homomorphism $\varphi: A \to {\C}$.

<a id="function-hascomplexconjugate-algetq"></a>
#### `HasComplexConjugate(A): AlgEtQ -> BoolElt`

Returns if the algebra $A$ is the product of CM fields.

<a id="function-complexconjugate-algetqelt"></a>
#### `ComplexConjugate(x): AlgEtQElt -> AlgEtQElt`

If the algebra $A$ of the element $x$ is a product of CM fields, it returns the complex conjugate of the argument.

<a id="function-isconjugatestable-algetqord"></a>
#### `IsConjugateStable(O): AlgEtQOrd -> BoolElt, AlgEtQOrd`

Given an order $O$ in a CM-étale algebra, it returns whether $O$ is conjugate stable and the complex conjugate.

<a id="function-complexconjugate-algetqord"></a>
#### `ComplexConjugate(O): AlgEtQOrd -> AlgEtQOrd`

Given an order $O$ in a CM-étale algebra, it returns the complex conjugate of $O$.

<a id="function-isconjugatestable-algetqidl"></a>
#### `IsConjugateStable(I): AlgEtQIdl -> BoolElt, AlgEtQIdl`

Given a fractional ideal $I$ in a CM-étale algebra, it returns whether $I$ is conjugate stable and the complex conjugate. Note: if the order of $I$ is not conjugate stable, then the second output will be defined over the complex conjugate of the order.

<a id="function-complexconjugate-algetqidl"></a>
#### `ComplexConjugate(I): AlgEtQIdl -> AlgEtQIdl`

If $A$ is a product of CM fields, it returns the complex conjugate of the fractional ideal $I$. Note: if the order of $I$ is not conjugate stable, then the output will be defined over the complex conjugate of the order.

### Complex Multiplication

Let $A$ be a CM-étale algebra of dimension $2g$ over ${{\Q}}$. Then complex conjugation acts on ${\rm Homs}(A,{\C})$. We denote this action with $\overline{\cdot}$. A *CM-type* $\Phi$ of $A$ is a set of $g$ elements of ${\rm Homs}(A,{\C})$ such that ${\rm Homs}(A,{\C}) = \Phi \sqcup \overline{\Phi}$.

Given a CM-type $\Phi$ and a totally imaginary element $b\in A^\times$, we say that $b$ is $\Phi$-*positive* if ${\operatorname{Im}}(\varphi(b))>0$ for every $\varphi\in \Phi$. Two totally imaginary elements $b$ and $b'$ in $A^\times$ represent the same CM-type $\Phi$ if and only if $b/b'$ is totally real and totally positive.

In Magma a CM-type of a CM-algebra $A$ has type `AlgEtQCMType` and it is determined by $g$ homomorphisms to ${\C}$ or by a $\Phi$-positive element.

<a id="function-cmtype-seqenum-map"></a>
#### `CMType(seq): SeqEnum[Map] -> AlgEtQCMType`

Given a sequence $seq$ of homomorphisms from a CM-algebra to CC, one per conjugate pair, it returns the corresponding CMType.

<a id="example-ex-d5afe8"></a>
#### `Example: CM Type of an Etale Algebra (ex-d5afe8)`

```magma
> _<x> := PolynomialRing(Integers());
> A := EtaleAlgebra(x^2+1);
> homs := HomsToC(A);
> PHI := CMType([homs[1]]);
> H := Homs(PHI : Precision := 30);
> #H;
1
```

<a id="function-createcmtype-seqenum-map"></a>
#### `CreateCMType(seq): SeqEnum[Map] -> AlgEtQCMType`

Given a sequence $seq$ of homomorphisms from a CM-algebra to CC, one per conjugate pair, it returns the corresponding CMType.

<a id="function-cmtype-algetqelt"></a>
#### `CMType(b): AlgEtQElt -> AlgEtQCMType`

Given a totally imaginary element $b$, it returns the CMType PHI for which $b$ is PHI-positive, that is, ${\rm Im}(\phi(b))>0$ for every $\phi$ in PHI.

<a id="function-createcmtype-algetqelt"></a>
#### `CreateCMType(b): AlgEtQElt -> AlgEtQCMType`

Given a totally imaginary element $b$, it returns the CMType PHI for which $b$ is PHI-positive.

<a id="function-cmpositiveelement-algetqcmtype"></a>
#### `CMPositiveElement(PHI): AlgEtQCMType -> AlgEtQElt`

Given a CMType PHI returns a totally imaginary PHI-positive element (which uniquely determines PHI).

<a id="function-cmposelt-algetqcmtype"></a>
#### `CMPosElt(PHI): AlgEtQCMType -> AlgEtQElt`

Given a CMType PHI returns a totally imaginary PHI-positive element (which uniquely determines PHI).

<a id="function-homs-algetqcmtype"></a>
#### `Homs(PHI): AlgEtQCMType -> SeqEnum[Map]`

```magma
prec: RngIntElt                    Default: 30
```

Given an `AlgEtQCMType` PHI returns the sequence of maps to the complex field. The parameter `prec` (default value 30) determines the precision of the codomains of the maps.

<a id="operation-op-eq-algetqcmtype-algetqcmtype"></a>
#### `PHI1 eq PHI2: AlgEtQCMType, AlgEtQCMType -> BoolElt`

```magma
prec: RngIntElt                    Default: 30
```

Returns whether two cm types are equal. This happens if and only if the quotient of (any) two CMPositiveElements is totally real and totally positive.

<a id="function-precision-algetqcmtype"></a>
#### `Precision(PHI): AlgEtQCMType -> RngIntElt`

Returns the precision of the given CM-type, that is, the codomain of each homomorphism will be `ComplexField(Precision)`.

<a id="function-changeprecision-algetqcmtype-rngintelt"></a>
#### `ChangePrecision(PHI0, prec): AlgEtQCMType, RngIntElt -> AlgEtQCMType`

Changes the precision of the given CM-type, that is, the codomain of each homomorphism will be `ComplexField(Precision)`.

<a id="procedure-changeprecision-algetqcmtype-rngintelt-ref"></a>
#### `ChangePrecision(~PHI, prec): AlgEtQCMType, RngIntElt`

Changes the precision of the given CM-type, that is, the codomain of each homomorphism will be `ComplexField(Precision)`.

<a id="function-allcmtypes-algetq"></a>
#### `AllCMTypes(A): AlgEtQ -> SeqEnum[AlgEtQCMType]`

```magma
Precision: RngIntElt                    Default: Precision(GetDefaultRealField())
```

Returns all the `AlgEtQCMTypes` of $A$. The parameter `Precision` determined the precision of the codomain of the maps defining the CMTypes.

### Totally Real and Positive

<a id="function-istotallyreal-algetqelt"></a>
#### `IsTotallyReal(a): AlgEtQElt -> BoolElt`

Returns whether element $a$ is totally real.

<a id="function-istotallyrealpositive-algetqelt"></a>
#### `IsTotallyRealPositive(a): AlgEtQElt -> BoolElt`

Returns whether the element $a$ is totally positive, that is, totally real and with positive image in CC.

<a id="function-totallyrealsubalgebra-algetq"></a>
#### `TotallyRealSubAlgebra(K): AlgEtQ -> AlgEtQ, Map`

Given a CM algebra $K$, returns the unique totally real subalgebra, with an embedding.

<a id="function-totallyrealunitgroup-algetqord"></a>
#### `TotallyRealUnitGroup(S): AlgEtQOrd -> Grp`

Given an order $S$ in a CM étale algebra $A$ returns the groups of totally real units of $S$, as a subgroup of $S^*$.

<a id="function-totallyrealpositiveunitgroup-algetqord"></a>
#### `TotallyRealPositiveUnitGroup(S): AlgEtQOrd -> Grp`

Given an order $S$ in a CM étale algebra. Returns the groups of totally positive units of $S$, as a subgroup of $S^*$.

### Printing and Saving

<a id="function-printseqalgetqelt-seqenum-algetqelt"></a>
#### `PrintSeqAlgEtQElt(seq): SeqEnum[AlgEtQElt] -> SeqEnum, MonStgElt`

Given a sequence of elements of an étale algebra, returns a sequence of tuples of rational numbers that can be coerced into the original algebra to obtain the input sequence. As a second output, returns a string suitable for printing to file.

<a id="function-printwkicm-algetqord"></a>
#### `PrintWKICM(R): AlgEtQOrd -> MonStgElt`

Given an order $R$, returns a string encoding the weak equivalence classes of $R$, sorted by multiplicator ring. In particular, the overorders of $R$ can be recovered from this string. Such a string can be printed to file; use `LoadWKICM` to load it back.

<a id="function-loadwkicm-monstgelt"></a>
#### `LoadWKICM(str): MonStgElt -> AlgEtQOrd`

Given a string produced with `PrintWKICM`, returns the corresponding order $R$ with populated attributes for overorders and weak equivalence classes.

<a id="characters"></a>
<a id="char-main"></a>
## Dirichlet and Hecke Characters

- [Introduction](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md)
  - [Creation Functions](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#creation-functions)
    - [`DirichletGroup(I): RngOrdIdl → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletgroup-rngordidl)
    - [`DirichletGroup(I, oo): RngOrdIdl, SeqEnum → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletgroup-rngordidl-seqenum)
    - [`HeckeCharacterGroup(I): RngOrdIdl → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharactergroup-rngordidl)
    - [`HeckeCharacterGroup(I, oo): RngOrdIdl, SeqEnum → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharactergroup-rngordidl-seqenum)
    - [`UnitTrivialSubgroup(G): GrpDrchNF → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-unittrivialsubgroup-grpdrchnf)
    - [`TotallyUnitTrivialSubgroup(G): GrpDrchNF → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-totallyunittrivialsubgroup-grpdrchnf)
    - [`HilbertCharacterSubgroup(G): GrpHecke → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-hilbertcharactersubgroup-grphecke)
  - [Functions on Groups and Group Elements](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#functions-on-groups-and-group-elements)
    - [`Modulus(G): GrpDrchNF → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-modulus-grpdrchnf)
    - [`Modulus(G): GrpHecke → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-modulus-grphecke)
    - [`Modulus(chi): GrpDrchNFElt → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-modulus-grpdrchnfelt)
    - [`Modulus(chi): GrpHeckeElt → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-modulus-grpheckeelt)
    - [`Order(chi): GrpDrchNFElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-order-grpdrchnfelt)
    - [`Order(psi): GrpHeckeElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-order-grpheckeelt)
    - [`Random(G): GrpDrchNF → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-random-grpdrchnf)
    - [`Random(G): GrpHecke → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-random-grphecke)
    - [`Domain(G): GrpDrchNF → FldNum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-domain-grpdrchnf)
    - [`Domain(G): GrpDrchNFElt → FldNum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-domain-grpdrchnfelt)
    - [`Domain(G): GrpHecke → PowIdl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-domain-grphecke)
    - [`Domain(G): GrpHeckeElt → PowIdl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-domain-grpheckeelt)
    - [`Decomposition(chi): GrpDrchNFElt → List`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-decomposition-grpdrchnfelt)
    - [`Components(chi): GrpDrchNFElt → Assoc`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-components-grpdrchnfelt)
    - [`Components(psi): GrpHeckeElt → Assoc`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-components-grpheckeelt)
    - [`Component(chi, P): GrpDrchNFElt, RngOrdIdl → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpdrchnfelt-rngordidl)
    - [`Component(psi, P): GrpHeckeElt, RngOrdIdl → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpheckeelt-rngordidl)
    - [`Component(chi, oo): GrpDrchNFElt, RngIntElt → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpdrchnfelt-rngintelt)
    - [`Component(psi, oo): GrpHeckeElt, RngIntElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpheckeelt-rngintelt)
    - [`Component(chi, P): GrpDrchNFElt, PlcNumElt → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpdrchnfelt-plcnumelt)
    - [`Component(psi, P): GrpHeckeElt, PlcNumElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grpheckeelt-plcnumelt)
    - [`Conductor(chi): GrpDrchNFElt → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-conductor-grpdrchnfelt)
    - [`Conductor(psi): GrpHeckeElt → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-conductor-grpheckeelt)
    - [`AssociatedPrimitiveCharacter(chi): GrpDrchNFElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-associatedprimitivecharacter-grpdrchnfelt)
    - [`AssociatedPrimitiveCharacter(psi): GrpHeckeElt → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-associatedprimitivecharacter-grpheckeelt)
    - [`Restrict(chi, D): GrpDrchNFElt, GrpDrchNF → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnfelt-grpdrchnf)
    - [`Restrict(psi, H): GrpHeckeElt, GrpHecke → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpheckeelt-grphecke)
    - [`Restrict(chi, I): GrpDrchNFElt, RngOrdIdl → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnfelt-rngordidl)
    - [`Restrict(psi, I): GrpHeckeElt, RngOrdIdl → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpheckeelt-rngordidl)
    - [`Restrict(chi, I, oo): GrpDrchNFElt, RngOrdIdl, SeqEnum → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnfelt-rngordidl-seqenum)
    - [`Restrict(psi, I, oo): GrpHeckeElt, RngOrdIdl, SeqEnum → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpheckeelt-rngordidl-seqenum)
    - [`Restrict(G, D): GrpDrchNF, GrpDrchNF → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnf-grpdrchnf)
    - [`Restrict(G, H): GrpHecke, GrpHecke → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grphecke-grphecke)
    - [`Restrict(G, I): GrpDrchNF, RngOrdIdl → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnf-rngordidl)
    - [`Restrict(G, I): GrpHecke, RngOrdIdl → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grphecke-rngordidl)
    - [`Restrict(G, I, oo): GrpDrchNF, RngOrdIdl, SeqEnum → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grpdrchnf-rngordidl-seqenum)
    - [`Restrict(G, I, oo): GrpHecke, RngOrdIdl, SeqEnum → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grphecke-rngordidl-seqenum)
    - [`TargetRestriction(G, C): GrpDrchNF, FldCyc → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-targetrestriction-grpdrchnf-fldcyc)
    - [`TargetRestriction(H, C): GrpHecke, FldCyc → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-targetrestriction-grphecke-fldcyc)
    - [`SetTargetRing(~ chi, e): GrpDrchNFElt, RngElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#procedure-settargetring-grpdrchnfelt-rngelt-ref)
    - [`SetTargetRing(~ psi, e): GrpHeckeElt, RngElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#procedure-settargetring-grpheckeelt-rngelt-ref)
    - [`Extend(chi, D): GrpDrchNFElt, GrpDrchNF → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnfelt-grpdrchnf)
    - [`Extend(psi, H): GrpHeckeElt, GrpHecke → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpheckeelt-grphecke)
    - [`Extend(chi, I): GrpDrchNFElt, RngOrdIdl → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnfelt-rngordidl)
    - [`Extend(psi, I): GrpHeckeElt, RngOrdIdl → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpheckeelt-rngordidl)
    - [`Extend(chi, I, oo): GrpDrchNFElt, RngOrdIdl, SeqEnum → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnfelt-rngordidl-seqenum)
    - [`Extend(psi, I, oo): GrpHeckeElt, RngOrdIdl, SeqEnum → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpheckeelt-rngordidl-seqenum)
    - [`Extend(G, D): GrpDrchNF, GrpDrchNF → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnf-grpdrchnf)
    - [`Extend(G, H): GrpHecke, GrpHecke → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grphecke-grphecke)
    - [`Extend(G, I): GrpDrchNF, RngOrdIdl → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnf-rngordidl)
    - [`Extend(G, I): GrpHecke, RngOrdIdl → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grphecke-rngordidl)
    - [`Extend(G, I, oo): GrpDrchNF, RngOrdIdl, SeqEnum → GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grpdrchnf-rngordidl-seqenum)
    - [`Extend(G, I, oo): GrpHecke, RngOrdIdl, SeqEnum → GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grphecke-rngordidl-seqenum)
  - [Predicates on Group Elements](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#predicates-on-group-elements)
    - [`IsTrivial(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-istrivial-grpdrchnfelt)
    - [`IsTrivial(psi): GrpHeckeElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-istrivial-grpheckeelt)
    - [`IsTrivialOnUnits(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-istrivialonunits-grpdrchnfelt)
    - [`IsOdd(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-isodd-grpdrchnfelt)
    - [`IsEven(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-iseven-grpdrchnfelt)
    - [`IsTotallyEven(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-istotallyeven-grpdrchnfelt)
    - [`IsPrimitive(chi): GrpDrchNFElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-isprimitive-grpdrchnfelt)
    - [`IsPrimitive(psi): GrpHeckeElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-isprimitive-grpheckeelt)
  - [Passing between Dirichlet and Hecke Characters](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#passing-between-dirichlet-and-hecke-characters)
    - [`HeckeLift(chi): GrpDrchNFElt → GrpHeckeElt, GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckelift-grpdrchnfelt)
    - [`DirichletRestriction(psi): GrpHeckeElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletrestriction-grpheckeelt)
    - [`NormInduction(K, chi): FldNum, GrpDrchElt → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-norminduction-fldnum-grpdrchelt)
    - [`QuadraticCharacter(e): FldNumElt → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-quadraticcharacter-fldnumelt)
    - [Example: Dirichlet Characters over the Rationals](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-853a78)
    - [Example: Basic Character Operations](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-b4977b)
    - [`DirichletCharacter(I, B): RngOrdIdl, Tup → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-rngordidl-tup)
    - [`DirichletCharacter(I, oo, B): RngOrdIdl, SeqEnum, Tup → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-rngordidl-seqenum-tup)
    - [`DirichletCharacter(G, B): GrpDrchNF, Tup → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-grpdrchnf-tup)
    - [`DirichletCharacter(I, L): RngOrdIdl, List → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-rngordidl-list)
    - [`DirichletCharacter(I, oo, L): RngOrdIdl, SeqEnum, List → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-rngordidl-seqenum-list)
    - [`DirichletCharacter(G, L): GrpDrchNF, List → GrpDrchNFElt, GrpDrchNF`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacter-grpdrchnf-list)
    - [`HeckeCharacter(I, B): RngOrdIdl, Tup → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-rngordidl-tup)
    - [`HeckeCharacter(I, oo, B): RngOrdIdl, SeqEnum, Tup → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-rngordidl-seqenum-tup)
    - [`HeckeCharacter(G, B): GrpHecke, Tup → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-grphecke-tup)
    - [`HeckeCharacter(I, L): RngOrdIdl, List → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-rngordidl-list)
    - [`HeckeCharacter(I, oo, L): RngOrdIdl, SeqEnum, List → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-rngordidl-seqenum-list)
    - [`HeckeCharacter(G, L): GrpHecke, List → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-heckecharacter-grphecke-list)
    - [Example: Dirichlet Character with Prescribed Values](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-80bd7f)
    - [`CentralCharacter(chi): GrpDrchNFElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-centralcharacter-grpdrchnfelt)
    - [`CentralCharacter(psi): GrpHeckeElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-centralcharacter-grpheckeelt)
    - [Example: Central Character of a Dirichlet Character](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-3ed3f9)
    - [`DirichletCharacterOverNF(chi): GrpDrchElt → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacterovernf-grpdrchelt)
    - [`DirichletCharacterOverQ(chi): GrpDrchNFElt → GrpDrchElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-dirichletcharacteroverq-grpdrchnfelt)
    - [Example: Dirichlet Characters over Q and Number Fields](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-5e238b)
  - [L-functions of Hecke Characters](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#l-functions-of-hecke-characters)
    - [Example: L-Function of a Hecke Character](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-d505ea)
  - [Hecke Grössencharacters and their L-functions](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#hecke-grossencharacters-and-their-l-functions)
    - [`Grossencharacter(psi, chi, T): GrpHeckeElt, GrpDrchNFElt, SeqEnum → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-grossencharacter-grpheckeelt-grpdrchnfelt-seqenum)
    - [`RawEval(I, GR): RngOrdFracIdl, GrossenChar → FldNumElt, FldCycElt, FldCycElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-raweval-rngordfracidl-grossenchar)
    - [`Grossencharacter(psi, T): GrpHeckeElt, SeqEnum → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-grossencharacter-grpheckeelt-seqenum)
    - [`Conductor(GR): GrossenChar → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-conductor-grossenchar)
    - [`Modulus(GR): GrossenChar → RngOrdIdl, SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-modulus-grossenchar)
    - [`IsPrimitive(GR): GrossenChar → BoolElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-isprimitive-grossenchar)
    - [`AssociatedPrimitiveGrossencharacter(psi): GrossenChar → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-associatedprimitivegrossencharacter-grossenchar)
    - [`Components(GR): GrossenChar → Assoc`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-components-grossenchar)
    - [`Component(GR, P): GrossenChar, RngOrdIdl → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grossenchar-rngordidl)
    - [`Component(GR, oo): GrossenChar, RngIntElt → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grossenchar-rngintelt)
    - [`Component(GR, P): GrossenChar, PlcNumElt → GrpDrchNFEl`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-component-grossenchar-plcnumelt)
    - [`Extend(GR, I): GrossenChar, RngOrdIdl → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-extend-grossenchar-rngordidl)
    - [`Restrict(GR, I): GrossenChar, RngOrdIdl → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-restrict-grossenchar-rngordidl)
    - [`CentralCharacter(GR): GrossenChar → GrpDrchNFElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-centralcharacter-grossenchar)
    - [`GrossenTwist(GR, D): GrossenChar, List → GrossenChar, GrpHecke`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-grossentwist-grossenchar-list)
    - [`TateTwist(GR, n): GrossenChar, RngIntElt → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-tatetwist-grossenchar-rngintelt)
    - [`TateTwist(psi, n): GrpHeckeElt, RngIntElt → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-tatetwist-grpheckeelt-rngintelt)
    - [Example: Grossencharacters on the Gaussian Field](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-42864c)
    - [Example: Canonical Grossencharacter of Q(sqrt(-23))](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-b4291f)
    - [Example: Grossencharacter with Vanishing Central Value](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-7d182f)
    - [Example: Grossencharacter Central Value and Gamma Periods](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-38ad25)
    - [Example: Twisting a Grossencharacter by a Hilbert Character](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-a39eeb)
    - [Example: Grossencharacters of Trivial Conductor](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-03fd6d)
    - [Example: Grossencharacter on the Eighth Cyclotomic Field](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-105c44)
    - [Example: Grossencharacter from a Hypergeometric Motive](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-d12cc1)
  - [Local Root Numbers](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#local-root-numbers)
    - [`RootNumber(GR, P): GrossenChar, RngOrgIdl → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grossenchar-rngorgidl)
    - [`RootNumber(psi, P): GrpHeckeElt, RngOrgIdl → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grpheckeelt-rngorgidl)
    - [`RootNumber(GR, P): GrossenChar, PlcNumElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grossenchar-plcnumelt)
    - [`RootNumber(psi, P): GrpHeckeElt, PlcNumElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grpheckeelt-plcnumelt)
    - [`RootNumber(GR, p): GrossenChar, RngIntElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grossenchar-rngintelt)
    - [`RootNumber(psi, p): GrpHeckeElt, RngIntElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grpheckeelt-rngintelt)
    - [`RootNumbers(GR): GrossenChar → SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumbers-grossenchar)
    - [`RootNumbers(psi): GrossenChar → SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumbers-grossenchar-2)
    - [`RootNumber(GR): GrossenChar → SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grossenchar)
    - [`RootNumber(psi): GrossenChar → SeqEnum`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-rootnumber-grossenchar-2)
    - [Example: Local Root Numbers for Curve 27a](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-a7b80a)
    - [Example: Rohrlich's Root Number Exercise](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-f91aec)
  - [Grössencharacters and Elliptic Curves](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#grossencharacters-and-elliptic-curves)
    - [`Grossencharacter(E): CrvEll → GrossenChar`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-grossencharacter-crvell)
    - [`EllipticCurve(GR): GrossenChar → CrvEll`](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#function-ellipticcurve-grossenchar)
    - [Example: Grossencharacters of CM Elliptic Curves](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/introduction.md#example-ex-e6dfed)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/DirichletAndHeckeCharacters/bibliography.md)

### Introduction

This chapter presents the facilities provided in Magma for Dirichlet and Hecke characters, currently implemented over number fields. For Dirichlet characters over the rationals (as `FldRat`), see Section [Dirichlet Characters](https://docs.magma-maths.org/BasicRings/ResidueClassRings/dirichlet-characters.md#rngint-dirichlet).

The principal constructors are `DirichletGroup` whose elements are functions on number field elements, and `HeckeCharacterGroup` whose elements are functions on ideals. The former is the dual of the `RayResidueRing` of an ideal, and the latter is the dual of the `RayClassGroup` of an ideal (see Chapter [Class Field Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/index-class-field-theory.md#fldab-main)).

Arithmetic on groups can be done multiplicatively, and the characters can be evaluated at suitable field elements and ideals. The `sub` constructor, along with `+` and `meet` for subgroups on the same modulus, should also work.

The associated types are `GrpDrchNF` and `GrpDrchNFElt`, `GrpHecke` and `GrpHeckeElt`. The number field must be an absolute extension of the rationals.

#### Creation Functions

<a id="function-dirichletgroup-rngordidl"></a>
##### `DirichletGroup(I): RngOrdIdl -> GrpDrchNF`

<a id="function-dirichletgroup-rngordidl-seqenum"></a>
##### `DirichletGroup(I, oo): RngOrdIdl, SeqEnum -> GrpDrchNF`

Given an ideal $I$ of the integer ring of the number field $K$ and a set of real places of $K$, the intrinsic `DirichletGroup` will return the dual group to the `RayResidueRing` of the specified information.

<a id="function-heckecharactergroup-rngordidl"></a>
##### `HeckeCharacterGroup(I): RngOrdIdl -> GrpHecke`

<a id="function-heckecharactergroup-rngordidl-seqenum"></a>
##### `HeckeCharacterGroup(I, oo): RngOrdIdl, SeqEnum -> GrpHecke`

Given an ideal $I$ of the integer ring of the number field $K$ and a set of real places of $K$, the intrinsic `HeckeCharacterGroup` will return the dual group to the `RayClassGroup` of the specified information.

<a id="function-unittrivialsubgroup-grpdrchnf"></a>
##### `UnitTrivialSubgroup(G): GrpDrchNF -> GrpDrchNF`

Given a group of Dirichlet characters, return the subgroup that is trivial on the image of the field units in the residue ring.

<a id="function-totallyunittrivialsubgroup-grpdrchnf"></a>
##### `TotallyUnitTrivialSubgroup(G): GrpDrchNF -> GrpDrchNF`

Given a group of Dirichlet characters, return the subgroup that is totally trivial on the image of the field units in the residue ring. That is, it is trivial at each place individually.

<a id="function-hilbertcharactersubgroup-grphecke"></a>
##### `HilbertCharacterSubgroup(G): GrpHecke -> GrpHecke`

Given a group of Hecke characters, return the subgroup corresponding to the class group (those with trivial conductor).

#### Functions on Groups and Group Elements

<a id="function-modulus-grpdrchnf"></a>
##### `Modulus(G): GrpDrchNF -> RngOrdIdl, SeqEnum`

<a id="function-modulus-grphecke"></a>
##### `Modulus(G): GrpHecke -> RngOrdIdl, SeqEnum`

<a id="function-modulus-grpdrchnfelt"></a>
##### `Modulus(chi): GrpDrchNFElt -> RngOrdIdl, SeqEnum`

<a id="function-modulus-grpheckeelt"></a>
##### `Modulus(chi): GrpHeckeElt -> RngOrdIdl, SeqEnum`

Returns the modulus ideal and a (possibly empty) sequence of real places.

<a id="function-order-grpdrchnfelt"></a>
##### `Order(chi): GrpDrchNFElt -> RngIntElt`

<a id="function-order-grpheckeelt"></a>
##### `Order(psi): GrpHeckeElt -> RngIntElt`

Returns the order of a Dirichlet or Hecke character.

<a id="function-random-grpdrchnf"></a>
##### `Random(G): GrpDrchNF -> GrpDrchNFElt`

<a id="function-random-grphecke"></a>
##### `Random(G): GrpHecke -> GrpHeckeElt`

Returns a random element of a Dirichlet or Hecke group.

<a id="function-domain-grpdrchnf"></a>
##### `Domain(G): GrpDrchNF -> FldNum`

<a id="function-domain-grpdrchnfelt"></a>
##### `Domain(G): GrpDrchNFElt -> FldNum`

Returns the number field that is the domain for the Dirichlet character.

<a id="function-domain-grphecke"></a>
##### `Domain(G): GrpHecke -> PowIdl`

<a id="function-domain-grpheckeelt"></a>
##### `Domain(G): GrpHeckeElt -> PowIdl`

Returns the set of ideals that is the domain for the Hecke character.

<a id="function-decomposition-grpdrchnfelt"></a>
##### `Decomposition(chi): GrpDrchNFElt -> List`

Returns a list of characters of prime power modulus (and real places) whose product (after extension to the original `DirichletGroup`) is the given Dirichlet character.

<a id="function-components-grpdrchnfelt"></a>
##### `Components(chi): GrpDrchNFElt -> Assoc`

<a id="function-components-grpheckeelt"></a>
##### `Components(psi): GrpHeckeElt -> Assoc`

Given a Hecke or Dirichlet character, return its components as an associative array of Dirichlet characters indexed by bad places. For a Hecke character, this is the decomposition of its `DirichletRestriction`. Note that the character need not be primitive.

<a id="function-component-grpdrchnfelt-rngordidl"></a>
##### `Component(chi, P): GrpDrchNFElt, RngOrdIdl -> GrpDrchNFEl`

<a id="function-component-grpheckeelt-rngordidl"></a>
##### `Component(psi, P): GrpHeckeElt, RngOrdIdl -> GrpDrchNFElt`

<a id="function-component-grpdrchnfelt-rngintelt"></a>
##### `Component(chi, oo): GrpDrchNFElt, RngIntElt -> GrpDrchNFEl`

<a id="function-component-grpheckeelt-rngintelt"></a>
##### `Component(psi, oo): GrpHeckeElt, RngIntElt -> GrpDrchNFElt`

<a id="function-component-grpdrchnfelt-plcnumelt"></a>
##### `Component(chi, P): GrpDrchNFElt, PlcNumElt -> GrpDrchNFEl`

<a id="function-component-grpheckeelt-plcnumelt"></a>
##### `Component(psi, P): GrpHeckeElt, PlcNumElt -> GrpDrchNFElt`

Given a Dirichlet or Hecke character and a prime ideal or place (possibly specified by an integer for an infinite place), return the corresponding Dirichlet character component. For a place that it is not ramified, the trivial character of the integer ring is returned.

<a id="function-conductor-grpdrchnfelt"></a>
##### `Conductor(chi): GrpDrchNFElt -> RngOrdIdl, SeqEnum`

<a id="function-conductor-grpheckeelt"></a>
##### `Conductor(psi): GrpHeckeElt -> RngOrdIdl, SeqEnum`

The product of the moduli of the all nontrivial characters in the decomposition of the given Dirichlet character, given as an ideal and a set of real places. Similarly with Hecke characters, where, in fact, one takes the `DirichletRestriction` of the Hecke character, and decomposes this.

<a id="function-associatedprimitivecharacter-grpdrchnfelt"></a>
##### `AssociatedPrimitiveCharacter(chi): GrpDrchNFElt -> GrpDrchNFElt`

<a id="function-associatedprimitivecharacter-grpheckeelt"></a>
##### `AssociatedPrimitiveCharacter(psi): GrpHeckeElt -> GrpHeckeElt`

The primitive Dirichlet character associated to the one that is given, which can be obtained by multiplying all the nontrivial characters in the decomposition. Similarly with Hecke characters, for which this decomposes the `DirichletRestriction` to finds its underlying primitive part, and then takes the `HeckeLift` of this.

<a id="function-restrict-grpdrchnfelt-grpdrchnf"></a>
##### `Restrict(chi, D): GrpDrchNFElt, GrpDrchNF -> GrpDrchNFElt`

<a id="function-restrict-grpheckeelt-grphecke"></a>
##### `Restrict(psi, H): GrpHeckeElt, GrpHecke -> GrpHeckeElt`

<a id="function-restrict-grpdrchnfelt-rngordidl"></a>
##### `Restrict(chi, I): GrpDrchNFElt, RngOrdIdl -> GrpDrchNFElt`

<a id="function-restrict-grpheckeelt-rngordidl"></a>
##### `Restrict(psi, I): GrpHeckeElt, RngOrdIdl -> GrpHeckeElt`

<a id="function-restrict-grpdrchnfelt-rngordidl-seqenum"></a>
##### `Restrict(chi, I, oo): GrpDrchNFElt, RngOrdIdl, SeqEnum -> GrpDrchNFElt`

<a id="function-restrict-grpheckeelt-rngordidl-seqenum"></a>
##### `Restrict(psi, I, oo): GrpHeckeElt, RngOrdIdl, SeqEnum -> GrpHeckeElt`

<a id="function-restrict-grpdrchnf-grpdrchnf"></a>
##### `Restrict(G, D): GrpDrchNF, GrpDrchNF -> GrpDrchNF`

<a id="function-restrict-grphecke-grphecke"></a>
##### `Restrict(G, H): GrpHecke, GrpHecke -> GrpHecke`

<a id="function-restrict-grpdrchnf-rngordidl"></a>
##### `Restrict(G, I): GrpDrchNF, RngOrdIdl -> GrpDrchNF`

<a id="function-restrict-grphecke-rngordidl"></a>
##### `Restrict(G, I): GrpHecke, RngOrdIdl -> GrpHecke`

<a id="function-restrict-grpdrchnf-rngordidl-seqenum"></a>
##### `Restrict(G, I, oo): GrpDrchNF, RngOrdIdl, SeqEnum -> GrpDrchNF`

<a id="function-restrict-grphecke-rngordidl-seqenum"></a>
##### `Restrict(G, I, oo): GrpHecke, RngOrdIdl, SeqEnum -> GrpHecke`

Given a Dirichlet character modulo an ideal $I$ and a Dirichlet character group modulo $J$ for which $I\subseteq J$ (including behavior at real places when specified) with the character trivial on $(J/I)^\star$, this returns the restricted character on $J$. Similarly with Hecke characters, and with an ideal (with possible real places) at the second argument. Also with a group of characters as the first argument.

<a id="function-targetrestriction-grpdrchnf-fldcyc"></a>
##### `TargetRestriction(G, C): GrpDrchNF, FldCyc -> GrpDrchNF`

<a id="function-targetrestriction-grphecke-fldcyc"></a>
##### `TargetRestriction(H, C): GrpHecke, FldCyc -> GrpDrchNF`

Given a group of Dirichlet or Hecke characters and a cyclotomic field, return the subgroup of characters whose image is contained in the cyclotomic field.

<a id="procedure-settargetring-grpdrchnfelt-rngelt-ref"></a>
##### `SetTargetRing(~ chi, e): GrpDrchNFElt, RngElt`

<a id="procedure-settargetring-grpheckeelt-rngelt-ref"></a>
##### `SetTargetRing(~ psi, e): GrpHeckeElt, RngElt`

Given a Dirichlet or Hecke character and a suitable root of unity, modify the character to take values according to this root of unity. The ring element must be a root of unity, and its order must be a multiple of the order of the character. Writing $m={\rm ord}(\chi)$, if the character previously had $\chi(u)=\zeta_m^v$, it will now have $\chi(u)=(e^q)^v$ where $q$ is ${\rm ord}(e)/m$.

<a id="function-extend-grpdrchnfelt-grpdrchnf"></a>
##### `Extend(chi, D): GrpDrchNFElt, GrpDrchNF -> GrpDrchNFElt`

<a id="function-extend-grpheckeelt-grphecke"></a>
##### `Extend(psi, H): GrpHeckeElt, GrpHecke -> GrpHeckeElt`

<a id="function-extend-grpdrchnfelt-rngordidl"></a>
##### `Extend(chi, I): GrpDrchNFElt, RngOrdIdl -> GrpDrchNFElt`

<a id="function-extend-grpheckeelt-rngordidl"></a>
##### `Extend(psi, I): GrpHeckeElt, RngOrdIdl -> GrpHeckeElt`

<a id="function-extend-grpdrchnfelt-rngordidl-seqenum"></a>
##### `Extend(chi, I, oo): GrpDrchNFElt, RngOrdIdl, SeqEnum -> GrpDrchNFElt`

<a id="function-extend-grpheckeelt-rngordidl-seqenum"></a>
##### `Extend(psi, I, oo): GrpHeckeElt, RngOrdIdl, SeqEnum -> GrpHeckeElt`

<a id="function-extend-grpdrchnf-grpdrchnf"></a>
##### `Extend(G, D): GrpDrchNF, GrpDrchNF -> GrpDrchNF`

<a id="function-extend-grphecke-grphecke"></a>
##### `Extend(G, H): GrpHecke, GrpHecke -> GrpHecke`

<a id="function-extend-grpdrchnf-rngordidl"></a>
##### `Extend(G, I): GrpDrchNF, RngOrdIdl -> GrpDrchNF`

<a id="function-extend-grphecke-rngordidl"></a>
##### `Extend(G, I): GrpHecke, RngOrdIdl -> GrpHecke`

<a id="function-extend-grpdrchnf-rngordidl-seqenum"></a>
##### `Extend(G, I, oo): GrpDrchNF, RngOrdIdl, SeqEnum -> GrpDrchNF`

<a id="function-extend-grphecke-rngordidl-seqenum"></a>
##### `Extend(G, I, oo): GrpHecke, RngOrdIdl, SeqEnum -> GrpHecke`

Given a Dirichlet character modulo $I$ and a Dirichlet character group modulo $J$ for which $J\subseteq I$ (again possibly including the real places), this function returns the induced character on $J$, that is, the one that is trivial on $(I/J)^\star$. Similarly with Hecke characters, and with an ideal (with possible real places) at the second argument. Also with a group of characters as the first argument.

#### Predicates on Group Elements

<a id="function-istrivial-grpdrchnfelt"></a>
##### `IsTrivial(chi): GrpDrchNFElt -> BoolElt`

<a id="function-istrivial-grpheckeelt"></a>
##### `IsTrivial(psi): GrpHeckeElt -> BoolElt`

Returns whether the given character corresponds to the trivial element in the character group.

<a id="function-istrivialonunits-grpdrchnfelt"></a>
##### `IsTrivialOnUnits(chi): GrpDrchNFElt -> BoolElt`

Returns whether a Dirichlet character is trivial on the units of the number field; this determines whether the character can lift to a Hecke character on the ideals.

<a id="function-isodd-grpdrchnfelt"></a>
##### `IsOdd(chi): GrpDrchNFElt -> BoolElt`

Returns whether a Dirichlet character $\chi$ has $\chi(-1)=-1$.

<a id="function-iseven-grpdrchnfelt"></a>
##### `IsEven(chi): GrpDrchNFElt -> BoolElt`

Returns whether a Dirichlet character $\chi$ has $\chi(-1)=+1$.

<a id="function-istotallyeven-grpdrchnfelt"></a>
##### `IsTotallyEven(chi): GrpDrchNFElt -> BoolElt`

Returns whether a Dirichlet character $\chi$ has $\chi_p(-1)=+1$ for each $\chi_p$ in its decomposition.

<a id="function-isprimitive-grpdrchnfelt"></a>
##### `IsPrimitive(chi): GrpDrchNFElt -> BoolElt`

<a id="function-isprimitive-grpheckeelt"></a>
##### `IsPrimitive(psi): GrpHeckeElt -> BoolElt`

Returns whether a Dirichlet character is primitive, that is, whether its conductor and modulus are equal.

#### Passing between Dirichlet and Hecke Characters

<a id="function-heckelift-grpdrchnfelt"></a>
##### `HeckeLift(chi): GrpDrchNFElt -> GrpHeckeElt, GrpHecke`

Given a Dirichlet character that is trivial on the units of the number field, this functions returns a Hecke character that extends its domain to all the ideals of the integer ring. Also returns a kernel, so as to span the set of all possible lifts.

<a id="function-dirichletrestriction-grpheckeelt"></a>
##### `DirichletRestriction(psi): GrpHeckeElt -> GrpDrchNFElt`

Given a Hecke character on the ideals of the integer ring of a number field, this function returns the Dirichlet restriction of it on the field elements.

<a id="function-norminduction-fldnum-grpdrchelt"></a>
##### `NormInduction(K, chi): FldNum, GrpDrchElt -> GrpHeckeElt`

Given a Dirichlet character $\chi$ over the rationals (as `FldRat`) induce it to a Hecke character over the number field $K$. That is, find $\psi$ with $\psi(a)=\chi({\rm N}a)$ with $\psi$ primitive.

<a id="function-quadraticcharacter-fldnumelt"></a>
##### `QuadraticCharacter(e): FldNumElt -> GrpHeckeElt`

Given a nonzero field element $e$ over an absolute number field, return the associated quadratic Hecke character (which will be trivial when $e$ is a square).

<a id="example-ex-853a78"></a>
##### `Example: Dirichlet Characters over the Rationals (ex-853a78)`

This example tries to codify the terminology via a standard example with Dirichlet characters over the rationals. We construct various characters modulo 5.

```magma
> Q := NumberField(Polynomial([-1, 1]) : DoLinearExtension);
> O := IntegerRing(Q);
> I := 5*O;
> DirichletGroup(I);
Abelian Group isomorphic to Z/4
Group of Dirichlet characters of modulus of norm 5 mapping to
 Cyclotomic Field of order 4 and degree 2
```

The above group is the Dirichlet characters modulo 5. However, the odd characters are not characters on ideals, as they are nontrivial on the units. To pass to the Hecke characters, we need to enlarge the modulus to consider embeddings at the real place. Note that this will give four more characters, corresponding to multiplying the above by the character that has $\chi$ as $+1$ on positive elements and $-1$ on negative elements; such characters will not be periodic in the traditional sense of Dirichlet characters, but are still completely multiplicative.

```magma
> D := DirichletGroup(I, [1]); D; // include first real place
Abelian Group isomorphic to Z/2 + Z/4
Group of Dirichlet characters D of modulus of norm 5 and infinite
places [ 1 ] mapping to Cyclotomic Field of order 4 and degree 2
> [ IsTrivialOnUnits(x) : x in Elements(D) ];
[ true, false, false, true, true, false, false, true ]
> HeckeLift(D.1); // non-trivial on units
Runtime error in 'HeckeLift': Character is nontrivial on the units
> hl := HeckeLift(D.1 * D.2);
> hl(2);
zeta_4
> hl(2) eq (D.1 * D.2)(2);
true
```

So only half of the 8 completely multiplicative characters on field elements lift to characters on ideals, and these correspond exactly the standard four Dirichlet characters modulo 5, though evinced in a different guise. In terms of class field theory, this can viewed as saying that the global Artin map relates $-1$ to complex conjugation.

<a id="example-ex-b4977b"></a>
##### `Example: Basic Character Operations (ex-b4977b)`

This example gives some basic character operations.

```magma
> K := QuadraticField(-23);
> p3 := Factorization(3*Integers(K))[1][1];
> G1 := HeckeCharacterGroup(p3^1);
> G2 := HeckeCharacterGroup(p3^2);
> G3 := HeckeCharacterGroup(p3^3);
> assert Extend(G1.1,G3) eq G3.1^9;
> assert Restrict(G2.1^3,G1) eq G1.1;
> assert Extend(G1.1,p3^3) eq Extend(G2.1^3,p3^3);
> assert Restrict(Restrict(G3.1^3,p3^2)^3,p3) eq G1.1;
> assert G1 eq HilbertCharacterSubgroup(G1);
> assert Restrict(HilbertCharacterSubgroup(G2),G1) eq G1;
> assert Restrict(sub<G2|[G2.1^3]>,p3) eq G1;
> assert Extend(G2,G3) eq sub<G3|[G3.1^3]>;
> assert Extend(G1,p3^2) eq Restrict(sub<G3|[G3.1^9]>,G2);
```

```magma
> chi := KroneckerCharacter(-7);
> K := QuadraticField(5);
> theta := NormInduction(K,chi);
> Type(theta);
GrpHeckeElt
> Modulus(theta); assert IsPrimitive(theta);
Principal Prime Ideal, Generator: 7
[ 1, 2 ] // places at infinity
> cbrt := Parent(theta).1;
> assert cbrt^3 eq theta; // Order(cbrt) is 6
> SetTargetRing(~cbrt,GF(13)!2); // choice of gen
> cbrt(K.1); // now an element of GF(13)
10
> DirichletRestriction(cbrt)(K.1);
-zeta_6 + 1
```

<a id="function-dirichletcharacter-rngordidl-tup"></a>
##### `DirichletCharacter(I, B): RngOrdIdl, Tup -> GrpDrchNFElt, GrpDrchNF`

<a id="function-dirichletcharacter-rngordidl-seqenum-tup"></a>
##### `DirichletCharacter(I, oo, B): RngOrdIdl, SeqEnum, Tup -> GrpDrchNFElt, GrpDrchNF`

<a id="function-dirichletcharacter-grpdrchnf-tup"></a>
##### `DirichletCharacter(G, B): GrpDrchNF, Tup -> GrpDrchNFElt, GrpDrchNF`

<a id="function-dirichletcharacter-rngordidl-list"></a>
##### `DirichletCharacter(I, L): RngOrdIdl, List -> GrpDrchNFElt, GrpDrchNF`

<a id="function-dirichletcharacter-rngordidl-seqenum-list"></a>
##### `DirichletCharacter(I, oo, L): RngOrdIdl, SeqEnum, List -> GrpDrchNFElt, GrpDrchNF`

<a id="function-dirichletcharacter-grpdrchnf-list"></a>
##### `DirichletCharacter(G, L): GrpDrchNF, List -> GrpDrchNFElt, GrpDrchNF`

<a id="function-heckecharacter-rngordidl-tup"></a>
##### `HeckeCharacter(I, B): RngOrdIdl, Tup -> GrpHeckeElt`

<a id="function-heckecharacter-rngordidl-seqenum-tup"></a>
##### `HeckeCharacter(I, oo, B): RngOrdIdl, SeqEnum, Tup -> GrpHeckeElt`

<a id="function-heckecharacter-grphecke-tup"></a>
##### `HeckeCharacter(G, B): GrpHecke, Tup -> GrpHeckeElt`

<a id="function-heckecharacter-rngordidl-list"></a>
##### `HeckeCharacter(I, L): RngOrdIdl, List -> GrpHeckeElt`

<a id="function-heckecharacter-rngordidl-seqenum-list"></a>
##### `HeckeCharacter(I, oo, L): RngOrdIdl, SeqEnum, List -> GrpHeckeElt`

<a id="function-heckecharacter-grphecke-list"></a>
##### `HeckeCharacter(G, L): GrpHecke, List -> GrpHeckeElt`

```magma
RequireGenerators: BoolElt                    Default: true
```

Given either an ideal (and also possibly a set of real infinite places) or a `DirichletGroup`, and a list/tuple of 2-tuples each containing a field element and a element of `Integers(m)` for some $m$, construct a Dirichlet character that sends each field element to the cyclotomic unit corresponding to the residue element. The second member of each 2-tuple can alternatively be a torsion element of some cyclotomic field.

The parameter `RequireGenerators` demands that the given field elements should generate the `RayResidueRing` of the ideal. The second return argument is a subgroup of the ambient `DirichletGroup` by which the returned character can be translated and still retain the same values on the given elements.

Similarly for `HeckeCharacter` – there the first element in each 2-tuple can now be an ideal of the field, and `RequireGenerators` demands that these generate the `RayClassGroup` of the ideal.

<a id="example-ex-80bd7f"></a>
##### `Example: Dirichlet Character with Prescribed Values (ex-80bd7f)`

We define a character on $5 O_K$ that sends $\sqrt{-23}$ to $\zeta_8^2$ (note that $\sqrt{-23}$ has order 8 in the `RayResidueRing` to this modulus).

```magma
> K := QuadraticField(-23);
> I := 5*IntegerRing(K);
> chi, SG := DirichletCharacter
>           (I, <<K.1, Integers(8)!2>> : RequireGenerators := false);
> chi(K.1);
zeta_4
> (SG.1 * chi)(K.1);
zeta_4
```

And then we define one that sends $\sqrt{-23}$ to $\zeta_8^6$ and $(3+2\sqrt{-23})$, an element of order 6 in the `RayResidueRing`, to $\zeta_{24}^8$.

```magma
> data := <<K.1, Integers(8)!6>, <3+2*K.1,Integers(24)!8>>;
> chi, SG := DirichletCharacter(I, data);
> chi(K.1);
-zeta_4
> chi(3+2*K.1);
zeta_3
> #SG; // this subgroup SG is trivial, as the data determine chi
1
```

Note that we can replace the Integers(8)!6 in the first tuple by $\zeta_8^6$.

```magma
> C<zeta8> := CyclotomicField(8);
> data2 := <<K.1, zeta8^6>, <3+2*K.1,Integers(24)!8>>;
> chi2 := DirichletCharacter(I, data2);
> chi eq chi2;
true
```

Now we give a example with Hecke characters over a cubic field. We also note that the evaluation of a character (either Dirichlet or Hecke) can be obtained in “raw” form as an element in a residue ring via the use of the `Raw` parameter.

```magma
> _<x> := PolynomialRing(Integers());
> K<s> := NumberField(x^3-x^2+7*x-6); // #ClassGroup(K) is 5
> I := Factorization(11*IntegerRing(K))[2][1]; // norm 121
> HG := HeckeCharacterGroup(I,[1]); // has 20 elements
> f3 := Factorization(3*IntegerRing(K))[1][1]; // order 10
> data := < <f3, Integers(10)!7> >;
> psi := HeckeCharacter(HG, data : RequireGenerators := false);
> psi(f3);
-zeta_10^2
> psi(f3) eq CyclotomicField(10).1^7;
true
> '@'(f3,psi : Raw); // get Raw form of evaluation
14
> Parent($1);
Residue class ring of integers modulo 20
> f113 := Factorization(113*IntegerRing(K))[1][1]; // order 4
> data2 := < <f113, Integers(4)!3> >;
> psi := HeckeCharacter(HG, <data[1], data2[1]>);
> psi(f113);
-zeta_4
```

<a id="function-centralcharacter-grpdrchnfelt"></a>
##### `CentralCharacter(chi): GrpDrchNFElt -> GrpDrchNFElt`

<a id="function-centralcharacter-grpheckeelt"></a>
##### `CentralCharacter(psi): GrpHeckeElt -> GrpDrchNFElt`

Given a Dirichlet or Hecke character, compute its central character down to the rationals. This is defined by computing a Dirichlet character that is defined over ${\mathbb{Q}}$ and agrees with the given character on a set of generators of the residue ring of the norm of the modulus of the given character. The `AssociatedPrimitiveCharacter` of this is then returned. It should have the same value as the original character on all unramified primes (at least). Note that the central character will always be a Dirichlet character, as the class number of the rationals is 1.

<a id="example-ex-3ed3f9"></a>
##### `Example: Central Character of a Dirichlet Character (ex-3ed3f9)`

```magma
> K := NumberField(Polynomial([4,3,-1,1])); // x^3-x^2+3*x+4
> f7 := Factorization(7*Integers(K))[1][1];
> G:= DirichletGroup(f7^2,[1]);
> chi := G.1*G.2*G.3;
> cc := CentralCharacter(chi); Conductor(cc);
Principal Ideal, Generator: [49] // conductor 49
[ 1 ] // infinite place
> cc := CentralCharacter(chi^14); Conductor(cc);
Principal Ideal, Generator: [7] // conductor 7
[ ] // no infinite places
> ////////////////
> K := NumberField(Polynomial([-10,-9,-10,1]));
> #ClassGroup(K); // C7 class group
7
> f5 := Factorization(5*Integers(K))[1][1];
> H := HeckeCharacterGroup(f5,[1]);
> cc:=CentralCharacter(H.1); Conductor(cc);
Principal Prime Ideal, Generator: [5] // conductor 5
[ 1 ] // infinite place
> Order(H.1), Order(cc);
28 4
> IsTrivial(CentralCharacter(H.1^4));
true
```

<a id="function-dirichletcharacterovernf-grpdrchelt"></a>
##### `DirichletCharacterOverNF(chi): GrpDrchElt -> GrpDrchNFElt`

<a id="function-dirichletcharacteroverq-grpdrchnfelt"></a>
##### `DirichletCharacterOverQ(chi): GrpDrchNFElt -> GrpDrchElt`

These are utility functions to pass between the two types of Dirichlet character over ${\mathbb{Q}}$ in Magma. The first takes a Dirichlet character over the `Rationals()` and returns one over the rationals as a number field (or more precisely over the first cyclotomic field, which unlike `QNF()` is unique in Magma), and the second reverses this.

<a id="example-ex-5e238b"></a>
##### `Example: Dirichlet Characters over Q and Number Fields (ex-5e238b)`

```magma
> G := DirichletGroup(16*3^2*5^2*7*11, CyclotomicField(2^6*3*5));
> #G;
57600
> repeat chi := Random(G); until Order(chi) eq 30;
> psi := DirichletCharacterOverNF(chi);
> Order(psi);
30
> #Parent(psi)`ambient;
57600
> &and[chi(p) eq psi(p) : p in PrimesUpTo(1000)];
true
> DirichletCharacterOverQ(psi) eq chi;
true
```

#### L-functions of Hecke Characters

Given a primitive Hecke character $\psi$, one can define the associated $L$-function as

$$
L(\psi,s)=\prod_{{\mathfrak{p}}} \bigl(1-\psi({\mathfrak{p}})/{{\mathbb{N}}}{\mathfrak{p}}^s\bigr)^{-1},
$$

and this satisfies a functional equation whose conductor is the product of the conductor of $\psi$ and the discriminant of (the integer ring) of the number field for $\psi$.

<a id="example-ex-d505ea"></a>
##### `Example: L-Function of a Hecke Character (ex-d505ea)`

```magma
> _<x> := PolynomialRing(Integers());
> K<s> := NumberField(x^5 - 2*x^4 + 2*x + 2);
> I2 := Factorization( 2 * IntegerRing(K) ) [1][1]; // ideal above 2
> I11 := Factorization( 11 * IntegerRing(K) ) [1][1]; // above 11
> I := I2*I11; Norm(I);
22
> H := HeckeCharacterGroup(I, [1]);
> #H;
2
> psi := H.1; IsPrimitive(psi);
false
> prim := AssociatedPrimitiveCharacter(psi); Norm(Conductor(prim));
11
> L := LSeries(prim);
> LSetPrecision(L, 10);
> LCfRequired(L); // approx with old CheckFunctionalEquation
4042
> CFENew(L);
-3.492459655E-10
```

<a id="hecke-grossencharacters-and-their-l-functions"></a>
<a id="gross"></a>
<a id="char-characters"></a>
#### Hecke Grössencharacters and their L-functions

Computations with Grössencharacters and their L-functions can now be done in Magma. These are “quasi-characters” in that their image is not restricted to the unit circle (and $0$). The implementation in Magma handles the “algebraic” characters of this sort, that is, those of type $A_0$; it also requires that the field of definition be a CM-field (an imaginary quadratic extension of a totally real field). The methods used are described in [[Wat11](https://docs.magma-maths.org/references.md#cite-watkinsgrossen)].

The natural definition of Grössencharacters would be on a coset of the dual group of the `RayResidueRing` extended by the `ClassGroup`, without any modding out by units (which gives the `RayClassGroup`). However, the Magma implementation uses a Hecke character combined with an auxiliary Dirichlet character to simulate this. Arithmetic with Grössencharacters is also possible, even though there is no underlying group structure. However, equality with Grössencharacters is not implemented (one needs to check that various class group representatives are compatible, etc.).

<a id="function-grossencharacter-grpheckeelt-grpdrchnfelt-seqenum"></a>
##### `Grossencharacter(psi, chi, T): GrpHeckeElt, GrpDrchNFElt, SeqEnum -> GrossenChar`

<a id="function-raweval-rngordfracidl-grossenchar"></a>
##### `RawEval(I, GR): RngOrdFracIdl, GrossenChar -> FldNumElt, FldCycElt, FldCycElt`

Given a Hecke character $\psi$ and a Dirichlet character $\chi$ (of the same modulus) and a compatible $\infty$-type $T$ return the associated Grössencharacter.

The $\infty$-type is a sequence of pairs of integers which correspond to embeddings, such that

$$
\psi\bigl((\alpha)\bigr)=
   \prod_{i=1}^{\#T} (\alpha^{\sigma_i})^{T[i][1]}
   (\bar\alpha^{\sigma_i})^{T[i][2]}
$$

for all $\alpha$ that are congruent to 1 modulo the modulus of $\psi$. For a Grössencharacter to exist it follows that the $\infty$-type must trivialise all (totally positive) units that are congruent to 1 modulo the modulus of $\psi$. Each pair in $T$ must have the same sum.

The Dirichlet character $\chi$ must correspond to the action on the image of the `UnitGroup` in the `RayResidueRing` of the modulus (note that [[Wat11](https://docs.magma-maths.org/references.md#cite-watkinsgrossen), §5.2] makes the reciprocal choice). In particular, for every unit $u$ we must have that

$$
\chi(u)=
   \prod_{i=1}^{\#T} (u^{\sigma_i})^{T[i][1]}(\bar u^{\sigma_i})^{T[i][2]},
$$

and since the $\infty$-type is multiplicative, we need only check this on generators of the units.

Evaluating a Grössencharacter returns a complex number, corresponding to some choice of internal embeddings. The use of `RawEval` on an ideal will return an element in an extension of the field $K$ (to which the $\infty$-type is then applied) and two elements in cyclotomic fields, corresponding to evaluations for $\chi$ and $\psi$ respectively.

For cyclotomic fields in Magma there is a specific order of the internal embeddings, while for general CM fields the user can obtain the ordering via the output of `Conjugates` or evaluating at `InfinitePlaces`.

<a id="function-grossencharacter-grpheckeelt-seqenum"></a>
##### `Grossencharacter(psi, T): GrpHeckeElt, SeqEnum -> GrossenChar`

Same as above, but Magma will try to compute a compatible Dirichlet character $\chi$ for the given data. If there is more than one possibility, an arbitrary choice could be made.

<a id="function-conductor-grossenchar"></a>
##### `Conductor(GR): GrossenChar -> RngOrdIdl, SeqEnum`

<a id="function-modulus-grossenchar"></a>
##### `Modulus(GR): GrossenChar -> RngOrdIdl, SeqEnum`

<a id="function-isprimitive-grossenchar"></a>
##### `IsPrimitive(GR): GrossenChar -> BoolElt`

<a id="function-associatedprimitivegrossencharacter-grossenchar"></a>
##### `AssociatedPrimitiveGrossencharacter(psi): GrossenChar -> GrossenChar`

The conductor of the Grössencharacter is the conductor of the quotient of the `DirichletRestriction` of the Hecke part divided by its Dirichlet part. A Grössencharacter is primitive if its modulus is the same as the conductor. When taking $L$-functions, as before the conductor is multiplied by the discriminant of the integer ring of the field.

<a id="function-components-grossenchar"></a>
##### `Components(GR): GrossenChar -> Assoc`

Given a Grössencharacter, return the components of its Hecke part divided by the reciprocal of its Dirichlet part.

<a id="function-component-grossenchar-rngordidl"></a>
##### `Component(GR, P): GrossenChar, RngOrdIdl -> GrpDrchNFEl`

<a id="function-component-grossenchar-rngintelt"></a>
##### `Component(GR, oo): GrossenChar, RngIntElt -> GrpDrchNFEl`

<a id="function-component-grossenchar-plcnumelt"></a>
##### `Component(GR, P): GrossenChar, PlcNumElt -> GrpDrchNFEl`

Given a Grössencharacter and a prime ideal or place (possibly specified by an integer for an infinite place), return the corresponding Dirichlet character component. For a place that it is not ramified, the trivial character of the integer ring is returned.

<a id="function-extend-grossenchar-rngordidl"></a>
##### `Extend(GR, I): GrossenChar, RngOrdIdl -> GrossenChar`

<a id="function-restrict-grossenchar-rngordidl"></a>
##### `Restrict(GR, I): GrossenChar, RngOrdIdl -> GrossenChar`

Extension and restriction of a Grössencharacter. Note that the second argument is an ideal, unlike the Dirichlet/Hecke cases, where it is a group of characters.

<a id="function-centralcharacter-grossenchar"></a>
##### `CentralCharacter(GR): GrossenChar -> GrpDrchNFElt`

Compute the central character (down to ${\mathbb{Q}}$) of a Grössencharacter, normalizing the result to be weight 0, and returning it as a Dirichlet character (over ${\mathbb{Q}}$ as a number field).

<a id="function-grossentwist-grossenchar-list"></a>
##### `GrossenTwist(GR, D): GrossenChar, List -> GrossenChar, GrpHecke`

```magma
Hilbert: BoolElt                    Default: false
```

Given a Grossencharacter $Y$ and a list $D$ of tuples $\langle a,r \rangle$, find a twist $\Psi$ of $Y$ (by a Hecke character of the same modulus as $Y$) such that $\Psi(a)=r$ for all data tuples. This operates by dividing the given $r$-values by the evaluations of $Y$ at the given ideals, and using `HeckeCharacter` on the resulting cyclotomic data. The intrinsic also returns a group of Hecke characters that corresponds to a kernel. The given values $r$ should be coercible into the complex numbers, and a numerical matching is made. The $a$ should be ideals or field elements. The `Hilbert` parameter restricts to twisting by characters of trivial modulus.

<a id="function-tatetwist-grossenchar-rngintelt"></a>
##### `TateTwist(GR, n): GrossenChar, RngIntElt -> GrossenChar`

<a id="function-tatetwist-grpheckeelt-rngintelt"></a>
##### `TateTwist(psi, n): GrpHeckeElt, RngIntElt -> GrossenChar`

Given a Grossencharacter or a Hecke character, return its Tate twist as a Grossencharacter. Note that the field need not be CM in the latter case.

<a id="example-ex-42864c"></a>
##### `Example: Grossencharacters on the Gaussian Field (ex-42864c)`

First, an example of $[1,0]$-type Grössencharacters on the Gaussian field, with modulus ${\mathfrak{p}}_2^3$ where ${\mathfrak{p}}_2$ is the (ramified) prime above 2. This induces the $L$-function for the congruent number curve.

```magma
> K<i> := QuadraticField(-1);
> I := (1+i)^3*IntegerRing(K);
> HG := HeckeCharacterGroup(I, []);
> DG := DirichletGroup(I, []); #DG;
4
> GR := Grossencharacter(HG.0, DG.1^3, [[1,0]]);
> L := LSeries(GR); CFENew(L);
1.57772181044202361082345713057E-30
> CentralValue(L);
0.655514388573029952616209897475
> CentralValue(LSeries(EllipticCurve("32a")));
0.655514388573029952616209897473
```

<a id="example-ex-b4291f"></a>
##### `Example: Canonical Grossencharacter of Q(sqrt(-23)) (ex-b4291f)`

An example with the canonical Grössencharacter for $K={\mathbb{Q}}(\sqrt{-23})$. The ramification here is only at the prime above 23.

```magma
> K<s> := QuadraticField(-23);
> I := Factorization(23*IntegerRing(K))[1][1]; // ramified place
> HG := HeckeCharacterGroup(I, []);
> DG := DirichletGroup(I, []); #DG;
22
> GR := Grossencharacter(HG.0, DG.1^11, [[1,0]]); // canonical character
> CFENew(LSeries(GR));
4.73316543132607083247037139170E-30
> H := K`extension_field; H; // defined by internal code
Number Field with defining polynomial y^3 + 1/2*(s + 3) over K
```

The values of the Grössencharacter are in the given field extension of $K$; in general, this `extension_field` attribute is a capitulation field for $K$ (thus $K$ itself when the class number is 1), and the values of the Grössencharacter can be further twisted by cyclotomic factors.

We can also twist the Grössencharacter by a Hecke character on $I$, either via the `Grossencharacter` intrinsic, or by direct multiplication.

```magma
> i2 :=  Factorization(2*IntegerRing(K))[1][1]; // ideal of norm 2
> (GR*HG.1)(i2); // evaluation at i2
-0.140157638956246665944180880120 - 1.40725116316960648195556086783*i
> GR2 := Grossencharacter(HG.1, DG.1^11, [[1,0]]); // psi over zeta_11
> GR2(i2);
-0.140157638956246665944180880120 - 1.40725116316960648195556086783*i
> RawEval(i2,GR2);  // first value is in the cubic extension of K
H.1
1
zeta_33^4
> CFENew(LSeries(GR2));
-7.09974814698910624870555708755E-30
```

<a id="example-ex-7d182f"></a>
##### `Example: Grossencharacter with Vanishing Central Value (ex-7d182f)`

An example from Fernando Rodriguez Villegas where the Grössencharacter yields an $L$-function with even functional equation, but vanishing central value. This is the cube of the canonical character on ${{\mathbb{Q}}}(\sqrt{-59})$, which has class number 3. The $L$-function can be alternatively realised from a weight 4 modular form of level $59^2$.

```magma
> K := QuadraticField(-59);
> I := Factorization(59*IntegerRing(K))[1][1];
> H := HeckeCharacterGroup(I);
> DG := DirichletGroup(I);
> GR := Grossencharacter(H.0, DG.1^29, [[3,0]]); // cube of canonical char
> L := LSeries(GR);
> CFENew(L);
0.000000000000000000000000000000
> Sign(L);
1.00000000000000000000000000000
> CentralValue(L);
3.51858026759864075475017925650E-30
> LSetPrecision(L, 9);
> LTaylor(L, 2, 3); // first 3 terms of Taylor series about s=2
-1.09144041E-12 + 9.82515510E-11*z + 2.87637101*z^2 - 7.65817878*z^3 + ...
```

The same Grössencharacter can be obtained from cubing the canonical character (of type $[1,0]$).

```magma
> GR3 := Grossencharacter(H.0, DG.1^29, [[1,0]])^3;
> CentralValue(LSeries(GR3));
3.51858026759864075475017925650E-30
```

<a id="example-ex-38ad25"></a>
##### `Example: Grossencharacter Central Value and Gamma Periods (ex-38ad25)`

An example with ${{\mathbb{Q}}}(\zeta_5)$, comparing the central value to the periods derived from $\Gamma$-values.

```magma
> _<x> := PolynomialRing(Rationals());
> K<z5> := NumberField(x^4+x^3+x^2+x+1);
> p5 := Factorization(5*IntegerRing(K))[1][1]; // ramified prime above 5
> H := HeckeCharacterGroup(p5^2);
> DG := DirichletGroup(p5^2);  // need p5^2 to get chi with this oo-type
> chi := DG.1^2*DG.2; // could alternatively have Magma compute this
> GR := Grossencharacter(H.0, chi, [[3,0],[1,2]]);
```

We can compute that this $\infty$-type sends $\zeta_5$ to $(\zeta_5^1)^3\cdot (\zeta_5^4)^0\cdot (\zeta_5^2)^1\cdot (\zeta_5^3)^2=\zeta_5^{11}$ under the default embedding, and thus the ideal needs to afford a character of order 5 for a Grössencharacter to exist.

```magma
> L := LSeries(GR);
> LSeriesData(L); // Conductor is Norm(p5^2) * disc(K) = 5^2 * 5^3
<4, [ 0, -1, 1, 0 ], 3125, ... >;
> CFENew(L); // functional equation works
0.000000000000000000000000000000
> CentralValue(L); // same as Evaluate(L,2)
1.25684568045898366613593980559
> Gamma(1/5)^3 * Gamma(2/5)^3 / Gamma(3/5)^2 / Gamma(4/5)^2 / 5^(7/2);
1.25684568045898366613593980558
```

The $[[3,0],[2,1]]$ $\infty$-type sends $\zeta_5$ to $\zeta_5^{3+0+2\cdot 2+3}=1$, but we still need ${\mathfrak{p}}_5$ in the modulus to trivialise the units of infinite order.

```magma
> H := HeckeCharacterGroup( 1 * IntegerRing(K)); // try conductor 1
> GR := Grossencharacter(H.0, [[3,0],[2,1]]);
Runtime error in 'Grossencharacter':
oo-type should be trivial on all totally positive units that are 1 mod I
Fails for -zeta_5^2 - 1 which gives -1.000000000 - 3.293785801E-101*$.1
> H := HeckeCharacterGroup(p5); // conductor of norm 5
> GR := Grossencharacter(H.0, [[3,0],[2,1]]); // finds a character
> L := LSeries(GR);
> PI := Pi(RealField());
> CentralValue(L); // now recognise as a product via logs and LLL
0.749859246433372123005585683300
> A := [ Gamma(1/5), Gamma(2/5), Gamma(3/5), Gamma(4/5), 5, PI, $1 ];
> LOGS := [ ComplexField() ! Log(x) : x in A ];
> IntegerRelation(LOGS);
[ -14, 2, -2, 14, 15, -4, 4 ]
```

<a id="example-ex-a39eeb"></a>
##### `Example: Twisting a Grossencharacter by a Hilbert Character (ex-a39eeb)`

Twisting a Grössencharacter by a Hilbert character is equivalent to changing the embedding.

```magma
> K := QuadraticField(-39);
> I := 39*IntegerRing(K);
> F := &*[f[1] : f in Factorization(I)]; // ideal of norm 39
> H := HeckeCharacterGroup(F); H;
Abelian Group isomorphic to Z/4 + Z/12 given as Z/4 + Z/12
> Norm(Conductor(H.1)); // H.1 is a Hilbert character of norm 1
1
> GR := Grossencharacter(H.0, [[3,0]]); // third power
```

There are four Hilbert characters here (from the class group of $K$), and we twist the Grössencharacter by each.

```magma
> L0 := LSeries(AssociatedPrimitiveGrossencharacter(GR));
> L1 := LSeries(AssociatedPrimitiveGrossencharacter(GR*H.1));
> L2 := LSeries(AssociatedPrimitiveGrossencharacter(GR*H.1^2));
> L3 := LSeries(AssociatedPrimitiveGrossencharacter(GR*H.1^3));
> Ls := [ L0, L1, L2, L3 ]; for L in Ls do LSetPrecision(L, 10); end for;
> for L in Ls do [CentralValue(L), Sign(L)]; end for;
[ 1.335826177, 1.000000000 + 2.706585223E-10*i ]
[ -1.373433032*i, -0.9999999999 - 6.351223882E-11*i ]
[ 1.335826177, 1.000000000 - 2.706585223E-10*i ]
[ 1.373433032*i, -0.9999999999 + 6.351223882E-11*i ]
```

The embedding information is stored internally in `K’Hip`, and we modify this directly to get the same $L$-values via a different method.

```magma
> K`Hip; // extension of infinite place of K
[ [ 1, 1 ] place at infinity ]
> IP := InfinitePlaces(K`extension_field); IP;
[ [ 1, 1 ] place at infinity, [ 1, 2 ] place at infinity,
  [ 1, 3 ] place at infinity, [ 1, 4 ] place at infinity ]
> for ip in IP do K`Hip := [ ip ]; // change ip, but use same GR
>        L := LSeries(AssociatedPrimitiveGrossencharacter(GR));
>        LSetPrecision(L, 10); [CentralValue(L), Sign(L)]; end for;
[ 1.335826177, 1.000000000 - 2.706585223E-10*i ]
[ 1.373433032*i, -0.9999999999 + 6.351223882E-11*i ]
[ 1.335826177, 1.000000000 - 2.706585223E-10*i ]
[ -1.373433032*i, -0.9999999999 - 6.351223882E-11*i ]
```

Finally, we can note that all the Hilbert characters have sign $+1$ in their functional equations, though two of the twists of the Grössencharacter have sign $-1$.

```magma
> Ls := [ LSeries(AssociatedPrimitiveCharacter(H.1^k)) : k in [1..4] ];
> [ Sign(L) where _:=CFENew(L) : L in Ls ]; // force Sign computation
[ 0.999999999999999999999999999997, 1.00000000000000000000000000000,
  0.999999999999999999999999999997, 1.00000000000000000000000000000 ]
```

<a id="example-ex-03fd6d"></a>
##### `Example: Grossencharacters of Trivial Conductor (ex-03fd6d)`

A final example with characters of trivial conductor, here of type $[2,0]$ in ${{\mathbb{Q}}}(\sqrt{-23})$.

```magma
> K<s> := QuadraticField(-23); // class number 3
> I := 1*IntegerRing(K);
> HG := HeckeCharacterGroup(I, []);
> GR := Grossencharacter(HG.0, [[2,0]]); // of oo-type (2,0)
> Evaluate(LSeries(GR), 2); // value at edge of critical strip
1.23819100212426040400794384795
> Evaluate(LSeries(GR*HG.1), 2); // twist by nontrivial Hecke char
0.670337208665839403747922477469
> Evaluate(LSeries(GR*HG.1^2), 2);
1.06110583266449728309907405960
```

The product of these three $L$-values should be related to values of the $\Gamma$-function at $k/23$ for integral $k$. (One could alternatively relate these $L$-values to periods of an elliptic curve over the Hilbert class field of $K$ having ramification only above 23.)

```magma
> SetDefaultRealFieldPrecision(100);
> e1 := Evaluate(LSeries(GR : Precision:=100), 2);
> e2 := Evaluate(LSeries(GR*HG.1 : Precision:=100), 2);
> e3 := Evaluate(LSeries(GR*HG.1^2 : Precision:=100), 2);
> GAMMA := [Gamma(i/23) : i in [1..22]];
> A := GAMMA cat [3,23,Pi(RealField())] cat [e1,e2,e3];
> LOGS := [ComplexField()!Log(x) : x in A];
> IntegerRelation(LOGS);
[ 2,  2,  2,  2, -2,  2, -2,  2,  2, -2, -2,
  2,  2, -2, -2,  2, -2,  2, -2, -2, -2, -2,
 -2, -7,  6, -2, -2, -2 ]
> &*[ GAMMA[i]^(2*(DirichletGroup(23).1)(i)) : i in [1..22] ];
24723927.96264290790447830542942451626433185347196157309315591128
> 3^2 * 23^7 / Pi(RealField())^6 * (e1*e2*e3)^2;
24723927.96264290790447830542942451626433185347196157309315591128
```

<a id="example-ex-105c44"></a>
##### `Example: Grossencharacter on the Eighth Cyclotomic Field (ex-105c44)`

An example from [[vGvS93](https://docs.magma-maths.org/references.md#cite-geemen-straten), §8.8]. Here the Grössencharacter is on an ideal of norm $2^4$ in the cyclotomic field ${{\mathbb{Q}}}(\zeta_8)$. The Euler factors will factor in various fields. In Table 7.6 of the cited paper, one notes that the coefficients satisfy $a_{17}=-180$ and $a_{17^2}=15878$.

```magma
> Q<z8> := CyclotomicField(8);
> p2 := Factorization(2*Integers(Q))[1][1];
> G := HeckeCharacterGroup(p2^4);
> psi := G.0; // trivial
> GR := Grossencharacter(psi, [[3,0],[1,2]]);
> L:=LSeries(GR);
> CFENew(L);
6.31088724176809444329382852226E-30
> Factorization(EulerFactor(L,7 : Integral)); // p is 7 mod 8
[ <343*x^2 + 1, 2> ]
> K<s2> := QuadraticField(-2);
> _<t> := PolynomialRing(K);
> Factorization(EulerFactor(L,3 : Integral),K); // 3 mod 8
[ <t^2 + 1/81*(-2*s2 - 1), 1>, <t^2 + 1/81*(2*s2 - 1), 1> ]
> K<i> := QuadraticField(-1);
> _<t> := PolynomialRing(K);
> Factorization(EulerFactor(L,5 : Integral),K); // 5 mod 8
[ <t^2 + 1/3125*(-24*i + 7), 1>, <t^2 + 1/3125*(24*i + 7), 1> ]
> EulerFactor(L,17 : Integral); // -180 and 15878 as desired
24137569*x^4 - 884340*x^3 + 15878*x^2 - 180*x + 1
```

<a id="example-ex-d12cc1"></a>
##### `Example: Grossencharacter from a Hypergeometric Motive (ex-d12cc1)`

This examples exhibits the use of `GrossenTwist`, and links a Grössencharacter to a hypergeometric datum. The chosen $t$-value is such that the degree 3 $L$-function is imprimitive, and it splits as $L(\chi_{12},s+1)L(\Psi,s)$, where $\Psi$ is defined over ${{\mathbb{Q}}}(\sqrt{-84})$, and has trivial modulus and $[2,0]$ $\infty$-type; there are still four such characters (the class number is 4), and we want the one with $\Psi(\tenfrak p_2)=2$ and $\Psi(\tenfrak p_3)=-3$. We then check the degree 3 Euler factors on all good primes up to 100.

```magma
> P := PrimesInInterval(5,100);
> H := HypergeometricData([2,3],[1,6]);
> t := -27;
> ZT := Translate(LSeries(KroneckerCharacter(12)),1);
> K := QuadraticField(-84);
> DATA2 := <Factorization(2*Integers(K))[1][1],2>;
> DATA3 := <Factorization(3*Integers(K))[1][1],-3>;
> G := HeckeCharacterGroup(1*Integers(K));
> GR := Grossencharacter(G.0,[[2,0]]);
> LGR := LSeries(GrossenTwist(GR,[* DATA2, DATA3 *]));
> PROD := LGR*ZT;
> assert &and[EulerFactor(PROD,p : Integral) eq
>     EulerFactor(H,t,p) : p in P];
```

And another (simpler) example of GrossenTwist.

```magma
> K := QuadraticField(-1);
> H := HeckeCharacterGroup(7*Integers(K));
> psi := H.1; // order 12
> GR := Grossencharacter(psi,[[1,0]]);
> TW := GR*psi^7;
> P := PrimesUpTo(100,K);
> D :=[* <p,TW(p)> : p in P | Gcd(14,Norm(p)) eq 1 *];
> assert GrossenTwist(GR,D) eq TW;
```

#### Local Root Numbers

One can also compute the local root numbers of Hecke characters and Grössencharacters at prime ideals over the field of definition and at places at infinity. Multiplying these together gives the global root number.

<a id="function-rootnumber-grossenchar-rngorgidl"></a>
##### `RootNumber(GR, P): GrossenChar, RngOrgIdl -> FldComElt`

<a id="function-rootnumber-grpheckeelt-rngorgidl"></a>
##### `RootNumber(psi, P): GrpHeckeElt, RngOrgIdl -> FldComElt`

<a id="function-rootnumber-grossenchar-plcnumelt"></a>
##### `RootNumber(GR, P): GrossenChar, PlcNumElt -> FldComElt`

<a id="function-rootnumber-grpheckeelt-plcnumelt"></a>
##### `RootNumber(psi, P): GrpHeckeElt, PlcNumElt -> FldComElt`

```magma
Precision: RngIntElt                    Default: 
```

Given a Hecke character or Grössencharacter and a place or a prime ideal, return the local root number as a complex number.

<a id="function-rootnumber-grossenchar-rngintelt"></a>
##### `RootNumber(GR, p): GrossenChar, RngIntElt -> FldComElt`

<a id="function-rootnumber-grpheckeelt-rngintelt"></a>
##### `RootNumber(psi, p): GrpHeckeElt, RngIntElt -> FldComElt`

```magma
Precision: RngIntElt                    Default: 
```

Given a Hecke character or Grössencharcter and a rational prime $p$, compute the (induced) root number at $p$.

<a id="function-rootnumbers-grossenchar"></a>
##### `RootNumbers(GR): GrossenChar -> SeqEnum`

<a id="function-rootnumbers-grossenchar-2"></a>
##### `RootNumbers(psi): GrossenChar -> SeqEnum`

```magma
Precision: RngIntElt                    Default: 
AA       : BoolElt                      Default: false
```

Given a Hecke character or Grössencharacter, return the local root numbers at bad places (including infinite ones) as an array of tuples with places and complex approximations given. If the `AA` vararg is set, the answer is returned as an associative array.

<a id="function-rootnumber-grossenchar"></a>
##### `RootNumber(GR): GrossenChar -> SeqEnum`

<a id="function-rootnumber-grossenchar-2"></a>
##### `RootNumber(psi): GrossenChar -> SeqEnum`

```magma
Precision: RngIntElt                    Default: 
```

Given a Hecke character or Grössencharacter, return the global root number.

<a id="example-ex-a7b80a"></a>
##### `Example: Local Root Numbers for Curve 27a (ex-a7b80a)`

We compute the local root numbers of the Grössencharacter over ${{\mathbb{Q}}}(\sqrt{-3})$ for the elliptic curve 27a, and some of its powers.

```magma
> G := Grossencharacter(EllipticCurve("27a")); G;
Grossencharacter G of type [[ 1, 0 ]] for Hecke-Dirichlet pair
(1,$.1*$.2^2) with modulus of norm 9 over Quadratic Field x^2 + 3
> K := NumberField(Order(Modulus(G)));
> I := Ideal(Decomposition(K,3)[1][1]);
> RootNumber(G,I);
6.80316131261355894597927551960E-31 + 1.00000000000000000000000000000*i
> RootNumber(G,InfinitePlaces(K)[1]);
-1.00000000000000000000000000000*i
> RootNumber(G); // product of the two previous
1.00000000000000000000000000000 - 6.80316131261355894597927551960E-31*i
> // over Q, the root numbers get induced to -1 and -1
> RootNumber(G,3); // at the rational prime 3
-1.00000000000000000000000000000 + 6.80316131261355894597927551960E-31*i
> RootNumber(HodgeStructure(G)); // at oo
-1
> for k in [1..12] do k,Real(RootNumber(G^k)); end for;
1 1.00000000000000000000000000000
2 1.00000000000000000000000000000
3 1.00000000000000000000000000000
4 1.00000000000000000000000000000
5 -1.00000000000000000000000000000
6 1.00000000000000000000000000000
7 1.00000000000000000000000000000
8 1.00000000000000000000000000000
9 -1.00000000000000000000000000000
10 1.00000000000000000000000000000
11 -1.00000000000000000000000000000
12 1.00000000000000000000000000000
```

<a id="example-ex-f91aec"></a>
##### `Example: Rohrlich's Root Number Exercise (ex-f91aec)`

This example comes from Exercise 5.5 in Rohrlich’s PCMI lectures [[Roh](https://docs.magma-maths.org/references.md#cite-rohrlich-pcmi)].

We take the Grössencharacter corresponding to the elliptic curve 49a, and then twist it over ${{\mathbb{Q}}}(\sqrt{-7})$ by $-118-18\sqrt{-7}$. This disturbs the root number and the resulting $L$-function is no longer self dual, but it still vanishes at the central point.

```magma
> GR := Grossencharacter(EllipticCurve("49a"));
> K := NumberField(Order(Modulus(GR))); K; // ensure same field
Quadratic Field with defining polynomial x^2 + 7 over the Rational Field
> psi := QuadraticCharacter(-118-18*K.1);
> RootNumber(GR);
1.00000000000000000000000000000 + 1.04356488711804586030321101838E-30*i
> RootNumber(psi);
1.00000000000000000000000000000 - 3.55311676760811128464401934867E-32*i
> RootNumber(GR*psi);
0.943041920192897214648941373352 - 0.332673919565230241738496249562*i
> L := LSeries(GR*psi);
> CentralValue(L); // zero
2.91343312836088675607917006164E-30
> Sign(L); // root of 253*x^4 - 394*x^2 + 253
0.943041920192897214648941373361 - 0.332673919565230241738496249560*i
```

<a id="grossencharacters-and-elliptic-curves"></a>
#### Grössencharacters and Elliptic Curves

There are also functions that transform between elliptic curves over ${\mathbb{Q}}$ that have complex multiplication (over an imaginary quadratic field), and Grössencharacters associated to them.

<a id="function-grossencharacter-crvell"></a>
##### `Grossencharacter(E): CrvEll -> GrossenChar`

Given an elliptic curve over ${\mathbb{Q}}$ with complex multiplication by an imaginary quadratic order, return the associated Grössencharacter.

<a id="function-ellipticcurve-grossenchar"></a>
##### `EllipticCurve(GR): GrossenChar -> CrvEll`

Given a suitable Grössencharacter, in particular of $\infty$-type $[1,0]$ over an imaginary quadratic field, with the underlying character of order 2, return an elliptic curve in the associated isogeny class.

<a id="example-ex-e6dfed"></a>
##### `Example: Grossencharacters of CM Elliptic Curves (ex-e6dfed)`

```magma
> E := EllipticCurve("49a"); // cm by -7
> G := Grossencharacter(QuadraticTwist(E,5*29));
> Conductor(QuadraticTwist(EllipticCurve(G),5*29));
49
> //
> E := EllipticCurve([2^2 * 3 * 5^3 * 7 * 11^2 * 13^3, 0]);
> G := Grossencharacter(E);
> assert IsIsogenous(E,EllipticCurve(G));
> //
> E := EllipticCurve([0, 2 * 3^5 * 5^3 * 7^4 * 11^2 * 13^5]);
> G := Grossencharacter(E);
> assert IsIsogenous(E,EllipticCurve(G));
> //
> K := QuadraticField(-163);
> p := Factorization(163*Integers(K))[1][1];
> psi := HeckeCharacterGroup(p).0;
> G := Grossencharacter(psi,[[1,0]]);
> E := EllipticCurve(G);
> b, cm := HasComplexMultiplication(E);
> assert b; assert cm eq -163;
> Conductor(E);
26569
```

<a id="algebraically-closed-field"></a>
<a id="acf-chap"></a>
## Algebraically Closed Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/introduction.md)
- [Representation](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/representation.md)
- [Creation of Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/structure.md)
  - [`AlgebraicClosure(K): Fld → FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/structure.md#function-fldac-algebraicclosure)
  - [`AlgebraicClosure() → FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/structure.md#function-algebraicclosure)
  - [`AssignNamePrefix(A, S): FldAC, MonStgElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/structure.md#procedure-assignnameprefix-fldac-monstgelt)
- [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md)
  - [Coercion](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#coercion)
    - [`A ! a: FldAC, RngElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#operation-op-fldac-rngelt)
    - [`One(A): FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-one-fldac)
    - [`Identity(A): FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-identity-fldac)
    - [`Zero(A): FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-zero-fldac)
    - [`Representative(A): FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-representative-fldac)
  - [Roots](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#roots)
    - [`Roots(f): RngUPolElt → [ < FldACElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots)
    - [`Roots(f, A): RngUPolElt, FldAC → [ < FldACElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-roots-rngupolelt-fldac)
    - [`RootOfUnity(n, A): RngIntElt, FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-rootofunity-rngintelt-fldac)
    - [`SquareRoot(a): FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-squareroot-fldacelt)
    - [`Sqrt(a): FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-sqrt)
    - [`IsSquare(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-issquare-fldacelt)
    - [`Root(a, n): FldACElt, RngIntElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-root-fldacelt-rngintelt)
    - [`IsPower(a, n): FldACElt, RngIntElt → BoolElt, FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-ispower-fldacelt-rngintelt)
  - [Variables](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#variables)
    - [`A . i: FldAC, RngIntElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#operation-operation-fldac-rngintelt-fldacelt)
    - [Example: Creating Roots in the Algebraic Closure](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#example-ex-f1defe)
    - [Example: Swinnerton-Dyer Polynomials](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#example-ex-681d9c)
    - [Example: Puiseux Expansions over an Algebraic Closure](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#example-ex-efef60)
- [Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md)
  - [`Category(A): FldAC → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-category-fldac)
  - [`Parent(A): FldAC → PowerStructure`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-parent-fldac)
  - [`Centre(A): FldAC → AC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-centre-fldac)
  - [`PrimeRing(A): FldAC → AC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-primering-fldac)
  - [`PrimeField(A): FldAC → AC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-primefield-fldac)
  - [`FieldOfFractions(A): FldAC → AC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/related.md#function-fieldoffractions-fldac)
- [Properties](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md)
  - [`BaseField(A): FldAC → Fld`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-basefield-fldac)
  - [`Rank(A): FldAC → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-rank-fldac)
  - [`Degree(A, v): FldAC, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-degree-fldac-rngintelt)
  - [`Degree(A): FldAC → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-degree-fldac)
  - [`AffineAlgebra(A): FldAC → RngMPolRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-fldac-affinealgebra)
  - [`QuotientRing(A): FldAC → RngMPolRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-quotientring-fldac)
  - [`Ideal(A): FldAC → RngMPol`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-ideal-fldac)
- [Ring Predicates and Properties](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md)
  - [`IsCommutative(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-iscommutative-fldac)
  - [`IsUnitary(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isunitary-fldac)
  - [`IsFinite(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isfinite-fldac)
  - [`IsOrdered(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isordered-fldac)
  - [`IsField(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isfield-fldac)
  - [`IsEuclideanDomain(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-iseuclideandomain-fldac)
  - [`IsPID(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-ispid-fldac)
  - [`IsUFD(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isufd-fldac)
  - [`IsDivisionRing(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isdivisionring-fldac)
  - [`IsEuclideanRing(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-iseuclideanring-fldac)
  - [`IsPrincipalIdealRing(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isprincipalidealring-fldac)
  - [`IsDomain(A): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-isdomain-fldac)
  - [`A eq B: FldAC, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#operation-op-eq-fldac-rng)
  - [`A ne B: FldAC, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#operation-op-ne-fldac-rng)
  - [`Characteristic(A): FldAC → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/predicate.md#function-characteristic-fldac)
- [Element Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md)
  - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#arithmetic-operators)
    - [`+ a: FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-operation-fldacelt-fldacelt)
    - [`- a: FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-operation-fldacelt-fldacelt-2)
    - [`a + b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-plus-fldacelt-fldacelt)
    - [`a - b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-minus-fldacelt-fldacelt)
    - [`a * b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-times-fldacelt-fldacelt)
    - [`a / b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-div-fldacelt-fldacelt)
    - [`a ^ k: FldACElt, RngIntElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-pow-fldacelt-rngintelt)
    - [`a +:= b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-operation-fldacelt-fldacelt-fldacelt)
    - [`a -:= b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-operation-fldacelt-fldacelt-fldacelt-2)
    - [`a *:= b: FldACElt, FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-operation-fldacelt-fldacelt-fldacelt-3)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#equality-and-membership)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#parent-and-category)
    - [`Parent(a): FldACElt → AC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-parent-fldacelt)
    - [`Category(a): FldACElt → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-category-fldacelt)
  - [Predicates on Ring Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#predicates-on-ring-elements)
    - [`IsZero(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-iszero)
    - [`IsOne(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isone-fldacelt)
    - [`IsMinusOne(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isminusone-fldacelt)
    - [`a eq b: FldACElt, FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-eq-fldacelt-fldacelt)
    - [`a ne b: FldACElt, FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-ne-fldacelt-fldacelt)
    - [`a in A: FldACElt, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-in-fldacelt-rng)
    - [`a notin A: FldACElt, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#operation-op-notin-fldacelt-rng)
    - [`IsNilpotent(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isnilpotent-fldacelt)
    - [`IsIdempotent(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isidempotent-fldacelt)
    - [`IsUnit(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isunit-fldacelt)
    - [`IsZeroDivisor(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-iszerodivisor-fldacelt)
    - [`IsRegular(a): FldAC → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isregular-fldac)
    - [`IsIrreducible(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isirreducible-fldacelt)
    - [`IsPrime(a): FldACElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-isprime-fldacelt)
  - [Minimal Polynomial, Norm, and Trace](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#minimal-polynomial-norm-and-trace)
    - [`MinimalPolynomial(a): FldACElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial)
    - [`Norm(a): FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-norm-fldacelt)
    - [`Trace(a): FldACElt → FldACElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-trace-fldacelt)
    - [`Conjugates(a): FldACElt → [ FldACElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-conjugates-fldacelt)
    - [Example: Conjugate Elements of an Algebraic Closure](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#example-ex-e31b1f)
- [Simplification](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md)
  - [`Simplify(A): FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-simplify)
  - [`Prune(A): FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-prune)
- [Absolute Field](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md)
  - [`AbsoluteAffineAlgebra(A): FldAC → RngUPolRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#function-absoluteaffinealgebra-fldac)
  - [`AbsoluteQuotientRing(A): FldAC → RngUPolRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#function-absolutequotientring-fldac)
  - [`AbsolutePolynomial(A): FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#procedure-absolutepolynomial-fldac)
  - [`NumberField(A): FldAC → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#function-numberfield-fldac)
  - [`NumberField(a): FldACElt → FldNum, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#function-numberfield-fldacelt)
  - [`Absolutize(A): FldAC`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#procedure-fldac-absolutize)
  - [Example: Field of Definition of the Cyclic-6 Variety](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#example-ex-32dfbd)
  - [Example: Splitting Field of a Degree 8 Polynomial](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#example-ex-862d19)
  - [Example: Splitting Field of a Quartic as a Number Field](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#example-ex-d2e9ca)
  - [Example: Splitting Field of Degree 720 as a Tower](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#example-ex-fe6f00)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/bibliography.md)

### Introduction

Magma contains a system [[Ste](https://docs.magma-maths.org/references.md#cite-steel02), [Ste10](https://docs.magma-maths.org/references.md#cite-steelacfjsc)] for computing with algebraically closed fields, which have the property that they always contain all the roots of any polynomial defined over them. It is of course not possible to construct explicitly the closure of a field, but the system works by automatically constructing larger and larger algebraic extensions of an original base field as needed during a computation, thus giving the illusion of computing in the algebraic closure of the base field.

Such a system was already proposed before (the D5 system [[DDD85](https://docs.magma-maths.org/references.md#cite-d5)]), but this has difficulty with the parallelism which occurs when one must compute with several conjugates of a root of a reducible polynomial, leading to situations where a certain expression evaluated at a root is invertible but evaluated at a conjugate of that root is not invertible.

Magma’s system has no such problem and one can compute with the field just like any other field in Magma; all standard algorithms which work over generic fields or which use factorization work automatically without having to be adapted to handle the many conjugates of a root.

Especially significant is also the fact that all the Gröbner basis algorithms work well over such fields. One can compute the variety of any zero-dimensional multivariate polynomial ideal over the algebraic closure of its base field. Puiseux expansions of polynomials are also successfully computed using an algebraically closed field.

### Representation

An algebraically closed field is based on an affine algebra (or quotient ring of a multivariate polynomial ring by an ideal of “relation” polynomials). The defining polynomials of this affine algebra are not necessarily irreducible – the system avoids factorization over an algebraic number field when possible, and automatically splits the defining polynomials of the affine algebra when factors are found during computations with the field. These factors often arise automatically because of the structure of the algorithm which is computing over the field.

Many technical optimizations have been designed to make the system practical. For example, the most expensive arithmetic operation by far in the whole system is, quite surprisingly, the testing of whether an element of the field is zero or not (which is utterly trivial for most other rings, of course)! To allow for the parallelism amongst conjugates to work, Magma performs a recursive GCD computation with the element, considered as a polynomial in its highest variable, and the appropriate defining polynomial, to determine the result. If the GCD is non-trivial, then this forces a splitting of the defining polynomial, all elements of the field are reduced, and the original element may now be zero. More details concerning the internal design of the system can be found in [[Ste10](https://docs.magma-maths.org/references.md#cite-steelacfjsc)].

Care must be taken with the interpretation of the roots of a polynomial in this system. The roots of polynomials are only defined algebraically, and the user may wish to identify them with some particular elements of the complex field, for example, but one cannot assume that the system will follow the embedding one wishes. An example will demonstrate. Suppose that $\alpha$ is a root of $x^2-2$, $\beta$ is a root of $x^2-3$, and $\gamma$ is a root of $x^2-6$. Does $\gamma = \alpha\cdot\beta$ or does $\gamma = -\alpha\cdot\beta$? The system will have to make a choice between the two possibilities if the situation arises, but the choice which it will make cannot be predicted beforehand. That is, even if we might like to interpret things as $\alpha=\sqrt 2$, $\beta=\sqrt 3$, and $\gamma=\sqrt 6$ (referring to the positive real roots in each case), it cannot be assumed that this will hold in the particular algebraically closed field, since the roots are only defined algebraically.

In the following descriptions, the adjective *invariable*, applied to a value, means that the mathematical value of a function will not change, despite simplifications, etc. which may occur after the function is called. That is, the value returned by the function may be considered constant with respect to the `eq` operator. A value may print differently later (because of simplifications of the field), but the mathematical value will never change.

In contrast, the adjective *variable* means that the mathematical value of a function may change (as a result of simplifications). This is usually only a property of access-like functions like `Degree(A, v)` (see below). But the fact that most functions below have invariable return values enables the illusion of a true field to be sustained.

Separate algebraic fields should be created for separate problems which involve root taking (if the roots of the different problems are unrelated). Otherwise it may be unnecessarily expensive to compute in the field with roots of unrelated polynomials.

Currently, the base field of an algebraic closure may be a finite field, the rational field ${\mathbb{Q}}$, or a rational function field over a finite field or ${\mathbb{Q}}$.

### Creation of Structures

<a id="function-fldac-algebraicclosure"></a>
#### `AlgebraicClosure(K): Fld -> FldAC`

Create the algebraic closure **A** of the field $K$. Currently $K$ may be $\Q$, a finite field, or a rational function field over a finite field or the rational field.

<a id="function-algebraicclosure"></a>
#### `AlgebraicClosure() -> FldAC`

Create the algebraic closure **A** of the rational field ${\mathbb{Q}}$.

<a id="procedure-assignnameprefix-fldac-monstgelt"></a>
#### `AssignNamePrefix(A, S): FldAC, MonStgElt`

(Procedure.) Given an algebraically closed field $A$ and a string $S$, reassign the string prefix of the names of $A$ to be $S$. By default, this prefix is `"r"`. When new variables are introduced by root taking, they are named by this prefix with the number appended (see `A.i` below).

### Creation of Elements

The usual way of creating elements within an algebraically closed field $A$ is by coercion from the base field into $A$, or by construction of roots of polynomials over $A$ (and this may be done indirectly via other functions).

#### Coercion

<a id="operation-op-fldac-rngelt"></a>
##### `A ! a: FldAC, RngElt -> FldACElt`

Given an algebraically closed field $A$, create the element specified by $a$; here $a$ is allowed to be an element coercible into $A$, which means that $a$ may be:

**(i)**
an element of $A$;

**(ii)**
an integer or rational.

<a id="function-one-fldac"></a>
##### `One(A): FldAC -> FldACElt`

<a id="function-identity-fldac"></a>
##### `Identity(A): FldAC -> FldACElt`

<a id="function-zero-fldac"></a>
##### `Zero(A): FldAC -> FldACElt`

<a id="function-representative-fldac"></a>
##### `Representative(A): FldAC -> FldACElt`

These generic functions create `A!1`, `A!1`, `A!0`, and `A!0`, respectively.

#### Roots

<a id="function-fldac-roots"></a>
##### `Roots(f): RngUPolElt -> [ < FldACElt, RngIntElt> ]`

<a id="function-roots-rngupolelt-fldac"></a>
##### `Roots(f, A): RngUPolElt, FldAC -> [ < FldACElt, RngIntElt> ]`

```magma
Max: RngIntElt                    Default: 
```

Given a polynomial $f$ over an algebraically closed field $A$, or given a polynomial $f$ over some subring of $A$ together with $A$ itself, this function computes all roots of $f$ in $A$, and returns a sorted sequence of tuples (pairs), each consisting of a root of $f$ in $A$ and its multiplicity. Since $A$ is algebraically closed, $f$ always splits completely.

If the parameter `Max` is set to a non-negative number $m$, at most $m$ roots are returned. This feature can be quite useful when one wishes, say, only one root of a polynomial and not all the conjugates of the root, as they will cause the field to have more variables than necessary and this can make the full simplification of the field much more difficult later (if that is requested).

Note that the function `Factorization(f)` is also supported, and simply returns the linear factors and multiplicities corresponding to the roots returned by `Roots(f)`.

<a id="function-rootofunity-rngintelt-fldac"></a>
##### `RootOfUnity(n, A): RngIntElt, FldAC -> FldACElt`

Return a primitive $n$-th root of unity in $A$, i.e., an element $\omega\in A$ such that $\omega^n = 1$ and $\omega^i \not=1$ for $1\leq i<n$. This always exists since the field is algebraically closed, and the return value is invariable. This function is equivalent to `Roots(CyclotomicPolynomial(n), A: Max := 1)[1, 1]`.

<a id="function-squareroot-fldacelt"></a>
##### `SquareRoot(a): FldACElt -> FldACElt`

<a id="function-fldac-sqrt"></a>
##### `Sqrt(a): FldACElt -> FldACElt`

A square root of the element $a$ from the field $A$, i.e., an element $y$ of $A$ such that $y^2 = a$. A square root always exists since the field is algebraically closed, and the return value is invariable.

<a id="function-issquare-fldacelt"></a>
##### `IsSquare(a): FldACElt -> BoolElt`

Return `true` and a square root of the element $a$ from the field $A$, i.e., `true` and an element $y$ of $A$ such that $y^2 = a$. A square root always exists since the field is algebraically closed, and the return value is invariable.

<a id="function-root-fldacelt-rngintelt"></a>
##### `Root(a, n): FldACElt, RngIntElt -> FldACElt`

Return an $n$-th root of the element $a$ from the field $A$, i.e., an element $y$ of $A$ such that $y^n = a$. A root always exists since the field is algebraically closed, and the return value is invariable.

<a id="function-ispower-fldacelt-rngintelt"></a>
##### `IsPower(a, n): FldACElt, RngIntElt -> BoolElt, FldACElt`

Return `true` and an $n$-th root of the element $a$ from the field $A$, i.e., `true` and an element $y$ of $A$ such that $y^n = a$. A root always exists since the field is algebraically closed, and the return value is invariable.

#### Variables

<a id="operation-operation-fldac-rngintelt-fldacelt"></a>
##### `A . i: FldAC, RngIntElt -> FldACElt`

Return the $i$-th variable of $A$. $i$ must be between 1 and the rank of $A$ (the current number of variables in $A$). Initially $A$ has no variables, and new variables are only created by calling [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) above (or similar functions such as [`Sqrt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-sqrt)). As long as [`Prune`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-prune) or [`Absolutize`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#procedure-fldac-absolutize) are not called (which shift the variable numbers – see below), the return value of this function is invariable, so $A.i$ for fixed $i$ will always return the same mathematical object despite any simplifications or constructions of new roots. New roots are always assigned higher generator numbers.

<a id="example-ex-f1defe"></a>
##### `Example: Creating Roots in the Algebraic Closure (ex-f1defe)`

We first show the most common way of creating roots: by the [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) function.

```magma
> A := AlgebraicClosure();
> P<x> := PolynomialRing(IntegerRing());
> r := Roots(x^3 + x + 1, A);
> r;
[
    <r1, 1>,
    <r2, 1>,
    <r3, 1>
]
> A;
Algebraically closed field with 3 variables
Defining relations:
[
    r3^3 + r3 + 1,
    r2^3 + r2 + 1,
    r1^3 + r1 + 1
]
> a := r[1,1];
> a^3 + a;
-1
> A.1;
r1
> A.2;
r2
> A.3;
r3
> A.1 eq a;
true
```

It is often useful to use the `Max` parameter with the [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) function. Note that in this case $A$ does not have the extra variables found in the previous example.

```magma
> A := AlgebraicClosure();
> r := Roots(x^3 + x + 1, A: Max := 1);
> A;
Algebraically closed field with 1 variable
Defining relations:
[
    r1^3 + r1 + 1
]
```

One can also create elements by [`Sqrt`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-sqrt), etc.

```magma
> A := AlgebraicClosure();
> sqrt2 := Sqrt(A ! 2);
> cube3 := Root(A!3, 3);
> A;
Algebraically closed field with 2 variables
Defining relations:
[
    r2^3 - 3,
    r1^2 - 2
]
> sqrt2^2;
2
> cube3^3;
3
```

<a id="example-ex-681d9c"></a>
##### `Example: Swinnerton-Dyer Polynomials (ex-681d9c)`

The $n$-th Swinnerton-Dyer polynomial is defined to be

$$
\prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm
   \cdots \pm \sqrt{p_n}),
$$

where $p_i$ is the $i$-th prime and the product runs over all $2^n$ possible combinations of $+$ and $-$ signs. Such polynomials lie in ${\mathbb{Z}}[x]$ and are irreducible over ${\mathbb{Z}}$. It is very easy to compute them using algebraically closed fields. We simply construct the square roots we need and multiply out the expression, coercing the resulting polynomial to ${\mathbb{Z}}[x]$.

```magma
> Z := IntegerRing();
> function SwinnertonDyer(n)
>     P := [2];
>     for i := 2 to n do
>         Append(~P, NextPrime(P[#P]));
>     end for;
>     A := AlgebraicClosure();
>     S := [Sqrt(A ! p): p in P];
>     P<z> := PolynomialRing(A);
>     f := &*[z + &+[t[i]*S[i]: i in [1..n]]: t in CartesianPower({-1, 1}, n)];
>     return PolynomialRing(Z) ! f;
> end function;
> P<x> := PolynomialRing(Z);
> [SwinnertonDyer(i): i in [1..5]];
[
    x^2 - 2,
    x^4 - 10*x^2 + 1,
    x^8 - 40*x^6 + 352*x^4 - 960*x^2 + 576,
    x^16 - 136*x^14 + 6476*x^12 - 141912*x^10 + 1513334*x^8 -
        7453176*x^6 + 13950764*x^4 - 5596840*x^2 + 46225,
    x^32 - 448*x^30 + 84864*x^28 - 9028096*x^26 + 602397952*x^24 -
        26625650688*x^22 + 801918722048*x^20 - 16665641517056*x^18 +
        239210760462336*x^16 - 2349014746136576*x^14 +
        15459151516270592*x^12 - 65892492886671360*x^10 +
        172580952324702208*x^8 - 255690851718529024*x^6 +
        183876928237731840*x^4 - 44660812492570624*x^2 +
        2000989041197056
]
```

The Swinnerton-Dyer polynomials yield worse-case inputs for the Berlekamp–Zassenhaus factorization algorithm for polynomials over ${\mathbb{Z}}$, but they are no longer difficult to factor using van Hoeij’s new algorithm (see Example [Factoring Swinnerton-Dyer Polynomials](https://docs.magma-maths.org/BasicRings/UnivariatePolynomialRings/factorization.md#example-ex-d3c652)).

We can even define a simple extension of the Swinnerton-Dyer polynomials. Let $Q = \{ q_1, \ldots, q_n \}$ be a set of $n$ distinct primes or negatives of primes. Define:

$$
{\rm GSD}_Q := \prod (x \pm \sqrt{q_1} \pm \sqrt{q_2} \pm
   \cdots \pm \sqrt{q_n}),
$$

where the product runs over all $2^n$ possible combinations of $+$ and $-$ signs. Then ${\rm GSD}_Q \in {\mathbb{Z}}[x]$, is irreducible over ${\mathbb{Z}}$, has degree $2^n$, and has at least $2^{n-1}$ factors mod any prime. A function to compute these polynomials is only a slight variation on the previous function.

```magma
> function GSD(Q)
>     n := #Q;
>     A := AlgebraicClosure();
>     S := [Sqrt(A ! x): x in Q];
>     z := PolynomialRing(A).1;
>     f := &*[z + &+[t[i]*S[i]: i in [1..n]]: t in CartesianPower({-1, 1}, n)];
>     return PolynomialRing(Z) ! f;
> end function;
```

One can multiply ${\rm GSD}_Q$ for various $Q$ to construct more reducible polynomials with many modular factors. We first note the effects of changing the sign of the input primes.

```magma
> GSD([2, 3, 5]);
x^8 - 40*x^6 + 352*x^4 - 960*x^2 + 576
> GSD([-2, -3, -5]);
x^8 + 40*x^6 + 352*x^4 + 960*x^2 + 576
> GSD([-2, 3, 5]);
x^8 - 24*x^6 + 224*x^4 + 960*x^2 + 1600
> GSD([2, -3, 5]);
x^8 - 16*x^6 + 184*x^4 + 960*x^2 + 3600
> GSD([2, 3, -5]);
x^8 + 152*x^4 + 1920*x^2 + 5776
```

We now form a polynomial $f$ which is the product of two degree-64 irreducible polynomials. $f$ has at least 64 factors modulo any prime, but is not difficult to factor using van Hoeij’s algorithm.

```magma
> f := GSD([2, 3, 5, 7, 11, 13])*GSD([-2, -3, -5, -7, -11, -13]);
> Degree(f);
128
> Max([Abs(x): x in Coefficients(f)]);
74356932844713201802276382813294219572861455394629943303351262856515487990904 17
> time L:=Factorization(f);
Time: 9.850
> [Degree(t[1]): t in L];
[ 64, 64 ]
> Max([Abs(x): x in Coefficients(L[1,1])]);
1771080720430629161685158978892152599456 11
```

<a id="example-ex-efef60"></a>
##### `Example: Puiseux Expansions over an Algebraic Closure (ex-efef60)`

This example shows how one can compute Puiseux expansions over an algebraic closure. The [`PuiseuxExpansion`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-newton-puiseuxexpansion) function calls the [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) function internally as it needs to.

```magma
> A := AlgebraicClosure();
> S<y> := PuiseuxSeriesRing(A);
> P<x> := PolynomialRing(S);
> f := (x^2 - y^2 - 1)^5 + x*y + 1;
> time S := PuiseuxExpansion(f, 3);
Time: 0.210
> S;
[
    r1*y + (102/2525*r1 - 2/505)*y^3 + O(y^4),
    r2*y + (102/2525*r2 - 2/505)*y^3 + O(y^4),
    r3 + (1/10*r3^2 - 1/10)*y + (-101/1000*r3^7 + 101/200*r3^5 -
        209/200*r3^3 + 26/25*r3)*y^2 + O(y^3),
    r4 + (1/10*r4^2 - 1/10)*y + (-101/1000*r4^7 + 101/200*r4^5 -
        209/200*r4^3 + 26/25*r4)*y^2 + O(y^3),
    r5 + (1/10*r5^2 - 1/10)*y + (-101/1000*r5^7 + 101/200*r5^5 -
        209/200*r5^3 + 26/25*r5)*y^2 + O(y^3),
    r6 + (1/10*r6^2 - 1/10)*y + (-101/1000*r6^7 + 101/200*r6^5 -
        209/200*r6^3 + 26/25*r6)*y^2 + O(y^3),
    r7 + (1/10*r7^2 - 1/10)*y + (-101/1000*r7^7 + 101/200*r7^5 -
        209/200*r7^3 + 26/25*r7)*y^2 + O(y^3),
    r8 + (1/10*r8^2 - 1/10)*y + (-101/1000*r8^7 + 101/200*r8^5 -
        209/200*r8^3 + 26/25*r8)*y^2 + O(y^3),
    r9 + (1/10*r9^2 - 1/10)*y + (-101/1000*r9^7 + 101/200*r9^5 -
        209/200*r9^3 + 26/25*r9)*y^2 + O(y^3),
    r10 + (1/10*r10^2 - 1/10)*y + (-101/1000*r10^7 + 101/200*r10^5 -
        209/200*r10^3 + 26/25*r10)*y^2 + O(y^3)
]
> A;
Algebraically closed field with 10 variables
Defining relations:
[
    r10^8 - 5*r10^6 + 10*r10^4 - 10*r10^2 + 5,
    r9^8 - 5*r9^6 + 10*r9^4 - 10*r9^2 + 5,
    r8^8 - 5*r8^6 + 10*r8^4 - 10*r8^2 + 5,
    r7^8 - 5*r7^6 + 10*r7^4 - 10*r7^2 + 5,
    r6^8 - 5*r6^6 + 10*r6^4 - 10*r6^2 + 5,
    r5^8 - 5*r5^6 + 10*r5^4 - 10*r5^2 + 5,
    r4^8 - 5*r4^6 + 10*r4^4 - 10*r4^2 + 5,
    r3^8 - 5*r3^6 + 10*r3^4 - 10*r3^2 + 5,
    r2^2 + 1/5*r2 - 1,
    r1^2 + 1/5*r1 - 1
]
```

We check that $f$ evaluated at each expansion in $S$ is zero up to the precision.

```magma
> [Evaluate(f, p): p in S];
[
    O(y^5),
    O(y^5),
    O(y^3),
    O(y^3),
    O(y^3),
    O(y^3),
    O(y^3),
    O(y^3),
    O(y^3),
    O(y^3)
]
```

### Related Structures

<a id="function-category-fldac"></a>
#### `Category(A): FldAC -> Cat`

<a id="function-parent-fldac"></a>
#### `Parent(A): FldAC -> PowerStructure`

<a id="function-centre-fldac"></a>
#### `Centre(A): FldAC -> AC`

<a id="function-primering-fldac"></a>
#### `PrimeRing(A): FldAC -> AC`

<a id="function-primefield-fldac"></a>
#### `PrimeField(A): FldAC -> AC`

<a id="function-fieldoffractions-fldac"></a>
#### `FieldOfFractions(A): FldAC -> AC`

### Properties

<a id="function-basefield-fldac"></a>
#### `BaseField(A): FldAC -> Fld`

Return the base field over which $A$ is defined.

<a id="function-rank-fldac"></a>
#### `Rank(A): FldAC -> RngIntElt`

Return the current rank of $A$, that is, the number of variables which currently define $A$. This can increase by the construction of new roots, or decrease by pruning (see [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) and [`Prune`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-prune) respectively below), so the return value of this function is *variable*.

<a id="function-degree-fldac-rngintelt"></a>
#### `Degree(A, v): FldAC, RngIntElt -> RngIntElt`

Given an algebraically closed field $A$ of rank $r$ and an integer $v$ in the range $1\leq v\leq r$, return the current degree of the defining polynomial for variable $v$. The return value of this function is *variable*, as $A$ may be simplified between invocations, making the defining polynomial for $v$ have smaller degree.

<a id="function-degree-fldac"></a>
#### `Degree(A): FldAC -> RngIntElt`

Return the current absolute degree of $A$, that is, the degree over its base field. This necessitates the simplification of $A$ (see [`Simplify`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-simplify) below), so may be very time consuming. The return value varies only when new roots of polynomials over the field are computed, but until then, the return value is invariable (as the field will remain simplified, even if [`Prune`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-prune) or [`Absolutize`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#procedure-fldac-absolutize) is called – see below).

<a id="function-fldac-affinealgebra"></a>
#### `AffineAlgebra(A): FldAC -> RngMPolRes`

<a id="function-quotientring-fldac"></a>
#### `QuotientRing(A): FldAC -> RngMPolRes`

Return the affine algebra (or multivariate quotient ring) $R$ which currently represents $A$. The quotient relations of $R$ consist of the defining polynomials $A$, and one may coerce between $A$ and $R$, but note that the variable numbers are inverted. The reason for this is that for the system to work, the first root $A.1$ must be the smallest variable with respect to the lexicographical order in the corresponding affine algebra $R$, so that reductions modulo the Gröbner basis of relations are in the correct form.

Note also that if $A$ changes in any way (whether from simplification or by pruning), then the affine algebra $R$ of course stays the same and will not be comparable with the new form of $A$ if $A$ has a different number of variables than before.

<a id="function-ideal-fldac"></a>
#### `Ideal(A): FldAC -> RngMPol`

Return the ideal of defining polynomials currently defining $A$. This is simply equivalent to `DivisorIdeal(AffineAlgebra(A))`. See the relevant comments for the function [`AffineAlgebra`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/property.md#function-fldac-affinealgebra).

### Ring Predicates and Properties

<a id="function-iscommutative-fldac"></a>
#### `IsCommutative(A): FldAC -> BoolElt`

<a id="function-isunitary-fldac"></a>
#### `IsUnitary(A): FldAC -> BoolElt`

<a id="function-isfinite-fldac"></a>
#### `IsFinite(A): FldAC -> BoolElt`

<a id="function-isordered-fldac"></a>
#### `IsOrdered(A): FldAC -> BoolElt`

<a id="function-isfield-fldac"></a>
#### `IsField(A): FldAC -> BoolElt`

<a id="function-iseuclideandomain-fldac"></a>
#### `IsEuclideanDomain(A): FldAC -> BoolElt`

<a id="function-ispid-fldac"></a>
#### `IsPID(A): FldAC -> BoolElt`

<a id="function-isufd-fldac"></a>
#### `IsUFD(A): FldAC -> BoolElt`

<a id="function-isdivisionring-fldac"></a>
#### `IsDivisionRing(A): FldAC -> BoolElt`

<a id="function-iseuclideanring-fldac"></a>
#### `IsEuclideanRing(A): FldAC -> BoolElt`

<a id="function-isprincipalidealring-fldac"></a>
#### `IsPrincipalIdealRing(A): FldAC -> BoolElt`

<a id="function-isdomain-fldac"></a>
#### `IsDomain(A): FldAC -> BoolElt`

<a id="operation-op-eq-fldac-rng"></a>
#### `A eq B: FldAC, Rng -> BoolElt`

<a id="operation-op-ne-fldac-rng"></a>
#### `A ne B: FldAC, Rng -> BoolElt`

<a id="function-characteristic-fldac"></a>
#### `Characteristic(A): FldAC -> FldACElt`

### Element Operations

#### Arithmetic Operators

This section lists the basic arithmetic operations available for elements of an algebraically closed field. Elements are always kept in normal form with respect to the defining relations of the field. Computing the inverse of an element may cause a simplification of the field to be performed.

<a id="operation-operation-fldacelt-fldacelt"></a>
##### `+ a: FldACElt -> FldACElt`

<a id="operation-operation-fldacelt-fldacelt-2"></a>
##### `- a: FldACElt -> FldACElt`

<a id="operation-op-plus-fldacelt-fldacelt"></a>
##### `a + b: FldACElt, FldACElt -> FldACElt`

<a id="operation-op-minus-fldacelt-fldacelt"></a>
##### `a - b: FldACElt, FldACElt -> FldACElt`

<a id="operation-op-times-fldacelt-fldacelt"></a>
##### `a * b: FldACElt, FldACElt -> FldACElt`

<a id="operation-op-div-fldacelt-fldacelt"></a>
##### `a / b: FldACElt, FldACElt -> FldACElt`

<a id="operation-op-pow-fldacelt-rngintelt"></a>
##### `a ^ k: FldACElt, RngIntElt -> FldACElt`

<a id="operation-operation-fldacelt-fldacelt-fldacelt"></a>
##### `a +:= b: FldACElt, FldACElt -> FldACElt`

<a id="operation-operation-fldacelt-fldacelt-fldacelt-2"></a>
##### `a -:= b: FldACElt, FldACElt -> FldACElt`

<a id="operation-operation-fldacelt-fldacelt-fldacelt-3"></a>
##### `a *:= b: FldACElt, FldACElt -> FldACElt`

#### Equality and Membership

#### Parent and Category

<a id="function-parent-fldacelt"></a>
##### `Parent(a): FldACElt -> AC`

<a id="function-category-fldacelt"></a>
##### `Category(a): FldACElt -> Cat`

#### Predicates on Ring Elements

<a id="function-fldac-iszero"></a>
##### `IsZero(a): FldACElt -> BoolElt`

Return whether $a$ is the zero element of its field. This is the most difficult of all arithmetic functions for algebraically closed fields! To determine whether $a$ is zero, Magma computes the recursive GCD of $a$, considered as a polynomial in its highest variable, and the appropriate defining polynomial, to determine the result. If the GCD is non-trivial, then this forces a splitting of the defining polynomial, all elements of the field are reduced, and the original element may now be deemed to be zero (it may not be zero because the cofactor of the GCD may be used to perform the simplification). Despite the fact that simplifications may occur, the return value of this function is *invariable*, and this fact is the most important feature of the whole system, enabling the illusion of a true field to be achieved!

<a id="function-isone-fldacelt"></a>
##### `IsOne(a): FldACElt -> BoolElt`

Return whether $a$ is one in its field, which is determined by testing whether $(a-1)$ is zero. Consequently, a simplification of the field may occur, but the return value is invariable.

<a id="function-isminusone-fldacelt"></a>
##### `IsMinusOne(a): FldACElt -> BoolElt`

Return whether $a$ is minus one in its field, which is determined by testing whether $(a+1)$ is zero. Consequently, a simplification of the field may occur, but the return value is invariable.

<a id="operation-op-eq-fldacelt-fldacelt"></a>
##### `a eq b: FldACElt, FldACElt -> BoolElt`

Return whether $a = b$, which is determined by testing whether $(a-b)$ is zero. Consequently, a simplification of the field may occur, but the return value is invariable.

<a id="operation-op-ne-fldacelt-fldacelt"></a>
##### `a ne b: FldACElt, FldACElt -> BoolElt`

<a id="operation-op-in-fldacelt-rng"></a>
##### `a in A: FldACElt, Rng -> BoolElt`

<a id="operation-op-notin-fldacelt-rng"></a>
##### `a notin A: FldACElt, Rng -> BoolElt`

<a id="function-isnilpotent-fldacelt"></a>
##### `IsNilpotent(a): FldACElt -> BoolElt`

<a id="function-isidempotent-fldacelt"></a>
##### `IsIdempotent(a): FldACElt -> BoolElt`

<a id="function-isunit-fldacelt"></a>
##### `IsUnit(a): FldACElt -> BoolElt`

<a id="function-iszerodivisor-fldacelt"></a>
##### `IsZeroDivisor(a): FldACElt -> BoolElt`

<a id="function-isregular-fldac"></a>
##### `IsRegular(a): FldAC -> BoolElt`

<a id="function-isirreducible-fldacelt"></a>
##### `IsIrreducible(a): FldACElt -> BoolElt`

<a id="function-isprime-fldacelt"></a>
##### `IsPrime(a): FldACElt -> BoolElt`

#### Minimal Polynomial, Norm, and Trace

<a id="function-fldac-minimalpolynomial"></a>
##### `MinimalPolynomial(a): FldACElt -> RngUPolElt`

Return the minimal polynomial of the element $a$ of the field $A$, relative to the base field of $A$. This is the unique minimal-degree *irreducible* monic polynomial with coefficients in the base field, having $a$ as a root.

This function works as follows. First the minimal polynomial $M$ of $a$ in the affine algebra corresponding to $A$ is computed. $M$ may be reducible in general, so $M$ is factored, and for each irreducible factor $F$ of $M$, $F(a)$ is evaluated and it is tested whether this evaluation is zero (using the [`IsZero`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-iszero) algorithm). If $M$ is not irreducible, some of these evaluations will cause simplifications of the field, but exactly one of the evaluations will be zero and the corresponding irreducible $F$ is the minimal polynomial of $a$. Consequently, after $F$ is returned, $F(a)$ will be identically zero so the return value of this function *is invariable*.

Thus the illusion of a true field is sustained by forcing the minimal polynomial of $a$ to be irreducible, by first performing whatever simplifications of $A$ are necessary for this. (In fact, computing minimal polynomials in this way is one method of achieving simplifications.)

<a id="function-norm-fldacelt"></a>
##### `Norm(a): FldACElt -> FldACElt`

Given an element $a$ from an algebraically closed field $A$, return the absolute norm of $a$ to the base field of $A$. This is simply computed as $(-1)^{\hbox{Degree}(M)}$ times the constant coefficient of $M$, where $M$ is the irreducible minimal polynomial of $a$ returned by [`MinimalPolynomial`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial)(a). Consequently, a simplification of the field may occur, but the return value is invariable.

<a id="function-trace-fldacelt"></a>
##### `Trace(a): FldACElt -> FldACElt`

Given an element $a$ from an algebraically closed field $A$, return the absolute trace of $a$ to the base field of $A$. This is simply computed as the negation of the coefficient of $x^{n-1}$ in $M$, where $M$ is the irreducible minimal polynomial of $a$ returned by [`MinimalPolynomial`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial)(a) and $n=\hbox{Degree}(M)$. Consequently, a simplification of the field may occur, but the return value is invariable.

<a id="function-conjugates-fldacelt"></a>
##### `Conjugates(a): FldACElt -> [ FldACElt ]`

Given an element $a$ from an algebraically closed field $A$, return the conjugates of $a$ as a sequence of elements. The conjugates of $a$ are defined to be the roots in $A$ of the minimal polynomial of $a$, and $a$ is always included. This function is thus simply equivalent to:

$$
\hbox{{\tt [t[1] : t in Roots(MinimalPolynomial(a), A)]}}.
$$

(No multiplicities are returned as in the [`Roots`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/creation.md#function-fldac-roots) function since the minimal polynomial is always squarefree, of course.) As this function first computes the minimal polynomials of $a$, a simplification of the field may occur, but the return value is invariable.

<a id="example-ex-e31b1f"></a>
##### `Example: Conjugate Elements of an Algebraic Closure (ex-e31b1f)`

We create two elements of an algebraically closed field and note that they are conjugate.

```magma
> A := AlgebraicClosure();
> x := Sqrt(A!2) + Sqrt(A!-3);
> y := Sqrt(A ! (-1 + 2*Sqrt(A!-6)));
> A;
Algebraically closed field with 4 variables
Defining relations:
[
    r4^2 - 2*r3 + 1,
    r3^2 + 6,
    r2^2 + 3,
    r1^2 - 2
]
> x;
r2 + r1
> y;
r4
> x eq y; // depends on choice of square roots
false
> Conjugates(x);
[
    r4,
    -r4,
    r5,
    r6
]
> y in Conjugates(x);
true
```

Of course, $x$ and $y$ are conjugate if and only if they have the same minimal polynomial, which is the case here:

```magma
> P<z> := PolynomialRing(RationalField());
> MinimalPolynomial(x);
z^4 + 2*z^2 + 25
> MinimalPolynomial(y);
z^4 + 2*z^2 + 25
```

### Simplification

The following procedures allow one to simplify an algebraically closed field so that it is a true field.

<a id="procedure-fldac-simplify"></a>
#### `Simplify(A): FldAC`

```magma
Partial: BoolElt                    Default: false
```

(Procedure.) Simplify the internal representation of $A$ in place, so that the ideal of its defining polynomials is explicitly maximal. Elements of $A$ computed earlier stay valid, though they may print differently.

The procedure first partially simplifies $A$ by calling [`MinimalPolynomial`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial) on all variables and sums of two variables of $A$. This will usually cause many simplifications, since this forces the corresponding minimal polynomials to be irreducible (see [`MinimalPolynomial`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial)). The procedure then performs all other necessary simplifications by successively computing absolute representations and factorizing the absolute polynomials which arise. This may be very expensive (in particular, if the final absolute degree is greater than 20), so is only practical for fairly small degrees.

If the parameter `Partial` is set to `true`, then only the partial simplification is performed, which is usually rather fast, and may be sufficient.

<a id="procedure-fldac-prune"></a>
#### `Prune(A): FldAC`

Prune the algebraically closed field $A$ by removing useless variables, modifying $A$ in place. That is, for each variable $v$ of $A$ such that its defining polynomial is a linear polynomial, remove $v$ and the corresponding defining polynomial from $A$, and shift variables higher than $v$ appropriately.

Note that elements of $A$ are kept reduced to normal form with respect to the defining polynomials of $A$ (at least according the user’s perception), so for each such $v$ having a linear relation, $v$ cannot occur in any element of $A$, so the removal of $v$ from $A$ is possible.

### Absolute Field

One may construct an absolute field isomorphic to the current subfield represented by an algebraically closed field. The construction of the absolute field may be very expensive, as it involves factoring polynomials over successive subfields. In fact, it is often the case that the degree of the absolute field is an extremely large integer, so that an absolute field is not practically representable, yet the system may allow one to compute effectively with the original non-absolute presentation.

<a id="function-absoluteaffinealgebra-fldac"></a>
#### `AbsoluteAffineAlgebra(A): FldAC -> RngUPolRes`

<a id="function-absolutequotientring-fldac"></a>
#### `AbsoluteQuotientRing(A): FldAC -> RngUPolRes`

Simplify the algebraically closed field $A$ fully (see [`Simplify`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-simplify)`(A)` above) and then return an absolute field as a univariate affine algebra $R$ which is isomorphic to the current (true) algebraic field represented by $A$, and also return the isomorphism $f:A\rightarrow R$.

<a id="procedure-absolutepolynomial-fldac"></a>
#### `AbsolutePolynomial(A): FldAC`

Simplify the algebraically closed field $A$ fully (see [`Simplify`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-simplify)`(A)` above) and then compute an absolute field isomorphic to the current (true) algebraic field represented by $A$ and return the defining polynomial of the absolute field. That is, return a polynomial $f$ such that $K[x]/<f>$ is isomorphic to $A$ in its current state.

<a id="function-numberfield-fldac"></a>
#### `NumberField(A): FldAC -> FldNum, Map`

```magma
Absolute: BoolElt                    Default: false
```

The number field $N$ isomorphic to the subfield of $A$ generated by the elements introduced so far, and a bidirectional map $f:A\ar N$. By default $N$ is a tower with one extension for each variable of $A$. If the parameter `Absolute` is set to `true`, then $N$ is an absolute number field instead. $A$ is simplified and pruned in place (see [`Simplify`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-simplify)`(A)` and [`Prune`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/simplify.md#procedure-fldac-prune)`(A)` above). The map $f$ is invalidated when $A$ changes later, for example when a new root is computed or $A$ is pruned again.

<a id="function-numberfield-fldacelt"></a>
#### `NumberField(a): FldACElt -> FldNum, Map`

The number field $N$ generated by $a$ over the base field of its parent $A$, and the embedding $N\ar A$ sending $N.1$ to $a$. $N$ is defined by the minimal polynomial of $a$ (see [`MinimalPolynomial`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/operation-element.md#function-fldac-minimalpolynomial)), so $A$ is not simplified as a whole.

<a id="procedure-fldac-absolutize"></a>
#### `Absolutize(A): FldAC`

Modify the algebraically closed field $A$ in place so that has an absolute presentation. That is, compute an isomorphic absolute field and absolute polynomial $f$ as in `AbsolutePolynomial` and modify $A$ and its elements in place so that $A$ now only has one variable $v$ and corresponding defining polynomial $f(v)$ and the elements of $A$ correspond via the isomorphism to their old representation.

<a id="example-ex-32dfbd"></a>
#### `Example: Field of Definition of the Cyclic-6 Variety (ex-32dfbd)`

We show how one can easily compute the number field over which the complete variety of the Cyclic-6 ideal can be defined.

We first create the ideal $I$ over ${\mathbb{Q}}$ and compute its variety over $A$, the algebraic closure of ${\mathbb{Q}}$.

```magma
> P<a,b,c,d,e,f> := PolynomialRing(RationalField(), 6);
> B := [
>     a + b + c + d + e + f,
>     a*b + b*c + c*d + d*e + e*f + f*a,
>     a*b*c + b*c*d + c*d*e + d*e*f + e*f*a + f*a*b,
>     a*b*c*d + b*c*d*e + c*d*e*f + d*e*f*a + e*f*a*b + f*a*b*c,
>     a*b*c*d*e + b*c*d*e*f + c*d*e*f*a + d*e*f*a*b +
>         e*f*a*b*c + f*a*b*c*d,
>     a*b*c*d*e*f - 1];
> I := ideal<P | B>;
> time Groebner(I);
Time: 1.459
> A := AlgebraicClosure();
> time V := Variety(I, A);
Time: 4.219
> #V;
156
```

We now notice that there are 28 variables in $A$ and we check that all elements of $V$ satisfy the original polynomials.

```magma
> Rank(A);
30
> V[1];
<-1, -1, -1, -1, r1 + 4, -r1>
> V[156];
<r28^3 + 2*r28^2*r9 - 2*r9, -r28^3 - 2*r28^2*r9 + 2*r9, r9, -r28, r28, -r9>
> {Evaluate(f, v): v in V, f in B};
{
    0
}
```

We now simplify $A$ to ensure that it represents a true field, and prune away useless variables now having linear defining polynomials.

```magma
> time Simplify(A);
Time: 3.330
> Prune(A);
> A;
Algebraically closed field with 3 variables
Defining relations:
[
    r3^2 - 1/3*r3*r2*r1 - 5/3*r3*r2 + 2/3*r3*r1 - 2/3*r3 + r2*r1 + 4*r2 + 1,
    r2^2 - r2*r1 - 4*r1 - 1,
    r1^2 + 4*r1 + 1
]
> V[1];
<-1, -1, -1, -1, r1 + 4, -r1>
> V[156];
<2/3*r3*r2*r1 + 7/3*r3*r2 - 1/3*r3*r1 - 2/3*r3 + 5/3*r2*r1 +
    19/3*r2 + 2/3*r1 + 4/3, -2/3*r3*r2*r1 - 7/3*r3*r2 + 1/3*r3*r1
    + 2/3*r3 - 5/3*r2*r1 - 19/3*r2 - 2/3*r1 - 4/3, -4/3*r2*r1 -
    14/3*r2 - 1/3*r1 - 2/3, 2/3*r3*r2*r1 + 7/3*r3*r2 - 1/3*r3*r1
    - 2/3*r3 - 5/3*r2*r1 - 19/3*r2 + 1/3*r1 - 1/3, -2/3*r3*r2*r1
    - 7/3*r3*r2 + 1/3*r3*r1 + 2/3*r3 + 5/3*r2*r1 + 19/3*r2 -
    1/3*r1 + 1/3, 4/3*r2*r1 + 14/3*r2 + 1/3*r1 + 2/3>
```

Finally we compute an absolute polynomial for $A$, and then modify $A$ in place using [`Absolutize`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/absolute.md#procedure-fldac-absolutize) to make $A$ be defined by one polynomial of degree 8.

```magma
> time AbsolutePolynomial(A);
x^8 + 4*x^6 - 6*x^4 + 4*x^2 + 1
Time: 0.080
> time Absolutize(A);
Time: 0.259
> A;
Algebraically closed field with 1 variables
Defining relations:
[
    r1^8 + 4*r1^6 - 6*r1^4 + 4*r1^2 + 1
]
> V[1];
<-1, -1, -1, -1, 1/2*r1^6 + 2*r1^4 - 7/2*r1^2 + 3, -1/2*r1^6 -
    2*r1^4 + 7/2*r1^2 + 1>
> V[156];
<r1^7 + 4*r1^5 - 6*r1^3 + 4*r1, -r1^7 - 4*r1^5 + 6*r1^3 - 4*r1,
    -1/4*r1^7 - 3/4*r1^5 + 11/4*r1^3 - 7/4*r1, -r1, r1, 1/4*r1^7
    + 3/4*r1^5 - 11/4*r1^3 + 7/4*r1>
> {Evaluate(f, v): v in V, f in B};
{
    0
}
```

<a id="example-ex-862d19"></a>
#### `Example: Splitting Field of a Degree 8 Polynomial (ex-862d19)`

In this example we compute the splitting field of a certain polynomial of degree 8.

We first set $f$ to a degree-8 polynomial using the database of polynomials with given Galois group. The Galois group has order 16, so we know that the splitting field will have absolute degree 16.

```magma
> P<x> := PolynomialRing(IntegerRing());
> load galpols;
Loading "/home/magma/libs/galpols/galpols"
> PolynomialWithGaloisGroup(8, 6);
x^8 - 2*x^7 - 9*x^6 + 10*x^5 + 22*x^4 - 14*x^3 - 15*x^2 + 2*x + 1
> f := $1;
> #GaloisGroup(f);
16
```

We next create an algebraic closure $A$ and compute the roots of $f$ over $A$.

```magma
> A := AlgebraicClosure();
> r := Roots(f, A);
> #r;
8
> A;
Algebraically closed field with 8 variables
Defining relations:
[
    r8^8 - 2*r8^7 - 9*r8^6 + 10*r8^5 + 22*r8^4 - 14*r8^3 - 15*r8^2 + 2*r8 + 1,
    r7^8 - 2*r7^7 - 9*r7^6 + 10*r7^5 + 22*r7^4 - 14*r7^3 - 15*r7^2 + 2*r7 + 1,
    r6^8 - 2*r6^7 - 9*r6^6 + 10*r6^5 + 22*r6^4 - 14*r6^3 - 15*r6^2 + 2*r6 + 1,
    r5^8 - 2*r5^7 - 9*r5^6 + 10*r5^5 + 22*r5^4 - 14*r5^3 - 15*r5^2 + 2*r5 + 1,
    r4^8 - 2*r4^7 - 9*r4^6 + 10*r4^5 + 22*r4^4 - 14*r4^3 - 15*r4^2 + 2*r4 + 1,
    r3^8 - 2*r3^7 - 9*r3^6 + 10*r3^5 + 22*r3^4 - 14*r3^3 - 15*r3^2 + 2*r3 + 1,
    r2^8 - 2*r2^7 - 9*r2^6 + 10*r2^5 + 22*r2^4 - 14*r2^3 - 15*r2^2 + 2*r2 + 1,
    r1^8 - 2*r1^7 - 9*r1^6 + 10*r1^5 + 22*r1^4 - 14*r1^3 - 15*r1^2 + 2*r1 + 1
]
```

Finally we simplify $A$. There are defining polynomials of degrees 2 and 8 in the simplified field. The absolute polynomial of degree 16 defines the splitting field of $f$.

```magma
> time Simplify(A);
Time: 2.870
> A;
Algebraically closed field with 8 variables
Defining relations:
[
    r8 + 1/2*r3*r1^6 - 2*r3*r1^5 - r3*r1^4 + 8*r3*r1^3 - 2*r3*r1^2 -
        5*r3*r1 - 1/2*r3 + r1^7 - 3/2*r1^6 - 9*r1^5 + 4*r1^4 + 19*r1^3
        - r1^2 - 9*r1 - 5/2,
    r7 - 1/2*r3*r1^6 + 2*r3*r1^5 + r3*r1^4 - 8*r3*r1^3 + 2*r3*r1^2 +
        5*r3*r1 + 1/2*r3,
    r6 + r3 - 3/2*r1^7 + 2*r1^6 + 14*r1^5 - 5*r1^4 - 28*r1^3 + 3*r1^2
        + 19/2*r1,
    r5 - 1/2*r3*r1^6 + 2*r3*r1^5 + r3*r1^4 - 8*r3*r1^3 + 2*r3*r1^2 +
        4*r3*r1 + 1/2*r3 + r1^6 - r1^5 - 9*r1^4 - r1^3 + 14*r1^2 +
        6*r1,
    r4 + 1/2*r3*r1^6 - 2*r3*r1^5 - r3*r1^4 + 8*r3*r1^3 - 2*r3*r1^2 -
        4*r3*r1 - 1/2*r3 - 1,
    r3^2 - 3/2*r3*r1^7 + 2*r3*r1^6 + 14*r3*r1^5 - 5*r3*r1^4 -
        28*r3*r1^3 + 3*r3*r1^2 + 19/2*r3*r1 + 3/2*r1^6 - r1^5 -
        15*r1^4 - 4*r1^3 + 27*r1^2 + 11*r1 - 9/2,
    r2 + 1/2*r1^7 - 3/2*r1^6 - 4*r1^5 + 10*r1^4 + 10*r1^3 - 16*r1^2 -
        11/2*r1 + 3/2,
    r1^8 - 2*r1^7 - 9*r1^6 + 10*r1^5 + 22*r1^4 - 14*r1^3 - 15*r1^2 +
        2*r1 + 1
]
> AbsolutePolynomial(A);
x^16 - 36*x^14 + 488*x^12 - 3186*x^10 + 10920*x^8 - 19804*x^6 + 17801*x^4 -
    6264*x^2 + 64
```

<a id="example-ex-d2e9ca"></a>
#### `Example: Splitting Field of a Quartic as a Number Field (ex-d2e9ca)`

In this example we present the splitting field of $x^4 - x - 1$, whose Galois group is $S_4$, as a number field.

```magma
> P<x> := PolynomialRing(RationalField());
> f := x^4 - x - 1;
> #GaloisGroup(f);
24
> A := AlgebraicClosure();
> r := Roots(f, A);
> #r;
4
```

By default `NumberField` presents the splitting field as a tower, with one small defining polynomial per level: a root of $f$, a root of the residual cubic above it, then a root of the residual quadratic. The map $m$ sends the roots of $f$ in $A$ to roots of $f$ in $N$.

```magma
> N, m := NumberField(A);
> AbsoluteDegree(N);
24
> DefiningPolynomial(N);
$.1^2 + (r2 + r1)*$.1 + r2^2 + r1*r2 + r1^2
> DefiningPolynomial(BaseField(N));
$.1^3 + r1*$.1^2 + r1^2*$.1 + r1^3 - 1
> DefiningPolynomial(BaseField(BaseField(N)));
x^4 - x - 1
> Evaluate(f, m(r[1][1]));
0
```

With `Absolute` the same field is defined by a single polynomial of degree 24 in a primitive element. The size of that polynomial grows quickly with the degree of the field, which is why the tower is the default.

```magma
> Na, ma := NumberField(A : Absolute);
> DefiningPolynomial(Na);
x^24 + 80*x^20 + 340*x^18 + 7520*x^16 - 23120*x^14 + 1241022*x^12 -
    462400*x^10 + 48052400*x^8 - 61067260*x^6 + 756753632*x^4 +
    2074608720*x^2 + 1215289321
> Evaluate(f, ma(r[1][1]));
0
```

<a id="example-ex-fe6f00"></a>
#### `Example: Splitting Field of Degree 720 as a Tower (ex-fe6f00)`

For larger splitting fields the tower is the only practical presentation. The splitting field of $x^6 - x - 1$, whose Galois group is $S_6$, has degree 720. As a tower with one extension for each variable of $A$ it takes the time shown below. The `Absolute` presentation is orders of magnitude more expensive, and its defining polynomial is far too large to print.

```magma
> P<x> := PolynomialRing(IntegerRing());
> f := x^6 - x - 1;
> #GaloisGroup(f);
720
> A := AlgebraicClosure();
> r := Roots(f, A);
> time N, m := NumberField(A);
Time: 20.140
> Degree(N), AbsoluteDegree(N);
2 720
> Evaluate(f, m(r[1][1]));
0
```

<a id="rational-function-field"></a>
<a id="fldfunrat-main"></a>
## Rational Function Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/introduction.md)
- [Creation Functions](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#creation-of-structures)
    - [`FunctionField(R): Rng → FldFunRat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-functionfield-rng)
    - [`RationalFunctionField(R): Rng → FldFunRat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-rationalfunctionfield-rng)
    - [`FunctionField(R, r): Rng, RngIntElt → FldFunRat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-functionfield-rng-rngintelt)
    - [`RationalFunctionField(R, r): Rng, RngIntElt → FldFunRat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-rationalfunctionfield-rng-rngintelt)
    - [`FieldOfFractions(P): RngUPol → FldFunRat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-fieldoffractions-rngupol)
  - [Names](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#names)
    - [`AssignNames(~F, s): FldFunRat, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#procedure-assignnames-fldfunrat-monstgelt-ref)
    - [`Name(F, i): FldFunRat, RngIntElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-name-fldfunrat-rngintelt)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#creation-of-elements)
    - [`F ! [a, b]: FldFunRat, RngUPolElt, RngUPolElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#operation-op-fldfunrat-rngupolelt-rngupolelt)
    - [`elt< F | a, b >: FldFunRat, RngUPolElt, RngUPolElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#constructor-constructor-elt-fldfunrat-rngupolelt-rngupolelt-fldfunratelt)
    - [`F ! a: FldFunRat, FldElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#operation-op-fldfunrat-fldelt)
    - [`K . i: FldFunRat, RngIntElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#operation-operation-fldfunrat-rngintelt-fldfunratelt)
    - [`One(F): FldFunRat → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-one-fldfunrat)
    - [`Identity(F): FldFunRat → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-identity-fldfunrat)
    - [`Zero(F): FldFunRat → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-zero-fldfunrat)
    - [`Representative(F): FldFunRat → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#function-representative-fldfunrat)
    - [Example: Creating Rational Function Field Elements](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/creation.md#example-ex-64b44d)
- [Structure Operations](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#related-structures)
    - [`IntegerRing(F): FldFunRat → RngPol`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-integerring-fldfunrat)
    - [`RingOfIntegers(F): FldFunRat → RngPol`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-ringofintegers-fldfunrat)
    - [`BaseRing(F): FldFunRat → Rng`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-basering-fldfunrat)
    - [`CoefficientRing(F): FldFunRat → Rng`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-coefficientring-fldfunrat)
    - [`Rank(F): FldFunRat → RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-rank-fldfunrat)
    - [`ValuationRing(F): FldFunRat → RngVal`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-valuationring-fldfunrat)
    - [`ValuationRing(F, f): FldFunRat, RngUPolElt → RngVal`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-valuationring-fldfunrat-rngupolelt)
    - [`Category(R): FldFunRat → Cat`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-category-fldfunrat)
    - [`Parent(R): FldFunRat → Pow`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-parent-fldfunrat)
    - [`PrimeRing(R): FldFunRat → Rng`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-primering-fldfunrat)
  - [Invariants](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#invariants)
    - [`Characteristic(F): FldFunRat → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-characteristic-fldfunrat)
  - [Ring Predicates and Booleans](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#ring-predicates-and-booleans)
    - [`IsCommutative(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-iscommutative-fldfunrat)
    - [`IsUnitary(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isunitary-fldfunrat)
    - [`IsFinite(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isfinite-fldfunrat)
    - [`IsOrdered(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isordered-fldfunrat)
    - [`IsField(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isfield-fldfunrat)
    - [`IsEuclideanDomain(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-iseuclideandomain-fldfunrat)
    - [`IsPID(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-ispid-fldfunrat)
    - [`IsUFD(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isufd-fldfunrat)
    - [`IsDivisionRing(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isdivisionring-fldfunrat)
    - [`IsEuclideanRing(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-iseuclideanring-fldfunrat)
    - [`IsPrincipalIdealRing(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isprincipalidealring-fldfunrat)
    - [`IsDomain(F): FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#function-isdomain-fldfunrat)
    - [`F eq G: FldFunRat, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#operation-op-eq-fldfunrat-rng)
    - [`F ne G: FldFunRat, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#operation-op-ne-fldfunrat-rng)
  - [Homomorphisms](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#homomorphisms)
    - [`hom< P -> S | f, y₁, ..., yₙ >: FldFunRat, Rng → Map`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#constructor-constructor-hom-fldfunrat-rng-map)
    - [`hom< P -> S | y₁, ..., yₙ >: FldFunRat, Rng → Map`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#constructor-constructor-hom-fldfunrat-rng-map-2)
    - [Example: Homomorphism to a Number Field](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/operation.md#example-ex-bca4bf)
- [Element Operations](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md)
  - [Arithmetic](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#arithmetic)
    - [`+ a: FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-operation-fldfunratelt-fldfunratelt)
    - [`- a: FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-operation-fldfunratelt-fldfunratelt-2)
    - [`a + b: FldFunRatElt, FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-plus-fldfunratelt-fldfunratelt)
    - [`a - b: FldFunRatElt, FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-minus-fldfunratelt-fldfunratelt)
    - [`a * b: FldFunRatElt, FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-times-fldfunratelt-fldfunratelt)
    - [`a / b: FldFunRatElt, FldFunRatElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-div-fldfunratelt-fldfunratelt)
    - [`a ^ k: FldFunRatElt, RngIntElt → FldFunRatElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-pow-fldfunratelt-rngintelt)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#equality-and-membership)
    - [`a eq b: FldFunRatElt, FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-eq-fldfunratelt-fldfunratelt)
    - [`a ne b: FldFunRatElt, FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-ne-fldfunratelt-fldfunratelt)
    - [`a in F: FldFunRatElt, FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-in-fldfunratelt-fldfunrat)
    - [`a notin F: FldFunRatElt, FldFunRat → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#operation-op-notin-fldfunratelt-fldfunrat)
  - [Numerator, Denominator, and Degree](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#numerator-denominator-and-degree)
    - [`Numerator(f): FldFunRatElt → RngElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-numerator-fldfunratelt)
    - [`Numerator(f): RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-numerator-rngupolelt)
    - [`Numerator(f): RngMPolElt → RngMPolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-numerator-rngmpolelt)
    - [`Denominator(f): FldFunRatElt → RngElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-denominator-fldfunratelt)
    - [`Denominator(f): RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-denominator-rngupolelt)
    - [`Denominator(f): RngMPolElt → RngMPolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-denominator-rngmpolelt)
    - [`Degree(f): FldFunRatElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-degree-fldfunratelt)
    - [`TotalDegree(f): FldFunRatElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-totaldegree-fldfunratelt)
    - [`WeightedDegree(f): FldFunRatElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-weighteddegree-fldfunratelt)
    - [`Numerator(f, R): FldFunRatElt → RngElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-numerator-fldfunratelt-2)
    - [`Denominator(f, R): FldFunRatElt → RngElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-denominator-fldfunratelt-2)
  - [Predicates on Ring Elements](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#predicates-on-ring-elements)
    - [`IsZero(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-iszero-fldfunratelt)
    - [`IsOne(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isone-fldfunratelt)
    - [`IsMinusOne(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isminusone-fldfunratelt)
    - [`IsNilpotent(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isnilpotent-fldfunratelt)
    - [`IsIdempotent(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isidempotent-fldfunratelt)
    - [`IsUnit(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isunit-fldfunratelt)
    - [`IsZeroDivisor(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-iszerodivisor-fldfunratelt)
    - [`IsRegular(a): FldFunRatElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-isregular-fldfunratelt)
  - [Evaluation](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#evaluation)
    - [`Evaluate(f, r): FldFunRatUElt, RngElt → FldFunRatUElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-evaluate-fldfunratuelt-rngelt)
    - [`Evaluate(f, v, r): FldFunRatMElt, RngIntElt, RngElt → FldFunRatMElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-evaluate-fldfunratmelt-rngintelt-rngelt)
    - [`Evaluate(f, S): FldFunRatMElt, [RngElt] → RngElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-evaluate-fldfunratmelt-rngelt)
  - [Decomposition](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#decomposition)
    - [`Decomposition(f): FldFunRatUElt → [[FldFunRatUElt]]`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-decomposition-fldfunratuelt)
    - [Example: Decomposition of a Rational Function](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#example-ex-221d21)
  - [Derivative](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#derivative)
    - [`Derivative(f): FldFunRatUElt → FldFunRatUElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-derivative-fldfunratuelt)
    - [`Derivative(f, k): FldFunRatUElt, RngIntElt → FldFunRatUElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-derivative-fldfunratuelt-rngintelt)
    - [`Derivative(f, v): FldFunRatMElt, RngIntElt → FldFunRatMElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-derivative-fldfunratmelt-rngintelt)
    - [`Derivative(f, v, k): FldFunRatMElt, RngIntElt, RngIntElt → FldFunRatMElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-derivative-fldfunratmelt-rngintelt-rngintelt)
  - [Partial Fraction Decomposition](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#partial-fraction-decomposition)
    - [`PartialFractionDecomposition(f): FldFunRatUElt → [ <RngUPolElt, RngIntElt, RngUPolElt> ]`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-partialfractiondecomposition-fldfunratuelt)
    - [`SquarefreePartialFractionDecomposition(f): FldFunRatUElt → [ <RngUPolElt, RngIntElt, RngUPolElt> ]`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#function-squarefreepartialfractiondecomposition-fldfunratuelt)
    - [Example: Partial Fraction Decomposition](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/element.md#example-ex-2ba727)
- [Padé-Hermite Approximants](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md)
  - [Introduction](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#introduction)
  - [Ordering of Sequences](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#ordering-of-sequences)
    - [`MaximumDegree(f): SeqEnum → RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-maximumdegree-seqenum)
    - [Example: Maximum Degree of a Sequence](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-ea74e8)
    - [`TypeOfSequence(f): SeqEnum → RngIntElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-typeofsequence-seqenum)
    - [Example: Type of a Sequence](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-8d75ca)
    - [`MinimalVectorSequence(f,n): SeqEnum, RngIntElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-minimalvectorsequence-seqenum-rngintelt)
    - [Example: Minimal Vector Sequence of Power Series](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-67b928)
    - [Example: Minimal Vector Sequence of Polynomials](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-d1c2b6)
    - [Example: Minimal Vector Sequence of Higher Order](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-328015)
    - [Example: Minimal Vector Sequence with Distortion](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-1d53c0)
  - [Approximants](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#approximants)
    - [`PadeHermiteApproximant(f,d): SeqEnum, SeqEnum → ModTupRngElt, SeqEnum, RngIntElt`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-padhermapp)
    - [Example: Pade-Hermite Approximants](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-05a6f0)
    - [Example: Pade-Hermite Approximant with Distortion](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-e98d49)
    - [Example: Degrees and Valuations of Approximants](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-ea09f6)
    - [`PadeHermiteApproximant(f,m): SeqEnum, RngIntElt → ModTupRngElt, SeqEnum`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-padehermiteapproximant-seqenum-rngintelt)
    - [Example: Pade-Hermite Approximants of Vectors](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-b5d830)
    - [Example: Approximants of Sine, Cosine, and Exponential](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#example-ex-15b388)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/bibliography.md)

### Introduction

Given a ring $R$ such that there is a greatest-common-divisor algorithm for polynomials over $R$, Magma allows the construction of a rational function field $K$ in any number of indeterminates over $R$. Such function fields are objects of type `FldFunRat` with elements of type `FldFunRatElt`. The elements of $K$ are fractions whose numerators and denominators lie in the corresponding polynomial ring over $R$. As for polynomial rings, the different univariate and multivariate cases are distinguished, since the fractions just use the different representations given by the different cases of polynomial rings. A fraction $f$ lying in a function field $K$ is always *reduced*; this means that the numerator and denominator of $f$ are coprime and the denominator of $f$ is *normalized* (monic over fields and positive over ${\mathbb{Z}}$). Note that $R$ itself need not be a field. Thus it is possible, for example, to create the rational function field $K = {\mathbb{Z}}(t)$ which is mathematically equal to ${\mathbb{Q}}(t)$ of course, but will be represented slightly differently. A fraction in ${\mathbb{Q}}(t)$ will have a monic denominator (and the coefficients of both the numerator and denominator may be non-integral), while a fraction in ${\mathbb{Z}}(t)$ will have a positive denominator (and the coefficients of both the numerator and denominator will be integral). Thus the fractions $(3t + 2)/(4t - 2) \in {\mathbb{Z}}(t)$ and $((3/4)t + 1/2)/(t - 1/2) \in {\mathbb{Q}}(t)$ are equal and are both reduced in their respective fields. It is generally much better to use the domain of integers instead of the field of fractions for the coefficient ring $R$ (so it is better to use ${\mathbb{Z}}(t)$ instead of ${\mathbb{Q}}(t)$) since arithmetic is much faster, but the use of a field of fractions for the coefficient ring may be more desirable for output purposes.

### Creation Functions

#### Creation of Structures

<a id="function-functionfield-rng"></a>
##### `FunctionField(R): Rng -> FldFunRat`

<a id="function-rationalfunctionfield-rng"></a>
##### `RationalFunctionField(R): Rng -> FldFunRat`

```magma
Global: BoolElt                    Default: true
```

Create the field ${\mathbb{F}}$ of rational functions in $1$ indeterminate (consisting of quotients of univariate polynomials) over the integral domain $R$. The angle bracket notation may be used to assign names to the indeterminates, just as in the case of polynomial rings, e.g.: `K<t> := FunctionField(IntegerRing());`. By default, the unique *global* univariate function field over $R$ will be returned; if the parameter `Global` is set to `false`, then a non-global univariate function field over $R$ will be returned (to which a separate name for the indeterminate can be assigned).

<a id="function-functionfield-rng-rngintelt"></a>
##### `FunctionField(R, r): Rng, RngIntElt -> FldFunRat`

<a id="function-rationalfunctionfield-rng-rngintelt"></a>
##### `RationalFunctionField(R, r): Rng, RngIntElt -> FldFunRat`

```magma
Global: BoolElt                    Default: false
```

Create the field ${\mathbb{F}}$ of rational functions in $r$ indeterminates over the integral domain $R$. may be used to assign names to the indeterminates, just as in the case of polynomial rings, e.g.: `K<a,b,c> := FunctionField(IntegerRing(), 3);`. By default, a *non-global* function field will be returned; if the parameter `Global` is set to `true`, then the unique global function field over $R$ with $n$ variables will be returned. This may be useful in some contexts, but a non-global result is returned by default since one often wishes to have several function fields with the same numbers of variables but with different variable names (and create mappings between them, for example). Explicit coercion is always allowed between function fields having the same number of variables (and suitable base rings), whether they are global or not, and the coercion maps the $i$-variable of one function field to the $i$-th variable of the other function field.

<a id="function-fieldoffractions-rngupol"></a>
##### `FieldOfFractions(P): RngUPol -> FldFunRat`

Given a polynomial ring $P$, return its field of fractions $F$, consisting of quotients $f/g$, with $f, g\in P$. The angle bracket notation may be used to assign names to the indeterminates, just as in the case of polynomial rings: `K<t> := FieldOfFractions(P);`. If this function is called more than once for a fixed $P$, then the identical function field will be returned each time.

#### Names

<a id="procedure-assignnames-fldfunrat-monstgelt-ref"></a>
##### `AssignNames(~F, s): FldFunRat, [ MonStgElt ]`

Procedure to change the name of the indeterminates of a function field $F$. The $i$-th indeterminate will be given the name of the $i$-th element of the sequence of strings $s$ (for $1\leq i\leq \#s$); the sequence may have length less than the number of indeterminates of $F$, in which case the remaining indeterminate names remain unchanged. This procedure only changes the name used in printing the elements of $F$. It does *not* assign to identifiers corresponding to the strings the indeterminates in $F$; to do this, use an assignment statement, or use angle brackets when creating the field. Note that since this is a procedure that modifies $F$, it is necessary to have a reference `~F` to $F$ in the call to this function.

<a id="function-name-fldfunrat-rngintelt"></a>
##### `Name(F, i): FldFunRat, RngIntElt -> FldFunRatElt`

Given a function field $F$, return the $i$-th indeterminate of $F$ (as an element of $F$).

#### Creation of Elements

<a id="operation-op-fldfunrat-rngupolelt-rngupolelt"></a>
##### `F ! [a, b]: FldFunRat, RngUPolElt, RngUPolElt -> FldFunRatElt`

<a id="constructor-constructor-elt-fldfunrat-rngupolelt-rngupolelt-fldfunratelt"></a>
##### `elt< F | a, b >: FldFunRat, RngUPolElt, RngUPolElt -> FldFunRatElt`

Given the rational function field $F$ (which is the field of fractions of the polynomial ring $R$), and polynomials $a, b$ in $R$ (with $b\neq 0$), construct the rational function $a / b$.

<a id="operation-op-fldfunrat-fldelt"></a>
##### `F ! a: FldFunRat, FldElt -> FldFunRatElt`

Given the rational function field $F$ as a field of fractions of $R$, and a polynomial $a\in R$, create the rational function $a=a/1$ in $F$.

<a id="operation-operation-fldfunrat-rngintelt-fldfunratelt"></a>
##### `K . i: FldFunRat, RngIntElt -> FldFunRatElt`

The $i$-th generator for the field of fractions $K$ of $R$ over the coefficient ring of $R$.

<a id="function-one-fldfunrat"></a>
##### `One(F): FldFunRat -> FldFunRatElt`

<a id="function-identity-fldfunrat"></a>
##### `Identity(F): FldFunRat -> FldFunRatElt`

<a id="function-zero-fldfunrat"></a>
##### `Zero(F): FldFunRat -> FldFunRatElt`

<a id="function-representative-fldfunrat"></a>
##### `Representative(F): FldFunRat -> FldFunRatElt`

<a id="example-ex-64b44d"></a>
##### `Example: Creating Rational Function Field Elements (ex-64b44d)`

We create the field of rational functions over the integers in a single variable $w$.

```magma
> R<x> := PolynomialRing(Integers());
> F<w> := FieldOfFractions(R);
> F ! x+3;
w + 3
> F ! [ x, x-1 ];
w/(w - 1)
```

### Structure Operations

#### Related Structures

<a id="function-integerring-fldfunrat"></a>
##### `IntegerRing(F): FldFunRat -> RngPol`

<a id="function-ringofintegers-fldfunrat"></a>
##### `RingOfIntegers(F): FldFunRat -> RngPol`

Given the rational function field $F$ this returns the polynomial ring from which $F$ was constructed as its field of fractions.

<a id="function-basering-fldfunrat"></a>
##### `BaseRing(F): FldFunRat -> Rng`

<a id="function-coefficientring-fldfunrat"></a>
##### `CoefficientRing(F): FldFunRat -> Rng`

The coefficient ring of the (ring of integers of) the rational function field $F$.

<a id="function-rank-fldfunrat"></a>
##### `Rank(F): FldFunRat -> RngIntElt`

The rank (number of indeterminates) of the rational function field $F$.

<a id="function-valuationring-fldfunrat"></a>
##### `ValuationRing(F): FldFunRat -> RngVal`

Given the rational function field $F$ for which the coefficients come from a field, this returns the valuation ring of $F$ with respect to the valuation given by the degree. This valuation ring consists of those rational functions $g/h$ for which the degree of $h$ is greater than or equal to that of $g$.

<a id="function-valuationring-fldfunrat-rngupolelt"></a>
##### `ValuationRing(F, f): FldFunRat, RngUPolElt -> RngVal`

Given the rational function field $F$ for which the coefficients come from a field, and an irreducible polynomial $f$ in the ring of integers of $F$, this returns the valuation ring of $F$ with respect to the valuation associated with $f$. This valuation ring consists of those rational functions $g/h$ for which $f$ divides $g$ but not $h$.

<a id="function-category-fldfunrat"></a>
##### `Category(R): FldFunRat -> Cat`

<a id="function-parent-fldfunrat"></a>
##### `Parent(R): FldFunRat -> Pow`

<a id="function-primering-fldfunrat"></a>
##### `PrimeRing(R): FldFunRat -> Rng`

#### Invariants

<a id="function-characteristic-fldfunrat"></a>
##### `Characteristic(F): FldFunRat -> FldFunRatElt`

#### Ring Predicates and Booleans

<a id="function-iscommutative-fldfunrat"></a>
##### `IsCommutative(F): FldFunRat -> BoolElt`

<a id="function-isunitary-fldfunrat"></a>
##### `IsUnitary(F): FldFunRat -> BoolElt`

<a id="function-isfinite-fldfunrat"></a>
##### `IsFinite(F): FldFunRat -> BoolElt`

<a id="function-isordered-fldfunrat"></a>
##### `IsOrdered(F): FldFunRat -> BoolElt`

<a id="function-isfield-fldfunrat"></a>
##### `IsField(F): FldFunRat -> BoolElt`

<a id="function-iseuclideandomain-fldfunrat"></a>
##### `IsEuclideanDomain(F): FldFunRat -> BoolElt`

<a id="function-ispid-fldfunrat"></a>
##### `IsPID(F): FldFunRat -> BoolElt`

<a id="function-isufd-fldfunrat"></a>
##### `IsUFD(F): FldFunRat -> BoolElt`

<a id="function-isdivisionring-fldfunrat"></a>
##### `IsDivisionRing(F): FldFunRat -> BoolElt`

<a id="function-iseuclideanring-fldfunrat"></a>
##### `IsEuclideanRing(F): FldFunRat -> BoolElt`

<a id="function-isprincipalidealring-fldfunrat"></a>
##### `IsPrincipalIdealRing(F): FldFunRat -> BoolElt`

<a id="function-isdomain-fldfunrat"></a>
##### `IsDomain(F): FldFunRat -> BoolElt`

<a id="operation-op-eq-fldfunrat-rng"></a>
##### `F eq G: FldFunRat, Rng -> BoolElt`

<a id="operation-op-ne-fldfunrat-rng"></a>
##### `F ne G: FldFunRat, Rng -> BoolElt`

#### Homomorphisms

In its general form a ring homomorphism taking a function field $R(x_1, \ldots, x_n)$ as domain requires $n+1$ pieces of information, namely, a map (homomorphism) telling how to map the coefficient ring $R$ together with the images of the $n$ indeterminates.

<a id="constructor-constructor-hom-fldfunrat-rng-map"></a>
##### `hom< P -> S | f, y₁, ..., yₙ >: FldFunRat, Rng -> Map`

<a id="constructor-constructor-hom-fldfunrat-rng-map-2"></a>
##### `hom< P -> S | y₁, ..., yₙ >: FldFunRat, Rng -> Map`

Given a function field $F=R(x_1,\ldots, x_n)$, a ring $S$, a map $f : F\ar S$, and $n$ elements $y_1, \ldots, y_n\in S$, create the homomorphism $g : F\ar S$ by applying the rules of $g(rx_1^{a_1}\cdots x_n^{a_n})=f(r)y_1^{a_1}\cdots y_n^{a_n}$ for monomials, linearity for polynomials, i.e., $g(M+N)=g(M)+g(N)$, and division for fractions, i.e., $g(n/d)=g(n)/g(d)$. The coefficient ring map may be omitted, in which case the coefficients are mapped into $S$ by the unitary homomorphism sending $1_R$ to $1_S$. Also, the images $y_i$ are allowed to be from a structure that allows automatic coercion into $S$.

<a id="example-ex-bca4bf"></a>
##### `Example: Homomorphism to a Number Field (ex-bca4bf)`

In this example we map ${\mathbb{Q}}(x, y)$ into the number field ${\mathbb{Q}}(\root 3 \of 2, \sqrt{5})$ by sending $x$ to $\root 3 \of 2$ and $y$ to $\sqrt{5}$ and the identity map on the coefficients (which we omit).

```magma
> Q := RationalField();
> F<x, y> := FunctionField(Q, 2);
> A<a> := PolynomialRing(IntegerRing());
> N<z, w> := NumberField([a^3-2, a^2+5]);
> h := hom< F -> N | z, w >;
> h(x^11*y^3-x+4/5*y-13/4);
-40*w*z^2 - z + 4/5*w - 13/4
> h(x/3);
1/3*z
> h(1/x);
1/2*z^2
> 1/z;
1/2*z^2
```

### Element Operations

#### Arithmetic

<a id="operation-operation-fldfunratelt-fldfunratelt"></a>
##### `+ a: FldFunRatElt -> FldFunRatElt`

<a id="operation-operation-fldfunratelt-fldfunratelt-2"></a>
##### `- a: FldFunRatElt -> FldFunRatElt`

<a id="operation-op-plus-fldfunratelt-fldfunratelt"></a>
##### `a + b: FldFunRatElt, FldFunRatElt -> FldFunRatElt`

<a id="operation-op-minus-fldfunratelt-fldfunratelt"></a>
##### `a - b: FldFunRatElt, FldFunRatElt -> FldFunRatElt`

<a id="operation-op-times-fldfunratelt-fldfunratelt"></a>
##### `a * b: FldFunRatElt, FldFunRatElt -> FldFunRatElt`

<a id="operation-op-div-fldfunratelt-fldfunratelt"></a>
##### `a / b: FldFunRatElt, FldFunRatElt -> FldFunRatElt`

<a id="operation-op-pow-fldfunratelt-rngintelt"></a>
##### `a ^ k: FldFunRatElt, RngIntElt -> FldFunRatElt`

#### Equality and Membership

<a id="operation-op-eq-fldfunratelt-fldfunratelt"></a>
##### `a eq b: FldFunRatElt, FldFunRatElt -> BoolElt`

<a id="operation-op-ne-fldfunratelt-fldfunratelt"></a>
##### `a ne b: FldFunRatElt, FldFunRatElt -> BoolElt`

<a id="operation-op-in-fldfunratelt-fldfunrat"></a>
##### `a in F: FldFunRatElt, FldFunRat -> BoolElt`

<a id="operation-op-notin-fldfunratelt-fldfunrat"></a>
##### `a notin F: FldFunRatElt, FldFunRat -> BoolElt`

#### Numerator, Denominator, and Degree

<a id="function-numerator-fldfunratelt"></a>
##### `Numerator(f): FldFunRatElt -> RngElt`

<a id="function-numerator-rngupolelt"></a>
##### `Numerator(f): RngUPolElt -> RngUPolElt`

<a id="function-numerator-rngmpolelt"></a>
##### `Numerator(f): RngMPolElt -> RngMPolElt`

Given a rational function $f\in K$, the field of fractions of $R$, return the numerator $P$ of $f=P/Q$ as an element of the polynomial ring $R$.

<a id="function-denominator-fldfunratelt"></a>
##### `Denominator(f): FldFunRatElt -> RngElt`

<a id="function-denominator-rngupolelt"></a>
##### `Denominator(f): RngUPolElt -> RngUPolElt`

<a id="function-denominator-rngmpolelt"></a>
##### `Denominator(f): RngMPolElt -> RngMPolElt`

Given a rational function $f\in K$, the field of fractions of $R$, return the denominator $Q$ of $f=P/Q$ as an element of the polynomial ring $R$.

<a id="function-degree-fldfunratelt"></a>
##### `Degree(f): FldFunRatElt -> RngIntElt`

Given a rational function $f$ in a univariate function field, return the degree of $f$ as an integer (the maximum of the degree of the numerator of $f$ and the degree of the denominator of $f$).

<a id="function-totaldegree-fldfunratelt"></a>
##### `TotalDegree(f): FldFunRatElt -> RngIntElt`

Given a rational function $f$ in a multivariate function field, return the total degree of $f$ as an integer (the total degree of the numerator of $f$ minus the total degree of the denominator of $f$).

<a id="function-weighteddegree-fldfunratelt"></a>
##### `WeightedDegree(f): FldFunRatElt -> RngIntElt`

Given a rational function $f$ in a multivariate function field, return the weighted degree of $f$ as an integer (the weighted degree of the numerator of $f$ minus the weighted degree of the denominator of $f$).

<a id="function-numerator-fldfunratelt-2"></a>
##### `Numerator(f, R): FldFunRatElt -> RngElt`

<a id="function-denominator-fldfunratelt-2"></a>
##### `Denominator(f, R): FldFunRatElt -> RngElt`

Return the numerator or denominator of $f$ with respect to the ring of integers $R$ of the rational function field $F$ containing $f$. The ring $R$ may be a polynomial ring or a valuation ring.

#### Predicates on Ring Elements

<a id="function-iszero-fldfunratelt"></a>
##### `IsZero(a): FldFunRatElt -> BoolElt`

<a id="function-isone-fldfunratelt"></a>
##### `IsOne(a): FldFunRatElt -> BoolElt`

<a id="function-isminusone-fldfunratelt"></a>
##### `IsMinusOne(a): FldFunRatElt -> BoolElt`

<a id="function-isnilpotent-fldfunratelt"></a>
##### `IsNilpotent(a): FldFunRatElt -> BoolElt`

<a id="function-isidempotent-fldfunratelt"></a>
##### `IsIdempotent(a): FldFunRatElt -> BoolElt`

<a id="function-isunit-fldfunratelt"></a>
##### `IsUnit(a): FldFunRatElt -> BoolElt`

<a id="function-iszerodivisor-fldfunratelt"></a>
##### `IsZeroDivisor(a): FldFunRatElt -> BoolElt`

<a id="function-isregular-fldfunratelt"></a>
##### `IsRegular(a): FldFunRatElt -> BoolElt`

#### Evaluation

<a id="function-evaluate-fldfunratuelt-rngelt"></a>
##### `Evaluate(f, r): FldFunRatUElt, RngElt -> FldFunRatUElt`

Given a univariate rational function $f$ in $F$, return the rational function in $F$ obtained by evaluating the indeterminate in $r$, which must be from (or coercible into) the coefficient ring of the integers of $F$.

<a id="function-evaluate-fldfunratmelt-rngintelt-rngelt"></a>
##### `Evaluate(f, v, r): FldFunRatMElt, RngIntElt, RngElt -> FldFunRatMElt`

Given a multivariate rational function $f$ in $F$, return the rational function in $F$ obtained by evaluating the $v$-th variable in $r$, which must be from (or coercible into) the coefficient ring of the integers of $F$.

<a id="function-evaluate-fldfunratmelt-rngelt"></a>
##### `Evaluate(f, S): FldFunRatMElt, [RngElt] -> RngElt`

Given a multivariate rational function $f$ in $F$ return the result of evaluating the $v$-th variable at the $v$-th element of the sequence $S$ which should be a sequence of elements coercible into the coefficient ring of the integers of $F$.

#### Decomposition

The following function provides an inverse operation to composing rational functions.

<a id="function-decomposition-fldfunratuelt"></a>
##### `Decomposition(f): FldFunRatUElt -> [[FldFunRatUElt]]`

```magma
All: BoolElt                    Default: true
```

Given a rational function $f$ defined over a field $k$, return all complete decompositions $[f_1,\ldots, f_r]$ of $f$ such that $f(t) = f_r(\ldots(f_1(t))$. These decompositions are found, as explained in [[ACvHS17](https://docs.magma-maths.org/references.md#cite-szutkoski)], by computing the subfield lattice of $k(t)/k(f)$, which in turn, is found by first computing the principal subfields of this extension and then computing all intersections of principal subfields. These intersections are computed by joining partitions.

The routines in this package are those developed by Peter Fleischmann and Jonas Szutkoski.

<a id="example-ex-221d21"></a>
##### `Example: Decomposition of a Rational Function (ex-221d21)`

We show a decomposition of a rational function and the corresponding evaluations which retrieve the function which was decomposed.

```magma
> k:=GF(3);
> F<t>:=FunctionField(k);
> f:=(t^10 + 2*t^8 + 2*t^4 + t^2)/(t^12 + 2*t^6 + 1);
> Decomposition(f);
[
    [
        t^2,
        t/(t^2 + 1),
        (2*t^3 + t^2 + 2*t)/(t^3 + 2)
    ],
    [
        t/(t^2 + 2),
        t^2,
        t/(t^3 + 1)
    ],
    [
        t/(t^2 + 1),
        t^3 + 2*t,
        t^2
    ],
    [
        t/(t^2 + 1),
        t^2 + t,
        t^3 + t^2
    ],
    [
        t/(t^2 + 1),
        t^2 + 2*t,
        t^3 + t^2
    ],
    [
        t/(t^2 + 1),
        t^2,
        t^3 + t^2 + t
    ]
]
> Decomposition(f : All := false);
[
    [
        t^2,
        t/(t^2 + 1),
        (2*t^3 + t^2 + 2*t)/(t^3 + 2)
    ]
]
> Evaluate($1[1][3], Evaluate($1[1][2], $1[1][1])) eq f;
true
```

#### Derivative

<a id="function-derivative-fldfunratuelt"></a>
##### `Derivative(f): FldFunRatUElt -> FldFunRatUElt`

Given a univariate rational function $f$, return the first derivative of $f$ with respect to its variable.

<a id="function-derivative-fldfunratuelt-rngintelt"></a>
##### `Derivative(f, k): FldFunRatUElt, RngIntElt -> FldFunRatUElt`

Given a univariate rational function $f$, return the $k$-th derivative of $f$ with respect to its variable. $k$ must be non-negative.

<a id="function-derivative-fldfunratmelt-rngintelt"></a>
##### `Derivative(f, v): FldFunRatMElt, RngIntElt -> FldFunRatMElt`

Given a multivariate rational function $f$, return the first derivative of $f$ with respect to variable number $v$.

<a id="function-derivative-fldfunratmelt-rngintelt-rngintelt"></a>
##### `Derivative(f, v, k): FldFunRatMElt, RngIntElt, RngIntElt -> FldFunRatMElt`

Given a multivariate rational function $f$, return the $k$-th derivative of $f$ with respect to variable number $v$. $k$ must be non-negative.

#### Partial Fraction Decomposition

<a id="function-partialfractiondecomposition-fldfunratuelt"></a>
##### `PartialFractionDecomposition(f): FldFunRatUElt -> [ <RngUPolElt, RngIntElt, RngUPolElt> ]`

Given a univariate rational function $f$ in $F=K(x)$, return the (unique) complete partial fraction decomposition of $f$. The decomposition is returned as a (sorted) sequence $Q$ consisting of triples, each of which is of the form $<d, k, n>$ where $d$ is the denominator, $k$ is the multiplicity of the denominator, and $n$ is the corresponding numerator, and also $d$ is irreducible and the degree of $n$ is strictly less than the degree of $d$. Thus $f$ equals the sum of the $n_t/{d_t}^{k_t}$, where $t$ ranges over the triples contained in $Q$. If $f$ is improper (the degree of its numerator is greater than or equal to the degree of its denominator), then the first triple of $Q$ will be of the form $<1, 1, q>$ where $q$ is the quotient of the numerator of $f$ by the denominator of $f$.

<a id="function-squarefreepartialfractiondecomposition-fldfunratuelt"></a>
##### `SquarefreePartialFractionDecomposition(f): FldFunRatUElt -> [ <RngUPolElt, RngIntElt, RngUPolElt> ]`

Given a univariate rational function $f$ in $F=K(x)$, return the (unique) complete squarefree partial fraction decomposition of $f$. The decomposition is returned as a (sorted) sequence $Q$ consisting of triples, each of which is of the form $<d, k, n>$ where $d$ is the denominator, $k$ is the multiplicity of the denominator, and $n$ is the corresponding numerator, and also $d$ is squarefree and the degree of $n$ is strictly less than the degree of $d$. Thus $f$ equals the sum of the $n_t/{d_t}^{k_t}$, where $t$ ranges over the triples contained in $Q$. If $f$ is improper (the degree of its numerator is greater than or equal to the degree of its denominator), then the first triple of $Q$ will be of the form $<1, 1, q>$ where $q$ is the quotient of the numerator of $f$ by the denominator of $f$.

<a id="example-ex-2ba727"></a>
##### `Example: Partial Fraction Decomposition (ex-2ba727)`

We compute the squarefree and complete (irreducible) partial fraction decompositions of a fraction in $Q(t)$.

```magma
> F<t> := FunctionField(RationalField());
> P<x> := IntegerRing(F);
> f := ((t + 1)^8 - 1) / ((t^3 - 1)*(t + 1)^2*(t^2 - 4)^2);
> SD := SquarefreePartialFractionDecomposition(f);
> SD;
[
    <x^4 + 2*x^3 - x - 2, 1, 467/196*x^3 + 1371/196*x^2 +
        1391/196*x + 234/49>,
    <x^2 - x - 2, 1, -271/196*x + 505/98>,
    <x^2 - x - 2, 2, 271/14*x + 139/7>
]
> // Check appropriate sum equals f:
> &+[F!t[3] / F!t[1]^t[2]: t in SD] eq f;
> D := PartialFractionDecomposition(f);
> D;
[
    <x - 2, 1, -3683/2646>,
    <x - 2, 2, 410/63>,
    <x - 1, 1, 85/36>,
    <x + 1, 1, 1/108>,
    <x + 1, 2, 1/18>,
    <x + 2, 1, 1/18>,
    <x^2 + x + 1, 1, -5/147*x - 8/147>
]
> // Check appropriate sum equals f:
> &+[F!t[3] / F!t[1]^t[2]: t in D] eq f;
true
```

Note that doing the same operation in the function field $Z(t)$ must modify the numerators and denominators to be integral but the result is otherwise the same.

```magma
> F<t> := FunctionField(IntegerRing());
> P<x> := IntegerRing(F);
> f := ((t + 1)^8 - 1) / ((t^3 - 1)*(t + 1)^2*(t^2 - 4)^2);
> D := PartialFractionDecomposition(f);
> D;
[
    <2646*x - 5292, 1, -3683>,
    <63*x - 126, 2, 25830>,
    <36*x - 36, 1, 85>,
    <108*x + 108, 1, 1>,
    <18*x + 18, 2, 18>,
    <18*x + 36, 1, 1>,
    <147*x^2 + 147*x + 147, 1, -5*x - 8>
]
> // Check appropriate sum equals f:
> &+[F!t[3] / F!t[1]^t[2]: t in D] eq f;
true
```

Finally, we compute the partial fraction decomposition of a fraction in a function field whose coefficient ring is a multivariate function field.

```magma
> R<a, b> := FunctionField(IntegerRing(), 2);
> F<t> := FunctionField(R);
> P<x> := IntegerRing(F);
> f := 1 / ((t^2 - a)^2*(t + b)^2*t^3);
> SD := SquarefreePartialFractionDecomposition(f);
> SD;
[
    <x^3 + b*x^2 - a*x - a*b, 1, (-3*a - 2*b^2)/(a^3*b^4)*x^2 +
        (-a - 2*b^2)/(a^3*b^3)*x + (3*a + 3*b^2)/(a^2*b^4)>,
    <x^3 + b*x^2 - a*x - a*b, 2, (a + b^2)/(a^2*b^3)*x^2 +
        1/a^2*x + (-a - b^2)/(a*b^3)>,
    <x, 1, (3*a + 2*b^2)/(a^3*b^4)>,
    <x, 2, -2/(a^2*b^3)>,
    <x, 3, 1/(a^2*b^2)>
]
> // Check appropriate sum equals f:
> &+[F!t[3] / F!t[1]^t[2]: t in SD] eq f;
true
> D := PartialFractionDecomposition(f);
> D;
[
    <x, 1, (3*a + 2*b^2)/(a^3*b^4)>,
    <x, 2, -2/(a^2*b^3)>,
    <x, 3, 1/(a^2*b^2)>,
    <x + b, 1, (-3*a + 7*b^2)/(a^3*b^4 - 3*a^2*b^6 + 3*a*b^8 -
        b^10)>,
    <x + b, 2, -1/(a^2*b^3 - 2*a*b^5 + b^7)>,
    <x^2 - a, 1, (-3*a^2 - 3*a*b^2 + 2*b^4)/(a^6 - 3*a^5*b^2 +
        3*a^4*b^4 - a^3*b^6)*x + (6*a*b - 2*b^3)/(a^5 - 3*a^4*b^2
        + 3*a^3*b^4 - a^2*b^6)>,
    <x^2 - a, 2, (a + b^2)/(a^4 - 2*a^3*b^2 + a^2*b^4)*x -
        2*b/(a^3 - 2*a^2*b^2 + a*b^4)>
]
> // Check appropriate sum equals f:
> &+[F!t[3] / F!t[1]^t[2]: t in D] eq f;
true
```

<a id="pade-hermite-approximants"></a>
<a id="padehermite"></a>
<a id="padherm"></a>
### Padé-Hermite Approximants

#### Introduction

A given rational function $F(z)\in k(z)$ over a field $k$ can be written as a power series $f(z)$ in the completion $k((z))$ of $k(z)$ at the place $(z)$. It thus is a good approximation of $f(z)$ in the sense that $F(z)$ is equal to $f(z)$ up to infinite order.

Padé-Hermite approximants deal with the converse. Given a (formal) power series $f(z)\in k[[z]]$ and some non- negative integers $n_P$ and $n_Q$, find polynomials $P(z), Q(z)\in k[z]$ of degrees at most $n_P$ and $n_Q$, respectively, such that $P(z)*f(z)-Q(z) = O(z^{n_P+n_Q+1})$ holds. In other words, $P/Q(z)$ is an approximation for $f(z)$ for polynomials $P$ and $Q$ of limited degree in $z$. In this notation the pair $[P,Q]$ is known as the Padé-Hermite approximant for the power series tuple $(f,-1)$.

The idea of approximating one power series by two polynomials can be extended to approximating several power series at the same time as follows. Consider the vector $\underline{f}^T:= (f_1, f_2, \ldots, f_m)^T$ in the $m$-dimensional vector space $k((z))^m$ over a power series ring. Let $\underline{n}=(n_1, n_2,\ldots, n_m)$ be an m-tuple of non-negative integers. A *Padé-Hermite approximant* of $\underline{f}^T(z)$ of type $\underline{n}$ is a non-zero vector of polynomials $\underline{P}=(P_1,P_2,\ldots,P_m)$ in $k[z]^m$ such that $\underline{P}\cdot\underline{f}^T = O(z^{N})$ , $N=n_1+n_2+\cdots+n_m+m-1$, is satisfied. A non-trivial Padé-Hermite approximant always exists. The approximant is contained in the sub-space $V_{\underline{f},N}=\{ \underline{Q}\in k[z]^m : \underline{Q}\cdot\underline{f}^T = O(z^{N})\}$.

The implementation of Padé-Hermite approximants is based on [[Der94](https://docs.magma-maths.org/references.md#cite-derksen94)] and [[BL94a](https://docs.magma-maths.org/references.md#cite-bl94)]. They are implemented in Magma as sequences rather than vectors.

#### Ordering of Sequences

A Padé-Hermite approximant to some sequence of power series does not have to be unique. They can be ordered according to their maximum degree and their type of sequence. A sequence $\underline{P}=[P_1, P_2,..., P_m]$ is of degree $i$ if the maximum of the weak degrees of $P_1, P_2, \ldots, P_m$ is $i$. An extension of the definition maximum degree is when a distortion of non-negative integers $\underline{d}=[d_1, d_2, \ldots, d_m]$ on the degrees is allowed. In this case the maximum degree is defined as the maximum of $\deg{P_i}-d_i$. The type of $\underline{P}$ identifies the last $P_i$ in $\underline{P}$ whose weak degree equals the maximum degree of $\underline{P}$. Again a distortion on the degrees is allowed.

<a id="function-maximumdegree-seqenum"></a>
##### `MaximumDegree(f): SeqEnum -> RngIntElt`

```magma
Distortion: SeqEnum                    Default: []
```

MaximumDegree returns the degree of a sequence of polynomials or power series, defined as the maximum of the degrees of $f[i]-d[i]$, where $d$ is the distortion. The value -infinity is returned in the case that $f$ is weakly equal to the zero-sequence.

<a id="example-ex-ea74e8"></a>
##### `Example: Maximum Degree of a Sequence (ex-ea74e8)`

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [u+u^2, 2+u^2+u^3,0];
> MaximumDegree(f);
3
> MaximumDegree(f:Distortion:=[]);
3
> MaximumDegree(f:Distortion:=[0,2,1]);
2
> MaximumDegree([S|0,0]);
-Infinity
> MaximumDegree([O(u)]);
-Infinity
```

<a id="function-typeofsequence-seqenum"></a>
##### `TypeOfSequence(f): SeqEnum -> RngIntElt, RngIntElt`

```magma
Distortion: SeqEnum                    Default: []
```

Returns the highest index $i$ for those $f[i]$ whose (distorted) degree is weakly equal to the maximum of the degrees of all entries. The second integer returned is the maximum degree of the sequence.

<a id="example-ex-8d75ca"></a>
##### `Example: Type of a Sequence (ex-8d75ca)`

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [u+u^2, 2+u^2+u^3,0];
> TypeOfSequence(f);
2 3
> TypeOfSequence(f:Distortion:=[]);
2 3
> TypeOfSequence(f:Distortion:=[0,2,1]);
1 2
> TypeOfSequence([S|0,0]);
2 -Infinity
```

The Padé-Hermite approximant of $\underline{f}$ can be seen as an element of the free module $k[z]^m$ of rank $m$, or as an element of the sub-space $V_{\underline{f},N}$.

A free sub-model $V\subset k[z]^m$ is generated by $m$ polynomial vectors $\underline{Q}_i$, $1=1,2,\ldots,m$, such that $\underline{Q}_1(z),  \underline{Q}_2(z), \ldots, \underline{Q}_m(z)$ form a minimal vector sequence of $V$. Such a sequence is defined as a sequence $S$ of $m$ vectors in $V$, such that $S[i]$ is a non-trivial polynomial vector in $V$ of minimal degree of type $i$, for $i=1,2,\ldots,m$. A minimal vector sequence is not unique.

Two variations on a minimal vector sequence are implemented. The first allows a distortion as an attribute. The sequence is the based on the distorted maximal degree. The second attribute sets the positive power $p$ of $z$ in each of the $\underline{Q}_i$ as follows. Instead of considering $\underline{Q}_i(z)$ for each $i$, one considers $\underline{Q}_i(z^p)$.

<a id="function-minimalvectorsequence-seqenum-rngintelt"></a>
##### `MinimalVectorSequence(f, n): SeqEnum, RngIntElt -> SeqEnum`

```magma
Distortion: SeqEnum                      Default: []
Power     : RngIntElt                    Default: 1
```

A minimal sequence of vectors $\underline{Q}_1, \underline{Q}_2, \ldots, \underline{Q}_m$ with respect to the sequence $f$ of length $m$ whose entries are polynomials or power series. The order of $\underline{Q}_i\cdot f$ is at least $m$.

<a id="example-ex-67b928"></a>
##### `Example: Minimal Vector Sequence of Power Series (ex-67b928)`

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [u+u^2, 2+u^2+u^3];
> seq := MinimalVectorSequence(f, 2);
> seq;
[
    (u 0),
    (   -1 1/2*u)
]
> sums := [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
> sums;
[
    u^2 + u^3,
    -u^2 + 1/2*u^3 + 1/2*u^4
]
> seq := MinimalVectorSequence(f,3);
> #seq eq 2,  seq[1], seq[2];
true (u^2   0)
(-1 + u  1/2*u)
```

<a id="example-ex-d1c2b6"></a>
##### `Example: Minimal Vector Sequence of Polynomials (ex-d1c2b6)`

```magma
> L<x> := PolynomialRing(Rationals());
> f := [1+x, 3-x^2, 5+x+x^3-x^5];
> seq := MinimalVectorSequence(f, 10);
> seq[1];
(-2*x^2 + 6   -2*x - 2          0)
> sums := [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
> sums;
[
    0,
    0,
    x^10
]
```

<a id="example-ex-328015"></a>
##### `Example: Minimal Vector Sequence of Higher Order (ex-328015)`

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [2*u^4,2+u^3+u^6];
> seq := MinimalVectorSequence(f, 10);
> seq;
[
    (1/2*u^6       0),
    (-1/2 - 1/4*u^3        1/2*u^4)
]
> sums := [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
> sums;
[
    u^10,
    1/2*u^10
]
```

<a id="example-ex-1d53c0"></a>
##### `Example: Minimal Vector Sequence with Distortion (ex-1d53c0)`

```magma
> S<u> := PowerSeriesRing(Rationals());
> f :=  [1+u-7*u^2, 6-3*u+1/2*u^2-u^3, 5-u+u^2];
> seq := MinimalVectorSequence(f, 5);
>  [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
[
    0,
    u^5,
    0
]
> seq := MinimalVectorSequence(f, 5:Distortion:=[2,0,1]);
> [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
[
    -7/2*u^5,
    u^5,
    0
]
> p:=2;
> seq := MinimalVectorSequence(f, 5:Distortion:=[2,0,1], Power:=p);
> sums := [&+([Q[i]*f[i]: i in [1..#f]]) : Q in seq];
> sums;
> mp:= map<S->S|  x :-> (IsWeaklyZero(x) select 0
>     else  &+([Coefficient(x,i)*(S.1)^(p*i) :  i in Exponents(x)]))
>       + (ISA(Type(v),RngIntElt) select O((S.1)^(p*v))
>   else S!0 where v := AbsolutePrecision(x))>;
> sums := [&+([mp(Q[i])*f[i]: i in [1..#f]]) : Q in seq];
> sums;
[
    u^6 + u^7 - 7*u^8,
    u^5 - 23/3*u^6,
    -5/3*u^5 + 35/3*u^6
]
```

#### Approximants

The Padé-Hermite approximant of type $\underline{d}=[d_1,d_2,\ldots,d_m]$ with respect to the tuple $\underline{f}^T\in k((z))^m$ is an element of the space $V_{\underline{f},N}=\{ \underline{Q}\in k[z]^m : \underline{Q}\cdot\underline{f}^T = O(z^{N})\}$ for $N$ equal to $d_1+d_2+\cdots+d_m+m-1$. This space is generated by the vectors in the minimal vector sequence with respect to $\underline{f}$ with distortion $\underline{d}$. The routine [`PadeHermiteApproximant`](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/padehermite.md#function-padhermapp) returns one that is smallest with respect to the degree on sequences. The input sequence $\underline{f}$ must be a sequence of polynomial ring elements, or be a power series sequence. While the Padé Hermite approximants theoretically are polynomials, Magma returns them as elements of the same ring the entries of $\underline{f}$ are contained in.

<a id="function-padhermapp"></a>
##### `PadeHermiteApproximant(f, d): SeqEnum, SeqEnum -> ModTupRngElt, SeqEnum, RngIntElt`

```magma
Power: RngIntElt                    Default: 1
```

Returns a Padé-Hermite form $\underline{P}$ of $f$ with distortion $d$, smallest with respect to the degree on sequences, and the corresponding minimal vector sequence. The third argument returned is the order in the order term of $\underline{P}\cdot f$.

<a id="example-ex-05a6f0"></a>
##### `Example: Pade-Hermite Approximants (ex-05a6f0)`

This example can be found on page 813 in [[BL94a](https://docs.magma-maths.org/references.md#cite-bl94)].

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [1,u,u/(1-u^4)+u^10+O(u^16),u/(1+u^4)+u^12+O(u^16)];
> pade, padebasis, ord := PadeHermiteApproximant(f,[2,2,2,2]);
> pade, ord;
( u -1  0  0)
11
> BaseRing(Parent(pade)) eq S;
true
> MinimalVectorSequence(f,10);
[
    ( u -1  0  0),
    (   0  u^4 -1/2  1/2),
    (         0    1 - u^4 -1/2 + u^4       -1/2),
    (    0    -u 1/2*u 1/2*u)
]
>
> p := 2;
> seq := MinimalVectorSequence(f,10: Distortion :=[2,2,2,2],Power := p);
> seq;
[
    (u^5   0   0   0),
    (   0  u^2 -1/2  1/2),
    (         0    1 - u^2 -1/2 + u^2       -1/2),
    (    0    -u 1/2*u 1/2*u)
]
> mp:= map<S->S|  x :-> (IsWeaklyZero(x) select 0
>     else  &+([Coefficient(x,i)*(S.1)^(p*i) :  i in Exponents(x)]))
>       + (ISA(Type(v),RngIntElt) select O((S.1)^(p*v))
>   else S!0 where v := AbsolutePrecision(x))>;
> sums := [&+([mp(Q[i])*f[i]: i in [1..#f]]) : Q in seq];
> [Valuation(v) : v in sums];
[ 10, 10, 10, 11 ]
> sums;
[
    u^10,
    -1/2*u^10 + 1/2*u^12 - u^13 + O(u^16),
    -1/2*u^10 - 1/2*u^12 + u^13 + u^14 + O(u^16),
    u^11 + 1/2*u^12 + 1/2*u^14 + O(u^18)
]
```

<a id="example-ex-e98d49"></a>
##### `Example: Pade-Hermite Approximant with Distortion (ex-e98d49)`

This example covers the example on page 815 in [[BL94a](https://docs.magma-maths.org/references.md#cite-bl94)].

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [1,u, -1-u^4-2*u^8+u^10+u^11-u^12+O(u^16),-u-u^5-u^9-u^14-u^15+O(u^16)];
> dist:=[2,2,3,3];
> seq := MinimalVectorSequence(f,13:Distortion:=dist);
> pade, padebasis, ord :=  PadeHermiteApproximant(f,dist);
> pade, ord;
(-u  1  0  0)
13
> padebasis;
[
    (-u  1  0  0),
    (1/2*u -1/2*u^4 1/2*u + 1/2*u^3 + 1/2*u^4 -1/2*u^2 - 1/2*u^3 - u^4),
    (-1/2 1/2*u^3 -1/2 - 1/2*u^2 - 1/2*u^3 - u^4 1/2*u + 1/2*u^2 + 2*u^3),
    (      -u        0        0 -1 + u^4)
]
> padebasis eq seq;
true
> [[Valuation(w[i]): i in [1..Degree(w)]] : w in seq];
[
    [ 1, 0, Infinity, Infinity ],
    [ 1, 4, 1, 2 ],
    [ 0, 3, 0, 1 ],
    [ 1, Infinity, Infinity, 0 ]
]
> [[MaximumDegree([w[i]])-dist[i]: i in [1..Degree(w)] ] : w in seq];
[
    [ -1, -2, -Infinity, -Infinity ],
    [ -1, 2, 1, 1 ],
    [ -2, 1, 1, 0 ],
    [ -1, -Infinity, -Infinity, 1 ]
]
> p:=2;
> seq := MinimalVectorSequence(f,12:Distortion:=dist,Power:=p);
> seq;
[
    (  u - u^3         0 u - 2*u^3         0),
    (-1 - u + u^2 -u^3 -1 - u + 2*u^2 + u^3 -u^3),
    (u + u^2 - u^3 0 u + u^2 - 2*u^3 - u^4 0),
    (      0       1       0 1 - u^2)
]
> seq[1]-seq[3];
(      -u^2          0 -u^2 + u^4          0)
> mp:= map<S->S|  x :-> (IsWeaklyZero(x) select 0
>     else  &+([Coefficient(x,i)*(S.1)^(p*i) :  i in Exponents(x)]))
>       + (ISA(Type(v),RngIntElt) select O((S.1)^(p*v))
>   else S!0 where v := AbsolutePrecision(x))>;
>  [Valuation(&+([mp(Q[i])*f[i]: i in [1..#f]])) : Q in seq];
[ 12, 12, 13, 13 ]
```

<a id="example-ex-ea09f6"></a>
##### `Example: Degrees and Valuations of Approximants (ex-ea09f6)`

This example considers the example on page 816 in [[BL94a](https://docs.magma-maths.org/references.md#cite-bl94)].

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [1,u,-1-u^4-2*u^8+u^10+O(u^12),-u-u^5-u^9+u^10+O(u^12)];
> dist := [2,2,3,3];
> seq := MinimalVectorSequence(f,12: Distortion := dist);
> [[MaximumDegree([w[i]])-dist[i]: i in [1..Degree(w)] ] : w in seq];
[
    [ -1, -2, -Infinity, -Infinity ],
    [ -2, 1, 0, 0 ],
    [ -Infinity, -Infinity, 1, 0 ],
    [ -1, -Infinity, 0, 1 ]
]
> [Valuation(&+([(Q[i])*f[i]: i in [1..#f]]) ) : Q in seq];
[ Infinity, 12, 12, 12 ]
> [MaximumDegree([ &+([(Q[i])*f[i]: i in [1..#f]]) ]) : Q in seq];
[ -Infinity, -Infinity, 14, -Infinity ]
> PadeHermiteApproximant(f,[2,2,3,3]);
> p := 2;
> seq := MinimalVectorSequence(f,12:Distortion:=[2,2,3,3],Power:=p);
> seq;
[
    (  1 - u^2        -1 1 - 2*u^2  -1 + u^2),
    (   0 -u^4    0 -u^4),
    (      -u       -1 -u + u^3 -1 + u^2),
    (      0       u       0 u - u^3)
]
> [[MaximumDegree([w[i]])-dist[i]: i in [1..Degree(w)] ] : w in seq];
[
    [ 0, -2, -1, -1 ],
    [ -Infinity, 2, -Infinity, 1 ],
    [ -1, -2, 0, -1 ],
    [ -Infinity, -1, -Infinity, 0 ]
]
> mp:= map<S->S|  x :-> (IsWeaklyZero(x) select 0
>     else  &+([Coefficient(x,i)*(S.1)^(p*i) :  i in Exponents(x)]))
>       + (ISA(Type(v),RngIntElt) select O((S.1)^(p*v))
>   else S!0 where v := AbsolutePrecision(x))>;
>
> [Valuation(&+([mp(Q[i])*f[i]: i in [1..#f]])) : Q in seq];
[ 12, 13, 12, 12 ]
```

A variant of the Padé-Hermite approximant is when the exponent in the order term is set rather that the type of the sequence. It is also possible to let $\underline{f}$ be a sequence such that its entries themselves are vectors of polynomials or power series.

<a id="function-padehermiteapproximant-seqenum-rngintelt"></a>
##### `PadeHermiteApproximant(f, m): SeqEnum, RngIntElt -> ModTupRngElt, SeqEnum`

```magma
Power: RngIntElt                    Default: 1
```

Returns a Padé-Hermite form of minimal degree in the corresponding minimal vector sequence, such that its inproduct with $f$ has order at least $m$. The second argument returned is the corresponding minimal vector sequence.

<a id="example-ex-b5d830"></a>
##### `Example: Pade-Hermite Approximants of Vectors (ex-b5d830)`

This example can be found on page 813 in [[BL94a](https://docs.magma-maths.org/references.md#cite-bl94)].

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [Vector([1]), Vector([u])];
> pade, seq := PadeHermiteApproximant(f,3);
Calculating the Pade'-Hermite approximant for the sequence [
    1,
    u
]
with order term 3 and power 1 .
> pade;
( u -1)
> seq;
[
    ( u -1),
    (  0 u^2)
]
> mat := Matrix([Eltseq(v): v in f]);
> pade*mat;
(0)
> PadeHermiteApproximant([1,u],5);
( u -1)
[
    ( u -1),
    (  0 u^4)
]
> PadeHermiteApproximant(f,3:Power:=2);
> g:= [Vector([1,0,0]), Vector([0,1,0]), Vector([1+u,2+u^2,u^3])];
> pade := PadeHermiteApproximant(g,5);
Calculating the Pade'-Hermite approximant for the sequence [
    1,
    u,
    1 + 2*u + u^3 + u^7 + u^11
]
with order term 15 and power 3 .
> pade;
(-u^3 - u^4     -2*u^3        u^3)
> pade*Matrix([Eltseq(v): v in g]);
(  0 u^5 u^6)
```

<a id="example-ex-15b388"></a>
##### `Example: Approximants of Sine, Cosine, and Exponential (ex-15b388)`

This example considers Padé-Hermite approximants for some series that have non-trivial power series expansions.

```magma
> S<u> := PowerSeriesRing(Rationals());
> f := [Sin(u), Cos(u), Exp(u)];
> [Valuation(f[i]) : i in [1..#f]], [Degree(f[i]) : i in [1..#f]];
[ 1, 0, 0 ]
[ 19, 20, 20 ]
> [AbsolutePrecision(f[i]) : i in [1..#f]];
[ 21, 22, 21 ]
> dist := [3,2,5];
> pade, seq, ord := PadeHermiteApproximant(f,dist);
> 1/420*pade;
(-1275 - 255*u + 45*u^2 + 5*u^3 120 + 495*u + 75*u^2 -120 + 900*u - 600*u^2 +
    160*u^3 - 20*u^4 + u^5)
> ord eq &+(dist)+#f-1, ord;
true 12
> [Degree(pade[i]) : i in [1..Degree(pade)]];
[ 3, 2, 5 ]
> g:= [Cos(2*u)*(u+1)+3,Cos(u)^2+u*Cos(u)+1,Cos(2*u)+1,Cos(u)];
> pade, basis := PadeHermiteApproximant(g,20);
> 131/75880*pade;
(          2    -4 + 2*u        -3*u 4*u - 2*u^2)
> h := [ 1+u^2-u^7+u^12, Sin(u), Exp(u) ];
> dist:=[3,1,2];
> seq := MinimalVectorSequence(h,8:Distortion := dist);
> sums := [&+([Q[i]*h[i]: i in [1..#f]]) : Q in seq];
> [Valuation(s) : s in sums];
[ 8, 8, 8 ]
> [[MaximumDegree([w[i]]): i in [1..Degree(w)] ] : w in seq];
[
    [ 4, 1, 2 ],
    [ 4, 2, 2 ],
    [ 3, 1, 2 ]
]
>  [[MaximumDegree([w[i]])-dist[i]: i in [1..Degree(w)] ] : w in seq];
[
    [ 1, 0, 0 ],
    [ 1, 1, 0 ],
    [ 0, 0, 0 ]
]
```

<a id="function-field"></a>
<a id="fldfung-main"></a>
## Algebraic Function Fields

- [Introduction](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/introduction.md)
  - [Representations of Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/introduction.md#representations-of-fields)
- [Creation of Algebraic Function Fields and their Orders](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md)
  - [Creation of Algebraic Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#creation-of-algebraic-function-fields)
    - [`ext< K | f >: FldFunRat, RngUPolElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#constructor-constructor-ext-fldfunrat-rngupolelt-fldfun)
    - [`ext< K | f >: FldFun, RngUPolElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#constructor-constructor-ext-fldfun-rngupolelt-fldfun)
    - [`FunctionField(f : parameters): RngUPolElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-functionfield-rngupolelt)
    - [`FunctionField(f : parameters): RngMPolElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-functionfield-rngmpolelt)
    - [`FunctionField(S): [RngUPolElt] → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-functionfield-rngupolelt-2)
    - [`HermitianFunctionField(p, d): RngIntElt, RngIntElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-hermitianfunctionfield-rngintelt-rngintelt)
    - [`HermitianFunctionField(q): RngIntElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-hermitianfunctionfield-rngintelt)
    - [`sub<F | S>: FldFun, [] → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#constructor-constructor-sub-fldfun-fldfun)
    - [`sub<F | s₁, ..., sᵣ >: FldFun, [] → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#constructor-constructor-sub-fldfun-fldfun-2)
    - [`AssignNames(~F, s): FldFun, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#procedure-assignnames-fldfun-monstgelt-ref)
    - [`AssignNames(~a, s): FldFunElt, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#procedure-assignnames-fldfunelt-monstgelt-ref)
    - [`FunctionField(R): Rng → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-functionfield-rng)
    - [Example: Creating a Function Field Extension](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-4f7d5b)
    - [Example: Creating a Relative Extension](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-b33520)
    - [Example: Creating a Non-Simple Extension](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-5f689c)
    - [Example: Hermitian Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-5c6691)
  - [Construction of Orders of Algebraic Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#construction-of-orders-of-algebraic-function-fields)
    - [`EquationOrderFinite(F): FldFun → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-equationorderfinite-fldfun)
    - [`MaximalOrderFinite(F): FldFun → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-maximalorderfinite-fldfun)
    - [`EquationOrderInfinite(F): FldFun → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-equationorderinfinite-fldfun)
    - [`MaximalOrderInfinite(F): FldFun → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-maximalorderinfinite-fldfun)
    - [`IntegralClosure(R, F): Rng, FldFun → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-integralclosure-rng-fldfun)
    - [`EquationOrder(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-equationorder-rngfunord)
    - [`MaximalOrder(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-fldfung-max-ord-al)
    - [`SetOrderMaximal(O, b): RngFunOrd, BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#procedure-setordermaximal-rngfunord-boolelt)
    - [`ext<O | f>: RngFunOrd, RngUPolElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#constructor-constructor-ext-rngfunord-rngupolelt-rngfunord)
    - [Example: Creating Orders of a Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-68faea)
    - [Example: Integral Closure in a Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-4ba3aa)
    - [`Order(O, T, d): RngFunOrd, AlgMatElt, RngElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-order-rngfunord-algmatelt-rngelt)
    - [`Order(O, M): RngFunOrd, ModDed → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-order-rngfunord-modded)
    - [`Order(O, S): RngFunOrd, [FldFunElt] → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-order-rngfunord-fldfunelt)
    - [`Simplify(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-simplify-rngfunord)
    - [`O1 + O2: RngFunOrd, RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#operation-op-plus-rngfunord-rngfunord)
    - [`O1 meet O2: RngFunOrd, RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#operation-op-meet-rngfunord-rngfunord)
    - [`AsExtensionOf(O1, O2): RngFunOrd, RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-asextensionof-rngfunord-rngfunord)
    - [Example: Further Order Constructions](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#example-ex-b548f7)
  - [Orders and Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#orders-and-ideals)
    - [`MultiplicatorRing(I): RngFunOrdIdl → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-multiplicatorring-rngfunordidl)
    - [`pMaximalOrder(O, p): RngFunOrd, RngFunOrdIdl → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-pmaximalorder-rngfunord-rngfunordidl)
    - [`pMaximalOrder(O, p): RngFunOrd, RngElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-pmaximalorder-rngfunord-rngelt)
    - [`pRadical(O, p): RngFunOrd, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-pradical-rngfunord-rngfunordidl)
    - [`pRadical(O, p): RngFunOrd, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-pradical-rngfunord-rngelt)
- [Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#parent-and-category)
    - [`Category(F): FldFun → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-category-fldfun)
    - [`Category(O): RngFunOrd → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-category-rngfunord)
    - [`Parent(F): FldFun → Pow`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-parent-fldfun)
    - [`Parent(O): RngFunOrd → Pow`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-parent-rngfunord)
  - [Other Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#other-related-structures)
    - [`PrimeRing(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-primering-fldfun)
    - [`PrimeField(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-primefield-fldfun)
    - [`PrimeRing(O): RngFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-primering-rngfunord)
    - [`ConstantField(F): FldFunG → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-constantfield-fldfung)
    - [`DefiningConstantField(F): FldFunG → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-definingconstantfield-fldfung)
    - [`ExactConstantField(F): FldFunG → Rng, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-exactconstantfield-fldfung)
    - [`BaseRing(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-basering-fldfun)
    - [`BaseField(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-basefield-fldfun)
    - [`CoefficientRing(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-coefficientring-fldfun)
    - [`CoefficientField(F): FldFun → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-coefficientfield-fldfun)
    - [`ISABaseField(F,G): Fld, Fld → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-isabasefield-fld-fld)
    - [`BaseRing(O): RngFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-basering-rngfunord)
    - [`CoefficientRing(O): RngFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-coefficientring-rngfunord)
    - [`BaseRing(FF): FldFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-basering-fldfunord)
    - [`BaseField(FF): FldFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-basefield-fldfunord)
    - [`CoefficientRing(FF): FldFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-coefficientring-fldfunord)
    - [`CoefficientField(FF): FldFunOrd → Rng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-coefficientfield-fldfunord)
    - [`SubOrder(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-suborder-rngfunord)
    - [`FunctionField(O): RngFunOrd → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-functionfield-rngfunord)
    - [`FieldOfFractions(O): RngFunOrd → FldFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-fieldoffractions-rngfunord)
    - [`FieldOfFractions(FF): FldFunOrd → FldFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-fieldoffractions-fldfunord)
    - [`FieldOfFractions(F): FldFun → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-fieldoffractions-fldfun)
    - [`Order(FF): FldFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-order-fldfunord)
    - [`RationalExtensionRepresentation(F): FldFunG → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-rationalextensionrepresentation-fldfung)
    - [`AbsoluteOrder(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-absoluteorder-rngfunord)
    - [`AbsoluteFunctionField(F): FldFunG → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-absolutefunctionfield-fldfung)
    - [`UnderlyingRing(F): FldFunG → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-underlyingring-fldfung)
    - [`UnderlyingField(F): FldFunG → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-underlyingfield-fldfung)
    - [`UnderlyingRing(F, R): FldFunG, Rng → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-underlyingring-fldfung-rng)
    - [`UnderlyingField(F, R): FldFunG, Rng → FldFunG`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-underlyingfield-fldfung-rng)
    - [`Embed(F, L, a): FldFun, FldFun, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#procedure-embed-fldfun-fldfun-fldfunelt)
    - [`Embed(F, L, s): FldFun, FldFun, [FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#procedure-embed-fldfun-fldfun-fldfunelt-2)
    - [`HasEmbedding(O1, O2): RngFunOrd, RngFunOrd → Bool`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-hasembedding-rngfunord-rngfunord)
    - [`CanComputeEmbedding(O1, O2): RngFunOrd, RngFunOrd → Bool`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-cancomputeembedding-rngfunord-rngfunord)
    - [`Places(F): FldFunG → PlcFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-places-fldfung)
    - [`DivisorGroup(F): FldFun → DivFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-divisorgroup-fldfun)
    - [`DifferentialSpace(F): FldFun → DiffFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-differentialspace-fldfun)
    - [Example: Constant and Coefficient Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#example-ex-a0477f)
    - [Example: Underlying Rings of a Relative Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#example-ex-efbad3)
    - [`WeilRestriction(E, n): FldFun, RngIntElt → FldFun, UserProgram`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-weilrestriction-fldfun-rngintelt)
    - [`ConstantFieldExtension(F, E): FldFun, Rng → FldFun, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-constantfieldextension-fldfun-rng)
    - [Example: Extending to the Exact Constant Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#example-ex-01df8e)
    - [`MonicModel(F): FldFun → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-monicmodel-fldfun)
    - [`Reduce(O): RngFunOrd → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-reduce-rngfunord)
    - [`Localization(O, p): RngFunOrd, RngFunOrdIdl → RngVal, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-related.md#function-localization-rngfunord-rngfunordidl)
- [General Structure Invariants](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md)
  - [`Characteristic(F): FldFun → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-characteristic-fldfun)
  - [`Characteristic(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-characteristic-rngfunord)
  - [`IsPerfect(F): Fld → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-isperfect-fld)
  - [`Degree(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-degree-fldfung)
  - [`Degree(F, G): FldFun, FldFun → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-degree-fldfun-fldfun)
  - [`Degree(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-degree-rngfunord)
  - [`AbsoluteDegree(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-absolutedegree-fldfung)
  - [`AbsoluteDegree(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-absolutedegree-rngfunord)
  - [`DefiningPolynomial(F): FldFun → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-definingpolynomial-fldfun)
  - [`DefiningPolynomial(O): RngFunOrd → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-definingpolynomial-rngfunord)
  - [`DefiningPolynomials(F): FldFun → [RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-definingpolynomials-fldfun)
  - [`DefiningPolynomials(O): RngFunOrd → [RngUPolElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-definingpolynomials-rngfunord)
  - [`Basis(F): FldFunG → SeqEnum[FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-basis-fldfung)
  - [`Basis(O): RngFunOrd → SeqEnum[FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-basis-rngfunord)
  - [`Basis(O, R): RngFunOrd, Rng → SeqEnum[RngElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-basis-rngfunord-rng)
  - [`TransformationMatrix(O1, O2): RngFunOrd, RngFunOrd → AlgMatElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-transformationmatrix-rngfunord-rngfunord)
  - [`CoefficientIdeals(O): RngFunOrd → [RngFunOrdIdl]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-coefficientideals-rngfunord)
  - [`BasisMatrix(O): RngFunOrd → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-basismatrix-rngfunord)
  - [`PrimitiveElement(O): RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-primitiveelement-rngfunord)
  - [`Discriminant(O): RngFunOrd → .`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-discriminant-rngfunord)
  - [`AbsoluteDiscriminant(O): RngFunOrd → .`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-absolutediscriminant-rngfunord)
  - [`DimensionOfExactConstantField(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-dimensionofexactconstantfield-fldfung)
  - [`DegreeOfExactConstantField(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-degreeofexactconstantfield-fldfung)
  - [`Genus(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-genus-fldfung)
  - [Example: Invariants of a Relative Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#example-ex-a8d7ef)
  - [Example: Invariants of a Non-Simple Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#example-ex-ec93f9)
  - [`GapNumbers(F): FldFunG → SeqEnum[RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-gapnumbers-fldfung)
  - [`GapNumbers(F, P): FldFunG, PlcFunElt → SeqEnum[RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-gapnumbers-fldfung-plcfunelt)
  - [`GapNumbers(P): PlcFunElt → SeqEnum[RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-gapnumbers-plcfunelt)
  - [`SeparatingElement(F): FldFunG → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-separatingelement-fldfung)
  - [`RamificationDivisor(F): FldFunG → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-ramificationdivisor-fldfung)
  - [`WeierstrassPlaces(F): FldFunG → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-weierstrassplaces-fldfung)
  - [`WronskianOrders(F): FldFunG → [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-wronskianorders-fldfung)
  - [`Different(O): RngFunOrd → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-different-rngfunord)
  - [`Index(O, S): RngFunOrd, RngFunOrd → Any`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-invar.md#function-index-rngfunord-rngfunord)
- [Galois Groups](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md)
  - [`GaloisGroup(f): RngUPolElt → GrpPerm, [ RngElt ], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-rngupolelt)
  - [`GaloisGroup(F): FldFun → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-fldfun)
  - [`GaloisGroup(F): FldFun[FldFun[FldFunRat]] → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-fldfun-fldfun-fldfunrat)
  - [`GaloisGroup(F): FldFun[FldFin] → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-fldfun-fldfin)
  - [`GaloisGroup(F): FldFun[FldFunRat] → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-fldfun-fldfunrat)
  - [`GaloisGroup(F): FldFun[FldRat] → GrpPerm, [RngElt], GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoisgroup-fldfun-fldrat)
  - [Example: Galois Group over a Rational Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#example-ex-0264c2)
  - [Example: Galois Groups in Positive Characteristic](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#example-ex-93f3e8)
  - [`GeometricGaloisGroup(f): RngUPolElt → GrpPerm, RngUPolElt, GaloisData`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-geometricgaloisgroup-rngupolelt)
  - [`HilbertIrreducibilityCurves(f): RngUPolElt → SetEnum, SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-hilbertirreducibilitycurves-rngupolelt)
  - [Example: Geometric Galois Group](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#example-ex-2194f2)
  - [Splitting Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#splitting-fields)
    - [`GaloisSplittingField(f): RngUPolElt → FldFun, [FldFunElt], GrpPerm, [[FldFunElt]]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-galoissplittingfield-rngupolelt)
    - [Example: Galois Splitting Field of a Polynomial](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#example-ex-36697a)
    - [Solvability by Radicals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#solvability-by-radicals)
      - [`SolveByRadicals(f): RngUPolElt → FldFun, [FldFunElt], [FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-solvebyradicals-rngupolelt)
      - [`CyclicToRadical(K, a, z): FldFun, FldFunElt, RngElt → FldFun, [FldFunElt], [FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#function-cyclictoradical-fldfun-fldfunelt-rngelt)
      - [Example: Solving a Polynomial by Radicals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/galois.md#example-ex-0a9a35)
- [Subfields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/subfields.md)
  - [`Subfields(F): FldFun → SeqEnum[FldFun]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/subfields.md#function-subfields-fldfun)
  - [Example: Subfields of a Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/subfields.md#example-ex-aeb7db)
- [Automorphism Group](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md)
  - [Automorphisms over the Base Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#automorphisms-over-the-base-field)
    - [`Automorphisms(K, k): FldFun, FldFunG → [Map]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphisms-fldfun-fldfung)
    - [`AutomorphismGroup(K, k): FldFun, FldFunG → GrpFP, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphismgroup-fldfun-fldfung)
    - [Example: Automorphisms of a Degree 7 Extension](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#example-ex-796d6f)
    - [`IsSubfield(K, L): FldFun, FldFun → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-issubfield-fldfun-fldfun)
    - [`IsIsomorphicOverQt(K, L): FldFun, FldFun → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-isisomorphicoverqt-fldfun-fldfun)
    - [Example: Subfields and Isomorphism Testing](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#example-ex-40fb2d)
  - [General Automorphisms](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#general-automorphisms)
    - [`Isomorphisms(K, E): FldFunG, FldFunG → [Map]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-isomorphisms-fldfung-fldfung)
    - [`IsIsomorphic(K, E): FldFunG, FldFunG → BoolElt, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-isisomorphic-fldfung-fldfung)
    - [`Automorphisms(K): FldFunG → [Map]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphisms-fldfung)
    - [`Isomorphisms(K,E,p1,p2): FldFunG, FldFunG, PlcFunElt, PlcFunElt → [Map]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-isomorphisms-fldfung-fldfung-plcfunelt-plcfunelt)
    - [`Automorphisms(K,p1,p2): FldFunG, PlcFunElt, PlcFunElt → [Map]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphisms-fldfung-plcfunelt-plcfunelt)
    - [`AutomorphismGroup(K): FldFunG → GrpFP, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphismgroup-fldfung)
    - [`AutomorphismGroup(K,f): FldFunG, Map → Grp, Map, SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-automorphismgroup-fldfung-map)
  - [Field Morphisms](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#field-morphisms)
    - [`IsMorphism(f): Map → Bool`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-ismorphism-map)
    - [`FieldMorphism(f): Map → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-fieldmorphism-map)
    - [`IdentityFieldMorphism(F): Fld → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-identityfieldmorphism-fld)
    - [`IsIdentity(f): Map → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-isidentity-map)
    - [`Equality(f, g): Map, Map → Bool`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-equality-map-map)
    - [`HasInverse(f): Map → MonStgElt, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-hasinverse-map)
    - [`Composition(f, g): Map, Map → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#function-composition-map-map)
    - [Example: Isomorphisms of Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/automorphism-group.md#example-ex-9d9eb5)
- [Global Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md)
  - [Functions relative to the Exact Constant Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#functions-relative-to-the-exact-constant-field)
    - [`NumberOfPlacesOfDegreeOverExactConstantField(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoverexactconstantfield-fldfun-rngintelt)
    - [`NumberOfPlacesDegECF(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesdegecf-fldfun-rngintelt)
    - [`NumberOfPlacesOfDegreeOneOverExactConstantField(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneoverexactconstantfield-fldfung)
    - [`NumberOfPlacesOfDegreeOneECF(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneecf-fldfung)
    - [`NumberOfPlacesOfDegreeOneOverExactConstantField(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneoverexactconstantfield-fldfung-rngintelt)
    - [`NumberOfPlacesOfDegreeOneECF(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneecf-fldfun-rngintelt)
    - [`SerreBound(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-serrebound-fldfung)
    - [`SerreBound(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-serrebound-fldfung-rngintelt)
    - [`SerreBound(q, g): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-serrebound-rngintelt-rngintelt)
    - [`IharaBound(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-iharabound-fldfung)
    - [`IharaBound(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-iharabound-fldfung-rngintelt)
    - [`IharaBound(q, g): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-iharabound-rngintelt-rngintelt)
    - [`NumberOfPlacesOfDegreeOneECFBound(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneecfbound-fldfung)
    - [`NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfung)
    - [`NumberOfPlacesOfDegreeOneECFBound(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneecfbound-fldfun-rngintelt)
    - [`NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfung-rngintelt)
    - [`NumberOfPlacesOfDegreeOneECFBound(q, g): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneecfbound-rngintelt-rngintelt)
    - [`NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(q, g): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-numberofplacesofdegreeoneoverexactconstantfieldbound-rngintelt-rngintelt)
    - [`LPolynomial(F): FldFunG → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-lpolynomial-fldfung)
    - [`LPolynomial(F, m): FldFunG, RngIntElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-lpolynomial-fldfung-rngintelt)
    - [`ZetaFunction(F): FldFunG → FldFunRatUElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-zetafunction-fldfung)
    - [`ZetaFunction(F, m): FldFunG, RngIntElt → FldFunRatUElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-zetafunction-fldfung-rngintelt)
  - [Functions Relative to the Constant Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#functions-relative-to-the-constant-field)
    - [`Places(F, m): FldFunG, RngIntElt → SeqEnum[PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-places-fldfung-rngintelt)
    - [`HasPlace(F, m): FldFunG, RngIntElt → BoolElt, PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-hasplace-fldfung-rngintelt)
    - [`HasRandomPlace(F, m): FldFunG, RngIntElt → BoolElt, PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-hasrandomplace-fldfung-rngintelt)
    - [`RandomPlace(F, m): FldFunG, RngIntElt → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-randomplace-fldfung-rngintelt)
    - [Example: Invariants of a Global Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#example-ex-8f580e)
    - [Example: Invariants of a Global Relative Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#example-ex-9f3184)
  - [Functions related to Class Group](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#functions-related-to-class-group)
    - [`UnitRank(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-unitrank-rngfunord)
    - [`UnitGroup(O): RngFunOrd → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-unitgroup-rngfunord)
    - [`Regulator(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-regulator-rngfunord)
    - [`PrincipalIdealMap(O): RngFunOrd → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-principalidealmap-rngfunord)
    - [Example: Unit Group of an Equation Order](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#example-ex-1591a6)
    - [`ClassGroup(F : parameters): FldFunG → GrpAb, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroup-fldfung)
    - [`ClassGroup(O): RngFunOrd → GrpAb, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroup-rngfunord)
    - [`ClassGroupExactSequence(O): RngFunOrd → Map, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroupexactsequence-rngfunord)
    - [`ClassGroupAbelianInvariants(F : parameters): FldFunG → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroupabelianinvariants-fldfung)
    - [`ClassGroupAbelianInvariants(O): RngFunOrd → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroupabelianinvariants-rngfunord)
    - [`ClassNumber(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classnumber-fldfung)
    - [`ClassNumber(O): RngFunOrd → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classnumber-rngfunord)
    - [Example: Class Groups of Relative Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#example-ex-dd2e5e)
    - [`GlobalUnitGroup(F): FldFunG → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-globalunitgroup-fldfung)
    - [`ClassGroupPRank(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-classgroupprank-fldfung)
    - [`HasseWittInvariant(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-hassewittinvariant-fldfung)
    - [`IndependentUnits(O): RngFunOrd → SeqEnum[RngFunOrdElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-independentunits-rngfunord)
    - [`FundamentalUnits(O): RngFunOrd → SeqEnum[RngFunOrdElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#function-fundamentalunits-rngfunord)
    - [Example: Basis and Fundamental Units of a Maximal Order](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/global.md#example-ex-065c59)
- [Structure Predicates](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md)
  - [`IsField(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isfield-fldfun)
  - [`IsEuclideanDomain(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-iseuclideandomain-fldfun)
  - [`IsField(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isfield-rngfunord)
  - [`IsPID(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-ispid-fldfun)
  - [`IsUFD(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isufd-fldfun)
  - [`IsDivisionRing(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isdivisionring-fldfun)
  - [`IsEuclideanRing(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-iseuclideanring-fldfun)
  - [`IsDivisionRing(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isdivisionring-rngfunord)
  - [`IsPrincipalIdealRing(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isprincipalidealring-fldfun)
  - [`IsDomain(R): FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isdomain-fldfun)
  - [`IsDomain(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isdomain-rngfunord)
  - [`F eq G: FldFunG, FldFunG → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#operation-op-eq-fldfung-fldfung)
  - [`F ne G: FldFunG, FldFunG → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#operation-op-ne-fldfung-fldfung)
  - [`O1 eq O2: RngFunOrd, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#operation-op-eq-rngfunord-rng)
  - [`O1 ne O2: RngFunOrd, Rng → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#operation-op-ne-rngfunord-rng)
  - [`O1 subset O2: RngFunOrd, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#operation-op-subset-rngfunord-rngfunord)
  - [`IsGlobal(F): FldFunG → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isglobal-fldfung)
  - [`IsRationalFunctionField(F): FldFunG → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isrationalfunctionfield-fldfung)
  - [`IsFiniteOrder(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isfiniteorder-rngfunord)
  - [`IsEquationOrder(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isequationorder-rngfunord)
  - [`IsAbsoluteOrder(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isabsoluteorder-rngfunord)
  - [`IsMaximal(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-ismaximal-rngfunord)
  - [`IsTamelyRamified(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-istamelyramified-rngfunord)
  - [`IsTotallyRamified(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-istotallyramified-rngfunord)
  - [`IsUnramified(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isunramified-rngfunord)
  - [`IsWildlyRamified(O): RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-iswildlyramified-rngfunord)
  - [`IsInKummerRepresentation(K): FldFun → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isinkummerrepresentation-fldfun)
  - [`IsInArtinSchreierRepresentation(K): FldFun → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/structure-predicates.md#function-isinartinschreierrepresentation-fldfun)
- [Homomorphisms](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md)
  - [`hom<F -> R | g>: FldFun, Rng, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-fldfun-rng-rngelt-map)
  - [`hom<F -> R | cf, g>: FldFun, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-fldfun-rng-map-rngelt-map)
  - [`hom< O -> R | g >: RngFunOrd, Rng, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-rngfunord-rng-rngelt-map)
  - [`hom< O -> R | cf, g >: RngFunOrd, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-rngfunord-rng-map-rngelt-map)
  - [`IsRingHomomorphism(m): Map → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#function-isringhomomorphism-map)
  - [Example: Homomorphisms of Relative Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#example-ex-1107ee)
  - [`hom< O -> R | b₁, ..., bₙ >: RngFunOrd, Rng, RngElt, ..., RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-rngfunord-rng-rngelt-rngelt-map)
  - [`hom< O -> R | m, b₁, ..., bₙ >: RngFunOrd, Rng, Map, RngElt, ..., RngElt → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/hom.md#constructor-constructor-hom-rngfunord-rng-map-rngelt-rngelt-map)
- [Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#creation-of-elements)
    - [`F . 1: FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfun-fldfunelt)
    - [`F . 2: FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfun-fldfunelt-2)
    - [`Name(F, i): FldFun, RngIntElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-name-fldfun-rngintelt)
    - [`O . i: RngFunOrd, RngIntElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-rngfunord-rngintelt-fldfunordelt)
    - [`FF . i: FldFunOrd, RngIntElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfunord-rngintelt-fldfunordelt)
    - [`F ! a: FldFun, . → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-fldfun)
    - [`elt<F | a>: FldFun, . → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-fldfun-fldfunelt)
    - [`O ! a: RngFunOrd, . → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-rngfunord)
    - [`elt<O | a>: RngFunOrd, . → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-rngfunord-rngfunordelt)
    - [`FF ! a: FldFunOrd, Any → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-fldfunord-any)
    - [`elt<FF | a>: FldFunOrd, Any → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-fldfunord-any-fldfunordelt)
    - [`elt< F | a₀, a₁, ..., aₙ₋₁>: FldFun, RngElt, ..., RngElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-fldfun-rngelt-rngelt-fldfunelt)
    - [`elt< O | a₁, a₂, ..., aₙ>: RngFunOrd, RngElt, ..., RngElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-rngfunord-rngelt-rngelt-rngfunordelt)
    - [`elt< FF | a₁, a₂, ..., aₙ>: FldFunOrd, RngElt, ..., RngElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#constructor-constructor-elt-fldfunord-rngelt-rngelt-fldfunordelt)
    - [`One(F): FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-one-fldfun)
    - [`One(O): RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-one-rngfunord)
    - [`Identity(F): FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-identity-fldfun)
    - [`Identity(O): RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-identity-rngfunord)
    - [`Zero(F): FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zero-fldfun)
    - [`Zero(O): RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zero-rngfunord)
    - [`Representative(F): FldFun → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representative-fldfun)
    - [`Representative(O): RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representative-rngfunord)
    - [`Random(F, m): FldFunG, RngIntElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-random-fldfung-rngintelt)
    - [`Random(O, m): RngFunOrd, RngIntElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-random-rngfunord-rngintelt)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#parent-and-category)
    - [`Parent(a): FldFunElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-parent-fldfunelt)
    - [`Parent(a): RngFunOrdElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-parent-rngfunordelt)
    - [`Category(a): FldFunElt → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-category-fldfunelt)
    - [`Category(a): RngFunOrdElt → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-category-rngfunordelt)
  - [Sequence Conversions](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#sequence-conversions)
    - [`ElementToSequence(a): FldFunElt → SeqEnum[FldElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-elementtosequence-fldfunelt)
    - [`ElementToSequence(a): RngFunOrdElt → SeqEnum[RngElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-elementtosequence-rngfunordelt)
    - [`ElementToSequence(a): FldFunOrdElt → SeqEnum[RngElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-elementtosequence-fldfunordelt)
    - [`Eltseq(a): FldFunElt → SeqEnum[FldElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-eltseq-fldfunelt)
    - [`Eltseq(a): RngFunOrdElt → SeqEnum[RngElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-eltseq-rngfunordelt)
    - [`Eltseq(a): FldFunOrdElt → SeqEnum[RngElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-eltseq-fldfunordelt)
    - [`Eltseq(a, R): FldFunElt, FldFunG → [FldFunGElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-eltseq-fldfunelt-fldfung)
    - [`Flat(a): FldFunElt → [FldFunGElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-flat-fldfunelt)
    - [`F ! [ a₀, a₁, ..., aₙ₋₁ ]: FldFun, SeqEnum → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-fldfun-seqenum)
    - [`O ! [ a₁, a₂, ..., aₙ ]: RngFunOrd, SeqEnum → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-rngfunord-seqenum)
    - [Example: Creating Function Field Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#example-ex-27bc08)
  - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#arithmetic-operators)
    - [`+ a: FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfunelt-fldfunelt)
    - [`+ a: RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-rngfunordelt-rngfunordelt)
    - [`+ a: FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfunordelt-fldfunordelt)
    - [`- a: FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfunelt-fldfunelt-2)
    - [`- a: RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-rngfunordelt-rngfunordelt-2)
    - [`- a: FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-fldfunordelt-fldfunordelt-2)
    - [`a + b: FldFunElt, FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-plus-fldfunelt-fldfunelt)
    - [`a + b: RngFunOrdElt, RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-plus-rngfunordelt-rngfunordelt)
    - [`a + b: FldFunOrdElt, FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-plus-fldfunordelt-fldfunordelt)
    - [`a - b: FldFunElt, FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-minus-fldfunelt-fldfunelt)
    - [`a - b: RngFunOrdElt, RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-minus-rngfunordelt-rngfunordelt)
    - [`a - b: FldFunOrdElt, FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-minus-fldfunordelt-fldfunordelt)
    - [`a * b: FldFunElt, FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-times-fldfunelt-fldfunelt)
    - [`a * b: RngFunOrdElt, RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-times-rngfunordelt-rngfunordelt)
    - [`a * b: FldFunOrdElt, FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-times-fldfunordelt-fldfunordelt)
    - [`a div b: FldFunElt, FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-div-fldfunelt-fldfunelt-fldfunelt)
    - [`a div b: FldFunElt, RngElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-div-fldfunelt-rngelt-fldfunelt)
    - [`a div b: RngFunOrdElt, RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-div-rngfunordelt-rngfunordelt-rngfunordelt)
    - [`a div b: RngFunOrdElt, RngElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-div-rngfunordelt-rngelt-rngfunordelt)
    - [`a / b: FldFunElt, FldFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-div-fldfunelt-fldfunelt)
    - [`a / b: RngFunOrdElt, RngFunOrdElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-div-rngfunordelt-rngfunordelt)
    - [`a / b: FldFunOrdElt, FldFunOrdElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-div-fldfunordelt-fldfunordelt)
    - [`a ^ k: FldFunElt, RngIntElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-pow-fldfunelt-rngintelt)
    - [`a ^ k: RngFunOrdElt, RngIntElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-pow-rngfunordelt-rngintelt)
    - [`a ^ k: FldFunOrdElt, RngIntElt → FldFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-pow-fldfunordelt-rngintelt)
    - [`Modexp(a, k, m): RngFunOrdElt, RngIntElt, RngUPolElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-modexp-rngfunordelt-rngintelt-rngupolelt)
    - [`Modexp(a, k, m): RngFunOrdElt, RngIntElt, RngValElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-modexp-rngfunordelt-rngintelt-rngvalelt)
    - [`a mod I: RngFunOrdElt, RngFunOrdIdl → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-operation-mod-rngfunordelt-rngfunordidl-rngfunordelt)
    - [`Modinv(a, m): RngFunOrdElt, RngFunOrdIdl → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-modinv-rngfunordelt-rngfunordidl)
    - [`Modinv(a, m): RngFunOrdElt, RngUPolElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-modinv-rngfunordelt-rngupolelt)
    - [`Modinv(a, m): RngFunOrdElt, RngValElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-modinv-rngfunordelt-rngvalelt)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#equality-and-membership)
    - [`a eq b: FldFunElt, FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-eq-fldfunelt-fldfunelt)
    - [`a eq b: RngFunOrdElt, RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-eq-rngfunordelt-rngfunordelt)
    - [`a eq b: FldFunOrdElt, FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-eq-fldfunordelt-fldfunordelt)
    - [`a ne b: FldFunElt, FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-ne-fldfunelt-fldfunelt)
    - [`a ne b: RngFunOrdElt, RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-ne-rngfunordelt-rngfunordelt)
    - [`a ne b: FldFunOrdElt, FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-ne-fldfunordelt-fldfunordelt)
    - [`a in F: RngElt, FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-in-rngelt-fldfun)
    - [`a in O: RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-in-rngelt-rngfunord)
    - [`a in FF: RngElt, FldFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-in-rngelt-fldfunord)
    - [`a notin F: RngElt, FldFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-notin-rngelt-fldfun)
    - [`a notin O: RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-notin-rngelt-rngfunord)
    - [`a notin FF: RngElt, FldFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#operation-op-notin-rngelt-fldfunord)
  - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#predicates-on-elements)
    - [`IsDivisibleBy(a, b): FldFunElt, FldFunElt → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isdivisibleby-fldfunelt-fldfunelt)
    - [`IsDivisibleBy(a, b): RngFunOrdElt, RngFunOrdElt → BoolElt, RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isdivisibleby-rngfunordelt-rngfunordelt)
    - [`IsZero(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-iszero-fldfunelt)
    - [`IsZero(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-iszero-rngfunordelt)
    - [`IsZero(a): FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-iszero-fldfunordelt)
    - [`IsOne(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isone-fldfunelt)
    - [`IsOne(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isone-rngfunordelt)
    - [`IsOne(a): FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isone-fldfunordelt)
    - [`IsMinusOne(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isminusone-fldfunelt)
    - [`IsMinusOne(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isminusone-rngfunordelt)
    - [`IsMinusOne(a): FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isminusone-fldfunordelt)
    - [`IsNilpotent(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isnilpotent-fldfunelt)
    - [`IsNilpotent(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isnilpotent-rngfunordelt)
    - [`IsIdempotent(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isidempotent-fldfunelt)
    - [`IsIdempotent(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isidempotent-rngfunordelt)
    - [`IsUnit(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isunit-fldfunelt)
    - [`IsUnit(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isunit-rngfunordelt)
    - [`IsUnit(a): FldFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isunit-fldfunordelt)
    - [`IsZeroDivisor(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-iszerodivisor-fldfunelt)
    - [`IsZeroDivisor(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-iszerodivisor-rngfunordelt)
    - [`IsRegular(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isregular-fldfunelt)
    - [`IsRegular(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isregular-rngfunordelt)
    - [`IsIrreducible(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isirreducible-fldfunelt)
    - [`IsIrreducible(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isirreducible-rngfunordelt)
    - [`IsPrime(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isprime-fldfunelt)
    - [`IsPrime(a): RngFunOrdElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isprime-rngfunordelt)
    - [`IsSeparating(a): FldFunGElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isseparating-fldfungelt)
    - [`IsConstant(a): FldFunGElt → BoolElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isconstant-fldfungelt)
    - [`IsConstant(a): RngFunOrdElt → BoolElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-isconstant-rngfunordelt)
    - [`IsGlobalUnit(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-field-elements-isglobalunit)
    - [`IsGlobalUnitWithPreimage(a): FldFunElt → BoolElt, GrpAbElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-field-elements-isglobalunitwithpreimage)
    - [`IsUnitWithPreimage(a): RngFunOrdElt → BoolElt, GrpAbElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-orders-elements-isunitwithpreimage)
  - [Functions related to Norm and Trace](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#functions-related-to-norm-and-trace)
    - [`Trace(a): FldFunGElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-trace-fldfungelt)
    - [`Trace(a): RngFunOrdElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-trace-rngfunordelt)
    - [`Norm(a): FldFunGElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-norm-fldfungelt)
    - [`Norm(a): RngFunOrdElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-norm-rngfunordelt)
    - [`MinimalPolynomial(a): FldFunElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimalpolynomial-fldfunelt)
    - [`MinimalPolynomial(a): RngFunOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimalpolynomial-rngfunordelt)
    - [`MinimalPolynomial(a): FldFunOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimalpolynomial-fldfunordelt)
    - [`CharacteristicPolynomial(a): FldFunElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-characteristicpolynomial-fldfunelt)
    - [`CharacteristicPolynomial(a): RngFunOrdElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-characteristicpolynomial-rngfunordelt)
    - [`RepresentationMatrix(a): FldFunGElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representationmatrix-fldfungelt)
    - [`RepresentationMatrix(a): RngFunOrdElt → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representationmatrix-rngfunordelt)
    - [`Trace(a, R): FldFunElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-trace-fldfunelt-rng)
    - [`Trace(a, R): RngFunOrdElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-trace-rngfunordelt-rng)
    - [`Norm(a, R): FldFunElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-norm-fldfunelt-rng)
    - [`Norm(a, R): RngFunOrdElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-norm-rngfunordelt-rng)
    - [`CharacteristicPolynomial(a, R): FldFunElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-characteristicpolynomial-fldfunelt-rng)
    - [`CharacteristicPolynomial(a, R): RngFunOrdElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-characteristicpolynomial-rngfunordelt-rng)
    - [`MinimalPolynomial(a, R): FldFunElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimalpolynomial-fldfunelt-rng)
    - [`MinimalPolynomial(a, R): RngFunOrdElt, Rng → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimalpolynomial-rngfunordelt-rng)
    - [`AbsoluteMinimalPolynomial(a): FldFunElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-absoluteminimalpolynomial-fldfunelt)
    - [`RepresentationMatrix(a, R): FldFunGElt, Rng → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representationmatrix-fldfungelt-rng)
    - [`RepresentationMatrix(a, R): RngFunOrdElt, Rng → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-representationmatrix-rngfunordelt-rng)
    - [Example: Norm and Trace of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#example-ex-2d04b2)
  - [Functions related to Orders and Integrality](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#functions-related-to-orders-and-integrality)
    - [`IntegralSplit(a, O): FldFunElt, RngFunOrd → RngFunOrdElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-integralsplit-fldfunelt-rngfunord)
    - [`IntegralSplit(a, O): RngFunOrdElt, RngFunOrd → RngFunOrdElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-integralsplit-rngfunordelt-rngfunord)
    - [`IntegralSplit(a, O): FldFunOrdElt, RngFunOrd → RngFunOrdElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-integralsplit-fldfunordelt-rngfunord)
    - [`Numerator(a, O): FldFunElt, RngFunOrd → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-numerator-fldfunelt-rngfunord)
    - [`Numerator(a): FldFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-numerator-fldfunordelt)
    - [`Numerator(a, O): FldFunOrdElt, RngFunOrd → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-numerator-fldfunordelt-rngfunord)
    - [`Denominator(a, O): FldFunElt, RngFunOrd → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-denominator-fldfunelt-rngfunord)
    - [`Denominator(a): FldFunOrdElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-denominator-fldfunordelt)
    - [`Denominator(a, O): FldFunOrdElt, RngFunOrd → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-denominator-fldfunordelt-rngfunord)
    - [`Min(a, O): FldFunElt, RngFunOrd → RngElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-min-fldfunelt-rngfunord)
    - [`Minimum(a, O): FldFunElt, RngFunOrd → RngElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimum-fldfunelt-rngfunord)
    - [`Minimum(a, O): RngFunOrdElt, RngFunOrd → RngElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-minimum-rngfunordelt-rngfunord)
    - [`Min(a, O): RngFunOrdElt, RngFunOrd → RngElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-min-rngfunordelt-rngfunord)
  - [Functions related to Places and Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#functions-related-to-places-and-divisors)
    - [`Evaluate(a, P): FldFunElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-evaluate-fldfunelt-plcfunelt)
    - [`Evaluate(a, P): RngFunOrdElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-evaluate-rngfunordelt-plcfunelt)
    - [`Lift(a, P): RngElt, PlcFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-lift-rngelt-plcfunelt)
    - [`Valuation(a, P): FldFunElt, PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-valuation-fldfunelt-plcfunelt)
    - [`Valuation(a, P): RngFunOrdElt, PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-valuation-rngfunordelt-plcfunelt)
    - [`Expand(a, P): FldFunGElt, PlcFunElt → RngSerElt, FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-expand-fldfungelt-plcfunelt)
    - [`Development(a, P): FldFunGElt, PlcFunElt → RngSerElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-development-fldfungelt-plcfunelt)
    - [`Divisor(a): FldFunGElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-divisor-fldfungelt)
    - [`Divisor(a): RngFunOrdElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-divisor-rngfunordelt)
    - [`PrincipalDivisor(a): FldFunGElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-principaldivisor-fldfungelt)
    - [`PrincipalDivisor(a): RngFunOrdElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-principaldivisor-rngfunordelt)
    - [`Zeros(a): FldFunGElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeros-fldfungelt)
    - [`Zeros(a): RngFunOrdElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeros-rngfunordelt)
    - [`Zeroes(a): FldFunGElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeroes-fldfungelt)
    - [`Zeroes(a): RngFunOrdElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeroes-rngfunordelt)
    - [`Zeros(F, a): FldFunG, FldFunGElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeros-fldfung-fldfungelt)
    - [`Zeroes(F, a): FldFunG, FldFunGElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-zeroes-fldfung-fldfungelt)
    - [`Poles(a): FldFunGElt → SeqEnum[PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-poles-fldfungelt)
    - [`Poles(a): RngFunOrdElt → SeqEnum[PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-poles-rngfunordelt)
    - [`Poles(F, a): FldFun, FldFunGElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-poles-fldfun-fldfungelt)
    - [`Degree(a): FldFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-degree-fldfunelt)
    - [`Degree(a): RngFunOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-degree-rngfunordelt)
    - [`CommonZeros(L): [FldFunGElt] → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-commonzeros-fldfungelt)
    - [`CommonZeros(F, L): FldFunG, SeqEnum[ FldFunGElt ] → SeqEnum[ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-commonzeros-fldfung-seqenum-fldfungelt)
    - [Example: Minimal Polynomial and Representation Matrix](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#example-ex-0c032c)
    - [`Module(L, R): SeqEnum[ FldFunGElt ], Rng → Mod, Map, SeqEnum[ ModElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-module-seqenum-fldfungelt-rng)
    - [`Relations(L, R): SeqEnum[ FldFunElt ], Rng → ModTupRng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-relations-seqenum-fldfunelt-rng)
    - [`Relations(L, R, m): SeqEnum[ FldFunElt ], Rng, RngIntElt → ModTupRng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-relations-seqenum-fldfunelt-rng-rngintelt)
    - [`Roots(f, D): RngUPolElt, DivFunElt → SeqEnum[ FldFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-roots-rngupolelt-divfunelt)
    - [Example: Module and Relations over Relative Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#example-ex-7f09fd)
  - [Other Operations on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#other-operations-on-elements)
    - [`ProductRepresentation(a): FldFunGElt → [FldFunGElt], [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-productrepresentation-fldfungelt)
    - [`ProductRepresentation(a): RngFunOrdElt → [RngElt], [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-productrepresentation-rngfunordelt)
    - [`ProductRepresentation(Q, S): [FldFunGElt], [RngIntElt] → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-productrepresentation-fldfungelt-rngintelt)
    - [`PowerProduct(Q, S): [FldFunGElt], [RngIntElt] → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-powerproduct-fldfungelt-rngintelt)
    - [`RationalFunction(a): FldFunGElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-rationalfunction-fldfungelt)
    - [`RationalFunction(a, R): FldFunGElt, Rng → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-rationalfunction-fldfungelt-rng)
    - [`Differentiation(x, a): FldFunGElt, FldFunGElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-differentiation-fldfungelt-fldfungelt)
    - [`Differentiation(x, n, a): FldFunGElt, RngIntElt, FldFunGElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-fldfungelt-differentiation)
    - [`DifferentiationSequence(x, n, a): FldFunGElt, RngIntElt, FldFunGElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-differentiationsequence-fldfungelt-rngintelt-fldfungelt)
    - [`PrimePowerRepresentation(x, k, a): FldFunGElt, RngIntElt, FldFunGElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-primepowerrepresentation-fldfungelt-rngintelt-fldfungelt)
    - [`Different(a): RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-different-rngfunordelt)
    - [`RationalReconstruction(e, f): FldFunElt, RngUPolElt → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-rationalreconstruction-fldfunelt-rngupolelt)
    - [`CoefficientHeight(a): RngFunOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-coefficientheight-rngfunordelt)
    - [`CoefficientHeight(a): FldFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-coefficientheight-fldfunelt)
    - [`CoefficientLength(a): RngFunOrdElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-coefficientlength-rngfunordelt)
    - [`CoefficientLength(a): FldFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-coefficientlength-fldfunelt)
    - [Example: Product Representation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#example-ex-d8f7df)
- [Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md)
  - [Creation of Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#creation-of-ideals)
    - [`ideal< O | a₁, a₂, ... , aₘ >: RngFunOrd, RngElt, ..., RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-ideal-rngfunord-rngelt-rngelt-rngfunordidl)
    - [`ideal< O | T, d >: RngFunOrd, AlgMatElt, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-ideal-rngfunord-algmatelt-rngelt-rngfunordidl)
    - [`ideal< O | T, d >: RngFunOrd, ModDed, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-ideal-rngfunord-modded-rngelt-rngfunordidl)
    - [`ideal< O | T, S >: RngFunOrd, AlgMatElt, [RngFunOrdIdl] → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-ideal-rngfunord-algmatelt-rngfunordidl-rngfunordidl)
    - [`ideal< O | T, I₁, ..., Iₙ >: RngFunOrd, AlgMatElt, RngFunOrdIdl, ..., RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-ideal-rngfunord-algmatelt-rngfunordidl-rngfunordidl-rngfunordidl)
    - [`x * O: RngElt, RngFunOrd → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngelt-rngfunord)
    - [`O * x: RngFunOrd, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngfunord-rngelt)
    - [`Ideal(P): PlcFunElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-ideal-plcfunelt)
    - [`Ideals(D): DivFunElt → RngFunOrdIdl, RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-ideals-divfunelt)
    - [`O !! I: RngFunOrd, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-rngfunord-rngfunordidl)
  - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#parent-and-category)
    - [`Parent(I): RngFunOrdIdl → PowIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-parent-rngfunordidl)
    - [`Category(I): RngFunOrdIdl → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-category-rngfunordidl)
  - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#arithmetic-operators)
    - [`I + J: RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-plus-rngfunordidl-rngfunordidl)
    - [`I * J: RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngfunordidl-rngfunordidl)
    - [`I / J: RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-div-rngfunordidl-rngfunordidl)
    - [`I ^ k: RngFunOrdIdl, RngIntElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-pow-rngfunordidl-rngintelt)
    - [`c * I: RngElt, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngelt-rngfunordidl)
    - [`I * c: RngFunOrdIdl, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngfunordidl-rngelt)
    - [`I / c: RngFunOrdIdl, RngElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-div-rngfunordidl-rngelt)
    - [`c / I: RngElt, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-div-rngelt-rngfunordidl)
    - [`IdealQuotient(I, J): RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-idealquotient-rngfunordidl-rngfunordidl)
    - [`ColonIdeal(I, J): RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-colonideal-rngfunordidl-rngfunordidl)
    - [`ChineseRemainderTheorem(I1, I2, e1, e2): RngFunOrdIdl, RngFunOrdIdl, RngFunOrdElt, RngFunOrdElt → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-chineseremaindertheorem-rngfunordidl-rngfunordidl-rngfunordelt-rngfunordelt)
    - [`CRT(I1, I2, e1, e2): RngFunOrdIdl, RngFunOrdIdl, RngFunOrdElt, RngFunOrdElt → RngOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-crt-rngfunordidl-rngfunordidl-rngfunordelt-rngfunordelt)
  - [Roots of Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#roots-of-ideals)
    - [`IsPower(I, n): RngFunOrdIdl, RngIntElt → BoolElt, RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-ispower-rngfunordidl-rngintelt)
    - [`Root(I, n): RngFunOrdIdl, RngIntElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-root-rngfunordidl-rngintelt)
    - [`IsSquare(I): RngFunOrdIdl → BoolElt, RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-issquare-rngfunordidl)
    - [`SquareRoot(I): RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-squareroot-rngfunordidl)
    - [`Sqrt(I): RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-sqrt-rngfunordidl)
    - [Example: Testing Whether an Ideal Is a Square](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#example-ex-eaf22a)
  - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#equality-and-membership)
    - [`I eq J: RngFunOrdIdl, RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-eq-rngfunordidl-rngfunordidl)
    - [`I ne J: RngFunOrdIdl, RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-ne-rngfunordidl-rngfunordidl)
    - [`I in S: RngFunOrdIdl, PowIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-in-rngfunordidl-powidl)
    - [`I notin S: RngFunOrdIdl, PowIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-notin-rngfunordidl-powidl)
  - [Predicates on Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#predicates-on-ideals)
    - [`IsZero(I): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-iszero-rngfunordidl)
    - [`IsOne(I): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isone-rngfunordidl)
    - [`IsIntegral(I): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isintegral-rngfunordidl)
    - [`IsPrime(I): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isprime-rngfunordidl)
    - [`IsPrincipal(I): RngFunOrdIdl → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isprincipal-rngfunordidl)
    - [Predicates on Prime Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#predicates-on-prime-ideals)
      - [`IsInert(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isinert-rngfunordidl)
      - [`IsInert(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isinert-rngfunordidl-rngfunord)
      - [`IsInert(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isinert-rngelt-rngfunord)
      - [`IsRamified(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isramified-rngfunordidl)
      - [`IsRamified(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isramified-rngfunordidl-rngfunord)
      - [`IsRamified(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isramified-rngelt-rngfunord)
      - [`IsSplit(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-issplit-rngfunordidl)
      - [`IsSplit(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-issplit-rngfunordidl-rngfunord)
      - [`IsSplit(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-issplit-rngelt-rngfunord)
      - [`IsTamelyRamified(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istamelyramified-rngfunordidl)
      - [`IsTamelyRamified(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istamelyramified-rngfunordidl-rngfunord)
      - [`IsTamelyRamified(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istamelyramified-rngelt-rngfunord)
      - [`IsTotallyRamified(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallyramified-rngfunordidl)
      - [`IsTotallyRamified(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallyramified-rngfunordidl-rngfunord)
      - [`IsTotallyRamified(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallyramified-rngelt-rngfunord)
      - [`IsTotallySplit(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallysplit-rngfunordidl)
      - [`IsTotallySplit(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallysplit-rngfunordidl-rngfunord)
      - [`IsTotallySplit(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-istotallysplit-rngelt-rngfunord)
      - [`IsUnramified(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isunramified-rngfunordidl)
      - [`IsUnramified(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isunramified-rngfunordidl-rngfunord)
      - [`IsUnramified(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isunramified-rngelt-rngfunord)
      - [`IsWildlyRamified(P): RngFunOrdIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-iswildlyramified-rngfunordidl)
      - [`IsWildlyRamified(P, O): RngFunOrdIdl, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-iswildlyramified-rngfunordidl-rngfunord)
      - [`IsWildlyRamified(P, O): RngElt, RngFunOrd → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-iswildlyramified-rngelt-rngfunord)
  - [Further Ideal Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#further-ideal-operations)
    - [`I meet J: RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-meet-rngfunordidl-rngfunordidl)
    - [`Gcd(I, J): RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-gcd-rngfunordidl-rngfunordidl)
    - [`Lcm(I, J): RngFunOrdIdl, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-lcm-rngfunordidl-rngfunordidl)
    - [`Factorization(I): RngFunOrdIdl → [ <RngFunOrdIdl, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-factorization-rngfunordidl)
    - [`Factorisation(I): RngFunOrdIdl → [<RngFunOrdIdl, RngIntElt>]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-factorisation-rngfunordidl)
    - [`Decomposition(O, p): RngFunOrd, RngElt → [ RngFunOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decomposition-rngfunord-rngelt)
    - [`Decomposition(O, p): RngFunOrd, RngFunOrdIdl → [ RngFunOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decomposition-rngfunord-rngfunordidl)
    - [`Decomposition(O): RngFunOrd → [ RngFunOrdIdl ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decomposition-rngfunord)
    - [`DecompositionType(O, p): RngFunOrd, RngElt → [ <RngIntElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decompositiontype-rngfunord-rngelt)
    - [`DecompositionType(O, p): RngFunOrd, RngFunOrdIdl → [ <RngIntElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decompositiontype-rngfunord-rngfunordidl)
    - [`DecompositionType(O): RngFunOrd → [ <RngIntElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-decompositiontype-rngfunord)
    - [`MultiplicatorRing(I): RngFunOrdIdl → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-multiplicatorring-rngfunordidl-2)
    - [`pMaximalOrder(O, p): RngFunOrd, RngFunOrdIdl → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-pmaximalorder-rngfunord-rngfunordidl-2)
    - [`pRadical(O, p): RngFunOrd, RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-pradical-rngfunord-rngfunordidl-2)
    - [`Valuation(a, P): RngElt, RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-valuation-rngelt-rngfunordidl)
    - [`Valuation(I, P): RngFunOrdIdl, RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-valuation-rngfunordidl-rngfunordidl)
    - [`Order(I): RngFunOrdIdl → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-order-rngfunordidl)
    - [`Denominator(I): RngFunOrdIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-denominator-rngfunordidl)
    - [`Minimum(I): RngFunOrdIdl → Any`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-minimum-rngfunordidl)
    - [`I meet R: RngFunOrdIdl, Rng → Any`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-meet-rngfunordidl-rng)
    - [`IntegralSplit(I): RngFunOrdIdl → RngFunOrdIdl, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-integralsplit-rngfunordidl)
    - [`Norm(I): RngFunOrdIdl → Any`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-norm-rngfunordidl)
    - [`TwoElement(I): RngFunOrdIdl → RngElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-twoelement-rngfunordidl)
    - [`Generators(I): RngFunOrdIdl → [ RngFunOrdElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-generators-rngfunordidl)
    - [`Basis(I): RngFunOrdIdl → [FldFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-basis-rngfunordidl)
    - [`Basis(I, R): RngFunOrdIdl, Rng → [ RngElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-basis-rngfunordidl-rng)
    - [`BasisMatrix(I): RngFunOrdIdl → AlgMatElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-basismatrix-rngfunordidl)
    - [`TransformationMatrix(I): RngFunOrdIdl → AlgMatElt, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-transformationmatrix-rngfunordidl)
    - [`CoefficientIdeals(I): RngFunOrdIdl → [RngFunOrdIdl]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-coefficientideals-rngfunordidl)
    - [`Different(I): RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-different-rngfunordidl)
    - [`Codifferent(I): RngFunOrdIdl → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-codifferent-rngfunordidl)
    - [`Divisor(I): RngFunOrdIdl → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-divisor-rngfunordidl)
    - [`Divisor(I, J): RngFunOrdIdl, RngFunOrdIdl → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-divisor-rngfunordidl-rngfunordidl)
    - [`CoefficientHeight(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-coefficientheight-rngfunordidl)
    - [`CoefficientLength(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-coefficientlength-rngfunordidl)
    - [Example: Ideal Operations in a Relative Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#example-ex-bdacf7)
    - [Functions on Prime Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#functions-on-prime-ideals)
      - [`RamificationIndex(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-ramificationindex-rngfunordidl)
      - [`RamificationDegree(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-ramificationdegree-rngfunordidl)
      - [`Degree(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-degree-rngfunordidl)
      - [`InertiaDegree(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-inertiadegree-rngfunordidl)
      - [`ResidueClassDegree(I): RngFunOrdIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-residueclassdegree-rngfunordidl)
      - [`ResidueClassField(I): RngFunOrdIdl → Rng, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-residueclassfield-rngfunordidl)
      - [`Place(I): RngFunOrdIdl → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-place-rngfunordidl)
      - [`SafeUniformizer(P): RngFunOrdIdl → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-safeuniformizer-rngfunordidl)
      - [`WeakApproximation(I, V): [RngFunOrdIdl], [RngIntElt] → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-weakapproximation-rngfunordidl-rngintelt)
      - [Example: Factoring an Ideal of a Maximal Order](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#example-ex-a0157f)
  - [Quotient Rings](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#quotient-rings)
    - [Operations on Quotient Rings](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operations-on-quotient-rings)
      - [`quo< O | I >: RngFunOrd, RngFunOrdIdl → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-rngfunordidl-rngfunordres)
      - [`quo< O | M >: RngFunOrd, ModDed → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-modded-rngfunordres)
      - [`quo< O | M >: RngFunOrd, AlgMatElt → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-algmatelt-rngfunordres)
      - [`quo< O | S >: RngFunOrd, RngElt, ..., RngElt → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-rngelt-rngelt-rngfunordres)
      - [`quo< O | p >: RngFunOrd, RngUPolElt → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-rngupolelt-rngfunordres)
      - [`quo< O | p, r >: RngFunOrd, RngUPolElt, RngIntElt → RngFunOrdRes`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#constructor-constructor-quo-rngfunord-rngupolelt-rngintelt-rngfunordres)
      - [`Modulus(OQ): RngFunOrdRes → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-modulus-rngfunordres)
      - [Example: Quotient Rings of Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#example-ex-d5cfa1)
    - [Elements of Quotients](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#elements-of-quotients)
      - [`OQ ! a: RngFunOrdRes, Elt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-rngfunordres-elt)
      - [`a mod I: RngFunOrdElt, RngFunOrdIdl → RngFunOrdElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-operation-mod-rngfunordelt-rngfunordidl-rngfunordelt)
      - [`a * b: RngFunOrdResElt, RngFunOrdResElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-times-rngfunordreselt-rngfunordreselt)
      - [`a + b: RngFunOrdResElt, RngFunOrdResElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-plus-rngfunordreselt-rngfunordreselt)
      - [`a - b: RngFunOrdResElt, RngFunOrdResElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-minus-rngfunordreselt-rngfunordreselt)
      - [`a / b: RngFunOrdResElt, RngFunOrdResElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-div-rngfunordreselt-rngfunordreselt)
      - [`- a: RngFunOrdResElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-operation-rngfunordreselt-rngfunordreselt)
      - [`a ^ n: RngFunOrdResElt, RngIntElt → RngFunOrdResElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-pow-rngfunordreselt-rngintelt)
      - [`a eq b: RngFunOrdResElt, RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-eq-rngfunordreselt-rngfunordreselt)
      - [`a ne b: RngFunOrdResElt, RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#operation-op-ne-rngfunordreselt-rngfunordreselt)
      - [`IsZero(a): RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-iszero-rngfunordreselt)
      - [`IsOne(a): RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isone-rngfunordreselt)
      - [`IsMinusOne(a): RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isminusone-rngfunordreselt)
      - [`IsUnit(a): RngFunOrdResElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-isunit-rngfunordreselt)
      - [`Eltseq(a): RngFunOrdResElt → []`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-eltseq-rngfunordreselt)
      - [`ElementToSequence(a): RngFunOrdResElt → []`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#function-elementtosequence-rngfunordreselt)
- [Places](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#creation-of-structures)
    - [`Places(F): FldFun → PlcFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-places-fldfun)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#creation-of-elements)
    - [General Function Field Places](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#general-function-field-places)
      - [`Decomposition(F, P): FldFunG, PlcFunElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-fldfung-decomp)
      - [`DecompositionType(F, P): FldFun, PlcFunElt → [ <RngIntElt, RngIntElt> ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-decompositiontype-fldfun-plcfunelt)
      - [`Zeros(a): FldFunElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-zeros-fldfunelt)
      - [`Zeros(a): RngFunOrdElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-zeros-rngfunordelt-2)
      - [`Poles(a): FldFunElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-poles-fldfunelt)
      - [`Poles(a): RngFunOrdElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-poles-rngfunordelt-2)
      - [`S ! I: PlcFun, RngFunOrdIdl → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-plcfun-rngfunordidl)
      - [`Place(I): RngFunOrdIdl → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-place-rngfunordidl-2)
      - [`Support(D): DivFunElt → [ PlcFunElt ], [ RngIntElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-support-divfunelt)
      - [`Support(P): PlcFunElt → [ PlcFunElt ], [ RngIntElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-support-plcfunelt)
      - [`AssignNames(~P, s): PlcFunElt, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#procedure-assignnames-plcfunelt-monstgelt-ref)
      - [`InfinitePlaces(F): FldFun → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-infiniteplaces-fldfun)
    - [Global Function Field Places](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#global-function-field-places)
      - [`HasPlace(F, m): FldFun, RngIntElt → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-hasplace-fldfun-rngintelt)
      - [`HasRandomPlace(F, m): FldFun, RngIntElt → BoolElt, PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-hasrandomplace-fldfun-rngintelt)
      - [`RandomPlace(F, m): FldFun, RngIntElt → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-randomplace-fldfun-rngintelt)
      - [`Places(F, m): FldFun, RngIntElt → SeqEnum[PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-places-fldfun-rngintelt)
      - [Example: Creating Places](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#example-ex-92c345)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#related-structures)
    - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#parent-and-category)
      - [`FunctionField(S): PlcFun → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-functionfield-plcfun)
      - [`DivisorGroup(F): FldFunG → DivFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-divisorgroup-fldfung)
  - [Structure Invariants](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#structure-invariants)
    - [General Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#general-function-fields)
      - [`WeierstrassPlaces(F): FldFunG → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-weierstrassplaces-fldfung-2)
    - [Global Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#global-function-fields)
      - [`NumberOfPlacesOfDegreeOneOverExactConstantField(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesofdegreeoneoverexactconstantfield-fldfun-rngintelt)
      - [`NumberOfPlacesOfDegreeOneECF(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesofdegreeoneecf-fldfung-rngintelt)
      - [`NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F, m): FldFun, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfun-rngintelt)
      - [`NumberOfPlacesOfDegreeOneECFBound(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesofdegreeoneecfbound-fldfung-rngintelt)
      - [`NumberOfPlacesOfDegreeOverExactConstantField(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesofdegreeoverexactconstantfield-fldfung-rngintelt)
      - [`NumberOfPlacesDegECF(F, m): FldFunG, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-numberofplacesdegecf-fldfung-rngintelt)
  - [Structure Predicates](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#structure-predicates)
    - [`S1 eq S2: PlcFun, PlcFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-eq-plcfun-plcfun)
    - [`S1 ne S2: PlcFun, PlcFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-ne-plcfun-plcfun)
  - [Element Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#element-operations)
    - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#id2)
      - [`Parent(P): PlcFunElt → PlcFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-parent-plcfunelt)
      - [`Category(P): PlcFunElt → Cat`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-category-plcfunelt)
    - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#arithmetic-operators)
      - [`- P: PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-operation-plcfunelt-divfunelt)
      - [`P1 + P2: PlcFunElt, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-plus-plcfunelt-plcfunelt)
      - [`P1 - P2: PlcFunElt, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-minus-plcfunelt-plcfunelt)
      - [`k * P: RngIntElt, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-times-rngintelt-plcfunelt)
      - [`P div k: PlcFunElt, RngIntElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-operation-div-plcfunelt-rngintelt-divfunelt)
      - [`P mod k: PlcFunElt, RngIntElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-operation-mod-plcfunelt-rngintelt-divfunelt)
      - [`Quotrem(P, k): PlcFunElt, RngIntElt → DivFunElt, DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-quotrem-plcfunelt-rngintelt)
    - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#equality-and-membership)
      - [`P1 eq P2: PlcFunElt, PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-eq-plcfunelt-plcfunelt)
      - [`P1 ne P2: PlcFunElt, PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-ne-plcfunelt-plcfunelt)
      - [`P in S: PlcFunElt, PlcFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-in-plcfunelt-plcfun)
      - [`P notin S: PlcFunElt, PlcFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#operation-op-notin-plcfunelt-plcfun)
    - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#predicates-on-elements)
      - [`IsFinite(P): PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-isfinite-plcfunelt)
      - [`IsWeierstrassPlace(P): PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-isweierstrassplace-plcfunelt)
      - [`IsWeierstrassPlace(F, P): FldFunG, PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-isweierstrassplace-fldfung-plcfunelt)
    - [Other Element Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#other-element-operations)
      - [`FunctionField(P): PlcFunElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-functionfield-plcfunelt)
      - [`Degree(P): PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-degree-plcfunelt)
      - [`RamificationIndex(P): PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-ramificationindex-plcfunelt)
      - [`RamificationDegree(P): PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-ramificationdegree-plcfunelt)
      - [`InertiaDegree(P): PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-inertiadegree-plcfunelt)
      - [`ResidueClassDegree(P): PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-residueclassdegree-plcfunelt)
      - [`Minimum(P): PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-minimum-plcfunelt)
      - [`ResidueClassField(P): PlcFunElt → Rng, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-residueclassfield-plcfunelt)
      - [`Evaluate(a, P): RngElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-evaluate-rngelt-plcfunelt)
      - [`Lift(a, P): RngElt, PlcFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-lift-rngelt-plcfunelt-2)
      - [`Lift(i, P): Infty, PlcFunElt → FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-lift-infty-plcfunelt)
      - [`TwoGenerators(P): PlcFunElt → FldFunGElt, FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-twogenerators-plcfunelt)
      - [`LocalUniformizer(P): PlcFunElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-fldfung-localuniformizer)
      - [`UniformizingElement(P): PlcFunElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-uniformizingelement-plcfunelt)
      - [`Valuation(a, P): FldFunElt, PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-valuation-fldfunelt-plcfunelt-2)
      - [`Ideal(P): PlcFunElt → RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-ideal-plcfunelt-2)
      - [`Norm(P): PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-norm-plcfunelt)
      - [Example: Counting Places of a Given Degree](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#example-ex-bbb5e4)
  - [Completion at Places](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#completion-at-places)
    - [`Completion(F, p): FldFun, PlcFunElt → RngSerLaur, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-completion-fldfun-plcfunelt)
    - [`Completion(O, p): RngFunOrd, PlcFunElt → RngSerPow, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-completion-rngfunord-plcfunelt)
- [Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#creation-of-structures)
    - [`DivisorGroup(F): FldFun → DivFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisorgroup-fldfun-2)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#creation-of-elements)
    - [`Divisor(P): PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisor-plcfunelt)
    - [`Div ! P: DivFun, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-divfun-plcfunelt)
    - [`1 * P: PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-operation-plcfunelt-divfunelt)
    - [`Div ! a: DivFun, RngElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-divfun-rngelt)
    - [`Divisor(a): FldFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisor-fldfunelt)
    - [`Divisor(a): RngFunOrdElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisor-rngfunordelt-2)
    - [`Div ! I: DivFun, RngFunOrdIdl → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-divfun-rngfunordidl)
    - [`Divisor(I): RngFunOrdIdl → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisor-rngfunordidl-2)
    - [`Divisor(I, J): RngFunOrdIdl, RngFunOrdIdl → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisor-rngfunordidl-rngfunordidl-2)
    - [`Identity(G): DivFun → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-identity-divfun)
    - [`Id(G): DivFun → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-id-divfun)
    - [`CanonicalDivisor(F): FldFunG → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-canonicaldivisor-fldfung)
    - [`DifferentDivisor(F): FldFunG → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-differentdivisor-fldfung)
    - [`AssignNames(~D, s): DivFunElt, [ MonStgElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#procedure-assignnames-divfunelt-monstgelt-ref)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#related-structures)
    - [Parent and Category](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#parent-and-category)
      - [`FunctionField(G): DivFun → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-functionfield-divfun)
      - [`Places(F): FldFun → PlcFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-places-fldfun-2)
  - [Structure Invariants](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#structure-invariants)
    - [`NumberOfSmoothDivisors(n, m, P): RngIntElt, RngIntElt, SeqEnum[RngElt] → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-numberofsmoothdivisors-rngintelt-rngintelt-seqenum-rngelt)
    - [`DivisorOfDegreeOne(F): FldFunG → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisorofdegreeone-fldfung)
  - [Structure Predicates](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#structure-predicates)
    - [`Div1 eq Div2: DivFun, DivFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-eq-divfun-divfun)
    - [`Div1 ne Div2: DivFun, DivFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-ne-divfun-divfun)
  - [Element Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#element-operations)
    - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#arithmetic-operators)
      - [`- D: DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-operation-divfunelt-divfunelt)
      - [`D1 + D2: DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-plus-divfunelt-divfunelt)
      - [`D1 - D2: DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-minus-divfunelt-divfunelt)
      - [`k * D: RngIntElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-times-rngintelt-divfunelt)
      - [`D div k: DivFunElt, RngIntElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-operation-div-divfunelt-rngintelt-divfunelt)
      - [`D mod k: DivFunElt, RngIntElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-operation-mod-divfunelt-rngintelt-divfunelt)
      - [`P + D: PlcFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-plus-plcfunelt-divfunelt)
      - [`D + P: DivFunElt, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-plus-divfunelt-plcfunelt)
      - [`D - P: DivFunElt, PlcFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-minus-divfunelt-plcfunelt)
      - [`P - D: PlcFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-minus-plcfunelt-divfunelt)
      - [`Quotrem(D, k): DivFunElt, RngIntElt → DivFunElt, DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-quotrem-divfunelt-rngintelt)
      - [`GCD(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-gcd-divfunelt-divfunelt)
      - [`Gcd(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-gcd-divfunelt-divfunelt-2)
      - [`GreatestCommonDivisor(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-greatestcommondivisor-divfunelt-divfunelt)
      - [`LCM(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-lcm-divfunelt-divfunelt)
      - [`Lcm(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-lcm-divfunelt-divfunelt-2)
      - [`LeastCommonMultiple(D1, D2): DivFunElt, DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-leastcommonmultiple-divfunelt-divfunelt)
    - [Equality, Comparison, and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#equality-comparison-and-membership)
      - [`D1 eq D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-eq-divfunelt-divfunelt)
      - [`D1 ne D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-ne-divfunelt-divfunelt)
      - [`D1 le D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-le-divfunelt-divfunelt)
      - [`D1 lt D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-lt-divfunelt-divfunelt)
      - [`D1 ge D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-ge-divfunelt-divfunelt)
      - [`D1 gt D2: DivFunElt, DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-gt-divfunelt-divfunelt)
      - [`D in Div: DivFunElt, DivFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-in-divfunelt-divfun)
      - [`D notin Div: DivFunElt, DivFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#operation-op-notin-divfunelt-divfun)
    - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#predicates-on-elements)
      - [`IsZero(D): DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-iszero-divfunelt)
      - [`IsEffective(D): DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-iseffective-divfunelt)
      - [`IsPositive(D): DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-ispositive-divfunelt)
      - [`IsSpecial(D): DivFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-isspecial-divfunelt)
      - [`IsPrincipal(D): DivFunElt → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-isprincipal-divfunelt)
      - [`IsCanonical(D): DivFunElt → BoolElt, DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-iscanonical-divfunelt)
      - [Example: Divisors on a Relative Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-749efd)
    - [Other Element Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#other-element-operations)
      - [`FunctionField(D): DivFunElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-functionfield-divfunelt)
      - [`Degree(D): DivFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-degree-divfunelt)
      - [`Support(D): DivFunElt → [ PlcFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-support)
      - [`Numerator(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-numerator-divfunelt)
      - [`ZeroDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-zerodivisor-divfunelt)
      - [`Denominator(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-denominator-divfunelt)
      - [`PoleDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-poledivisor-divfunelt)
      - [`Ideals(D): DivFunElt → RngFunOrdIdl, RngFunOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-ideals)
      - [`Norm(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-norm-divfunelt)
      - [`FiniteSplit(D): DivFunElt → DivFunElt, DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-finitesplit-divfunelt)
      - [`FiniteDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-finitedivisor-divfunelt)
      - [`InfiniteDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-infinitedivisor-divfunelt)
      - [`Dimension(D): DivFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-dimension)
      - [`IndexOfSpeciality(D): DivFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-indexofspeciality-divfunelt)
      - [`ShortBasis(D : parameters): DivFunElt → [RngElt], [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-shortbasis-divfunelt)
      - [`Basis(D : parameters): DivFunElt → [ FldFunElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-basis-divfunelt)
      - [`RiemannRochSpace(D): DivFunElt → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-riemannrochspace-divfunelt)
      - [`RiemannRochSpace(P): PlcFunElt → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-riemannrochspace-plcfunelt)
      - [`Valuation(D, P): DivFunElt, PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-valuation-divfunelt-plcfunelt)
      - [`Reduction(D): DivFunElt → DivFunElt, RngIntElt, DivFunElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-reduction)
      - [`Reduction(D, A): DivFunElt, DivFunElt → DivFunElt, RngIntElt, DivFunElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-reduction-divfunelt-divfunelt)
      - [`GapNumbers(D, P): DivFunElt, PlcFunElt → SeqEnum[RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-gapnumbers)
      - [`GapNumbers(D): DivFunElt → SeqEnum[RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-gapnumbers-divfunelt)
      - [Example: Riemann-Roch Space of a Divisor](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-bddf6b)
      - [Example: Algebraic Relation for Sine and Cosine](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-3b8680)
      - [Example: Sine and Cosine via Exponentials](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-f4fe11)
      - [`RamificationDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-ramificationdivisor)
      - [`WeierstrassPlaces(D): DivFunElt → [PlcFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-weierstrassplaces)
      - [`IsWeierstrassPlace(D, P): DivFunElt, PlcFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-isweierstrassplace-divfunelt-plcfunelt)
      - [`WronskianOrders(D): DivFunElt → [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-wronskianorders)
      - [`ComplementaryDivisor(D): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-complementarydivisor)
      - [`DifferentialBasis(D): DivFunElt → [DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-differentialbasis-divfunelt)
      - [`DifferentialSpace(D): DivFunElt → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-differentialspace-divfunelt)
      - [`Parametrization(F, D): FldFun, DivFunElt → FldFunElt, [FldFunRatUElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-parametrization-fldfun-divfunelt)
  - [Functions related to Divisor Class Groups of Global Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#functions-related-to-divisor-class-groups-of-global-function-fields)
    - [`ClassGroupGenerationBound(q, g): RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classgroupgenerationbound-rngintelt-rngintelt)
    - [`ClassGroupGenerationBound(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classgroupgenerationbound-fldfung)
    - [`ClassNumberApproximation(F, e): FldFunG, FldReElt → FldReElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classnumberapproximation-fldfung-fldreelt)
    - [`ClassNumberApproximationBound(q, g, e): RngIntElt, RngIntElt, FldReElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classnumberapproximationbound-rngintelt-rngintelt-fldreelt)
    - [`ClassGroup(F : parameters): FldFun → GrpAb, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroup)
    - [`ClassGroupAbelianInvariants(F : parameters): FldFun → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroupabelianinvariants)
    - [`ClassNumber(F): FldFun → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classnumber-fldfun)
    - [Example: Divisor Class Group Computations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-caa2d2)
    - [`GlobalUnitGroup(F): FldFun → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-globalunitgroup-fldfun)
    - [`IsGlobalUnit(a): FldFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-isglobalunit-fldfunelt)
    - [`IsGlobalUnitWithPreimage(a): FldFunElt → BoolElt, GrpAbElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-isglobalunitwithpreimage-fldfunelt)
    - [`PrincipalDivisorMap(F): FldFunG → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-principaldivisormap-fldfung)
    - [`ClassGroupExactSequence(F): FldFunG → Map, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-classgroupexactsequence-fldfung)
    - [`SUnitGroup(S): SetEnum[PlcFunElt] → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sunitgroup-setenum-plcfunelt)
    - [`IsSUnit(a, S): FldFunElt, SetEnum[PlcFunElt] → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-issunit-fldfunelt-setenum-plcfunelt)
    - [`IsSUnitWithPreimage(a, S): FldFunElt, SetEnum[PlcFunElt] → BoolElt, GrpAbElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-issunitwithpreimage-fldfunelt-setenum-plcfunelt)
    - [`SRegulator(S): SetEnum[PlcFunElt] → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sregulator-setenum-plcfunelt)
    - [`SPrincipalDivisorMap(S): SetEnum[PlcFunElt] → Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sprincipaldivisormap-setenum-plcfunelt)
    - [`IsSPrincipal(D, S): DivFunElt, SetEnum[PlcFunElt] → BoolElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-issprincipal-divfunelt-setenum-plcfunelt)
    - [`SClassGroup(S): SetEnum[PlcFunElt] → GrpAb, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sclassgroup-setenum-plcfunelt)
    - [`SClassGroupExactSequence(S): SetEnum[PlcFunElt] → Map, Map, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sclassgroupexactsequence-setenum-plcfunelt)
    - [`SClassGroupAbelianInvariants(S): SetEnum[PlcFunElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sclassgroupabelianinvariants-setenum-plcfunelt)
    - [`SClassNumber(S): SetEnum[PlcFunElt] → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-sclassnumber-setenum-plcfunelt)
    - [`ClassGroupPRank(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroupprank)
    - [`HasseWittInvariant(F): FldFunG → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-hassewittinvariant)
    - [`TateLichtenbaumPairing(D1, D2, m): DivFunElt, DivFunElt, RngIntElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-tatelichtenbaumpairing-divfunelt-divfunelt-rngintelt)
    - [Example: Tate-Lichtenbaum Pairing of Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#example-ex-7f9ab0)
- [Differentials](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md)
  - [Creation of Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#creation-of-structures)
    - [`DifferentialSpace(F): FldFunG → DiffFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differentialspace-fldfung)
  - [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#creation-of-elements)
    - [`Differential(a): FldFunGElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differential-fldfungelt)
    - [`Differential(a): RngFunOrdElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differential-rngfunordelt)
    - [`Identity(D): DiffFun → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-identity-difffun)
    - [`Id(D): DiffFun → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-id-difffun)
    - [`IsCanonical(D): DivFunElt → BoolElt, DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-iscanonical-divfunelt-2)
  - [Related Structures](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#related-structures)
    - [`FunctionField(D): DiffFun → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-functionfield-difffun)
    - [`FunctionField(d): DiffFunElt → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-functionfield-difffunelt)
  - [Subspaces](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#subspaces)
    - [`SpaceOfDifferentialsFirstKind(F): FldFunG → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-spaceofdifferentialsfirstkind-fldfung)
    - [`SpaceOfHolomorphicDifferentials(F): FldFunG → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-spaceofholomorphicdifferentials-fldfung)
    - [`BasisOfDifferentialsFirstKind(F): FldFunG → SeqEnum[DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-basisofdifferentialsfirstkind-fldfung)
    - [`BasisOfHolomorphicDifferentials(F): FldFunG → SeqEnum[DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-basisofholomorphicdifferentials-fldfung)
    - [`DifferentialBasis(D): DivFunElt → [DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differentials-subspaces-differentialbasis)
    - [`DifferentialSpace(D): DivFunElt → ModFld, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differentialspace-divfunelt-2)
    - [Example: Differential Space of a Divisor](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#example-ex-b69721)
  - [Structure Predicates](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#structure-predicates)
    - [`D1 eq D2: DiffFun, DiffFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-eq-difffun-difffun)
  - [Operations on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operations-on-elements)
    - [Arithmetic Operators](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#arithmetic-operators)
      - [`r * x: RngElt, DiffFunElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-times-rngelt-difffunelt)
      - [`x * r: DiffFunElt, RngElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-times-difffunelt-rngelt)
      - [`x + y: DiffFunElt, DiffFunElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-plus-difffunelt-difffunelt)
      - [`- x: DiffFunElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-operation-difffunelt-difffunelt)
      - [`x - y: DiffFunElt, DiffFunElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-minus-difffunelt-difffunelt)
      - [`x / y: DiffFunElt, DiffFunElt → FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-div-difffunelt-difffunelt)
      - [`x / r: DiffFunElt, RngElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-div-difffunelt-rngelt)
    - [Equality and Membership](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#equality-and-membership)
      - [`x eq y: DiffFunElt, DiffFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-eq-difffunelt-difffunelt)
      - [`x in D: Any, DiffFun → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#operation-op-in-any-difffun)
    - [Predicates on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#predicates-on-elements)
      - [`IsExact(d): DiffFunElt → BoolElt, FldFunGElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-isexact-difffunelt)
      - [`IsZero(d): DiffFunElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-iszero-difffunelt)
    - [Functions on Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#functions-on-elements)
      - [`Valuation(d, P): DiffFunElt, PlcFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-valuation-difffunelt-plcfunelt)
      - [`Divisor(d): DiffFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-divisor-difffunelt)
      - [`Residue(d, P): DiffFunElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-residue-difffunelt-plcfunelt)
      - [Example: Functions on Differentials](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#example-ex-7c77de)
      - [`Module(L, R): SeqEnum[ DiffFunElt ], Rng → Mod, Map, SeqEnum[ ModElt ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-module-seqenum-difffunelt-rng)
      - [`Relations(L, R): SeqEnum[ DiffFunElt ], Rng → ModTupRng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-relations-seqenum-difffunelt-rng)
      - [`Relations(L, R, m): SeqEnum[ DiffFunElt ], Rng, RngIntElt → ModTupRng`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-relations-seqenum-difffunelt-rng-rngintelt)
      - [Example: Differentials as a Module](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#example-ex-3e031a)
      - [`Cartier(b): DiffFunElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-cartier-difffunelt)
      - [`Cartier(b, r): DiffFunElt, RngIntElt → DiffFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-cartier-difffunelt-rngintelt)
    - [Other](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#other)
      - [`CartierRepresentation(F): FldFunG → AlgMatElt, SeqEnum[DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-cartierrepresentation-fldfung)
      - [`CartierRepresentation(F, r): FldFunG, RngIntElt → AlgMatElt, SeqEnum[DiffFunElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-cartierrepresentation-fldfung-rngintelt)
      - [Example: Trivial Cartier Action on Differentials](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#example-ex-78c02f)
- [Weil Descent](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md)
  - [`WeilDescent(E,k): FldFun, FldFin → FldFunG, Map`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#function-fldfung-weil-desc)
  - [`ArtinSchreierExtension(c,a,b): FldFin, FldFin, FldFin → FldFun`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#function-artinschreierextension-fldfin-fldfin-fldfin)
  - [`WeilDescentDegree(E,k): FldFun, FldFin → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#function-weildescentdegree-fldfun-fldfin)
  - [`WeilDescentGenus(E,k): FldFun, FldFin → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#function-weildescentgenus-fldfun-fldfin)
  - [`MultiplyFrobenius(b,f,F): RngElt, RngUPolElt, Map → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#function-multiplyfrobenius-rngelt-rngupolelt-map)
  - [Example: GHS Weil Descent](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/weil_descent.md#example-ex-469a62)
- [Function Field Database](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md)
  - [Creation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#creation)
    - [`FunctionFieldDatabase(q, d): RngIntElt, RngIntElt → DB`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-functionfielddatabase-rngintelt-rngintelt)
    - [`sub< D | : parameters>: DB → DB`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#constructor-alffdb-sub)
  - [Access](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#access)
    - [`BaseField(D): DB → FldFin`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-basefield-db)
    - [`CoefficientField(D): DB → FldFin`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-coefficientfield-db)
    - [`Degree(D): DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-degree-db)
    - [`# D: DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#operation-operation-db-rngintelt)
    - [`NumberOfFields(D): DB → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-numberoffields-db)
    - [`FunctionFields(D): DB → [ FldFunG ]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#function-functionfields-db)
    - [Example: Genus Distribution in the Function Field Database](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#example-ex-f1c514)
- [The Montes Algorithm](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md)
  - [`Montes(f, p): RngUPolElt, RngUPolElt → SeqEnum, SeqEnum, RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#function-montes-rngupolelt-rngupolelt)
  - [Example: Montes Algorithm for a Polynomial](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#example-ex-531fa2)
  - [`Montes(K, p): FldArith, RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#procedure-montes-fldarith-rngelt)
  - [Example: Montes Algorithm for a Function Field](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#example-ex-bec397)
  - [`SFL(P, s): OMIdl, RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#procedure-sfl-omidl-rngintelt)
  - [Example: Refining an OM Prime Ideal Approximation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#example-ex-8aed80)
  - [`SetUseMontes(f): BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#procedure-setusemontes-boolelt)
  - [`SetUseMontes(t, f): Cat, BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#procedure-setusemontes-cat-boolelt)
  - [`GetUseMontes(t): Cat → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#function-getusemontes-cat)
  - [`SetVerbose("Montes", v): MonStgElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#procedure-setverbose-monstgelt-rngintelt-montes)
- [Ideals in OM Representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md)
  - [`Ideal(I): OMIdl → RngOrdIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-ideal-omidl)
  - [`OMRepresentation(I): RngFunOrdIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-omrepresentation-rngfunordidl)
  - [`OMRepresentation(I): RngOrdFracIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-omrepresentation-rngordfracidl)
  - [`OMRepresentation(L, S): FldArith, [FldArithElt] → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-omrepresentation-fldarith-fldarithelt)
  - [`OMRepresentation(L, a): FldArith, FldArithElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-omrepresentation-fldarith-fldarithelt-2)
  - [`OMRepresentation(L, a): FldArith, RngElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-omrepresentation-fldarith-rngelt)
  - [Example: Converting OM Prime Ideals to Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#example-ex-c49fbd)
  - [Ideal Arithmetic](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#ideal-arithmetic)
    - [`I + J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-plus-omidl-omidl)
    - [`I * J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-times-omidl-omidl)
    - [`I / J: OMIdl, OMIdl → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-div-omidl-omidl)
    - [`I ^ n: OMIdl, RngIntElt → OMIdl`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-pow-omidl-rngintelt)
    - [Example: Arithmetic of OM Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#example-ex-0a493e)
  - [Ideal Predicates](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#ideal-predicates)
    - [`IsOne(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-isone-omidl)
    - [`IsZero(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-iszero-omidl)
    - [`I eq J: OMIdl, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-eq-omidl-omidl)
    - [`a in I: RngElt, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-in-rngelt-omidl)
    - [`I subset J: OMIdl, OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#operation-op-subset-omidl-omidl)
    - [`IsPrime(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-isprime-omidl)
    - [`IsIntegral(I): OMIdl → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-rep.md#function-isintegral-omidl)
- [Ideal Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md)
  - [`pIntegralBasis(I, p): OMIdl, RngElt → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-pintegralbasis-omidl-rngelt)
  - [`SIntegralBasis(I, S): OMIdl, SeqEnum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-sintegralbasis-omidl-seqenum)
  - [`SIntegralBasis(I, S): RngOrdFracIdl, [RngIntElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-sintegralbasis-rngordfracidl-rngintelt)
  - [`SIntegralBasis(I, S): RngFunOrdIdl, [RngUPolElt] → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-sintegralbasis-rngfunordidl-rngupolelt)
  - [`Basis(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-basis-omidl)
  - [Example: Integral Basis of an OM Ideal](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#example-ex-70e335)
  - [`TwoElement(I): OMIdl → FldArithElt, FldArithElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-twoelement-omidl)
  - [`Norm(I): OMIdl → RngElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-norm-omidl)
  - [`Valuation(alpha, P : parameters): FldArithElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-valuation-fldarithelt-omidl)
  - [`Valuation(alpha, P : parameters): FldRatElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-valuation-fldratelt-omidl)
  - [`Valuation(alpha, P : parameters): RngIntElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-valuation-rngintelt-omidl)
  - [`Valuation(alpha, P : parameters): RngUPolElt, OMIdl → RngIntElt, FldElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-valuation-rngupolelt-omidl)
  - [`Valuation(I, P): OMIdl, OMIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-valuation-omidl-omidl)
  - [`a mod P: FldArithElt, OMIdl → FldArithElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#operation-operation-mod-fldarithelt-omidl-fldarithelt)
  - [`Reduction(a, P): FldArithElt, OMIdl → FldArithElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-reduction-fldarithelt-omidl)
  - [`Reduction(a, P, m): FldArithElt, OMIdl, RngIntElt → [FldArithElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-reduction-fldarithelt-omidl-rngintelt)
  - [`Factorization(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-factorization-omidl)
  - [`Factorisation(I): OMIdl → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-factorisation-omidl)
  - [Example: Creating an OM Ideal](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#example-ex-fbb1be)
  - [`ResidueField(I): OMIdl → Fld`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-residuefield-omidl)
  - [`Degree(I): OMIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#function-degree-omidl)
  - [Example: Degree and Residue Field of OM Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideal-op.md#example-ex-7d7ba3)
- [Divisors in OM representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md)
  - [Constructing Divisors in OM representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#constructing-divisors-in-om-representation)
    - [`OMDivisor(If, Ii): OMIdl, OMIdl → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-omdivisor-omidl-omidl)
    - [`OMDivisor(I): OMIdl → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-omdivisor-omidl)
    - [`OMDivisor(z): FldFunElt → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-omdivisor-fldfunelt)
    - [`PoleDivisor(a): FldFunElt → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-poledivisor-fldfunelt)
    - [`ZeroDivisor(a): FldFunElt → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-zerodivisor-fldfunelt)
    - [`OMDivisorOfDegreeOne(F): FldFun → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-omdivisorofdegreeone-fldfun)
    - [`ReferenceDivisor(F): FldFun → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-referencedivisor-fldfun)
    - [`OMDivisor(D): DivFunElt → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-omdivisor-divfunelt)
    - [Example: Constructing Divisors in OM Representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#example-ex-42c816)
  - [Arithmetic with Divisors in OM representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#arithmetic-with-divisors-in-om-representation)
    - [`k * D: RngIntElt, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#operation-op-times-rngintelt-omdiv)
    - [`D1 + D2: OMDiv, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#operation-op-plus-omdiv-omdiv)
    - [`D1 - D2: OMDiv, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#operation-op-minus-omdiv-omdiv)
    - [`GCD(D1, D2): OMDiv, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-gcd-omdiv-omdiv)
    - [`Gcd(D1, D2): OMDiv, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-gcd-omdiv-omdiv-2)
    - [`GreatestCommonDivisor(D1, D2): OMDiv, OMDiv → OMDiv`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-greatestcommondivisor-omdiv-omdiv)
    - [Example: Arithmetic of OM Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#example-ex-31985e)
  - [Predicates on Divisors in OM representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#predicates-on-divisors-in-om-representation)
    - [`IsEffective(D): OMDiv → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-iseffective-omdiv)
    - [`IsPositive(D): OMDiv → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-ispositive-omdiv)
    - [`IsPrincipal(D): OMDiv → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-isprincipal-omdiv)
    - [`D1 eq D2: OMDiv, OMDiv → BoolElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#operation-op-eq-omdiv-omdiv)
    - [Example: Predicates on OM Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#example-ex-c8e530)
  - [Other Operations on Divisors in OM representation](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#other-operations-on-divisors-in-om-representation)
    - [`Divisor(D): OMDiv → DivFunElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-divisor-omdiv)
    - [`Valuation(D, P): OMDiv, OMIdl → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-valuation-omdiv-omidl)
    - [`Support(D): OMDiv → [OMIdl], [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-support-omdiv)
    - [`Height(D): OMDiv → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-height-omdiv)
    - [`CanonicalHeight(D): OMDiv → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-canonicalheight-omdiv)
    - [`Degree(D): OMDiv → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-degree-omdiv)
    - [`Basis(D): OMDiv → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-basis-omdiv)
    - [`Dimension(D): OMDiv → RngIntElt`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-dimension-omdiv)
    - [`ReducedBasis(D): OMDiv → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-reducedbasis-omdiv)
    - [`SemiReducedBasis(D): OMDiv → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-semireducedbasis-omdiv)
    - [`SuccessiveMinima(D): OMDiv → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-successiveminima-omdiv)
    - [`ApproximatedSuccessiveMinima(D): OMDiv → SeqEnum`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#function-approximatedsuccessiveminima-omdiv)
    - [Example: Operations on OM Divisors](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors-in-om-representation.md#example-ex-e8bf40)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/bibliography.md)

### Introduction

This version of Magma is based on the KANT Version 4 system for algebraic function field computations. Special functions for rational function fields are described in Chapter [Rational Function Fields](https://docs.magma-maths.org/GlobalFields/RationalFunctionFields/index-rational-function-fields.md#fldfunrat-main).

An algebraic function field $F/k$ (in one variable) over a field $k$ is a field extension $F$ of $k$ such that $F$ is a finite field extension of $k(x)$ for an element $x \in F$ which is transcendental over $k$. As a Magma object it is of type `FldFun` with elements of type `FldFunElt`. For perfect $k$ it is always possible to choose $x \in F$ so that $F/k(x)$ is also separable. For such $x$ there exists a primitive element $\alpha \in F$ with $F = k(x, \alpha)$ where $\alpha$ is a root of an irreducible, separable polynomial in $k(x)[y]$.

#### Representations of Fields

All function fields in Magma can be represented as described above, i.e. as $k(x, \alpha)$ where $x$ is transcendental and $\alpha$ is algebraic. This is the representation which has the most functionality.

Alternatively, one may wish to consider a function field as a combined transcendental and algebraic extension of its constant field, more like a curve. Such a field would be a quotient of $k[x, y]$. Fields in this representation do not have orders.

Algebraic function fields may be extended to create relative finite extensions of $k(x)$ like $F = k(x, \alpha_1, \ldots, \alpha_n)$. The functionality described in this chapter which is not available for these relative extensions is that involving series rings, galois groups, and subfields.

It is also possible to make non–simple extensions where more than one root of a polynomial is added at each step by extending by several polynomials. These extensions have the same functionality as the relative finite extensions, except that primitive elements and some functions involving differentials are not available.

Function fields represented as finite extensions may have orders. Some orders will have a basis different to that of their function fields. Orders may have a field of fractions. A field of fractions of an order is isomorphic to the function field of the order, however its elements are represented with respect to the basis of the order. So there are 3 different types of rings covered in this chapter, function fields (`FldFun`), orders of function fields (`RngFunOrd`) and fields of fractions of orders of function fields (`FldFunOrd`). Each ring type has its own corresponding element type.

### Creation of Algebraic Function Fields and their Orders

#### Creation of Algebraic Function Fields

<a id="constructor-constructor-ext-fldfunrat-rngupolelt-fldfun"></a>
##### `ext< K | f >: FldFunRat, RngUPolElt -> FldFun`

<a id="constructor-constructor-ext-fldfun-rngupolelt-fldfun"></a>
##### `ext< K | f >: FldFun, RngUPolElt -> FldFun`

<a id="function-functionfield-rngupolelt"></a>
##### `FunctionField(f : parameters): RngUPolElt -> FldFun`

```magma
Check : BoolElt                    Default: true
Global: BoolElt                    Default: true
```

Let $k$ be a field and $K = k(x)$ or $K = k(x, \alpha_1, \ldots, \alpha_r)$ some finite extension of $k(x)$. Given an irreducible and separable polynomial $f \in K[y]$ of degree greater than zero with coefficients within $K$, create the algebraic function field $F= K[y] / \langle f \rangle = k(x, \alpha_1, \ldots, \alpha_r, \alpha)$ obtained by adjoining a root $\alpha$ of $f$ to $K$. $F$ will be viewed as a (finite) extension of $K$. The polynomial $f$ is also allowed to be $\in k[x][y]$.

The optional parameter `Check` may be used to prevent some conditions from being tested. The default is `Check := true`, so that $f$ is verified to be irreducible and separable. The optional parameter `Global` may be used to allow another copy of the field to be returned if it is set to `false`, otherwise if a field has already been constructed using $f$ over $K$ and has not been deleted then the existing field will be returned.

The angle bracket notation may be used to assign the root $\alpha$ to an identifier: `F<a> := FunctionField(f)`.

<a id="function-functionfield-rngmpolelt"></a>
##### `FunctionField(f : parameters): RngMPolElt -> FldFun`

```magma
Check : BoolElt                    Default: true
Global: BoolElt                    Default: true
```

Let $k$ be a field. Given an irreducible polynomial $f \in k[x, y]$ of degree greater than zero, create the algebraic function field $F$ which is the field of fractions of $k[x, y] / \langle f \rangle$. The polynomial $f$ must be separable in at least one variable. $F$ will be viewed as (infinite) extension of $k$.

The optional parameter `Check` may be used to prevent some conditions from being tested. The default is `Check := true`, so that $f$ is verified to be irreducible and separable in at least one variable. The optional parameter `Global` may be used to allow another copy of the field to be returned if it is set to `false`, otherwise if a field has already been constructed using $f$ over $K$ and has not been deleted then the existing field will be returned.

The angle bracket notation may be used to assign the images of $x,y$ in $F$ to identifiers: `F<a, b> := FunctionField(f)`.

<a id="function-functionfield-rngupolelt-2"></a>
##### `FunctionField(S): [RngUPolElt] -> FldFun`

```magma
Check: BoolElt                    Default: true
```

Return the function field $F$ whose defining polynomials are the polynomials in the sequence $S$. If `Check` is set to `false` then it will not be checked the polynomials actually define a field.

<a id="function-hermitianfunctionfield-rngintelt-rngintelt"></a>
##### `HermitianFunctionField(p, d): RngIntElt, RngIntElt -> FldFun`

<a id="function-hermitianfunctionfield-rngintelt"></a>
##### `HermitianFunctionField(q): RngIntElt -> FldFun`

Create the Hermitian function field $F = {\bf F}_{q^2}(x, \alpha)$ defined by $\alpha^q + \alpha = x^{q+1}$, where $q$ is the $d$-th power of the prime number $p$.

<a id="constructor-constructor-sub-fldfun-fldfun"></a>
##### `sub<F | S>: FldFun, [] -> FldFun`

<a id="constructor-constructor-sub-fldfun-fldfun-2"></a>
##### `sub<F | s₁, ..., sᵣ >: FldFun, [] -> FldFun`

The subfield of the function field $F$ containing the elements in the sequence $S$ or the elements $s_i$.

<a id="procedure-assignnames-fldfun-monstgelt-ref"></a>
##### `AssignNames(~F, s): FldFun, [ MonStgElt ]`

<a id="procedure-assignnames-fldfunelt-monstgelt-ref"></a>
##### `AssignNames(~a, s): FldFunElt, [ MonStgElt ]`

Procedure to change the name of the generating element(s) in the function field $F$ ($a$ in $F$) to the contents of the sequence of strings $s$, which must have length $1$ or $2$ in this case.

This procedure only changes the name(s) used in printing the elements of $F$. It does *not* assign to any identifier(s) the value(s) of the generator(s) in $F$; to do this, use an assignment statement, or use angle brackets when creating the field.

Note that since this is a procedure that modifies $F$, it is necessary to have a reference `~F` to $F$ (or $a$) in the call to this function.

<a id="function-functionfield-rng"></a>
##### `FunctionField(R): Rng -> FldFunG`

```magma
Global: BoolElt                    Default: true
Type  : Cat                        Default: FldFunRat
```

Return the rational function field over $R$ in one variable. If `Global` is `false` then create a new copy of the field, otherwise reuse any globally created field which already exists. If `Type` is `FldFun` create the field as an algebraic function field, otherwise create as a rational function field.

<a id="example-ex-4f7d5b"></a>
##### `Example: Creating a Function Field Extension (ex-4f7d5b)`

Let ${\bf F}_{5}$ be the finite field of five elements. To create the function field extension ${\bf F}_{5}(x, \alpha) / {\bf F}_{5}(x)$, where $\alpha$ satisfies $\alpha^2 = 1/x,$ one may proceed in the following, equivalent ways:

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := FunctionField(y^2 - 1/x);
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
y^2 + 4/x
```

or

```magma
> R<x> := PolynomialRing(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := FunctionField(x*y^2 - 1);
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
x*y^2 + 4
```

or

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := ext< R | y^2 - 1/x >;
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
y^2 + 4/x
```

<a id="example-ex-b33520"></a>
##### `Example: Creating a Relative Extension (ex-b33520)`

An extension of $F$ may be created as follows.

```magma
> R<y> := PolynomialRing(F);
> FF<beta> := FunctionField(y^3 - x/alpha : Check := false);
> FF;
Algebraic function field defined over F by
y^3 + 4*x^2*alpha
```

<a id="example-ex-5f689c"></a>
##### `Example: Creating a Non-Simple Extension (ex-5f689c)`

To create a non–simple extension:

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> FF<alpha, beta> := FunctionField([y^2 - 1/x, y^3 + x]);
> FF;
Algebraic function field defined over Univariate rational function field over
GF(5) by
y^2 + 4/x
y^3 + x
```

or

```magma
> P<y> := PolynomialRing(F);
> FF<beta, gamma> := FunctionField([y^2 - x/alpha, y^3 + x]);
> FF;
Algebraic function field defined over F by
y^2 + 4*x^2*alpha
y^3 + x
```

<a id="example-ex-5c6691"></a>
##### `Example: Hermitian Function Field (ex-5c6691)`

The creation of an Hermitian function field:

```magma
> F := HermitianFunctionField(9);
> F;
Algebraic function field defined over GF(3^4) by
y^9 + y + 2*x^10
```

<a id="creation-rings"></a>
<a id="fldfung-max-ord"></a>
#### Construction of Orders of Algebraic Function Fields

Equation orders, maximal orders, and other orders of algebraic function fields can be constructed.

For more information about the Montes algorithm which can be used to compute maximal orders, see Section [The Montes Algorithm](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/montes.md#montes-fld-fun).

<a id="function-equationorderfinite-fldfun"></a>
##### `EquationOrderFinite(F): FldFun -> RngFunOrd`

Create the ‘finite’ equation order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$, i.e. $k[x, d_1 \alpha_1, \ldots, d_r \alpha_r, d \alpha]$ where $d_j, d \in k[x]$ is chosen such that $d_j \alpha_j, d \alpha$ are integral over $k[x]$.

<a id="function-maximalorderfinite-fldfun"></a>
##### `MaximalOrderFinite(F): FldFun -> RngFunOrd`

```magma
Al: MonStgElt                    Default: 
```

Construct the ‘finite’ maximal order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$. This is the integral closure of $k[x, d_1 \alpha_1, \ldots, d_r \alpha_r]$ in $F$. If $F$ is an extension of a rational function field over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and the parameter `Al` is set to `"Montes"` then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used for the computation.

<a id="function-equationorderinfinite-fldfun"></a>
##### `EquationOrderInfinite(F): FldFun -> RngFunOrd`

Create the ‘infinite’ equation order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$, i.e. $o_{\infty}[\alpha_1, \ldots, \alpha_r, \beta]$ where $o_{\infty}$ denotes the valuation ring of the degree valuation in $k(x)$ and $\beta$ is a primitive element of $F/k(x, \alpha_1, \ldots, \alpha_r)$ which is integral over $o_{\infty}$.

<a id="function-maximalorderinfinite-fldfun"></a>
##### `MaximalOrderInfinite(F): FldFun -> RngFunOrd`

Create the ‘infinite’ maximal order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$. This is the integral closure of $o_{\infty}$ in $F$.

<a id="function-integralclosure-rng-fldfun"></a>
##### `IntegralClosure(R, F): Rng, FldFun -> RngFunOrd`

The integral closure of the subring $R$ of the function field $F$ in itself.

<a id="function-equationorder-rngfunord"></a>
##### `EquationOrder(O): RngFunOrd -> RngFunOrd`

The equation order of the order $O$. An order whose basis is a transformation of that of $O$ and is a power basis.

<a id="function-fldfung-max-ord-al"></a>
##### `MaximalOrder(O): RngFunOrd -> RngFunOrd`

```magma
Discriminant: Any                          Default: 
Ramification: SeqEnum                      Default: 
Al          : MonStgElt                    Default: "Auto"
MaximalOrder: Verbose                      Default: 5
```

The maximal order of the order $O$ of an algebraic function field.

If $O$ is a radical (pure) extension then specific code is used to calculate each $p$-maximal order, rather than the Round $2$ method. In this case we can compute a pseudo basis for the $p$-maximal orders knowing only the valuation of the constant coefficient of the defining polynomial at $p$ [[Sut12](https://docs.magma-maths.org/references.md#cite-suth-max-kummer)].

If $O$ is an Artin–Schreier extension then the maximal order can be computed directly without computing the $p$-maximal orders. The proof of Proposition III.7.8 of [[Sti93](https://docs.magma-maths.org/references.md#cite-stichtenoth)] gives us a start on some elements which are a basis for the maximal order [[Sut13](https://docs.magma-maths.org/references.md#cite-suth-artin)].

If the `Discriminant` or `Ramification` parameters are supplied an algorithm ([[BL94c](https://docs.magma-maths.org/references.md#cite-buchman-lenstra)], Theorems 1.2 and 7.6) which can compute the maximal order given the discriminant of the maximal order will be used. `Discriminant` must be an element of the coefficient ring of $O$ if $O$ is a non relative order and must be an ideal of $O$ if $O$ is a relative order. `Ramification` must contain elements of the coefficient ring if $O$ is a non relative order and must contain ideals of $O$ if $O$ is a relative order. The ramification sequence is taken to contain prime factors of the discriminant. Only one of these parameters can be specified and if one of them is then `Al` cannot be specified.

If $O$ is an extension of a polynomial ring over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and the parameter `Al` is set to `"Montes"` then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used to compute the maximal order. Otherwise `Al` may be set to `"Round2"` to avoid using the algorithms for the special cases above.

<a id="procedure-setordermaximal-rngfunord-boolelt"></a>
##### `SetOrderMaximal(O, b): RngFunOrd, BoolElt`

Set the order $O$ of a function field to be maximal if $b$ is `true` and to be non–maximal if $b$ is `false`.

<a id="constructor-constructor-ext-rngfunord-rngupolelt-rngfunord"></a>
##### `ext<O | f>: RngFunOrd, RngUPolElt -> RngFunOrd`

```magma
Check: Bool                    Default: true
```

The order $O$ with a root of $f$ adjoined.

<a id="example-ex-68faea"></a>
##### `Example: Creating Orders of a Function Field (ex-68faea)`

Creation of orders is shown below.

```magma
> PR<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(PR);
> FR1<a> := FunctionField(y^3 - x*y^2 + y + x^4);
> P<y> := PolynomialRing(FR1);
> FR2<c> := FunctionField(y^2 + y - a/x^5);
> EFR1F := EquationOrderFinite(FR1);
> MFR1F := MaximalOrderFinite(FR1);
> EFR1I := EquationOrderInfinite(FR1);
> MFR1I := MaximalOrderInfinite(FR1);
> EFR2F := EquationOrderFinite(FR2);
> MFR2F := MaximalOrderFinite(FR2);
> EFR2I := EquationOrderInfinite(FR2);
> MFR2I := MaximalOrderInfinite(FR2);
> MaximalOrder(EFR2I);
>> MaximalOrder(EFR2I);
               ^
Runtime error in 'MaximalOrder': Order must be defined over a maximal order
> MFR2I;
Maximal Order of FR2 over MFR1I
> P<y> := PolynomialRing(FR1);
> MaximalOrder(ext<MFR1F | y^2 + y - a*x^5>); MFR2F;
Maximal Equation Order of Algebraic function field defined over FR1 by
y^2 + y - x^5*a over EFR1F
Maximal Order of FR2 over EFR1F
> MaximalOrder(ext<MFR1I | y^2 - 1/a>);
Maximal Order of Algebraic function field defined over FR1 by
y^2 + 1/x^4*a^2 - 1/x^3*a + 1/x^4 over MFR1I
```

<a id="example-ex-4ba3aa"></a>
##### `Example: Integral Closure in a Function Field (ex-4ba3aa)`

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> f := y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2;
> F<alpha> := FunctionField(f);
> IntegralClosure(R, F);
Algebraic function field defined over GF(5) by
y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2
> IntegralClosure(PolynomialRing(GF(5)), F);
Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
> IntegralClosure(ValuationRing(R), F);
Maximal Order of F over Valuation ring of Rational function field of
rank 1 over GF(5)
Variables: x with generator 1/x
```

<a id="function-order-rngfunord-algmatelt-rngelt"></a>
##### `Order(O, T, d): RngFunOrd, AlgMatElt, RngElt -> RngFunOrd`

```magma
Check: BoolElt                    Default: true
```

Create the order whose basis is that of the order $O$ multiplied by the matrix $T$ over the coefficient ring of $O$ divided by the scalar $d$. If the parameter `Check` is set to `false` then it will not be checked that the result is actually an order (potentially expensive). Note that this can result in a non-order being constructed which may cause errors later.

<a id="function-order-rngfunord-modded"></a>
##### `Order(O, M): RngFunOrd, ModDed -> RngFunOrd`

```magma
NFBasis: BoolElt                    Default: true
Check  : BoolElt                    Default: true
```

Create the order whose basis is that of the order $O$ multiplied by the dedekind module $M$. If the parameter `Check` is set to `false` then it will not be checked that the result is actually an order (potentially expensive). Note that this can result in a non-order being constructed which may cause errors later. If the parameter `NFBasis` is set to `false` then the `PseudoGenerators` of the module $M$ will be used rather than the `PseudoBasis`, however these pseudo generators must also be a pseudo basis.

<a id="function-order-rngfunord-fldfunelt"></a>
##### `Order(O, S): RngFunOrd, [FldFunElt] -> RngFunOrd`

```magma
Verify : BoolElt                    Default: true
IsBasis: BoolElt                    Default: false
```

Given a sequence $S$ of elements in an algebraic function field $F$ create the minimal order $R$ of $F$ which contains all elements of $S$.

The order $O$ may be an order of $F$ which will be used as the suborder of $R$, in which case its coefficient ring should be maximal, or $O$ may be a maximal order of the coefficient field of $F$.

If `Verify` is `true`, it is verified that the elements of $S$ are integral algebraic numbers. This can be a lengthy process if the field is of large degree.

Setting `IsBasis` to `true` assumes that the given elements actually form a basis for the new order, thus it avoids testing for multiplicative closure. Without this parameter the order returned will have a canonical basis chosen with no direct relation to the input. By default, products of the generators will be added until the module is closed under multiplication. Note that setting `IsBasis` to `true` can result in a non-order being constructed if the elements in the sequence are not a basis which may cause errors later.

If `IsBasis` is set to `true` to specify the basis of the resulting order rather than avoid the expense of the multiplicative closure computation, it can be checked that the result $O$ is an order using `Order(SubOrder(O), Matrix(CoefficientRing(O), M*d), d) where d is Denominator(M) where M is BasisMatrix(O);`. If $O$ is not an order this will cause an error.

<a id="function-simplify-rngfunord"></a>
##### `Simplify(O): RngFunOrd -> RngFunOrd`

Return the order $O$ as a direct transformation of its equation order, instead of a composition of transformations.

<a id="operation-op-plus-rngfunord-rngfunord"></a>
##### `O1 + O2: RngFunOrd, RngFunOrd -> RngFunOrd`

The smallest common over order of $O1$ and $O2$ where $O1$ and $O2$ have the same equation order.

<a id="operation-op-meet-rngfunord-rngfunord"></a>
##### `O1 meet O2: RngFunOrd, RngFunOrd -> RngFunOrd`

The intersection of orders $O1$ and $O2$ which must have the same equation order.

<a id="function-asextensionof-rngfunord-rngfunord"></a>
##### `AsExtensionOf(O1, O2): RngFunOrd, RngFunOrd -> RngFunOrd`

Return the order $O1$ as a transformation of the order $O2$ where $O1$ and $O2$ have the same coefficient ring.

<a id="example-ex-b548f7"></a>
##### `Example: Further Order Constructions (ex-b548f7)`

Some of the above order creations are shown below.

```magma
> P<x> := PolynomialRing(GF(5));
> P<y> := PolynomialRing(P);
> F<a> := FunctionField(y^3 - x^4);
> O := Order(EquationOrderFinite(F), MatrixAlgebra(Parent(x), 3)!1, Parent(x)!3);
> O;
Order of F over Univariate Polynomial Ring in x over GF(5)
> Basis(O);
[
    2,
    2*a,
    2*a^2
]
> P<y> := PolynomialRing(O);
> EO := ext<MaximalOrder(O) | y^2 + O!(2*a)>;
> V := KModule(F, 2);
> M := Module([V | [1, 0], [4, 3], [9, 2]]);
> M;
Module over Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
Ideal of Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
Generator:
1 car Ideal of Maximal Order of F over Univariate Polynomial Ring in x over
GF(5)
Generator:
2
> O2 := Order(EO, M);
> O2;
Order of Algebraic function field defined over F by
$.1^2 + 2*a over Maximal Order of F over Univariate Polynomial Ring in x over
GF(5)
Transformation of EO

Transformation Matrix:
[[ 1, 0, 0 ] [ 0, 0, 0 ]]
[[ 0, 0, 0 ] [ 1, 0, 0 ]]
> Basis(O2);
[ 1, $.1 ]
```

<a id="orders-ideals"></a>
<a id="fldfung-ord-idl"></a>
#### Orders and Ideals

Orders may be created using ideals of other orders. Ideals are discussed in Section [Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#fldfung-ideals).

<a id="function-multiplicatorring-rngfunordidl"></a>
##### `MultiplicatorRing(I): RngFunOrdIdl -> RngFunOrd`

Returns the multiplicator ring of the ideal $I$ of the order $O$, that is, the subring of elements of the field of fractions of $O$ that multiply $I$ into itself.

<a id="function-pmaximalorder-rngfunord-rngfunordidl"></a>
##### `pMaximalOrder(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrd`

<a id="function-pmaximalorder-rngfunord-rngelt"></a>
##### `pMaximalOrder(O, p): RngFunOrd, RngElt -> RngFunOrd`

The $p$-maximal over order of $O$ where $p$ is a prime polynomial or ideal of the coefficient ring of $O$ or an element of valuation $1$ of the valuation ring.

If $O$ is a Kummer extension then specific code is used to calculate each $p$-maximal order, rather than the Round $2$ method. In this case we know $1$ or $2$ elements which generate the $p$-maximal order and can write the order down.

If $O$ is an Artin–Schreier extension then we can also write down a basis for the $p$-maximal order and avoid the Round $2$ algorithm. We use [[Sti93](https://docs.magma-maths.org/references.md#cite-stichtenoth)] Proposition III.7.8 to get a start on computing these elements.

<a id="function-pradical-rngfunord-rngfunordidl"></a>
##### `pRadical(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrdIdl`

<a id="function-pradical-rngfunord-rngelt"></a>
##### `pRadical(O, p): RngFunOrd, RngElt -> RngFunOrdIdl`

Returns the $p$-radical of an order $O$ for a prime $p$ (polynomial or ideal of the coefficient ring or element of valuation $1$ of the valuation ring), defined as the ideal consisting of elements of $O$ for which some power lies in the ideal $pO$.

It is possible to call this function even if $p$ is not prime. In this case the $p$-trace-radical will be computed, i.e.

$$
\{ x\in F \mid {\operatorname{Tr}}(xO)\subseteq C\}
$$

for F the field of fractions of $O$ and $C$ the order of $p$ (if $p$ is an ideal) or the parent of $p$ otherwise. If $p$ is square free and all divisors are larger than the field degree, this is the intersection of the radicals for all $l$ dividing $p$.

### Related Structures

#### Parent and Category

Function fields form the Magma category `FldFun` and function field orders form the Magma category `RngFunOrd`. The notional power structures exist as parents of function fields and their orders but allow no operations.

<a id="function-category-fldfun"></a>
##### `Category(F): FldFun -> Cat`

<a id="function-category-rngfunord"></a>
##### `Category(O): RngFunOrd -> Cat`

<a id="function-parent-fldfun"></a>
##### `Parent(F): FldFun -> Pow`

<a id="function-parent-rngfunord"></a>
##### `Parent(O): RngFunOrd -> Pow`

#### Other Related Structures

More interesting related structures (than above) are listed below.

<a id="function-primering-fldfun"></a>
##### `PrimeRing(F): FldFun -> Rng`

<a id="function-primefield-fldfun"></a>
##### `PrimeField(F): FldFun -> Rng`

<a id="function-primering-rngfunord"></a>
##### `PrimeRing(O): RngFunOrd -> Rng`

The prime field of the function field $F$ or the order $O$ (prime ring of the constant field).

<a id="function-constantfield-fldfung"></a>
##### `ConstantField(F): FldFunG -> Rng`

<a id="function-definingconstantfield-fldfung"></a>
##### `DefiningConstantField(F): FldFunG -> Rng`

The constant field $k$, where $F = k(x, \alpha)$.

<a id="function-exactconstantfield-fldfung"></a>
##### `ExactConstantField(F): FldFunG -> Rng, Map`

The exact constant field of the algebraic function field $F/k$, i.e. the algebraic closure in $F$ of the constant field $k$ of $F$, together with the inclusion map.

<a id="function-basering-fldfun"></a>
##### `BaseRing(F): FldFun -> Rng`

<a id="function-basefield-fldfun"></a>
##### `BaseField(F): FldFun -> Rng`

<a id="function-coefficientring-fldfun"></a>
##### `CoefficientRing(F): FldFun -> Rng`

<a id="function-coefficientfield-fldfun"></a>
##### `CoefficientField(F): FldFun -> Rng`

The rational function field $k(x)$ if the function field $F$ is an extension of $k(x)$ and $k$ if $F$ is an extension of $k$. If $F$ is an extension of another algebraic function field then this field will be returned.

<a id="function-isabasefield-fld-fld"></a>
##### `ISABaseField(F, G): Fld, Fld -> BoolElt`

Applies to more general fields within Magma than function fields. Returns whether $G$ is amongst the recursively defined base fields of $F$.

<a id="function-basering-rngfunord"></a>
##### `BaseRing(O): RngFunOrd -> Rng`

<a id="function-coefficientring-rngfunord"></a>
##### `CoefficientRing(O): RngFunOrd -> Rng`

The polynomial algebra $k[x]$ if the order $O$ is finite or the degree valuation ring if $O$ is infinite. If $O$ is an extension of another order of an algebraic function field this order will be returned.

<a id="function-basering-fldfunord"></a>
##### `BaseRing(FF): FldFunOrd -> Rng`

<a id="function-basefield-fldfunord"></a>
##### `BaseField(FF): FldFunOrd -> Rng`

<a id="function-coefficientring-fldfunord"></a>
##### `CoefficientRing(FF): FldFunOrd -> Rng`

<a id="function-coefficientfield-fldfunord"></a>
##### `CoefficientField(FF): FldFunOrd -> Rng`

Given a field of fractions $FF$ of an order $O$ return the field of fractions of the coefficient ring of $O$.

<a id="function-suborder-rngfunord"></a>
##### `SubOrder(O): RngFunOrd -> RngFunOrd`

For a non equation order $O$ returns the order which $O$ was created as a transformation of. This order is one transformation closer to the equation order.

<a id="function-functionfield-rngfunord"></a>
##### `FunctionField(O): RngFunOrd -> FldFun`

The function field which $O$ is an order of.

<a id="function-fieldoffractions-rngfunord"></a>
##### `FieldOfFractions(O): RngFunOrd -> FldFunOrd`

<a id="function-fieldoffractions-fldfunord"></a>
##### `FieldOfFractions(FF): FldFunOrd -> FldFunOrd`

<a id="function-fieldoffractions-fldfun"></a>
##### `FieldOfFractions(F): FldFun -> FldFun`

Given an order $O$, this function returns the field of fractions, a field with the same basis as $O$. On a function field or a field of fractions this function is trivial.

<a id="function-order-fldfunord"></a>
##### `Order(FF): FldFunOrd -> RngFunOrd`

Given a field of fractions $FF$ return the order $O$ which is the ring of integers of $FF$.

<a id="function-rationalextensionrepresentation-fldfung"></a>
##### `RationalExtensionRepresentation(F): FldFunG -> FldFun`

The function field $F$ represented as an extension of a rational function field. This function gives the representation of function fields $F/k$ as finite extensions.

<a id="function-absoluteorder-rngfunord"></a>
##### `AbsoluteOrder(O): RngFunOrd -> RngFunOrd`

The order $O$ as an extension of its bottom coefficient ring, (i.e. the order of the `RationalExtensionRepresentation` of the field of fractions of $O$ corresponding to $O$).

<a id="function-absolutefunctionfield-fldfung"></a>
##### `AbsoluteFunctionField(F): FldFunG -> FldFunG`

The function field $F$ expressed as an extension of its constant field.

<a id="function-underlyingring-fldfung"></a>
##### `UnderlyingRing(F): FldFunG -> FldFunG`

<a id="function-underlyingfield-fldfung"></a>
##### `UnderlyingField(F): FldFunG -> FldFunG`

<a id="function-underlyingring-fldfung-rng"></a>
##### `UnderlyingRing(F, R): FldFunG, Rng -> FldFunG`

<a id="function-underlyingfield-fldfung-rng"></a>
##### `UnderlyingField(F, R): FldFunG, Rng -> FldFunG`

Return the underlying ring of the function field $F$ over $R$. This is $F$ expressed as an extension of $R$. If $R$ is not given then it is taken to be the coefficient field of the coefficient field of $F$. The field $R$ must appear in the tower of coefficient fields under $F$.

<a id="procedure-embed-fldfun-fldfun-fldfunelt"></a>
##### `Embed(F, L, a): FldFun, FldFun, FldFunElt`

<a id="procedure-embed-fldfun-fldfun-fldfunelt-2"></a>
##### `Embed(F, L, s): FldFun, FldFun, [FldFunElt]`

Install the embedding of $F$ into $L$ with the image(s) of the primitive element(s) of $F$ being the element $a$ in $L$ or the images in $s$ in $L$.

<a id="function-hasembedding-rngfunord-rngfunord"></a>
##### `HasEmbedding(O1, O2): RngFunOrd, RngFunOrd -> Bool`

```magma
Print: RngIntElt                    Default: 0
```

Return whether there is an embedding of $O1$ into $O2$ already installed. For information about the installed embedding set the `Print` parameter $> 0$ with higher values providing more information than lower.

<a id="function-cancomputeembedding-rngfunord-rngfunord"></a>
##### `CanComputeEmbedding(O1, O2): RngFunOrd, RngFunOrd -> Bool`

```magma
Print: RngIntElt                    Default: 0
```

Return whether an embedding of $O1$ into $O2$ can be computed. For information about the installed embedding set the `Print` parameter $> 0$ with higher values providing more information than lower.

<a id="function-places-fldfung"></a>
##### `Places(F): FldFunG -> PlcFun`

The set of places of the algebraic function field $F/k$.

<a id="function-divisorgroup-fldfun"></a>
##### `DivisorGroup(F): FldFun -> DivFun`

The group of divisors of the algebraic function field $F/k$.

<a id="function-differentialspace-fldfun"></a>
##### `DifferentialSpace(F): FldFun -> DiffFun`

The space of differentials of the algebraic function field $F/k$.

<a id="example-ex-a0477f"></a>
##### `Example: Constant and Coefficient Fields (ex-a0477f)`

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> f := y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2;
> F<alpha> := FunctionField(f);
> ConstantField(F);
Finite field of size 5
> CoefficientField(F);
Univariate rational function field over GF(5)
Variables: x
> CoefficientRing(MaximalOrderFinite(F));
Univariate Polynomial Ring in x over GF(5)
> FieldOfFractions(IntegralClosure(ValuationRing(R), F));
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2
> Order(IntegralClosure(ValuationRing(R), F),
>     MatrixAlgebra(CoefficientRing(MaximalOrderInfinite(F)), 3)!4,
>     CoefficientRing(MaximalOrderInfinite(F))!1);
Maximal Order of F over Valuation ring of Univariate rational function field
over GF(5) with generator 1/x
> SubOrder($1);
Maximal Order of F over Valuation ring of Univariate rational function field
over GF(5) with generator 1/x
> Places(F);
Set of places of F
> DivisorGroup(F);
Divisor group of F
```

<a id="example-ex-efbad3"></a>
##### `Example: Underlying Rings of a Relative Function Field (ex-efbad3)`

Output from `UnderlyingRing` is shown.

```magma
> PF<x> := PolynomialRing(GF(31, 3));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x^3 + 1>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b*x*y - 1>;
> RationalExtensionRepresentation(FF2);
Algebraic function field defined over Univariate rational function field over
GF(31^3) by
y^6 + 29*y^3 + (30*x^5 + x^2)*y^2 + 1
> UnderlyingRing(FF2);
Algebraic function field defined over Univariate rational function field over
GF(31^3) by
y^6 + 29*y^3 + (30*x^5 + x^2)*y^2 + 1
> UnderlyingRing(FF2, FieldOfFractions(PF));
Algebraic function field defined over GF(31^3) by
$.1^6 + 29*$.1^3 + 30*$.1^2*$.2^5 + $.1^2*$.2^2 + 1
```

<a id="function-weilrestriction-fldfun-rngintelt"></a>
##### `WeilRestriction(E, n): FldFun, RngIntElt -> FldFun, UserProgram`

```magma
Reduction: BoolElt                    Default: true
WeilRes  : Verbose                    Default: 1
```

A hyperelliptic function field in the Weil restriction over ${\bf F}_{q}$ of the elliptic function field $E$: $y^2 + xy + x^3 + ax^2 + b$ defined over ${\bf F}_{q^n}$ where $q$ is a power of $2$. Also returns a function which can be used to map a place (not a pole or zero of $x$) of $F$ into a divisor of the result. See [[PGS00](https://docs.magma-maths.org/references.md#cite-ghs)]. `Reduction` indicates whether a (possibly quite expensive) reduction step is performed at the end of the computation. It defaults to `true`.

<a id="function-constantfieldextension-fldfun-rng"></a>
##### `ConstantFieldExtension(F, E): FldFun, Rng -> FldFun, Map`

Return the function field with constant field $E$ which contains the function field $F$. The ring $E$ must cover the constant field of $F$. If $E$ is contained in the exact constant field of $F$ then $F$ and the new field will be isomorphic.

<a id="example-ex-01df8e"></a>
##### `Example: Extending to the Exact Constant Field (ex-01df8e)`

Changing the constant field to the exact constant field is shown below.

```magma
> P<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(P);
> F<c> := FunctionField(y^6 + y + 2);
> E<a> := ExactConstantField(F);
> C, r := ConstantFieldExtension(F, E);
> r(c);
1/16*(a^5 + 4*a^4 + 6*a^3 + 4*a^2 + a)
> $1 @@ r;
c
> e := Random(C, 2);
> e @@ r;
1/2*x*c^5 - 3*x*c^4 + (-12*x + 8)*c^3 + (-16*x + 24)*c^2 + (-8*x + 16)*c - 1
> r($1);
1/2*(-a^5 - a^2 + a)*$.1 + a^5 + a^4 - a^3 - a^2 - 1
```

<a id="function-monicmodel-fldfun"></a>
##### `MonicModel(F): FldFun -> FldFun`

Given an algebraic function field $F$ return a function field which is isomorphic to $F$ and defined by a monic polynomial.

<a id="function-reduce-rngfunord"></a>
##### `Reduce(O): RngFunOrd -> RngFunOrd`

Given an order $O$ belonging to a function field $F$, this function returns the order obtained by applying size-reduction to the basis of $O$.

<a id="function-localization-rngfunord-rngfunordidl"></a>
##### `Localization(O, p): RngFunOrd, RngFunOrdIdl -> RngVal, Map`

Given an order $O$ of an algebraic function field and a prime ideal $p$ of $O$, return the localization of $O$ at $p$ and the map from $O$ into the localization.

### General Structure Invariants

<a id="function-characteristic-fldfun"></a>
#### `Characteristic(F): FldFun -> RngIntElt`

<a id="function-characteristic-rngfunord"></a>
#### `Characteristic(O): RngFunOrd -> RngIntElt`

The characteristic of the function field $F/k$ or one of its orders $O$.

<a id="function-isperfect-fld"></a>
#### `IsPerfect(F): Fld -> BoolElt`

Applies to any field in Magma. Returns whether $F$ is perfect.

<a id="function-degree-fldfung"></a>
#### `Degree(F): FldFunG -> RngIntElt`

<a id="function-degree-fldfun-fldfun"></a>
#### `Degree(F, G): FldFun, FldFun -> RngIntElt`

<a id="function-degree-rngfunord"></a>
#### `Degree(O): RngFunOrd -> RngIntElt`

The degree $[F:G]$ of the field extension $F/G$ where $G$ is the base field of $F$ unless specified. For an order $O$, this function returns the rank of $O$ as a module over its coefficient ring. Note that this rank is equal to the degree $[F:G]$ where $F$ and $G$ are the field of fractions of $O$ and the coefficient ring of $O$ respectively.

<a id="function-absolutedegree-fldfung"></a>
#### `AbsoluteDegree(F): FldFunG -> RngIntElt`

<a id="function-absolutedegree-rngfunord"></a>
#### `AbsoluteDegree(O): RngFunOrd -> RngIntElt`

The degree of the function field $F$ or the order $O$ as a finite extension of $k(x)$ or $k[x]$ or as an infinite extension of $k$.

<a id="function-definingpolynomial-fldfun"></a>
#### `DefiningPolynomial(F): FldFun -> RngUPolElt`

<a id="function-definingpolynomial-rngfunord"></a>
#### `DefiningPolynomial(O): RngFunOrd -> RngUPolElt`

The defining polynomial of the function field $F$ over its coefficient ring. For an order $O$ belonging to a function field $F$, this function returns the defining polynomial of $O$, which may be different from that of $F/k(x, \alpha_1, \ldots, \alpha_r)$.

<a id="function-definingpolynomials-fldfun"></a>
#### `DefiningPolynomials(F): FldFun -> [RngUPolElt]`

<a id="function-definingpolynomials-rngfunord"></a>
#### `DefiningPolynomials(O): RngFunOrd -> [RngUPolElt]`

Return the defining polynomials of the function field $F$ or the order $O$ as a sequence of polynomials over the coefficient ring.

<a id="function-basis-fldfung"></a>
#### `Basis(F): FldFunG -> SeqEnum[FldFunElt]`

<a id="function-basis-rngfunord"></a>
#### `Basis(O): RngFunOrd -> SeqEnum[FldFunElt]`

<a id="function-basis-rngfunord-rng"></a>
#### `Basis(O, R): RngFunOrd, Rng -> SeqEnum[RngElt]`

The basis $1, \alpha, \dots, \alpha^{n-1}$ of the function field $F[\alpha]$ over the coefficient field.

Given an order $O$ belonging to a function field $F$, this function returns the basis of $O$ in the form of function field elements.

Given an additional ring $R$, return the basis of $O$ as elements of $R$.

<a id="function-transformationmatrix-rngfunord-rngfunord"></a>
#### `TransformationMatrix(O1, O2): RngFunOrd, RngFunOrd -> AlgMatElt, RngElt`

Return the matrix $M$ and a denominator $d$ which transforms elements of the order $O1$ into elements of the order $O2$.

<a id="function-coefficientideals-rngfunord"></a>
#### `CoefficientIdeals(O): RngFunOrd -> [RngFunOrdIdl]`

The coefficient ideals of the order $O$ of a relative extension. These are the ideals $\{A_i\}$ of the coefficient ring of $O$ such that for every element $e$ of $O$, $e = \sum_i a_i*b_i$ where $\{b_i\}$ is the basis returned for $O$ and each $a_i \in A_i$.

<a id="function-basismatrix-rngfunord"></a>
#### `BasisMatrix(O): RngFunOrd -> AlgMatElt`

Given an order $O$ in a function field $F$ of degree $n$, this returns an $n\times n$ matrix whose $i$-th row contains the coefficients for the $i$-th basis element of $O$ with respect to the power basis of $F$. Thus, if $b_i$ is the $i$-th basis element of $O$,

$$
b_i=\sum_{j=1}^{n}M_{ij}\alpha^{j-1}
$$

where $M$ is the matrix and $\alpha$ is the generator of $F$.

<a id="function-primitiveelement-rngfunord"></a>
#### `PrimitiveElement(O): RngFunOrd -> RngFunOrdElt`

A root of the defining polynomial of the order $O$.

<a id="function-discriminant-rngfunord"></a>
#### `Discriminant(O): RngFunOrd -> .`

The discriminant of the order $O$, up to a unit in its coefficient ring.

<a id="function-absolutediscriminant-rngfunord"></a>
#### `AbsoluteDiscriminant(O): RngFunOrd -> .`

The discriminant of the order $O$ of an algebraic function field $F$ over the bottom coefficient ring of $O$, (the subring of the rational function field $F$ extends).

<a id="function-dimensionofexactconstantfield-fldfung"></a>
#### `DimensionOfExactConstantField(F): FldFunG -> RngIntElt`

<a id="function-degreeofexactconstantfield-fldfung"></a>
#### `DegreeOfExactConstantField(F): FldFunG -> RngIntElt`

The dimension of the exact constant field of the function field $F/k$ over $k$. The exact constant field is the algebraic closure of $k$ in $F$.

<a id="function-genus-fldfung"></a>
#### `Genus(F): FldFunG -> RngIntElt`

```magma
Al     : MonStgElt                    Default: 
IsExact: BoolElt                      Default: false
```

The genus of the function field $F/k$. If $F$ is an extension of a rational function field over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and the parameter `Al` is set to `"Montes"` then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used to compute the genus.

The index $[k_0:{\rm ConstantField}(F)]$, where $k_0$ is the full constant field, is also returned. If it is known beforehand that $k_0$ is the constant field $F$ is defined over then set the parameter `IsExact := true`.

<a id="example-ex-a8d7ef"></a>
#### `Example: Invariants of a Relative Function Field (ex-a8d7ef)`

```magma
> PF<x> := PolynomialRing(GF(31, 3));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x^3 + 1>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b*x*y - 1>;
> Characteristic(FF2);
31
> EFF2I := EquationOrderInfinite(FF2);
> MFF2I := MaximalOrderInfinite(FF2);
> Degree(MFF2I) eq 3;
true
> AbsoluteDegree(EFF2I);
6
> Genus(FF2);
9
> DefiningPolynomial(EFF2I);
$.1^3 + [ 0, 30/x^3 ]*$.1 + [ 30/x^9, 0 ]
> Basis(MFF2I);
[ 1, 1/x*d, 1/x^2*d^2 ]
> Discriminant(EFF2I);
Ideal of Maximal Equation Order of FF1 over Valuation ring of Univariate
rational function field over GF(31^3)
Variables: x with generator 1/x
Generator:
(4*x^3 + 27)/x^15*b + 4/x^18
> AbsoluteOrder(EFF2I);
Order of Algebraic function field defined over Univariate rational function
field over GF(31^3) by
y^6 + 29*y^3 + (30*x^5 + x^2)*y^2 + 1 over Valuation ring of Univariate rational
function field over GF(31^3) with generator 1/x
> AbsoluteDiscriminant(EFF2I);
(2*x^9 + 25*x^6 + 6*x^3 + 29)/x^33
> Discriminant($2);
(30*x^24 + 6*x^21 + 16*x^18 + 20*x^15 + 16*x^12 + 7*x^9 + 27*x^6 + 3*x^3 +
    30)/x^48
```

<a id="example-ex-ec93f9"></a>
#### `Example: Invariants of a Non-Simple Field (ex-ec93f9)`

Invariants are slightly different for non–simple fields.

```magma
> P<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(P);
> F<a, b> := FunctionField([3*y^3 - x^2, x*y^2 + 1]);
> DefiningPolynomials(F);
[
    3*y^3 - x^2,
    x*y^2 + 1
]
> DefiningPolynomials(EquationOrderFinite(F));
[
    y^3 - 1/3*x^2,
    y^2 + x
]
> DefiningPolynomials(EquationOrderInfinite(F));
[
    $.1^3 - 1/3/$.1^4,
    $.1^2 + 1/$.1
]
> Basis(F);
[
    1,
    a,
    a^2,
    $.1*b,
    $.1*a*b,
    $.1*a^2*b
]
> TransformationMatrix(EquationOrderFinite(F), MaximalOrderFinite(F));
[1 0 0 0 0 0]
[0 1 0 0 0 0]
[0 0 x 0 0 0]
[0 0 0 1 0 0]
[0 0 0 0 x 0]
[0 0 0 0 0 x]
1
> TransformationMatrix(MaximalOrderFinite(F), EquationOrderFinite(F));
[x 0 0 0 0 0]
[0 x 0 0 0 0]
[0 0 1 0 0 0]
[0 0 0 x 0 0]
[0 0 0 0 1 0]
[0 0 0 0 0 1]
x
```

<a id="function-gapnumbers-fldfung"></a>
#### `GapNumbers(F): FldFunG -> SeqEnum[RngIntElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The sequence of global gap numbers of the function field $F/k$ (in characteristic zero this is always $[1, \dots, g]$). A separating element used internally for the computation can be specified, it defaults to `SeparatingElement(F)`. See the description of [`GapNumbers`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-gapnumbers).

<a id="function-gapnumbers-fldfung-plcfunelt"></a>
#### `GapNumbers(F, P): FldFunG, PlcFunElt -> SeqEnum[RngIntElt]`

<a id="function-gapnumbers-plcfunelt"></a>
#### `GapNumbers(P): PlcFunElt -> SeqEnum[RngIntElt]`

The sequence of gap numbers of the function field $F/k$ at $P$ where $P$ must be a place of degree one. See the description of [`GapNumbers`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-gapnumbers).

<a id="function-separatingelement-fldfung"></a>
#### `SeparatingElement(F): FldFunG -> FldFunGElt`

Returns a separating element of the function field $F/k$.

<a id="function-ramificationdivisor-fldfung"></a>
#### `RamificationDivisor(F): FldFunG -> DivFunElt`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The ramification divisor of the function field $F/k$. The semantics of calling `RamificationDivisor()` with $F$ or the zero divisor of $F$ are identical. For further details see the description of [`RamificationDivisor`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-ramificationdivisor).

<a id="function-weierstrassplaces-fldfung"></a>
#### `WeierstrassPlaces(F): FldFunG -> [PlcFunElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The Weierstrass places of the function field $F/k$. The semantics of calling `WeierstrassPlaces` with $F$ or the zero divisor of $F$ are identical. See the description of [`WeierstrassPlaces`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-weierstrassplaces).

<a id="function-wronskianorders-fldfung"></a>
#### `WronskianOrders(F): FldFunG -> [RngIntElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The Wronskian orders of the function field $F/k$. The semantics of calling `WronskianOrders` with $F$ or the zero divisor of $F$ are identical. See the description of [`WronskianOrders`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-wronskianorders).

<a id="function-different-rngfunord"></a>
#### `Different(O): RngFunOrd -> RngFunOrdIdl`

The different of the maximal order $O$.

<a id="function-index-rngfunord-rngfunord"></a>
#### `Index(O, S): RngFunOrd, RngFunOrd -> Any`

The index of $S$ in $O$ where $S$ is a suborder of $O$ and $O$ and $S$ have the same equation order.

### Galois Groups

Finding Galois groups (of normal closures) of polynomials over rational function fields over $k\in\{{\mathbb{Q}}, {\mathbb{F}}_q\}$, where ${\mathbb{F}}_q$ denotes the finite field of characteristic $p$ with $q=p^r$, $r\in {\mathbb{Z}}_{> 0}$ is a hard problem, in general. All practical algorithms used the classification of transitive groups, which is known up to degree $31$ [[CHM98](https://docs.magma-maths.org/references.md#cite-conwayhulpkemckay)]. These algorithms fall into two groups: The absolute resolvent method [[SM85](https://docs.magma-maths.org/references.md#cite-mk2)] and the method of Stauduhar [[Sta73](https://docs.magma-maths.org/references.md#cite-stau)].

The Magma implementation is based on an extension of the method of Stauduhar by Klüners, Geißler [[Gei03](https://docs.magma-maths.org/references.md#cite-geissler), [GK00](https://docs.magma-maths.org/references.md#cite-gk1)] and, more recently, Fieker [[FK14](https://docs.magma-maths.org/references.md#cite-fieker-galois)] and Sutherland [[Sut15](https://docs.magma-maths.org/references.md#cite-suth-galois)]. There is no longer any limit on the degree of the polynomials or fields as this algorithm does not use the classification of transitive groups. In contrast to the absolute resolvent method, it also provides the explicit action on the roots of the polynomial $f$ which generates the function field. The algorithm strongly depends on the fact that the corresponding problem is implemented for the residue class field.

Roughly speaking, the method of Stauduhar traverses the subgroup lattice of transitive permutation groups of degree $n$ from the symmetric group to the actual Galois group. This is done by using so-called relative resolvents. Resolvents are polynomials whose splitting fields are subfields of the splitting field of the given polynomial which are computed using approximations of the roots of the polynomial $f$.

If the field (or the field defined by a polynomial) has subfields (i.e. the Galois group is imprimitive) the current implementation changes the starting point of the algorithm in the subgroup lattice, to get as close as possible to the actual Galois group. This is done via computation of subfields of a stem field of $f$, that is the field extension of $k(t)$ which we get by adjoining a root of $f$ to $k(t)$. The Galois group is found as a subgroup of the intersection of suitable wreath products (using the knowledge of the subfields) which may be easily computed.

If the field (or the field defined by a polynomial) does not have subfields (i.e. the Galois group is primitive) we use a combination of the method of Stauduhar and the absolute resolvent method. The Frobenius automorphism of the underlying field already determines a subgroup of the Galois group, which is used to speed up computations in the primitive case.

The algorithms used here are similar to those use for number fields. See also Chapter [Galois Groups and Automorphisms](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/index-galois-groups-and-automorphisms.md#rngordgal-main). In addition to the intrinsics described here, some of the intrinsics described in Section [Galois Groups](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#rngord-galoisgroup-main) apply to polynomials over function fields also.

<a id="function-galoisgroup-rngupolelt"></a>
#### `GaloisGroup(f): RngUPolElt -> GrpPerm, [ RngElt ], GaloisData`

```magma
Prime      : RngElt                         Default: 
NextPrime  : UserProgram                    Default: 
ProofEffort: RngIntElt                      Default: 10
Ring       : GaloisData                     Default: 
ShortOK    : BoolElt                        Default: false
Old        : BoolElt                        Default: false
GaloisGroup: Verbose                        Default: 5
```

Given a separable polynomial $f(t,x)$ of degree $n$ over the rational function field $k(t),\; k\in\{\Q, \F_q\}$, or an extension $K$ thereof (if $k = \F_q$) this function returns a permutation group that forms the Galois group of a splitting field for $f$ in some algebraic closure of $K$. The permutation group acts on the points $1, 2, \dots, n$. The roots of $f$ are calculated in the process, expressed as power series, and returned as the second argument: For a prime polynomial $p(t)\in k(t)$ denote by $\bar{N}$ the splitting field of the polynomial $f(t,x)$ mod $p(t)$. It is well known that the roots of the polynomial $f(t,x)$ can be expressed as power series in $\bar{N}[[t]]$. We embed $\bar{N}$ in an unramified $p$-adic extension. The third return value is a structure containing information about the computation that can be used to compute the roots of $f$ to arbitrary precision. This can be used for example in [`GaloisSubgroup`](https://docs.magma-maths.org/GlobalFields/GaloisGroupsAndAutomorphisms/galois.md#function-rngordgal-galoissubgroup) to compute arbitrary subfields of the splitting field.

The required precision increases linearly with the index of the subgroups, which are passed traversing the subgroup lattice. Therefore computations may slow down considerably for higher degrees and large indices. This expense can be reduced by setting `ShortOK` to `true`, in which case a descent using only the short cosets [[Els14](https://docs.magma-maths.org/references.md#cite-elsenhans-short)] will be considered as reliable as a descent using all cosets.

The default version employs series computations over either unramified $p$-adic fields ($k={\mathbb{Q}}$) or finite fields ($k={\mathbb{F}}_q$). The prime polynomial is determined during a Galois group computation in such a way that $f$ is squarefree modulo $p$.

The prime to use for splitting field computations can be given via the parameter `Prime`. The method of choosing primes for splitting field computations can be given by the parameter `NextPrime`. If set, the `Prime` parameter must be a prime polynomial or a prime ideal when $f$ is over an algebraic function field. In characteristic 0 a tuple of a prime polynomial and a prime integer can be given. If the `Prime` given ramifies in the extensions defined by $f$ then an unramfied one larger than that given will be chosen.

An indication of how much effort the computation should make to prove the results can be provided by altering the parameter `ProofEffort`, it should be increased if more effort should be made.

If `Old` is set to `true`, then the old version is called if available. Since the return values of the new version differ substantially from the old one, this may be used in old applications.

<a id="function-galoisgroup-fldfun"></a>
#### `GaloisGroup(F): FldFun -> GrpPerm, [RngElt], GaloisData`

<a id="function-galoisgroup-fldfun-fldfun-fldfunrat"></a>
#### `GaloisGroup(F): FldFun[FldFun[FldFunRat]] -> GrpPerm, [RngElt], GaloisData`

<a id="function-galoisgroup-fldfun-fldfin"></a>
#### `GaloisGroup(F): FldFun[FldFin] -> GrpPerm, [RngElt], GaloisData`

<a id="function-galoisgroup-fldfun-fldfunrat"></a>
#### `GaloisGroup(F): FldFun[FldFunRat] -> GrpPerm, [RngElt], GaloisData`

<a id="function-galoisgroup-fldfun-fldrat"></a>
#### `GaloisGroup(F): FldFun[FldRat] -> GrpPerm, [RngElt], GaloisData`

```magma
Prime      : RngElt                         Default: 
NextPrime  : UserProgram                    Default: 
ProofEffort: RngIntElt                      Default: 10
Ring       : GaloisData                     Default: 
ShortOK    : BoolElt                        Default: false
```

Given a function field $F$ defined as an extension of either a rational function field or a global algebraic function field by one polynomial compute the Galois group of a normal closure of $F$.

The prime to use for splitting field computations can be given via the parameter `Prime`. The method of choosing primes for splitting field computations can be given by the parameter `NextPrime`. If set, the `Prime` parameter must be a prime polynomial or a prime ideal when $f$ is over an algebraic function field. In characteristic 0 a tuple of a prime polynomial and a prime integer can be given. If the `Prime` given ramifies in the extensions defined by $f$ then an unramfied one larger than that given will be chosen.

An indication of how much effort the computation should make to prove the results can be provided by altering the parameter `ProofEffort`, it should be increased if more effort should be made. If the parameter `ShortOK` is set to `true` then a descent using only the short cosets [[Els14](https://docs.magma-maths.org/references.md#cite-elsenhans-short)] will be considered as reliable as a descent using all cosets.

<a id="example-ex-0264c2"></a>
#### `Example: Galois Group over a Rational Function Field (ex-0264c2)`

A Galois group computation is shown below.

```magma
> k<t>:= FunctionField(Rationals());
> R<x>:= PolynomialRing(k);
> f:= x^15 + (-1875*t^2 - 125)*x^3 + (4500*t^2 + 300)*x^2 +
>     (-3600*t^2 - 240)*x + 960*t^2+ 64;
> G, r, S:= GaloisGroup(f);
> TransitiveGroupDescription(G);
1/2[S(5)^3]S(3)
> A := Universe(r);
> AssignNames(~A,  ["t"]);
> A;
Power series ring in t over Unramified extension
defined by the polynomial (1 + O(191^20))*x^4 +
    O(191^20)*x^3 + (7 + O(191^20))*x^2 + (100 +
    O(191^20))*x + 19 + O(191^20)
 over Unramified extension defined by the
polynomial (1 + O(191^20))*x + 190 + O(191^20)
 over pAdicField(191)
> r[1];
-49 + O(191) - (39 + O(191))*t + O(t^2)
> S;
GaloisData of type Q(t)

> TransitiveGroupIdentification(G);
99 15
```

<a id="example-ex-93f3e8"></a>
#### `Example: Galois Groups in Positive Characteristic (ex-93f3e8)`

Some examples for polynomials over rational function fields over finite fields.

```magma
> k<x>:= FunctionField(GF(1009));
> R<y>:= PolynomialRing(k);
> f:= y^10 + (989*x^4 + 20*x^3 + 989*x^2 + 20*x + 989)*y^8 + (70*x^8 +
> 869*x^7 + 310*x^6 + 529*x^5 + 600*x^4 + 479*x^3 + 460*x^2 + 719*x +
> 120)*y^6 + (909*x^12 + 300*x^11 + 409*x^10 + 1000*x^9 + 393*x^8 +
> 657*x^7 + 895*x^6 + 764*x^5 + 420*x^4 + 973*x^3 + 177*x^2 + 166*x +
> 784)*y^4 + (65*x^16 + 749*x^15 + 350*x^14 + 909*x^13 + 484*x^12 +
> 452*x^11 + 115*x^10 + 923*x^9 + 541*x^8 + 272*x^7 + 637*x^6 + 314*x^5 +
> 724*x^4 + 490*x^3 + 948*x^2 + 99*x + 90)*y^2 + 993*x^20 + 80*x^19 +
> 969*x^18 + 569*x^17 + 895*x^16 + 101*x^15 + 742*x^14 + 587*x^13 +
> 55*x^12+ 437*x^11 + 97*x^10 + 976*x^9 + 62*x^8 + 171*x^7 + 930*x^6 +
> 604*x^5 + 698*x^4 + 60*x^3 + 60*x^2 + 1004*x + 1008;
> G, r, p:= GaloisGroup(f);
> t1, t2:= TransitiveGroupIdentification(G);
> t1;
1
> t2;
10
```

And a second one.

```magma
> k<t>:= FunctionField(GF(7));
> R<x>:= PolynomialRing(k);
> f:= x^12 + x^10 + x^8 + (6*t^2 + 3)*x^6 + (4*t^4 + 6*t^2 + 1)*x^4 +
> (5*t^4 + t^2)*x^2 + 2*t^4;
> G, r, p:= GaloisGroup(f);
> G;
Permutation group G acting on a set of cardinality 12
Order = 24 = 2^3 * 3
    (1, 5, 4, 7, 11, 10)(2, 6, 3, 8, 12, 9)
    (3, 10)(4, 9)(5, 12)(6, 11)
> A := Universe(r);
> AssignNames(~A,  ["t"]);
> _<w> := CoefficientRing(Universe(r));
> _<u> := CoefficientField(Parent(w));
> r;
[
    (3*u + 2)*w^5 + (u + 5)*w^4 + (5*u + 6)*w^3 + (4*u + 2)*w^2 + (5*u + 4)*w +
        3*u + 4 + ((6*u + 1)*w^5 + 6*w^4 + (3*u + 4)*w^3 + (u + 2)*w^2 + (3*u +
        3)*w + (3*u + 2))*t + ((5*u + 2)*w^4 + (2*u + 1)*w^3 + (u + 1)*w^2 +
        (3*u + 1)*w + (3*u + 3))*t^2 + ((5*u + 1)*w^5 + 3*u*w^4 + 3*u*w^3 + (3*u
        + 6)*w^2 + (4*u + 4)*w + (5*u + 4))*t^3 + O(t^4),
    (3*u + 2)*w^5 + (6*u + 2)*w^4 + (5*u + 6)*w^3 + (3*u + 5)*w^2 + (5*u + 4)*w
        + 4*u + 3 + ((6*u + 1)*w^5 + w^4 + (3*u + 4)*w^3 + (6*u + 5)*w^2 + (3*u
        + 3)*w + (4*u + 5))*t + ((2*u + 5)*w^4 + (2*u + 1)*w^3 + (6*u + 6)*w^2 +
        (3*u + 1)*w + (4*u + 4))*t^2 + ((5*u + 1)*w^5 + 4*u*w^4 + 3*u*w^3 + (4*u
        + 1)*w^2 + (4*u + 4)*w + (2*u + 3))*t^3 + O(t^4),
    (2*u + 6)*w^5 + (2*u + 3)*w^4 + (2*u + 1)*w^3 + (2*u + 1)*w^2 + (4*u + 6)*w
        + 3*u + 4 + ((4*u + 3)*w^5 + 5*w^4 + (4*u + 3)*w^3 + (4*u + 1)*w^2 + (u
        + 1)*w + (3*u + 2))*t + ((3*u + 4)*w^4 + (5*u + 6)*w^3 + (4*u + 4)*w^2 +
        (u + 5)*w + (3*u + 3))*t^2 + ((u + 3)*w^5 + 6*u*w^4 + 4*u*w^3 + (5*u +
        3)*w^2 + (6*u + 6)*w + (5*u + 4))*t^3 + O(t^4),
    (2*u + 6)*w^5 + (5*u + 4)*w^4 + (2*u + 1)*w^3 + (5*u + 6)*w^2 + (4*u + 6)*w
        + 4*u + 3 + ((4*u + 3)*w^5 + 2*w^4 + (4*u + 3)*w^3 + (3*u + 6)*w^2 + (u
        + 1)*w + (4*u + 5))*t + ((4*u + 3)*w^4 + (5*u + 6)*w^3 + (3*u + 3)*w^2 +
        (u + 5)*w + (4*u + 4))*t^2 + ((u + 3)*w^5 + u*w^4 + 4*u*w^3 + (2*u +
        4)*w^2 + (6*u + 6)*w + (2*u + 3))*t^3 + O(t^4),
    (6*u + 4)*w^5 + (3*u + 1)*w^4 + (5*u + 6)*w^3 + (6*u + 3)*w^2 + (6*u + 2)*w
        + 4*u + 3 + ((5*u + 2)*w^5 + 4*w^4 + (3*u + 4)*w^3 + (5*u + 3)*w^2 +
        (5*u + 5)*w + (4*u + 5))*t + ((u + 6)*w^4 + (2*u + 1)*w^3 + (5*u +
        5)*w^2 + (5*u + 4)*w + (4*u + 4))*t^2 + ((3*u + 2)*w^5 + 2*u*w^4 +
        3*u*w^3 + (u + 2)*w^2 + (2*u + 2)*w + (2*u + 3))*t^3 + O(t^4),
    (6*u + 4)*w^5 + (4*u + 6)*w^4 + (5*u + 6)*w^3 + (u + 4)*w^2 + (6*u + 2)*w +
        3*u + 4 + ((5*u + 2)*w^5 + 3*w^4 + (3*u + 4)*w^3 + (2*u + 4)*w^2 + (5*u
        + 5)*w + (3*u + 2))*t + ((6*u + 1)*w^4 + (2*u + 1)*w^3 + (2*u + 2)*w^2 +
        (5*u + 4)*w + (3*u + 3))*t^2 + ((3*u + 2)*w^5 + 5*u*w^4 + 3*u*w^3 + (6*u
        + 5)*w^2 + (2*u + 2)*w + (5*u + 4))*t^3 + O(t^4),
    (4*u + 5)*w^5 + (u + 5)*w^4 + (2*u + 1)*w^3 + (4*u + 2)*w^2 + (2*u + 3)*w +
        3*u + 4 + ((u + 6)*w^5 + 6*w^4 + (4*u + 3)*w^3 + (u + 2)*w^2 + (4*u +
        4)*w + (3*u + 2))*t + ((5*u + 2)*w^4 + (5*u + 6)*w^3 + (u + 1)*w^2 +
        (4*u + 6)*w + (3*u + 3))*t^2 + ((2*u + 6)*w^5 + 3*u*w^4 + 4*u*w^3 + (3*u
        + 6)*w^2 + (3*u + 3)*w + (5*u + 4))*t^3 + O(t^4),
    (4*u + 5)*w^5 + (6*u + 2)*w^4 + (2*u + 1)*w^3 + (3*u + 5)*w^2 + (2*u + 3)*w
        + 4*u + 3 + ((u + 6)*w^5 + w^4 + (4*u + 3)*w^3 + (6*u + 5)*w^2 + (4*u +
        4)*w + (4*u + 5))*t + ((2*u + 5)*w^4 + (5*u + 6)*w^3 + (6*u + 6)*w^2 +
        (4*u + 6)*w + (4*u + 4))*t^2 + ((2*u + 6)*w^5 + 4*u*w^4 + 4*u*w^3 + (4*u
        + 1)*w^2 + (3*u + 3)*w + (2*u + 3))*t^3 + O(t^4),
    (5*u + 1)*w^5 + (2*u + 3)*w^4 + (5*u + 6)*w^3 + (2*u + 1)*w^2 + (3*u + 1)*w
        + 3*u + 4 + ((3*u + 4)*w^5 + 5*w^4 + (3*u + 4)*w^3 + (4*u + 1)*w^2 +
        (6*u + 6)*w + (3*u + 2))*t + ((3*u + 4)*w^4 + (2*u + 1)*w^3 + (4*u +
        4)*w^2 + (6*u + 2)*w + (3*u + 3))*t^2 + ((6*u + 4)*w^5 + 6*u*w^4 +
        3*u*w^3 + (5*u + 3)*w^2 + (u + 1)*w + (5*u + 4))*t^3 + O(t^4),
    (5*u + 1)*w^5 + (5*u + 4)*w^4 + (5*u + 6)*w^3 + (5*u + 6)*w^2 + (3*u + 1)*w
        + 4*u + 3 + ((3*u + 4)*w^5 + 2*w^4 + (3*u + 4)*w^3 + (3*u + 6)*w^2 +
        (6*u + 6)*w + (4*u + 5))*t + ((4*u + 3)*w^4 + (2*u + 1)*w^3 + (3*u +
        3)*w^2 + (6*u + 2)*w + (4*u + 4))*t^2 + ((6*u + 4)*w^5 + u*w^4 + 3*u*w^3
        + (2*u + 4)*w^2 + (u + 1)*w + (2*u + 3))*t^3 + O(t^4),
    (u + 3)*w^5 + (3*u + 1)*w^4 + (2*u + 1)*w^3 + (6*u + 3)*w^2 + (u + 5)*w +
        4*u + 3 + ((2*u + 5)*w^5 + 4*w^4 + (4*u + 3)*w^3 + (5*u + 3)*w^2 + (2*u
        + 2)*w + (4*u + 5))*t + ((u + 6)*w^4 + (5*u + 6)*w^3 + (5*u + 5)*w^2 +
        (2*u + 3)*w + (4*u + 4))*t^2 + ((4*u + 5)*w^5 + 2*u*w^4 + 4*u*w^3 + (u +
        2)*w^2 + (5*u + 5)*w + (2*u + 3))*t^3 + O(t^4),
    (u + 3)*w^5 + (4*u + 6)*w^4 + (2*u + 1)*w^3 + (u + 4)*w^2 + (u + 5)*w + 3*u
        + 4 + ((2*u + 5)*w^5 + 3*w^4 + (4*u + 3)*w^3 + (2*u + 4)*w^2 + (2*u +
        2)*w + (3*u + 2))*t + ((6*u + 1)*w^4 + (5*u + 6)*w^3 + (2*u + 2)*w^2 +
        (2*u + 3)*w + (3*u + 3))*t^2 + ((4*u + 5)*w^5 + 5*u*w^4 + 4*u*w^3 + (6*u
        + 5)*w^2 + (5*u + 5)*w + (5*u + 4))*t^3 + O(t^4)
]
> p;
GaloisData of type F_q(t)
> p`Prime;
t^2 + t + 4
> p`Ring;
Power series ring in t over GF(7^12)
```

<a id="function-geometricgaloisgroup-rngupolelt"></a>
#### `GeometricGaloisGroup(f): RngUPolElt -> GrpPerm, RngUPolElt, GaloisData`

Given a polynomial $f$ over ${\mathbb{Q}}(t)$ return the Galois group of $f$ as a polynomial over ${\mathbb{C}}(t)$ and a polynomial defining the fixed field of that group. For information about the algorithm involved see [[Sut18](https://docs.magma-maths.org/references.md#cite-suth-car)].

<a id="function-hilbertirreducibilitycurves-rngupolelt"></a>
#### `HilbertIrreducibilityCurves(f): RngUPolElt -> SetEnum, SeqEnum`

Given a polynomial $f$ over ${\mathbb{Q}}(t)$ this intrinsic provides a finite set and a sequence of curves such that the rational points on the curves together with the finite set determine the set of exceptions to Hilbert’s Irreducibility Theorem for $f$. For more information see [[KS21](https://docs.magma-maths.org/references.md#cite-krumm-sutherland)].

<a id="example-ex-2194f2"></a>
#### `Example: Geometric Galois Group (ex-2194f2)`

We show a computation of a geometric Galois group

```magma
> Qt<t> := FunctionField(Rationals());
> Qtx<x> := PolynomialRing(Qt);
> f := x^9 - 3*x^7 + (-6*t - 6)*x^6 + 3*x^5 + (12*t - 6)*x^4 +
> (12*t^2 - 84*t + 11)*x^3 + (-6*t - 6)*x^2 + (-12*t^2 + 12*t + 24)*x -
> 8*t^3 - 24*t^2 - 24*t - 6;
> time GeometricGaloisGroup(f);
Permutation group acting on a set of cardinality 9
Order = 6 = 2 * 3
    (2, 9)(3, 8)(4, 7)
    (1, 9, 2)(3, 8, 6)(4, 7, 5)
x^6 + 78732
GaloisData of type Q(t)
```

and one of the exceptions and curves involved in making Hilbert’s Irreducibility Theorem explicit.

```magma
> f := x^6 + t^6 - 1;
> HilbertIrreducibilityCurves(f);
{ -1, 1 }
[
    <Curve over Rational Field defined by
    x^2 + 6*x + 9*t^6, Permutation group acting on a set of cardinality 6
    Order = 6 = 2 * 3
        (2, 5)(3, 4)
        (1, 5, 2)(3, 4, 6)>,
    <Curve over Rational Field defined by
    x^2 + 1728*t^12 - 3456*t^6 + 1728, Permutation group acting on a set of
    cardinality 6
    Order = 6 = 2 * 3
        (1, 3, 2, 6, 5, 4)
        (1, 5, 2)(3, 4, 6)>,
    <Curve over Rational Field defined by
    x^2 - 62208*t^30 + 311040*t^24 - 622080*t^18 + 622080*t^12 - 311040*t^6 +
        62208, Permutation group acting on a set of cardinality 6
    Order = 6 = 2 * 3
        (1, 3)(2, 4)(5, 6)
        (1, 5, 2)(3, 4, 6)>,
    <Curve over Rational Field defined by
    x^3 + 12*x^2 + 48*x - 8*t^6 + 72, Permutation group acting on a set of
    cardinality 6
    Order = 4 = 2^2
        (2, 5)(3, 4)
        (1, 6)(2, 4)(3, 5)>
]
```

#### Splitting Fields

The Galois group of a polynomial can be used to compute splitting fields of the polynomial. Magma contains intrinsics which compute a minimal degree splitting field over the coefficient field as well as a splitting field consisting of radical extensions.

<a id="function-galoissplittingfield-rngupolelt"></a>
##### `GaloisSplittingField(f): RngUPolElt -> FldFun, [FldFunElt], GrpPerm, [[FldFunElt]]`

```magma
Galois : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
Roots  : BoolElt                                               Default: true
AllAuto: BoolElt                                               Default: false
Stab   : BoolElt                                               Default: true
Chain  : [GrpPerm]                                             Default: false
Inv    : [RngSLPolElt]                                         Default: false
Name   : MonStgElt                                             Default: false
```

For a polynomial $f$ over ${\mathbb{F}}_q[t]$ this function computes the splitting field of $f$ as a tower of fields. The various parameters can be used to force certain subfield towers and/or compute additional data. By default `Stab` is set to `true`, which means that the splitting field will be the tower corresponding to the chain of stabilizers of $\{1\}$, $\{1,2\}$, $\ldots$, $\{1, \ldots, n\}$. Also by default `Roots` is set to `true`, which means that the roots of $f$ are expressed as elements of the splitting field. If `Roots` is set to `false`, only the field is computed and returned.

The third return value will be the Galois group, the optional fourth value the automorphisms.

If the parameter `Galois` is used, it should contain a list or triplet containing the output of `GaloisGroup(f);`.

If `Chain` is set to a sequence of subgroups, this chain is used to compute a subfield tower. In this case the first elements must be $G$, the full Galois group. If `Chain` is used, `Inv` can be used to provide the invariants as well.

If `AllAuto` is set to `true`, the full automorphism group of the splitting field is computed as a sequence of sequences giving the all the roots of the relative polynomials.

If `Name` is given, it should be set to a string. In this case the primitive element of the $i$-subfield in the tower will be called `Name.i`.

<a id="example-ex-36697a"></a>
##### `Example: Galois Splitting Field of a Polynomial (ex-36697a)`

We start with a small example, to illustrate some of the parameters and their influence:

```magma
> F<t> := FunctionField(GF(5));
> P<x> := PolynomialRing(F);
> f := x^3-2*t;
> GaloisSplittingField(f);
Algebraic function field defined over Algebraic function field defined over
Univariate rational function field over GF(5) by
x^3 + 2*t by
$.1^2 + $.1*$.1 + $.1^2
[
    4*$.1,
    4*$.1,
    $.1 + $.1
]
Symmetric group acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
> K, R, G := $1;
> K:Maximal;
  K
  |
  | $.1^2 + $.1*$.1 + $.1^2
  |
 $2
  |
  | x^3 + 2*t
  |
Univariate rational function field over GF(5)
Variables: t
> [x^3 : x in R];
[
    2*t,
    2*t,
    2*t
]
```

The fact that by default all generators are called `$.1` makes this hard to read, so let us assign other names:

```magma
> GaloisSplittingField(f:Name := "K");
Algebraic function field defined over Algebraic function field defined over
Univariate rational function field over GF(5) by
x^3 + 2*t by
K1^2 + K2*K1 + K2^2
[
    4*K2,
    4*K1,
    K1 + K2
]
Symmetric group G acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
> (K where K := $1):Maximal;
   K<K1>
     |
     | K1^2 + K2*K1 + K2^2
     |
  $2<K2>
     |
     | x^3 + 2*t
     |
Univariate rational function field over GF(5)
Variables: t
```

So now we can easily see that the splitting field is a relative quadratic extension of the degree $3$ stem field. Now we try a different subgroup chain:

```magma
> G, r, S := GaloisGroup(f);
> GaloisSplittingField(f:Galois := <G, r, S>,
>     Chain := CompositionSeries(G), Name := "K", AllAuto);
Algebraic function field defined over Algebraic function field defined over
Univariate rational function field over GF(5) by
x^2 + 3*t^2 by
K1^3 + 2*t
[
    4*K1,
    (3/t*K2 + 3)*K1,
    (2/t*K2 + 3)*K1
]
Symmetric group G acting on a set of cardinality 3
Order = 6 = 2 * 3
    (1, 2, 3)
    (1, 2)
[
    [
        4*K2,
        K2
    ],
    [
        4*K1,
        (3/t*K2 + 3)*K1,
        (2/t*K2 + 3)*K1
    ]
]
> (K where K := $1):Maximal;
  $1<K1>
     |
     | K1^3 + 2*t
     |
  $2<K2>
     |
     | x^2 + 3*t^2
     |
Univariate rational function field over GF(5)
Variables: t
```

And lastly we show a larger example.

```magma
> f := x^6 - t^14*x^4 - t^19*x^2 - t^52;
> G, r, S := GaloisGroup(f); G;
Permutation group G acting on a set of cardinality 6
Order = 24 = 2^3 * 3
    (1, 5, 6)(2, 3, 4)
    (1, 2)(4, 5)
    (1, 5)(2, 4)
    (1, 2, 3)(4, 5, 6)
> TransitiveGroupIdentification(G);
7 6
> TransitiveGroupDescription(G);
S_4(6d) = [2^2]S(3)
> time K, R := GaloisSplittingField(f:Name := "K");
Time: 149.700
> K:Maximal;
   K<K1>
     |
     | K1^4 + (K2^2 + 4*t^14)*K1^2 + K2^4 + 4*t^14*K2^2 + 4*t^19
     |
  $2<K2>
     |
     | x^6 + 4*t^14*x^4 + 4*t^19*x^2 + 4*t^52
     |
Univariate rational function field over GF(5)
Variables: t
```

##### Solvability by Radicals

For a polynomial $f\in{\mathbb{F}}_q[t][x]$ with solvable Galois group it is well known that the roots of $f$ can be expressed as nested radicals. On the other hand no good algorithm is known to achieve this. Here we use the explicit action of the Galois group of $f$ as a permutation group on the $p$-adic roots to compute such a representation.

<a id="function-solvebyradicals-rngupolelt"></a>
###### `SolveByRadicals(f): RngUPolElt -> FldFun, [FldFunElt], [FldFunElt]`

```magma
Prime      : RngIntElt                                             Default: false
Name       : MonStgElt                                             Default: false
Galois     : Tup<GrpPerm, [RngElt], GaloisData>                    Default: 
UseZeta_p  : BoolElt                                               Default: false
MaxBound   : RngIntElt                                             Default: Infinity()
GaloisTower: Verbose                                               Default: 3
```

For a polynomial $f\in {\mathbb{Z}}[t]$ with solvable Galois group, a splitting field as a tower of radical extensions is computed together with algebraic representations of the roots of $f$ as elements in the splitting field. The third return value contains the non-trivial roots of unity which are used.

If the parameter `Galois` is used, it should contain a list or triplet containing the output of `GaloisGroup(f);`.

If `Prime` is used, and `Galois` is unspecified, the value of `Prime` is passed onto the Galois group computation and can therefore be used to choose the $p$-adic field. If set, the `Prime` parameter must be a prime polynomial or a prime ideal when $f$ is over an algebraic function field. In characteristic 0 a tuple of a prime polynomial and a prime integer can be given. If the `Prime` given ramifies in the extensions defined by $f$ then an unramfied one larger than that given will be chosen.

If `UseZeta_p` is set to `true`, then the expression for the roots of $p$ will contain pure radicals and roots of unity. By default, if `UseZeta_p` is `false`, radical expressions for the roots of unit necessary will also be computed.

If `MaxBound` is given, it will be used as an upper bound for the $p$-adic precision used internally. Especially when the radical tower contains many steps, the internally used precision estimates become more and more pessimistic, thus resulting in larger and larger precision.

If `Name` is set to some string, the $i$-th level primitive element in the tower will be called `Name.i`.

<a id="function-cyclictoradical-fldfun-fldfunelt-rngelt"></a>
###### `CyclicToRadical(K, a, z): FldFun, FldFunElt, RngElt -> FldFun, [FldFunElt], [FldFunElt]`

Let $K/F$ be a function field with cyclic automorphism group of order $n$ generated by $K.1 \to a$ and $z$ be a $n$-th root of unity in $k$. This intrinsic will return a field $L$ isomorphic to $K$ such that $L$ is a Kummer extension or an Artin–Schreier extension, i.e. the defining polynomial for $L$ will be of the form $y^n - b$ or $y^p - y - b$ for some $b$ in the coefficient field $k$ of $K$. The second returned value contains the roots of $f$ in $L$ while the third return value contains the roots of unity used.

<a id="example-ex-0a9a35"></a>
###### `Example: Solving a Polynomial by Radicals (ex-0a9a35)`

```magma
> F<t> := FunctionField(GF(5));
> P<x> := PolynomialRing(F);
> f := x^6 + (2*t + 3)*x^4 + 3*t*x^3 + (3*t^2 + 1)*x^2 +
> (4*t^2 + 2*t)*x + 4*t^3 + 3*t^2 + 4*t;
> K, R := SolveByRadicals(f:Name := "K.");
> K:Maximal;
   K<K.1>
     |
     | K.1^3 + 3*$.1*K.2 + 4*$.1
     |
  $2<K.2>
     |
     | K.2^2 + 2*$.1^2 + 1
     |
  $3<K.3>
     |
     | K.3^2 + $.1
     |
Univariate rational function field over GF(5^2)
Variables: $.1
> [ Evaluate(f, x) eq 0 : x in R];
[ true, true, true, true, true, true ]
```

Note that every step in the tower defining $K$ is radical, ie. given by an equation of type $x^n-a$ or $x^p-x-a$ in characteristic $p$.

### Subfields

For finite extensions $L$ of $\Q(t)$, $\F_q(t)$ or extensions $K$ of $\F_q(t)$ Magma can compute all fields between $L$ and $\Q(t)$, $\F_q(t)$, or $K$. It should be noted that the computation of subfields does not depend on the Galois groups. The implementation over $\Q(t)$ uses the algorithm of Klüners [[Klu02](https://docs.magma-maths.org/references.md#cite-kl4)]. The implementation over $\F_q(t)$ and extensions thereof follows the newer ideas of Klüners and van Hoeij [[vHKN11](https://docs.magma-maths.org/references.md#cite-vanhoeijklueners)].

<a id="function-subfields-fldfun"></a>
#### `Subfields(F): FldFun -> SeqEnum[FldFun]`

All algebraic function fields $G$ with $k(x) \subset G \subseteq F$ or $K \subset G \subseteq F$ where $K$ is an extension of ${\mathbb{F}}_q(x)$ and the coefficient field of $F$.

<a id="example-ex-aeb7db"></a>
#### `Example: Subfields of a Function Field (ex-aeb7db)`

A subfield computation is shown below.

```magma
> k<x>:= FunctionField(Rationals());
> R<y>:= PolynomialRing(k);
> f:= y^14 - 3234*y^12 + (8*x + 123480)*y^11 + (-696*x - 1152480)*y^10 +
> (27672*x - 43563744)*y^9 + (-663544*x + 1795525424)*y^8 + (10660416*x -
>  33905500608)*y^7 + (-120467088*x + 409661347536)*y^6 + (976911040*x -
>  3428257977088)*y^5 + (-5684130144*x + 20264929189344)*y^4 + (23251514496*x -
>  83582683562112)*y^3 + (-63672983360*x + 229899367865216)*y^2 +
>  (105037027200*x - 380160309247488)*y - 79060128000*x + 286518963720192;
> F:= FunctionField(f);
> Subfields(F);
[
    <Algebraic function field defined over Univariate rational function field
    over Rational Field
    Variables: x by
    y^14 - 3234*y^12 + (8*x + 123480)*y^11 + (-696*x - 1152480)*y^10 + (27672*x
        - 43563744)*y^9 + (-663544*x + 1795525424)*y^8 + (10660416*x -
        33905500608)*y^7 + (-120467088*x + 409661347536)*y^6 + (976911040*x -
        3428257977088)*y^5 + (-5684130144*x + 20264929189344)*y^4 +
        (23251514496*x - 83582683562112)*y^3 + (-63672983360*x +
        229899367865216)*y^2 + (105037027200*x - 380160309247488)*y -
        79060128000*x + 286518963720192, Mapping from: FldFun: F to FldFun: F>,
    <Algebraic function field defined over Univariate rational function field
    over Rational Field
    Variables: x by
    y^7 + 294*y^6 - 107016*y^5 + (2744*x + 576240)*y^4 + (-806736*x +
        2469418896)*y^3 + (88740960*x - 312072913824)*y^2 + (-4329483200*x +
        15606890921216)*y + 79060128000*x - 286518963720192, Mapping from:
    Algebraic function field defined over Univariate rational function field
    over Rational Field
    Variables: x by
    y^7 + 294*y^6 - 107016*y^5 + (2744*x + 576240)*y^4 + (-806736*x +
        2469418896)*y^3 + (88740960*x - 312072913824)*y^2 + (-4329483200*x +
        15606890921216)*y + 79060128000*x - 286518963720192 to FldFun: F>
]
```

### Automorphism Group

Let $K$ be a finite extension of the rational function field over a finite field, the rationals, or a number field. In contrast to the number field situation, there are two different natural notions of automorphisms here: we distinguish between automorphisms that fix the base field and arbitrary automorphisms that can also induce non-trivial maps of the constant field.

The first case, automorphisms fixing the base field of $K$, is analogous to the number field case and was implemented by Jürgen Klüners.

The second case of more general automorphisms has been implemented by Florian Heß along the lines of his paper [[Hes](https://docs.magma-maths.org/references.md#cite-antshessautiso)]. Here the constant field of $K$ can, in fact, be any exact perfect field in Magma with a few provisos.

#### Automorphisms over the Base Field

<a id="function-automorphisms-fldfun-fldfung"></a>
##### `Automorphisms(K, k): FldFun, FldFunG -> [Map]`

Computes all ${\mathbb{Q}}(t)$ automorphisms of the absolute finite extension $K$ that fix $k$. The field $k$ has to be ${\mathbb{Q}}(t)$ for this function.

<a id="function-automorphismgroup-fldfun-fldfung"></a>
##### `AutomorphismGroup(K, k): FldFun, FldFunG -> GrpFP, Map`

Return the group of $k$-automorphisms of the algebraic function field $K$ together with the map from the group to the sequence of automorphisms of $K$. The field $k$ has to be ${\mathbb{Q}}(t)$.

<a id="example-ex-796d6f"></a>
##### `Example: Automorphisms of a Degree 7 Extension (ex-796d6f)`

We define an extension of degree 7 over ${\mathbb{Q}}(t)$ and compute the automorphisms.

```magma
> Q:=Rationals();
> Qt<t>:=PolynomialRing(Q);
> Qtx<x>:=PolynomialRing(Qt);
> f := x^7 + (t^3 + 2*t^2 - t + 13)*x^6 + (3*t^5 - 3*t^4
>     + 9*t^3 + 24*t^2 - 21*t + 54)*x^5 + (3*t^7 -
>     9*t^6 + 27*t^5 - 22*t^4 + 6*t^3 + 84*t^2 -
>     121*t + 75)*x^4 + (t^9 - 6*t^8 + 22*t^7 -
>     57*t^6 + 82*t^5 - 70*t^4 - 87*t^3 + 140*t^2 -
>     225*t - 2)*x^3 + (-t^10 + 5*t^9 - 25*t^8 +
>     61*t^7 - 126*t^6 + 117*t^5 - 58*t^4 - 155*t^3
>     + 168*t^2 - 80*t - 44)*x^2 + (-t^10 + 8*t^9 -
>     30*t^8 + 75*t^7 - 102*t^6 + 89*t^5 + 34*t^4 -
>     56*t^3 + 113*t^2 + 42*t - 17)*x + t^9 - 7*t^8
>     + 23*t^7 - 42*t^6 + 28*t^5 + 19*t^4 - 60*t^3 -
>     2*t^2 + 16*t - 1;
> K:=FunctionField(f);
> A:=Automorphisms(K, BaseField(K));
> #A;
7
```

Now we transform this list into a group to see that it is really cyclic. We pass in special functions for equality testing and multiplication to speed the algorithm up.

```magma
> G := GenericGroup(A: Eq := func<a,b | a`Images eq b`Images>,
>                    Mult := func<a,b | hom<K -> K | a`Images @ b>>);
> G;
Finitely presented group G on 2 generators
Relations
    G.1 = Id(G)
    G.1 * G.2 = G.2 * G.1
    G.1 * G.2^2 = G.2^2 * G.1
    G.1 * G.2^3 = G.2^3 * G.1
    G.1 * G.2^4 = G.2^4 * G.1
    G.1 * G.2^5 = G.2^5 * G.1
    G.1 * G.2^6 = G.2^6 * G.1
    G.1 = G.2^7
```

Finally, we verify that this gives the same result as `AutomorphismGroup`.

```magma
> AutomorphismGroup(K, BaseField(K));
Finitely presented group on 2 generators
Relations
    $.1 = Id($)
    $.1 * $.2 = $.2 * $.1
    $.1 * $.2^2 = $.2^2 * $.1
    $.1 * $.2^3 = $.2^3 * $.1
    $.1 * $.2^4 = $.2^4 * $.1
    $.1 * $.2^5 = $.2^5 * $.1
    $.1 * $.2^6 = $.2^6 * $.1
    $.1 = $.2^7
Mapping from: GrpFP to [
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K,
    Mapping from: FldFun: K to FldFun: K
] given by a rule
```

<a id="function-issubfield-fldfun-fldfun"></a>
##### `IsSubfield(K, L): FldFun, FldFun -> BoolElt, Map`

Given two absolute finite extensions $K$ and $L$ of ${\mathbb{Q}}(t)$, decide if $L$ is an extension of $K$. If this is the case, return an embedding map from $K$ into $L$.

<a id="function-isisomorphicoverqt-fldfun-fldfun"></a>
##### `IsIsomorphicOverQt(K, L): FldFun, FldFun -> BoolElt, Map`

Given two absolute finite extensions $K$ and $L$ of ${\mathbb{Q}}(t)$, decide if $L$ is ${\mathbb{Q}}(t)$-isomorphic to $K$. If this is the case, return a map from $K$ onto $L$.

<a id="example-ex-40fb2d"></a>
##### `Example: Subfields and Isomorphism Testing (ex-40fb2d)`

`Subfields` and `IsIsomorphic` are illustrated below.

```magma
> Q:=Rationals();
> Qt<t>:=PolynomialRing(Q);
> Qtx<x>:=PolynomialRing(Qt);
> K:=FunctionField(x^4-t^3);
> L:=Subfields(K);
> #L;
2
> L:=L[2][1]; L;
Algebraic function field defined over Univariate
rational function field over Rational Field
Variables: t by
x^2 - t^3
```

Now we will check if $L$ is indeed a subfield of $K$:

```magma
> IsSubfield(L,K);
true Mapping from: FldFun: L to FldFun: K
```

Obviously, $L$ can be defined using a simpler polynomial:

```magma
> LL:=FunctionField(x^2-t);
> IsIsomorphicOverQt(LL,L);
true Mapping from: FldFun: LL to FldFun: L
```

<a id="autgen"></a>
#### General Automorphisms

<a id="function-isomorphisms-fldfung-fldfung"></a>
##### `Isomorphisms(K, E): FldFunG, FldFunG -> [Map]`

```magma
BaseMorphism: Map                          Default: false
Bound       : RngIntElt                    Default: Infinity()
Strategy    : MonStgElt                    Default: "None"
```

Given two function fields $K$ and $E$, this function computes a list of at most `Bound` field isomorphisms from $K$ to $E$.

If `BaseMorphism` is given it should be an isomorphism $f$ between the constant fields of $K$ and $E$. In this case only isomorphisms extending $f$ are considered.

The default behaviour is for all isomorphisms from $K$ to $E$ which extend SOME isomorphism of the constant field of $K$ to that of $E$ considered. In this case (no base morphism is specified), the constant fields must be finite, the rationals, or a number field. If the base morphism $f$ is specified then the constant fields can be any exact perfect fields ( finite or characteristic 0 ).

If the base morphism $f$ is specified, it can be defined in the natural way for most constant field types. For example, for finite fields and number fields, the usual `hom<k->l|x>`, where `x` gives the image of $k.1$, can be used. A common situation is where the constant fields of $K$ and $E$ are equal to $k$ and $f$ is the identity. This can be defined very simply for any $k$ by `IdentityFieldMorphism(k) `. Several more intrinsics related to field morphisms are described in the following subsection.

The possible choices of `Strategy` are `"None"`, `"Weierstrass"`, or `"DegOne"`. If `Strategy` is different to `"None"`, this determines the places that are used as the basis of the construction of the maps. In all cases, a finite set of places of $E$ and $K$ which must correspond under any isomorphism are used. All isomorphisms are found between the canonical affine models (as defined by Heß) obtained by omitting one of these places from each of $E$ and $K$.

`DegOne` can only be used with finite constant fields. In this case, isomorphisms are determined which map a fixed degree one place of $K$ to any one of the finite number of degree one places of $E$. This function can fail in rare situations if the constant field of $K$ is too small and no degree one place exists. In this case an appropriate error message is displayed.

`Weierstrass` uses the Weierstrass places of the fields. Isomorphisms are determined which map a fixed Weierstrass place of $K$ to any of those of $E$ with the same degree and Riemann-Roch data. This strategy can be very fast if the residue field and Riemann-Roch data of a particular place of $K$ match those of only a few (or no!) Weierstrass places of $E$.

In case of fields of genus $<2$, the constant field must be finite.

<a id="function-isisomorphic-fldfung-fldfung"></a>
##### `IsIsomorphic(K, E): FldFunG, FldFunG -> BoolElt, Map`

```magma
BaseMorphism: Map                          Default: false
Strategy    : MonStgElt                    Default: "None"
```

As above, except the function only computes a single isomorphism if one exists.

<a id="function-automorphisms-fldfung"></a>
##### `Automorphisms(K): FldFunG -> [Map]`

```magma
BaseMorphism: Map                          Default: false
Bound       : RngIntElt                    Default: Infinity()
Strategy    : MonStgElt                    Default: "None"
```

This function computes a list of at most `Bound` automorphisms of the function field $K$. This is an abbreviation for `Isomorphisms(K, K)` and the parameters are as described above.

An important difference is that the BaseMorphism, if specified, must be of field morphism type. `IdentityFieldMorphism` may be used, but basic constructors for non-trivial constant field maps $f$ will usually cause an error if used directly. The way around this is to use the conversion `f := FieldMorphism(f)` (see the following subsection).

<a id="function-isomorphisms-fldfung-fldfung-plcfunelt-plcfunelt"></a>
##### `Isomorphisms(K, E, p1, p2): FldFunG, FldFunG, PlcFunElt, PlcFunElt -> [Map]`

<a id="function-automorphisms-fldfung-plcfunelt-plcfunelt"></a>
##### `Automorphisms(K, p1, p2): FldFunG, PlcFunElt, PlcFunElt -> [Map]`

```magma
Bound: RngIntElt                    Default: Infinity()
```

As above except that the constant field morphism is taken as the identity and only iso/automorphisms which take function field place $p1$ to $p2$ are computed.

<a id="function-automorphismgroup-fldfung"></a>
##### `AutomorphismGroup(K): FldFunG -> GrpFP, Map`

```magma
BaseMorphism: Map                          Default: false
Strategy    : MonStgElt                    Default: "None"
```

Given a function field $K$, this function computes that group of automorphisms satisfying the conditions specified by the parameters and returns it as a finitely-presented group. The map also returned is invertible and takes a group element to the function field isomorphism that it represents.

<a id="function-automorphismgroup-fldfung-map"></a>
##### `AutomorphismGroup(K, f): FldFunG, Map -> Grp, Map, SeqEnum`

```magma
Strategy: MonStgElt                    Default: "None"
```

In this variation, the automorphism group of the function field $K$ is computed in its permutation representation on a set of places or divisors or in its linear representation on a space of differentials or subspace of $K$.

The return values consist of the representing group $G$, a map (with inverse) from $G$ to the maps of $K$ giving the actual isomorphisms, and a sequence of isomorphisms of $K$ which consist of the kernel of the representation.

Only automorphisms fixing the constant field are considered here. If the set/space on which the representation is to be defined is not invariant by the automorphism group, a run-time error will result.

The argument $f$ should be a map defining the representation.

Its domain must be an enumerated sequence for a permutation representation or a vector space for a linear representation.

Its codomain should be $K$ or a space or enumerated sequence of elements of $K$, places of $K$, divisors of $K$, or differentials of $K$. The examples below show some common ways of producing $f$ by using functions like `DifferentialSpace` and `RiemannRochSpace`.

#### Field Morphisms

The isomorphisms returned by the functions in the last subsection are of general `Map` type but contain some extra internal structure. The same is true of the maps used to specify `BaseMorphism`. These objects come in two flavours: *field morphisms*, that represent maps between general fields, and the more specialised *function field morphisms*, representing maps between algebraic function fields. This subsection contains several related functions that are very useful when working with (function) field morphisms.

<a id="function-ismorphism-map"></a>
##### `IsMorphism(f): Map -> Bool`

Returns `true`, if the map is a field or function field morphism; `false` otherwise.

<a id="function-fieldmorphism-map"></a>
##### `FieldMorphism(f): Map -> Map`

Converts a homomorphism between fields into a field morphism.

<a id="function-identityfieldmorphism-fld"></a>
##### `IdentityFieldMorphism(F): Fld -> Map`

Returns the identity automorphism of field $F$ as a field morphism.

<a id="function-isidentity-map"></a>
##### `IsIdentity(f): Map -> BoolElt`

Returns `true` if $f$ is the identity morphism; `false` otherwise.

<a id="function-equality-map-map"></a>
##### `Equality(f, g): Map, Map -> Bool`

Returns `true`, if the two maps are both field morphisms or function field morphisms and are equal; `false` otherwise.

<a id="function-hasinverse-map"></a>
##### `HasInverse(f): Map -> MonStgElt, Map`

Either returns `"true"` and the inverse morphism for (function) field morphism $f$, or `"false"` if inverse does not exist, or `"unknown"` if it cannot be computed.

<a id="function-composition-map-map"></a>
##### `Composition(f, g): Map, Map -> Map`

The composition of the field morphisms $f$ and $g$.

<a id="example-ex-9d9eb5"></a>
##### `Example: Isomorphisms of Function Fields (ex-9d9eb5)`

We illustrate the use of the general isomorphism functions with some examples. In the first, we have a rational function field of characteristic $5$:

```magma
> k<w> := GF(5);
> kxf<x> := RationalFunctionField(k);
> kxfy<y> := PolynomialRing(kxf);
> F<a> := FunctionField(x^2+y^2-1);
> L := Isomorphisms(kxf, F);
> #L eq #PGL(2, k);
```

In the next example we consider the function field of a hyperelliptic curve defined over ${\mathbb{Q}}(i)$ [$i^2 = -1$] and a Galois twist of it. The fields are not isomorphic over ${\mathbb{Q}}(i)$ but they are over ${\mathbb{Q}}$:

```magma
> k<i> := QuadraticField(-1);
> kxf<x> := RationalFunctionField(k);
> kxfy<y> := PolynomialRing(kxf);
> F1<a> := FunctionField(y^2-x^5-x^2-i);
> F2<b> := FunctionField(i*y^2-x^5-i*x^2+1);
> c := IdentityFieldMorphism(k);
> IsIsomorphic(F1,F2 : BaseMorphism := c);
false
> IsIsomorphic(F1,F2);
true Mapping from: FldFun: F1 to FldFun: F2 given by a rule
> L := Isomorphisms(F1, F2);
> [<f(a), f(x), f(i)> : f in L];
[
    <-i*b, i*x, -i>,
    <i*b, i*x, -i>
]
```

In the next example we consider the function field of the genus 3 plane curve $x^3*y+y^3*z+z^3*x=0$, which has full automorphism group $PGL_2({\mathbb{F}}_7)$. We compute automorphisms over different finite fields and also compute the automorphisms group as an FP group.

```magma
> k := GF(11);
> kxf<x> := RationalFunctionField(k);
> kxfy<y> := PolynomialRing(kxf);
> K<y> := FunctionField(x^3*y+y^3+x);
> L := Automorphisms(K);
> #L;
3
> // Extend base field to get all autos
> k := GF(11^3);
> kxf<x> := RationalFunctionField(k);
> kxfy<y> := PolynomialRing(kxf);
> K<y> := FunctionField(x^3*y+y^3+x);
> L := Automorphisms(K);
> #L;
504
> // restrict to just "geometric" autos, which fix the base
> c := IdentityFieldMorphism(k);
> L := Automorphisms(K : BaseMorphism := c);
> #L;
168
> // get the automorphism group instead as an FP group
> G,mp := AutomorphismGroup(K : BaseMorphism := c);
> G;
Finitely presented group G on 2 generators
Relations
    G.2^3 = Id(G)
    (G.1^-1 * G.2)^3 = Id(G)
    G.1^7 = Id(G)
    (G.2^-1 * G.1^-3)^2 = Id(G)
    (G.2^-1 * G.1^-1)^4 = Id(G)
> #G;
168
> IdentifyGroup(G); // find in small group database
<168, 42>
```

Finally, we give an example of a genus 1 function field over ${\mathbb{F}}_5$ where the group of automorphisms is computed acting on various spaces of functions and differentials.

```magma
> k<w> := GF(5);
> kxf<x> := RationalFunctionField(k);
> kxfy<y> := PolynomialRing(kxf);
> f := x^3 + y^3 + 1;
> F<a> := FunctionField(f);
> f := Numeration(Set(Places(F, 1)));
> G, h, K := AutomorphismGroup(F, f);
> #G; Type(G);
12
GrpPerm
> V, f := SpaceOfDifferentialsFirstKind(F);
> G, h, K := AutomorphismGroup(F, f);
> #G; Type(G);
2
GrpMat
> D := &+ Places(F, 1);
> V, f := DifferentialSpace( -D );
> G, h := AutomorphismGroup(F, f);
> #G;
12
> V, f := RiemannRochSpace( D );
> G, h, ker := AutomorphismGroup(F, f);
> #G; #ker;
12
1
```

### Global Function Fields

In this section $F/k$ denotes a global function field.

#### Functions relative to the Exact Constant Field

<a id="function-numberofplacesofdegreeoverexactconstantfield-fldfun-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOverExactConstantField(F, m): FldFun, RngIntElt -> RngIntElt`

<a id="function-numberofplacesdegecf-fldfun-rngintelt"></a>
##### `NumberOfPlacesDegECF(F, m): FldFun, RngIntElt -> RngIntElt`

The number of places of degree $m$ of the global function field $F/k$. Contrary to the `Degree` function the degree is here taken over the respective exact constant fields.

<a id="function-numberofplacesofdegreeoneoverexactconstantfield-fldfung"></a>
##### `NumberOfPlacesOfDegreeOneOverExactConstantField(F): FldFunG -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecf-fldfung"></a>
##### `NumberOfPlacesOfDegreeOneECF(F): FldFunG -> RngIntElt`

The number of places of degree one in the global function field $F/k$. Contrary to the `Degree()` function the degree is here taken over the exact constant field.

<a id="function-numberofplacesofdegreeoneoverexactconstantfield-fldfung-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneOverExactConstantField(F, m): FldFunG, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecf-fldfun-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneECF(F, m): FldFun, RngIntElt -> RngIntElt`

The number of places of degree one in the constant field extension of degree $m$ of the global function field $F/k$. Contrary to the `Degree()` function the degree is here taken over the respective exact constant fields.

<a id="function-serrebound-fldfung"></a>
##### `SerreBound(F): FldFunG -> RngIntElt`

<a id="function-serrebound-fldfung-rngintelt"></a>
##### `SerreBound(F, m): FldFunG, RngIntElt -> RngIntElt`

<a id="function-serrebound-rngintelt-rngintelt"></a>
##### `SerreBound(q, g): RngIntElt, RngIntElt -> RngIntElt`

The Serre bound on the number of places of degree one in a global function field of genus $g$ over the exact constant field of $q$ elements (of the global function field $F$, of the constant field extension of degree $m$ of $F$). Contrary to the `Degree()` function the degree is here taken over the respective exact constant fields.

<a id="function-iharabound-fldfung"></a>
##### `IharaBound(F): FldFunG -> RngIntElt`

<a id="function-iharabound-fldfung-rngintelt"></a>
##### `IharaBound(F, m): FldFunG, RngIntElt -> RngIntElt`

<a id="function-iharabound-rngintelt-rngintelt"></a>
##### `IharaBound(q, g): RngIntElt, RngIntElt -> RngIntElt`

The Ihara bound on the number of places of degree one in a global function field $F/k$ of genus $g$ over the exact constant field of $q$ elements (of the global function field $F$, of the constant field extension of degree $m$ of $F$). Contrary to the `Degree` function the degree is here taken over the respective exact constant fields.

<a id="function-numberofplacesofdegreeoneecfbound-fldfung"></a>
##### `NumberOfPlacesOfDegreeOneECFBound(F): FldFunG -> RngIntElt`

<a id="function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfung"></a>
##### `NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F): FldFunG -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecfbound-fldfun-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneECFBound(F, m): FldFun, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfung-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F, m): FldFunG, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecfbound-rngintelt-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneECFBound(q, g): RngIntElt, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneoverexactconstantfieldbound-rngintelt-rngintelt"></a>
##### `NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(q, g): RngIntElt, RngIntElt -> RngIntElt`

The minimum of the Serre and Ihara bound. Contrary to the `Degree` function the degree is here taken over the respective exact constant fields.

<a id="function-lpolynomial-fldfung"></a>
##### `LPolynomial(F): FldFunG -> RngUPolElt`

The $L$-polynomial of the global function field $F/k$ (with respect to the exact constant field).

<a id="function-lpolynomial-fldfung-rngintelt"></a>
##### `LPolynomial(F, m): FldFunG, RngIntElt -> RngUPolElt`

The $L$-polynomial of the constant field extension of degree $m$ of the global function field $F/k$ (with respect to the exact constant field).

<a id="function-zetafunction-fldfung"></a>
##### `ZetaFunction(F): FldFunG -> FldFunRatUElt`

The Zeta function of the global function field $F/k$ (with respect to the exact constant field).

<a id="function-zetafunction-fldfung-rngintelt"></a>
##### `ZetaFunction(F, m): FldFunG, RngIntElt -> FldFunRatUElt`

The Zeta function of the constant field extension of degree $m$ of the global function field $F/k$ (with respect to the exact constant field).

#### Functions Relative to the Constant Field

<a id="function-places-fldfung-rngintelt"></a>
##### `Places(F, m): FldFunG, RngIntElt -> SeqEnum[PlcFunElt]`

A sequence containing the places of degree $m$ of the global function field $F/k$.

<a id="function-hasplace-fldfung-rngintelt"></a>
##### `HasPlace(F, m): FldFunG, RngIntElt -> BoolElt, PlcFunElt`

Returns `true` and a place of degree $m$ if and only if there exists such a place in the global function field; `false` otherwise.

<a id="function-hasrandomplace-fldfung-rngintelt"></a>
##### `HasRandomPlace(F, m): FldFunG, RngIntElt -> BoolElt, PlcFunElt`

Returns `true` and a random place of degree $m$ in the global function field (`false` if there are none).

<a id="function-randomplace-fldfung-rngintelt"></a>
##### `RandomPlace(F, m): FldFunG, RngIntElt -> PlcFunElt`

Returns a random place of degree $m$ in the global function field or throws an error if there is none.

<a id="example-ex-8f580e"></a>
##### `Example: Invariants of a Global Function Field (ex-8f580e)`

```magma
> Y<t> := PolynomialRing(Integers());
> R<x> := FunctionField(GF(9));
> P<y> := PolynomialRing(R);
> f := y^3 + y + x^5 + x + 1;
> F<alpha> := FunctionField(f);
> Genus(F);
4
> NumberOfPlacesDegECF(F, 1);
22
> NumberOfPlacesOfDegreeOneECFBound(F);
32
> HasRandomPlace(F, 2);
true (x^2 + $.1*x + 2, alpha + $.1^2*x + $.1^5)
> LPolynomial(F);
6561*t^8 + 8748*t^7 + 7290*t^6 + 3888*t^5 + 1539*t^4 + 432*t^3 + 90*t^2
    + 12*t + 1
```

<a id="example-ex-9f3184"></a>
##### `Example: Invariants of a Global Relative Field (ex-9f3184)`

Some of the above functions are demonstrated for a global relative field.

```magma
> PF<x> := PolynomialRing(GF(13, 2));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b>;
> RER_FF2 := RationalExtensionRepresentation(FF2);
> NumberOfPlacesOfDegreeOneECF(FF2) eq NumberOfPlacesOfDegreeOneECF(RER_FF2);
true
> SerreBound(FF2);
170
> NumberOfPlacesDegECF(FF2, 1);
170
> _, P := HasPlace(FF2, 1);
> P;
(x, (($.1^44*x + $.1^100)*b + ($.1^82*x + $.1^10))*d^2 + (($.1^85*x + $.1^67)*b
    + ($.1^107*x + $.1^130))*d + ($.1^26*x + $.1^69)*b + $.1^149*x)
> Degree(P) eq 1;
true
> LPolynomial(FF2, 2) eq LPolynomial(RER_FF2, 2);
true
```

#### Functions related to Class Group

<a id="function-unitrank-rngfunord"></a>
##### `UnitRank(O): RngFunOrd -> RngIntElt`

Given a maximal ‘finite’ order $O$ in a global function field, return the unit rank of $O$.

<a id="function-unitgroup-rngfunord"></a>
##### `UnitGroup(O): RngFunOrd -> GrpAb, Map`

The unit group of a ‘finite’ maximal order $O$ as an Abelian group and the map from the unit group into $O$. Also see [`IsUnitWithPreimage`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-orders-elements-isunitwithpreimage).

<a id="function-regulator-rngfunord"></a>
##### `Regulator(O): RngFunOrd -> RngIntElt`

The regulator of the unit group of the ‘finite’ maximal order $O$.

<a id="function-principalidealmap-rngfunord"></a>
##### `PrincipalIdealMap(O): RngFunOrd -> Map`

The map from the multiplicative group of the field of fractions of $O$ to the group of fractional ideals of $O$ where $O$ is a ‘finite’ maximal order.

<a id="example-ex-1591a6"></a>
##### `Example: Unit Group of an Equation Order (ex-1591a6)`

Following on from the last example,

```magma
> EFF2F := EquationOrderFinite(FF2);
> G, m := UnitGroup(EFF2F);
> G;
Abelian Group isomorphic to Z/168
Defined on 1 generator
Relations:
    168*G.1 = 0
> m(Random(G));
[ [ $.1^120, 0 ], [ 0, 0 ], [ 0, 0 ] ]
> IsUnit($1);
true
> Regulator(EFF2F);
1
```

<a id="function-classgroup-fldfung"></a>
##### `ClassGroup(F : parameters): FldFunG -> GrpAb, Map, Map`

```magma
DegreeBound     : RngIntElt                    Default: 
SizeBound       : RngIntElt                    Default: 
ReductionDivisor: DivFunElt                    Default: 
Proof           : BoolElt                      Default: 
```

The divisor class group of $F/k$ as an Abelian group, a map of representatives from the class group to the divisor group and the homomorphism from the divisor group onto the divisor class group. For a detailed description see [`ClassGroup`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroup).

<a id="function-classgroup-rngfunord"></a>
##### `ClassGroup(O): RngFunOrd -> GrpAb, Map, Map`

The ideal class group of the ‘finite’ maximal order $O$ as an Abelian group, a map of representatives from the ideal class group to the group of fractional ideals and the homomorphism from the group of fractional ideals onto the ideal class group.

<a id="function-classgroupexactsequence-rngfunord"></a>
##### `ClassGroupExactSequence(O): RngFunOrd -> Map, Map, Map`

Returns the maps in the center of the exact sequence $0 \rightarrow U \rightarrow F^\times \rightarrow Id \rightarrow Cl \rightarrow 0$ where $U$ is the unit group of $O$, $F^\times$ is the multiplicative group of the field of fractions of $O$, $Id$ is the group of fractional ideals of $O$ and $Cl$ is the class group of $O$ for a ‘finite’ maximal order $O$.

<a id="function-classgroupabelianinvariants-fldfung"></a>
##### `ClassGroupAbelianInvariants(F : parameters): FldFunG -> SeqEnum`

```magma
DegreeBound     : RngIntElt                    Default: 
SizeBound       : RngIntElt                    Default: 
ReductionDivisor: DivFunElt                    Default: 
Proof           : BoolElt                      Default: 
```

Computes a sequence of integers containing the Abelian invariants of the divisor class group of $F/k$. For a detailed description see [`ClassGroupAbelianInvariants`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroupabelianinvariants).

<a id="function-classgroupabelianinvariants-rngfunord"></a>
##### `ClassGroupAbelianInvariants(O): RngFunOrd -> SeqEnum`

Computes a sequence of integers containing the Abelian invariants of the ideal class group of the ‘finite’ maximal order $O$.

<a id="function-classnumber-fldfung"></a>
##### `ClassNumber(F): FldFunG -> RngIntElt`

The order of the group of divisor classes of degree zero of $F/k$.

<a id="function-classnumber-rngfunord"></a>
##### `ClassNumber(O): RngFunOrd -> RngIntElt`

The order of the ideal class group of the ‘finite’ maximal order $O$.

<a id="example-ex-dd2e5e"></a>
##### `Example: Class Groups of Relative Fields (ex-dd2e5e)`

An example of class groups of relative fields is shown.

```magma
> PF<x> := PolynomialRing(GF(13, 2));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b : Check := false>;
> MFF2I := MaximalOrderInfinite(FF2);
> G, m, mi := ClassGroup(FF2);
> m(Random(G));
Divisor in reduced representation:
Divisor in ideal representation:
Fractional ideal of Maximal Equation Order of FF2 over Maximal Equation Order of
FF1 over Univariate Polynomial Ring in x over GF(13^2)
Generators:
1
($.1^60/x*b + $.1^57/x)*d^2 + ($.1^141/x*b + $.1^4/x)*d + $.1^80/x*b, Ideal of
MFF2I
Generators:
1
1,
-2,
6*(1/x, (($.1^132*x^2 + $.1^164*x + 12)/x^3*b + ($.1^85*x^2 + $.1^155*x +
    12)/x^3)*d^2 + (($.1^75*x^2 + $.1^81*x + 12)/x^3*b + ($.1^29*x^2 + $.1^155*x
    + 12)/x^3)*d + ($.1^163*x^2 + $.1^29*x + 12)/x^3*b + ($.1^141*x + 12)/x^2),
    (x)^2 * (1/x)^2
> mi(&+[Divisor(Random(FF2, 3)) : i in [1 .. 3]]);
0
> ClassNumber(FF2);
1
```

<a id="function-globalunitgroup-fldfung"></a>
##### `GlobalUnitGroup(F): FldFunG -> GrpAb, Map`

The group of global units of $F/k$, i. e. the multiplicative group of the exact constant field, as an Abelian group, together with the map into $F$. Also see [`IsGlobalUnit`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-field-elements-isglobalunit) and [`IsGlobalUnitWithPreimage`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/elements.md#function-field-elements-isglobalunitwithpreimage).

<a id="function-classgroupprank-fldfung"></a>
##### `ClassGroupPRank(F): FldFunG -> RngIntElt`

Compute the $p$-rank of the class group of $F/k$ where $p$ is the characteristic of $F/k$. For a detailed description see [`ClassGroupPRank`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroupprank).

<a id="function-hassewittinvariant-fldfung"></a>
##### `HasseWittInvariant(F): FldFunG -> RngIntElt`

Return the Hasse–Witt invariant of $F/k$. See [`HasseWittInvariant`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-hassewittinvariant) for a detailed description.

<a id="function-independentunits-rngfunord"></a>
##### `IndependentUnits(O): RngFunOrd -> SeqEnum[RngFunOrdElt]`

A sequence of independent units of the ‘finite’ maximal order $O$.

<a id="function-fundamentalunits-rngfunord"></a>
##### `FundamentalUnits(O): RngFunOrd -> SeqEnum[RngFunOrdElt]`

A sequence of fundamental units of the ‘finite’ maximal order $O$.

<a id="example-ex-065c59"></a>
##### `Example: Basis and Fundamental Units of a Maximal Order (ex-065c59)`

```magma
> R<x> := FunctionField(GF(3));
> P<y> := PolynomialRing(R);
> f := y^4 + x*y + x^4 + x + 1;
> F<a> := FunctionField(f);
> O := MaximalOrderFinite(F);
> Basis(O);
[ 1, a, a^2, a^3 ]
> Discriminant(O);
x^12 + x^3 + 1
> UnitRank(O);
1
> U := FundamentalUnits(O);
> U;
[ [ x^33 + x^31 + 2*x^30 + 2*x^28 + 2*x^27 + x^25 + 2*x^24 + x^22 + 2*x^19 +
    2*x^15 + x^10 + 2*x^9 + 2*x^7 + x^6 + 2*x + 2, x^32 + 2*x^30 + x^29 + 2*x^28
    + 2*x^27 + 2*x^26 + x^22 + x^21 + 2*x^19 + x^18 + x^17 + x^16 + x^13 + x^11
    + 2*x^10 + 2*x^9 + 2*x^3 + 1, x^29 + x^27 + 2*x^25 + 2*x^23 + x^22 + 2*x^21
    + x^20 + x^18 + 2*x^17 + x^16 + x^15 + 2*x^14 + x^11 + 2*x^10 + 2*x^4 + x,
    x^30 + 2*x^27 + x^24 + x^21 + 2*x^18 + x^9 + 2*x^6 + 2 ] ]
> Norm(U[1]);
1
> Regulator(O);
33
```

### Structure Predicates

<a id="function-isfield-fldfun"></a>
#### `IsField(R): FldFun -> BoolElt`

<a id="function-iseuclideandomain-fldfun"></a>
#### `IsEuclideanDomain(R): FldFun -> BoolElt`

<a id="function-isfield-rngfunord"></a>
#### `IsField(O): RngFunOrd -> BoolElt`

<a id="function-ispid-fldfun"></a>
#### `IsPID(R): FldFun -> BoolElt`

<a id="function-isufd-fldfun"></a>
#### `IsUFD(R): FldFun -> BoolElt`

<a id="function-isdivisionring-fldfun"></a>
#### `IsDivisionRing(R): FldFun -> BoolElt`

<a id="function-iseuclideanring-fldfun"></a>
#### `IsEuclideanRing(R): FldFun -> BoolElt`

<a id="function-isdivisionring-rngfunord"></a>
#### `IsDivisionRing(O): RngFunOrd -> BoolElt`

<a id="function-isprincipalidealring-fldfun"></a>
#### `IsPrincipalIdealRing(R): FldFun -> BoolElt`

<a id="function-isdomain-fldfun"></a>
#### `IsDomain(R): FldFun -> BoolElt`

<a id="function-isdomain-rngfunord"></a>
#### `IsDomain(O): RngFunOrd -> BoolElt`

<a id="operation-op-eq-fldfung-fldfung"></a>
#### `F eq G: FldFunG, FldFunG -> BoolElt`

<a id="operation-op-ne-fldfung-fldfung"></a>
#### `F ne G: FldFunG, FldFunG -> BoolElt`

<a id="operation-op-eq-rngfunord-rng"></a>
#### `O1 eq O2: RngFunOrd, Rng -> BoolElt`

<a id="operation-op-ne-rngfunord-rng"></a>
#### `O1 ne O2: RngFunOrd, Rng -> BoolElt`

<a id="operation-op-subset-rngfunord-rngfunord"></a>
#### `O1 subset O2: RngFunOrd, RngFunOrd -> BoolElt`

Return whether $O1$ is a subset of $O2$.

<a id="function-isglobal-fldfung"></a>
#### `IsGlobal(F): FldFunG -> BoolElt`

Returns `true` if and only if the algebraic function field $F/k$ is global, i.e. the constant field is a finite field; `false` otherwise.

<a id="function-isrationalfunctionfield-fldfung"></a>
#### `IsRationalFunctionField(F): FldFunG -> BoolElt`

Return `true` if the function field $F$ is isomorphic to a rational function field, (i.e. $F$ is only trivially algebraic).

<a id="function-isfiniteorder-rngfunord"></a>
#### `IsFiniteOrder(O): RngFunOrd -> BoolElt`

Given an order $O$ of a function field, return `true` if and only if the bottom coefficient ring of $O$ is a polynomial ring.

<a id="function-isequationorder-rngfunord"></a>
#### `IsEquationOrder(O): RngFunOrd -> BoolElt`

Given an order $O$ of a function field, return `true` if and only if the order $O$ is an equation order (i.e. it has been defined by a polynomial and so has a power basis).

<a id="function-isabsoluteorder-rngfunord"></a>
#### `IsAbsoluteOrder(O): RngFunOrd -> BoolElt`

Return `false` if the order $O$ is an extension of another order, otherwise `true`.

<a id="function-ismaximal-rngfunord"></a>
#### `IsMaximal(O): RngFunOrd -> BoolElt`

Given an order $O$ of a function field, return `true` if and only if the order $O$ is maximal in its field of fractions.

<a id="function-istamelyramified-rngfunord"></a>
#### `IsTamelyRamified(O): RngFunOrd -> BoolElt`

Return whether the order $O$ is tamely ramified, i.e. no prime ideal of $O$ has residue field with characteristic dividing its ramification index.

<a id="function-istotallyramified-rngfunord"></a>
#### `IsTotallyRamified(O): RngFunOrd -> BoolElt`

Return whether there is an ideal of the order $O$ which is totally ramified, i.e. its ramification index is equal to the degree of $O$ over its coefficient ring.

<a id="function-isunramified-rngfunord"></a>
#### `IsUnramified(O): RngFunOrd -> BoolElt`

Return whether a finite order $O$ is unramified at the finite places and whether an infinite order $O$ is unramified at the infinite places.

<a id="function-iswildlyramified-rngfunord"></a>
#### `IsWildlyRamified(O): RngFunOrd -> BoolElt`

Return whether there is a prime ideal of the order $O$ which is wildly ramified, i.e. its ramification index is divisible by the characteristic of its residue class field.

<a id="function-isinkummerrepresentation-fldfun"></a>
#### `IsInKummerRepresentation(K): FldFun -> BoolElt, FldFunElt`

Tests if the global function field $K$ is, in its current representation, a Kummer extension. More specific, this function tests if the defining polynomial is of the form $x^r-a$ for some $r$ coprime to the characteristic and if $r$ divides the order of the multiplicative group of the constant field, ie. if the coefficient ring of $K$ contains a primitive $r$-th root of unity. In case $K$ is in Kummer representation, the element $a$ is returned as a second return value.

<a id="function-isinartinschreierrepresentation-fldfun"></a>
#### `IsInArtinSchreierRepresentation(K): FldFun -> BoolElt, FldFunElt`

Tests if a global function field $K$ is, in its current representation, a Artin-Schreier extension, ie. if the defining polynomial of $K$ is of the form $x^p-x-a$ where $p$ is the characteristic of $K$. In this case, the element $a$ is returned as a second return value.

### Homomorphisms

<a id="constructor-constructor-hom-fldfun-rng-rngelt-map"></a>
#### `hom<F -> R | g>: FldFun, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-fldfun-rng-map-rngelt-map"></a>
#### `hom<F -> R | cf, g>: FldFun, Rng, Map, RngElt -> Map`

The homomorphism from the function field $F$ to any ring $R$ where $g$ is the image of the generator of $F$ in $R$ and $cf$ is a map from the coefficient field of $F$ into $R$.

<a id="constructor-constructor-hom-rngfunord-rng-rngelt-map"></a>
#### `hom< O -> R | g >: RngFunOrd, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-rngfunord-rng-map-rngelt-map"></a>
#### `hom< O -> R | cf, g >: RngFunOrd, Rng, Map, RngElt -> Map`

Create the map from the order $O$ of an algebraic function field to $R$ using $g$ as the image of the primitive element of $O$. If the map $cf$ is given it should be from the coefficient ring of $O$ into $R$, otherwise the coefficient ring of $O$ should be automatically coercible into $R$.

<a id="function-isringhomomorphism-map"></a>
#### `IsRingHomomorphism(m): Map -> BoolElt`

Return whether the vector space homomorphism $m$ is a homomorphism of rings.

<a id="example-ex-1107ee"></a>
#### `Example: Homomorphisms of Relative Function Fields (ex-1107ee)`

A simple use of homomorphisms is shown.

```magma
> PR<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(PR);
> FR1<a> := FunctionField(y^3 - x*y + 1);
> P<y> := PolynomialRing(FR1);
> FR2<c> := FunctionField(y^2 - a^5*x^3*y + 1);
> EFR2F := EquationOrderFinite(FR2);
> cf := hom<FR1 -> EFR2F | a + 1>;
> h := hom<FR2 -> EFR2F | cf, c + 1>;
> h(c) eq c + 1;
true
> h(a*c) eq a*c + a + c + 1;
true
```

<a id="constructor-constructor-hom-rngfunord-rng-rngelt-rngelt-map"></a>
#### `hom< O -> R | b₁, ..., bₙ >: RngFunOrd, Rng, RngElt, ..., RngElt -> Map`

<a id="constructor-constructor-hom-rngfunord-rng-map-rngelt-rngelt-map"></a>
#### `hom< O -> R | m, b₁, ..., bₙ >: RngFunOrd, Rng, Map, RngElt, ..., RngElt -> Map`

Return the map from the order $O$ of an algebraic function field into the ring $R$ which maps the basis elements of $O$ to $b_1, ..., b_n$. The map $m$, if given, should be from the coefficient ring of $O$ into $R$ and will be used to map the coefficients of the basis elements. If not given, the coefficient ring of $O$ should automatically coerce into $R$.

### Elements

The function field $F = k(x, \alpha_1, \ldots, \alpha_r, \alpha)$ may be viewed as $n$-dimensional vector space over $k(x, \alpha_1, \ldots, \alpha_r)$, where $n$ is the degree of the field extension $F/k(x, \alpha_1, \ldots, \alpha_r)$. Note that $F$ is spanned by the powers $1, \alpha, \dots, \alpha^{n-1}$. Within Magma, function field elements are printed as linear combinations of these powers of $\alpha$ over the coefficient field.

An order can be viewed as a free $R$-module of rank $n$ where $R$ is its coefficient ring (a polynomial ring or the degree valuation ring of $k(x)$ or an order which is a lesser degree extension of $k[x]$) and $n$ equals the degree $F/k(x, \alpha_1, \ldots, \alpha_r)$. It has a basis consisting of $n$ elements. Within Magma, function field order elements are printed as a sequence of coefficients of the $R$-linear combination of such a basis.

Elements can also be represented as a product of other function field or order elements. This is referred to as the product representation. Product representations can be useful for large elements, however, it is expensive to put such elements in a set or to test them for equality as this involves finding coefficients for the element.

#### Creation of Elements

<a id="operation-operation-fldfun-fldfunelt"></a>
##### `F . 1: FldFun -> FldFunElt`

<a id="operation-operation-fldfun-fldfunelt-2"></a>
##### `F . 2: FldFun -> FldFunElt`

**(i)**
Return the generator for the function field $F$ over $k(x, \alpha_1, \ldots, \alpha_r)$, that is, $\alpha \in F$ such that $F = k(x, \alpha_1, \ldots, \alpha_r, \alpha)$.

**(ii)**
Return the first and second generators for the function field $F$ over $k$, that is, $\alpha \in F$ and $x \in F$ such that $F = k(x, \alpha)$.

<a id="function-name-fldfun-rngintelt"></a>
##### `Name(F, i): FldFun, RngIntElt -> FldFunElt`

Given a function field $F$, return the $i$-th generator, i.e. return the element `F.1` or `F.2` of $F$.

<a id="operation-operation-rngfunord-rngintelt-fldfunordelt"></a>
##### `O . i: RngFunOrd, RngIntElt -> FldFunOrdElt`

<a id="operation-operation-fldfunord-rngintelt-fldfunordelt"></a>
##### `FF . i: FldFunOrd, RngIntElt -> FldFunOrdElt`

Return the $i$th basis element of the order $O$ or its field of fractions $FF$.

<a id="operation-op-fldfun"></a>
##### `F ! a: FldFun, . -> FldFunElt`

<a id="constructor-constructor-elt-fldfun-fldfunelt"></a>
##### `elt<F | a>: FldFun, . -> FldFunElt`

Create the element of the function field $F$ specified by $a$; here $a$ is allowed to be an element coercible into $F$, which means that $a$ may be:

**(i)**
an element of $F$,

**(ii)**
an element of the coefficient field of $F$,

**(iii)**
an element of another representation of $F$. For $F$ an extension of $k(x)$ we additionally have

**(iv)**
an element of an order of $F$,

**(v)**
an element being coercible into $k(x)$,

**(vi)**
a sequence of elements being coercible into the coefficient field of $F$ of length equal to the degree of $F$ over its coefficient field. In this case the element $a_0 + a_1 \alpha + \dots + a_{n-1} \alpha^{n-1}$ is created, where $a=[a_0, \dots, a_{n-1}]$ and $\alpha$ is the generator `F.1` of $F$ over its coefficient field.

<a id="operation-op-rngfunord"></a>
##### `O ! a: RngFunOrd, . -> RngFunOrdElt`

<a id="constructor-constructor-elt-rngfunord-rngfunordelt"></a>
##### `elt<O | a>: RngFunOrd, . -> RngFunOrdElt`

Create the element of the order $O$ specified by $a$; here $a$ is allowed to be an element coercible into $O$, which means that mathematically $a \in O$ and that $a$ may be any of:

**(i)**
an element of the function field $F$,

**(ii)**
an element of an order of the function field $F$,

**(iii)**
an element that can be coerced into $k(x)$,

**(iv)**
an element that can be coerced into its coefficient field,

**(v)**
a sequence of elements being coercible into the coefficient field of $O$ of length equal to the rank of $O$ over its coefficient field. In this case the element $a_1 \omega_1 + a_2 \omega_2 + \dots + a_{n} \omega_n$ is created, where $a=[a_1, \dots, a_{n}]$ and $\omega_1, \omega_2, \dots, \omega_n$ is the basis of $O$ as returned by `Basis(O)`.

<a id="operation-op-fldfunord-any"></a>
##### `FF ! a: FldFunOrd, Any -> FldFunOrdElt`

<a id="constructor-constructor-elt-fldfunord-any-fldfunordelt"></a>
##### `elt<FF | a>: FldFunOrd, Any -> FldFunOrdElt`

Create the element of the field of fractions $FF$ of an order $O$ specified by $a$, where $a$ may be any of the above such that $d*a$ is mathematically in $O$ for some $d \in O$.

<a id="constructor-constructor-elt-fldfun-rngelt-rngelt-fldfunelt"></a>
##### `elt< F | a₀, a₁, ..., aₙ₋₁>: FldFun, RngElt, ..., RngElt -> FldFunElt`

Create the element $a_0 + a_1 \alpha + \dots + a_{n-1} \alpha^{n-1}$ where $a_0, \dots, a_{n-1}$ are coercible into the coefficient field of the function field $F$, $n$ equals the degree of $F$ over its coefficient field and $\alpha$ is the generator `F.1` of $F$ over $k(x)$.

<a id="constructor-constructor-elt-rngfunord-rngelt-rngelt-rngfunordelt"></a>
##### `elt< O | a₁, a₂, ..., aₙ>: RngFunOrd, RngElt, ..., RngElt -> RngFunOrdElt`

<a id="constructor-constructor-elt-fldfunord-rngelt-rngelt-fldfunordelt"></a>
##### `elt< FF | a₁, a₂, ..., aₙ>: FldFunOrd, RngElt, ..., RngElt -> FldFunOrdElt`

Create the element $a_1 \omega_1 + a_2 \omega_2 + \dots + a_{n} \omega_n$ where $a_1, \dots, a_{n}$ are coercible into the coefficient ring of the order $O$, $n$ equals the rank of $O$ over its coefficient ring and $\omega_1, \omega_2, \dots, \omega_n$ is the basis of $O$ as returned by `Basis(O)`, (where $O$ is the ring of integers of the field of fractions $FF$).

<a id="function-one-fldfun"></a>
##### `One(F): FldFun -> FldFunElt`

<a id="function-one-rngfunord"></a>
##### `One(O): RngFunOrd -> RngFunOrdElt`

<a id="function-identity-fldfun"></a>
##### `Identity(F): FldFun -> FldFunElt`

<a id="function-identity-rngfunord"></a>
##### `Identity(O): RngFunOrd -> RngFunOrdElt`

<a id="function-zero-fldfun"></a>
##### `Zero(F): FldFun -> FldFunElt`

<a id="function-zero-rngfunord"></a>
##### `Zero(O): RngFunOrd -> RngFunOrdElt`

<a id="function-representative-fldfun"></a>
##### `Representative(F): FldFun -> FldFunElt`

<a id="function-representative-rngfunord"></a>
##### `Representative(O): RngFunOrd -> RngFunOrdElt`

These generic functions (cf. Chapter [Introduction to Rings](https://docs.magma-maths.org/BasicRings/IntroductionToRings/index-introduction-to-rings.md#rngintro)) create $1$, $1$, $0$, and $0$ respectively in the function field $F$ or order $O$.

<a id="function-random-fldfung-rngintelt"></a>
##### `Random(F, m): FldFunG, RngIntElt -> FldFunElt`

<a id="function-random-rngfunord-rngintelt"></a>
##### `Random(O, m): RngFunOrd, RngIntElt -> RngFunOrdElt`

A “random” element of the global function field $F$ or one of its orders $O$. The size of the coefficients of the element are determined by $m$.

#### Parent and Category

<a id="function-parent-fldfunelt"></a>
##### `Parent(a): FldFunElt -> FldFun`

<a id="function-parent-rngfunordelt"></a>
##### `Parent(a): RngFunOrdElt -> RngFunOrd`

<a id="function-category-fldfunelt"></a>
##### `Category(a): FldFunElt -> Cat`

<a id="function-category-rngfunordelt"></a>
##### `Category(a): RngFunOrdElt -> Cat`

#### Sequence Conversions

The sequence conversions refer to the function field $F$ as a vector space of dimension $n$ over the coefficient field of $F$ where $F$ is a finite degree extension (degree $n$) of its coefficient field.

<a id="function-elementtosequence-fldfunelt"></a>
##### `ElementToSequence(a): FldFunElt -> SeqEnum[FldElt]`

<a id="function-elementtosequence-rngfunordelt"></a>
##### `ElementToSequence(a): RngFunOrdElt -> SeqEnum[RngElt]`

<a id="function-elementtosequence-fldfunordelt"></a>
##### `ElementToSequence(a): FldFunOrdElt -> SeqEnum[RngElt]`

<a id="function-eltseq-fldfunelt"></a>
##### `Eltseq(a): FldFunElt -> SeqEnum[FldElt]`

<a id="function-eltseq-rngfunordelt"></a>
##### `Eltseq(a): RngFunOrdElt -> SeqEnum[RngElt]`

<a id="function-eltseq-fldfunordelt"></a>
##### `Eltseq(a): FldFunOrdElt -> SeqEnum[RngElt]`

The sequence $[a_1, \dots, a_{n}]$ of elements of the coefficient field of the parent of the function field or order element $a$ such that $a = a_1 \omega_1 + a_2 \omega_2 + \dots + a_{n} \omega_n$ where $\omega_1, \omega_2, \dots, \omega_n$ is a basis of the parent of $a$.

<a id="function-eltseq-fldfunelt-fldfung"></a>
##### `Eltseq(a, R): FldFunElt, FldFunG -> [FldFunGElt]`

A sequence of coefficients of the function field element $a$ in the coefficient field $R$.

<a id="function-flat-fldfunelt"></a>
##### `Flat(a): FldFunElt -> [FldFunGElt]`

A sequence of coefficients of the function field element $a$ in the bottom coefficient field of the parent of $a$.

<a id="operation-op-fldfun-seqenum"></a>
##### `F ! [ a₀, a₁, ..., aₙ₋₁ ]: FldFun, SeqEnum -> FldFunElt`

The element $a = a_0 + a_1\alpha + \dots + a_{n-1}\alpha^{n-1}$ where the function field $F = k(x, \alpha_1, \ldots, \alpha_r, \alpha)$ and the $a_i$ may be coerced into $k(x, \alpha_1, \ldots, \alpha_r)$.

<a id="operation-op-rngfunord-seqenum"></a>
##### `O ! [ a₁, a₂, ..., aₙ ]: RngFunOrd, SeqEnum -> RngFunOrdElt`

The element $a = a_1 \omega_1 + a_2 \omega_2 + \dots + a_{n} \omega_n$ where $\omega_1, \omega_2, \dots, \omega_n$ is a basis of the order $O$ and the $a_i$ are coercible into the coefficient ring of $O$.

<a id="example-ex-27bc08"></a>
##### `Example: Creating Function Field Elements (ex-27bc08)`

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> f := y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2;
> F<alpha> := FunctionField(f);
> Evaluate(f, alpha);
0
> F.1;
alpha
> b := x + alpha + 1/x*alpha^2;
> b;
1/x*alpha^2 + alpha + x
> b eq F ! [x, 1, 1/x];
true
```

#### Arithmetic Operators

The following binary arithmetic operations can also be performed in the case where one operand is an element of the function field $F$ or an order $O$ and the other operand is a ring element which can naturally be mapped into $F$ or $O$.

<a id="operation-operation-fldfunelt-fldfunelt"></a>
##### `+ a: FldFunElt -> FldFunElt`

<a id="operation-operation-rngfunordelt-rngfunordelt"></a>
##### `+ a: RngFunOrdElt -> RngFunOrdElt`

<a id="operation-operation-fldfunordelt-fldfunordelt"></a>
##### `+ a: FldFunOrdElt -> FldFunOrdElt`

<a id="operation-operation-fldfunelt-fldfunelt-2"></a>
##### `- a: FldFunElt -> FldFunElt`

<a id="operation-operation-rngfunordelt-rngfunordelt-2"></a>
##### `- a: RngFunOrdElt -> RngFunOrdElt`

<a id="operation-operation-fldfunordelt-fldfunordelt-2"></a>
##### `- a: FldFunOrdElt -> FldFunOrdElt`

<a id="operation-op-plus-fldfunelt-fldfunelt"></a>
##### `a + b: FldFunElt, FldFunElt -> FldFunElt`

<a id="operation-op-plus-rngfunordelt-rngfunordelt"></a>
##### `a + b: RngFunOrdElt, RngFunOrdElt -> RngFunOrdElt`

<a id="operation-op-plus-fldfunordelt-fldfunordelt"></a>
##### `a + b: FldFunOrdElt, FldFunOrdElt -> FldFunOrdElt`

<a id="operation-op-minus-fldfunelt-fldfunelt"></a>
##### `a - b: FldFunElt, FldFunElt -> FldFunElt`

<a id="operation-op-minus-rngfunordelt-rngfunordelt"></a>
##### `a - b: RngFunOrdElt, RngFunOrdElt -> RngFunOrdElt`

<a id="operation-op-minus-fldfunordelt-fldfunordelt"></a>
##### `a - b: FldFunOrdElt, FldFunOrdElt -> FldFunOrdElt`

<a id="operation-op-times-fldfunelt-fldfunelt"></a>
##### `a * b: FldFunElt, FldFunElt -> FldFunElt`

<a id="operation-op-times-rngfunordelt-rngfunordelt"></a>
##### `a * b: RngFunOrdElt, RngFunOrdElt -> RngFunOrdElt`

<a id="operation-op-times-fldfunordelt-fldfunordelt"></a>
##### `a * b: FldFunOrdElt, FldFunOrdElt -> FldFunOrdElt`

<a id="operation-operation-div-fldfunelt-fldfunelt-fldfunelt"></a>
##### `a div b: FldFunElt, FldFunElt -> FldFunElt`

<a id="operation-operation-div-fldfunelt-rngelt-fldfunelt"></a>
##### `a div b: FldFunElt, RngElt -> FldFunElt`

<a id="operation-operation-div-rngfunordelt-rngfunordelt-rngfunordelt"></a>
##### `a div b: RngFunOrdElt, RngFunOrdElt -> RngFunOrdElt`

<a id="operation-operation-div-rngfunordelt-rngelt-rngfunordelt"></a>
##### `a div b: RngFunOrdElt, RngElt -> RngFunOrdElt`

<a id="operation-op-div-fldfunelt-fldfunelt"></a>
##### `a / b: FldFunElt, FldFunElt -> FldFunElt`

<a id="operation-op-div-rngfunordelt-rngfunordelt"></a>
##### `a / b: RngFunOrdElt, RngFunOrdElt -> FldFunGElt`

<a id="operation-op-div-fldfunordelt-fldfunordelt"></a>
##### `a / b: FldFunOrdElt, FldFunOrdElt -> FldFunOrdElt`

<a id="operation-op-pow-fldfunelt-rngintelt"></a>
##### `a ^ k: FldFunElt, RngIntElt -> FldFunElt`

<a id="operation-op-pow-rngfunordelt-rngintelt"></a>
##### `a ^ k: RngFunOrdElt, RngIntElt -> RngFunOrdElt`

<a id="operation-op-pow-fldfunordelt-rngintelt"></a>
##### `a ^ k: FldFunOrdElt, RngIntElt -> FldFunOrdElt`

<a id="function-modexp-rngfunordelt-rngintelt-rngupolelt"></a>
##### `Modexp(a, k, m): RngFunOrdElt, RngIntElt, RngUPolElt -> RngFunOrdElt`

<a id="function-modexp-rngfunordelt-rngintelt-rngvalelt"></a>
##### `Modexp(a, k, m): RngFunOrdElt, RngIntElt, RngValElt -> RngFunOrdElt`

Return $a^k\ mod\ m$ where $m$ is an element of $k[x]$ or $o_{\infty}$ according to whether the parent of $a$ is a finite or infinite order.

<a id="operation-operation-mod-rngfunordelt-rngfunordidl-rngfunordelt"></a>
##### `a mod I: RngFunOrdElt, RngFunOrdIdl -> RngFunOrdElt`

Return the element $a$ belonging to the order $O$ as an element of $O/I$.

<a id="function-modinv-rngfunordelt-rngfunordidl"></a>
##### `Modinv(a, m): RngFunOrdElt, RngFunOrdIdl -> RngFunOrdElt`

<a id="function-modinv-rngfunordelt-rngupolelt"></a>
##### `Modinv(a, m): RngFunOrdElt, RngUPolElt -> RngFunOrdElt`

<a id="function-modinv-rngfunordelt-rngvalelt"></a>
##### `Modinv(a, m): RngFunOrdElt, RngValElt -> RngFunOrdElt`

Return the inverse of the element $a$ of an order of a function field modulo $m$ where $m$ is an element of $k[x]$ or $o_{\infty}$ according to whether the order of $a$ is a finite or infinite order or an ideal of the order of $a$.

#### Equality and Membership

The following binary arithmetic operations can also be performed in the case where one operand is an element of the function field $F$ or an order $O$ and the other operand is a ring element which can naturally be mapped into $F$ or $O$.

<a id="operation-op-eq-fldfunelt-fldfunelt"></a>
##### `a eq b: FldFunElt, FldFunElt -> BoolElt`

<a id="operation-op-eq-rngfunordelt-rngfunordelt"></a>
##### `a eq b: RngFunOrdElt, RngFunOrdElt -> BoolElt`

<a id="operation-op-eq-fldfunordelt-fldfunordelt"></a>
##### `a eq b: FldFunOrdElt, FldFunOrdElt -> BoolElt`

<a id="operation-op-ne-fldfunelt-fldfunelt"></a>
##### `a ne b: FldFunElt, FldFunElt -> BoolElt`

<a id="operation-op-ne-rngfunordelt-rngfunordelt"></a>
##### `a ne b: RngFunOrdElt, RngFunOrdElt -> BoolElt`

<a id="operation-op-ne-fldfunordelt-fldfunordelt"></a>
##### `a ne b: FldFunOrdElt, FldFunOrdElt -> BoolElt`

<a id="operation-op-in-rngelt-fldfun"></a>
##### `a in F: RngElt, FldFun -> BoolElt`

<a id="operation-op-in-rngelt-rngfunord"></a>
##### `a in O: RngElt, RngFunOrd -> BoolElt`

<a id="operation-op-in-rngelt-fldfunord"></a>
##### `a in FF: RngElt, FldFunOrd -> BoolElt`

<a id="operation-op-notin-rngelt-fldfun"></a>
##### `a notin F: RngElt, FldFun -> BoolElt`

<a id="operation-op-notin-rngelt-rngfunord"></a>
##### `a notin O: RngElt, RngFunOrd -> BoolElt`

<a id="operation-op-notin-rngelt-fldfunord"></a>
##### `a notin FF: RngElt, FldFunOrd -> BoolElt`

#### Predicates on Elements

The functions in this section list the general ring element predicates that apply to function fields and orders of a function field.

<a id="function-isdivisibleby-fldfunelt-fldfunelt"></a>
##### `IsDivisibleBy(a, b): FldFunElt, FldFunElt -> BoolElt, FldFunElt`

<a id="function-isdivisibleby-rngfunordelt-rngfunordelt"></a>
##### `IsDivisibleBy(a, b): RngFunOrdElt, RngFunOrdElt -> BoolElt, RngFunOrdElt`

Given elements $a$ and $b$ belonging to a function field $F$ or an order $O$, returns `true` if there exists $c \in F$ or $c \in O$ such that $a = bc$ and returns $c$ as well, provided that $b\not=0$.

<a id="function-iszero-fldfunelt"></a>
##### `IsZero(a): FldFunElt -> BoolElt`

<a id="function-iszero-rngfunordelt"></a>
##### `IsZero(a): RngFunOrdElt -> BoolElt`

<a id="function-iszero-fldfunordelt"></a>
##### `IsZero(a): FldFunOrdElt -> BoolElt`

<a id="function-isone-fldfunelt"></a>
##### `IsOne(a): FldFunElt -> BoolElt`

<a id="function-isone-rngfunordelt"></a>
##### `IsOne(a): RngFunOrdElt -> BoolElt`

<a id="function-isone-fldfunordelt"></a>
##### `IsOne(a): FldFunOrdElt -> BoolElt`

<a id="function-isminusone-fldfunelt"></a>
##### `IsMinusOne(a): FldFunElt -> BoolElt`

<a id="function-isminusone-rngfunordelt"></a>
##### `IsMinusOne(a): RngFunOrdElt -> BoolElt`

<a id="function-isminusone-fldfunordelt"></a>
##### `IsMinusOne(a): FldFunOrdElt -> BoolElt`

<a id="function-isnilpotent-fldfunelt"></a>
##### `IsNilpotent(a): FldFunElt -> BoolElt`

<a id="function-isnilpotent-rngfunordelt"></a>
##### `IsNilpotent(a): RngFunOrdElt -> BoolElt`

<a id="function-isidempotent-fldfunelt"></a>
##### `IsIdempotent(a): FldFunElt -> BoolElt`

<a id="function-isidempotent-rngfunordelt"></a>
##### `IsIdempotent(a): RngFunOrdElt -> BoolElt`

<a id="function-isunit-fldfunelt"></a>
##### `IsUnit(a): FldFunElt -> BoolElt`

<a id="function-isunit-rngfunordelt"></a>
##### `IsUnit(a): RngFunOrdElt -> BoolElt`

<a id="function-isunit-fldfunordelt"></a>
##### `IsUnit(a): FldFunOrdElt -> BoolElt`

<a id="function-iszerodivisor-fldfunelt"></a>
##### `IsZeroDivisor(a): FldFunElt -> BoolElt`

<a id="function-iszerodivisor-rngfunordelt"></a>
##### `IsZeroDivisor(a): RngFunOrdElt -> BoolElt`

<a id="function-isregular-fldfunelt"></a>
##### `IsRegular(a): FldFunElt -> BoolElt`

<a id="function-isregular-rngfunordelt"></a>
##### `IsRegular(a): RngFunOrdElt -> BoolElt`

<a id="function-isirreducible-fldfunelt"></a>
##### `IsIrreducible(a): FldFunElt -> BoolElt`

<a id="function-isirreducible-rngfunordelt"></a>
##### `IsIrreducible(a): RngFunOrdElt -> BoolElt`

<a id="function-isprime-fldfunelt"></a>
##### `IsPrime(a): FldFunElt -> BoolElt`

<a id="function-isprime-rngfunordelt"></a>
##### `IsPrime(a): RngFunOrdElt -> BoolElt`

<a id="function-isseparating-fldfungelt"></a>
##### `IsSeparating(a): FldFunGElt -> BoolElt`

Returns `true` if the function field element $a$ is a separating element (has a non zero differential).

<a id="function-isconstant-fldfungelt"></a>
##### `IsConstant(a): FldFunGElt -> BoolElt, RngElt`

<a id="function-isconstant-rngfunordelt"></a>
##### `IsConstant(a): RngFunOrdElt -> BoolElt, RngElt`

Whether the algebraic function $a$ is constant; if so it is returned as an element of the exact constant field.

<a id="function-field-elements-isglobalunit"></a>
##### `IsGlobalUnit(a): FldFunElt -> BoolElt`

Whether the function field element $a$ is a global unit, i.e. a constant (equivalent to `IsConstant`)

<a id="function-field-elements-isglobalunitwithpreimage"></a>
##### `IsGlobalUnitWithPreimage(a): FldFunElt -> BoolElt, GrpAbElt`

Returns `true` and the preimage of the function field element $a$ in the global unit group, `false` otherwise. The function field must be global.

<a id="function-orders-elements-isunitwithpreimage"></a>
##### `IsUnitWithPreimage(a): RngFunOrdElt -> BoolElt, GrpAbElt`

Returns `true` and the preimage of the order element $a$ in the unit group of $O$ if $a$ is a unit, `false` otherwise. The function field has to be global.

#### Functions related to Norm and Trace

Multiplication by $a \in F$ or $a \in O$ defines a linear map of the vector space $F$ over its coefficient field where $F$ is a finite extension of its coefficient field. The following functions work with respect to this mapping.

<a id="function-trace-fldfungelt"></a>
##### `Trace(a): FldFunGElt -> FldFunGElt`

<a id="function-trace-rngfunordelt"></a>
##### `Trace(a): RngFunOrdElt -> RngElt`

<a id="function-norm-fldfungelt"></a>
##### `Norm(a): FldFunGElt -> FldFunGElt`

<a id="function-norm-rngfunordelt"></a>
##### `Norm(a): RngFunOrdElt -> RngElt`

<a id="function-minimalpolynomial-fldfunelt"></a>
##### `MinimalPolynomial(a): FldFunElt -> RngUPolElt`

<a id="function-minimalpolynomial-rngfunordelt"></a>
##### `MinimalPolynomial(a): RngFunOrdElt -> RngUPolElt`

<a id="function-minimalpolynomial-fldfunordelt"></a>
##### `MinimalPolynomial(a): FldFunOrdElt -> RngUPolElt`

<a id="function-characteristicpolynomial-fldfunelt"></a>
##### `CharacteristicPolynomial(a): FldFunElt -> RngUPolElt`

<a id="function-characteristicpolynomial-rngfunordelt"></a>
##### `CharacteristicPolynomial(a): RngFunOrdElt -> RngUPolElt`

<a id="function-representationmatrix-fldfungelt"></a>
##### `RepresentationMatrix(a): FldFunGElt -> AlgMatElt`

<a id="function-representationmatrix-rngfunordelt"></a>
##### `RepresentationMatrix(a): RngFunOrdElt -> AlgMatElt`

Returns the matrix $M \in R^{n \times n}$ such that $a\,(\omega_1, \omega_2, \dots, \omega_{n}) = (\omega_1, \omega_2, \dots, \omega_{n}) \, M$, where $\omega_1, \omega_2, \dots, \omega_n$ is a $R$-basis of the parent of the function field or order element $a$ and $R$ is the coefficient ring of the parent of $a$.

<a id="function-trace-fldfunelt-rng"></a>
##### `Trace(a, R): FldFunElt, Rng -> RngElt`

<a id="function-trace-rngfunordelt-rng"></a>
##### `Trace(a, R): RngFunOrdElt, Rng -> RngElt`

The trace of the function field or order element $a$ over $R$, a coefficient ring or field of the parent of $a$.

<a id="function-norm-fldfunelt-rng"></a>
##### `Norm(a, R): FldFunElt, Rng -> RngElt`

<a id="function-norm-rngfunordelt-rng"></a>
##### `Norm(a, R): RngFunOrdElt, Rng -> RngElt`

The norm of the order or algebraic function field element $a$ over $R$, a coefficient ring or field of the parent of $a$.

<a id="function-characteristicpolynomial-fldfunelt-rng"></a>
##### `CharacteristicPolynomial(a, R): FldFunElt, Rng -> RngUPolElt`

<a id="function-characteristicpolynomial-rngfunordelt-rng"></a>
##### `CharacteristicPolynomial(a, R): RngFunOrdElt, Rng -> RngUPolElt`

The characteristic polynomial of the order or algebraic function field element $a$ over $R$, a coefficient ring or field of the parent of $a$.

<a id="function-minimalpolynomial-fldfunelt-rng"></a>
##### `MinimalPolynomial(a, R): FldFunElt, Rng -> RngUPolElt`

<a id="function-minimalpolynomial-rngfunordelt-rng"></a>
##### `MinimalPolynomial(a, R): RngFunOrdElt, Rng -> RngUPolElt`

The minimal polynomial of the order or algebraic function field element $a$ over $R$, a coefficient ring or field of the parent of $a$.

<a id="function-absoluteminimalpolynomial-fldfunelt"></a>
##### `AbsoluteMinimalPolynomial(a): FldFunElt -> RngUPolElt`

The minimal polynomial of the function field element $a$ over the rational function field.

<a id="function-representationmatrix-fldfungelt-rng"></a>
##### `RepresentationMatrix(a, R): FldFunGElt, Rng -> AlgMatElt`

<a id="function-representationmatrix-rngfunordelt-rng"></a>
##### `RepresentationMatrix(a, R): RngFunOrdElt, Rng -> AlgMatElt`

Returns the matrix $M \in R^{n \times n}$ such that $a\,(\omega_1, \omega_2, \dots, \omega_{n}) = (\omega_1, \omega_2, \dots, \omega_{n}) \, M$, where $\omega_1, \omega_2, \dots, \omega_n$ is a $R$-basis of the parent of the function field or order element $a$ and $R$ is a coefficient ring of the parent of $a$.

<a id="example-ex-2d04b2"></a>
##### `Example: Norm and Trace of Elements (ex-2d04b2)`

```magma
> P<x> := PolynomialRing(Integers());
> N<n> := NumberField(x^6 - 6);
> P<x> := PolynomialRing(N);
> P<y> := PolynomialRing(P);
> F<c> := FunctionField(y^8 - x^3*N.1^5);
> P<y> := PolynomialRing(F);
> F2<d> := FunctionField(y^3 + N.1*F!x - c);
> d^10;
(c^3 - 3*n*x*c^2 + 3*n^2*x^2*c - n^3*x^3)*d
> Norm(d^10);
-120*n^3*x^3*c^7 + 210*n^4*x^4*c^6 - 252*n^5*x^5*c^5 + 1260*x^6*c^4 -
    720*n*x^7*c^3 + (270*n^2*x^8 + n^5*x^3)*c^2 + (-60*n^3*x^9 - 60*x^4)*c +
    6*n^4*x^10 + 270*n*x^5
> Norm(d^10, CoefficientField(F));
13060694016*n^2*x^80 - 21767823360*n^5*x^75 + 97955205120*n^2*x^70 -
    43535646720*n^5*x^65 + 76187381760*n^2*x^60 - 15237476352*n^5*x^55 +
    12697896960*n^2*x^50 - 1209323520*n^5*x^45 + 453496320*n^2*x^40 -
    16796160*n^5*x^35 + 1679616*n^2*x^30
> Trace(d^10, CoefficientField(F));
0
> Trace(d^10);
0
```

#### Functions related to Orders and Integrality

<a id="function-integralsplit-fldfunelt-rngfunord"></a>
##### `IntegralSplit(a, O): FldFunElt, RngFunOrd -> RngFunOrdElt, RngElt`

<a id="function-integralsplit-rngfunordelt-rngfunord"></a>
##### `IntegralSplit(a, O): RngFunOrdElt, RngFunOrd -> RngFunOrdElt, RngElt`

<a id="function-integralsplit-fldfunordelt-rngfunord"></a>
##### `IntegralSplit(a, O): FldFunOrdElt, RngFunOrd -> RngFunOrdElt, RngElt`

Split the element function field or order element $a$ into a numerator and denominator with respect to the order $O$.

<a id="function-numerator-fldfunelt-rngfunord"></a>
##### `Numerator(a, O): FldFunElt, RngFunOrd -> RngFunOrdElt`

The numerator of the function field element $a$ with respect to the order $O$.

<a id="function-numerator-fldfunordelt"></a>
##### `Numerator(a): FldFunOrdElt -> RngFunOrdElt`

Given an element $a$ in a field of fractions of an order $O$ return the numerator of $a$ with respect to $O$.

<a id="function-numerator-fldfunordelt-rngfunord"></a>
##### `Numerator(a, O): FldFunOrdElt, RngFunOrd -> RngElt`

Given an element $a$ in a field of fractions of an order and an order $O$ of a function field return the numerator of $a$ with respect to $O$.

<a id="function-denominator-fldfunelt-rngfunord"></a>
##### `Denominator(a, O): FldFunElt, RngFunOrd -> RngElt`

The denominator of the function field element $a$ with respect to the order $O$.

<a id="function-denominator-fldfunordelt"></a>
##### `Denominator(a): FldFunOrdElt -> RngElt`

Given an element $a$ in a field of fractions of an order $O$ return the denominator of $a$ with respect to $O$.

<a id="function-denominator-fldfunordelt-rngfunord"></a>
##### `Denominator(a, O): FldFunOrdElt, RngFunOrd -> RngElt`

Given an element $a$ in a field of fractions of an order and an order $O$ of a function field return the denominator of $a$ with respect to $O$.

<a id="function-min-fldfunelt-rngfunord"></a>
##### `Min(a, O): FldFunElt, RngFunOrd -> RngElt, RngElt`

<a id="function-minimum-fldfunelt-rngfunord"></a>
##### `Minimum(a, O): FldFunElt, RngFunOrd -> RngElt, RngElt`

<a id="function-minimum-rngfunordelt-rngfunord"></a>
##### `Minimum(a, O): RngFunOrdElt, RngFunOrd -> RngElt, RngElt`

<a id="function-min-rngfunordelt-rngfunord"></a>
##### `Min(a, O): RngFunOrdElt, RngFunOrd -> RngElt, RngElt`

A generator of the ideal $R \cap (d\times a\times O)$ where $R$ is the coefficient ring of the order $O$ and $d$ is the denominator of the function field or order element $a$ wrt $O$ ($d$ is the second return value).

#### Functions related to Places and Divisors

<a id="function-evaluate-fldfunelt-plcfunelt"></a>
##### `Evaluate(a, P): FldFunElt, PlcFunElt -> RngElt`

<a id="function-evaluate-rngfunordelt-plcfunelt"></a>
##### `Evaluate(a, P): RngFunOrdElt, PlcFunElt -> RngElt`

Evaluate the algebraic function $a$ at the place $P$. If it is not defined at $P$, infinity is returned.

<a id="function-lift-rngelt-plcfunelt"></a>
##### `Lift(a, P): RngElt, PlcFunElt -> FldFunElt`

Lift the element $a$ of the residue class field of the place $P$ (including infinity) to an algebraic function.

<a id="function-valuation-fldfunelt-plcfunelt"></a>
##### `Valuation(a, P): FldFunElt, PlcFunElt -> RngIntElt`

<a id="function-valuation-rngfunordelt-plcfunelt"></a>
##### `Valuation(a, P): RngFunOrdElt, PlcFunElt -> RngIntElt`

The valuation of the function field or order element $a$ at the place $P$.

<a id="function-expand-fldfungelt-plcfunelt"></a>
##### `Expand(a, P): FldFunGElt, PlcFunElt -> RngSerElt, FldFunGElt`

```magma
RelPrec: RngIntElt                    Default: 10
AbsPrec: RngIntElt                    Default: 
```

Expand the algebraic function $a$ to a series of given precision at the place $P$ and return also the local parameter.

<a id="function-development-fldfungelt-plcfunelt"></a>
##### `Development(a, P): FldFunGElt, PlcFunElt -> RngSerElt`

```magma
RelPrec: RngIntElt                    Default: 10
AbsPrec: RngIntElt                    Default: 
```

The algebraic function $a$ expressed as a combination of powers of the local parameter of the place $P$.

<a id="function-divisor-fldfungelt"></a>
##### `Divisor(a): FldFunGElt -> DivFunElt`

<a id="function-divisor-rngfunordelt"></a>
##### `Divisor(a): RngFunOrdElt -> DivFunElt`

<a id="function-principaldivisor-fldfungelt"></a>
##### `PrincipalDivisor(a): FldFunGElt -> DivFunElt`

<a id="function-principaldivisor-rngfunordelt"></a>
##### `PrincipalDivisor(a): RngFunOrdElt -> DivFunElt`

The (principal) divisor $(a)$ of the function field or order element $a$.

<a id="function-zeros-fldfungelt"></a>
##### `Zeros(a): FldFunGElt -> [PlcFunElt]`

<a id="function-zeros-rngfunordelt"></a>
##### `Zeros(a): RngFunOrdElt -> [PlcFunElt]`

<a id="function-zeroes-fldfungelt"></a>
##### `Zeroes(a): FldFunGElt -> [PlcFunElt]`

<a id="function-zeroes-rngfunordelt"></a>
##### `Zeroes(a): RngFunOrdElt -> [PlcFunElt]`

A sequence containing the zeros of the algebraic function $a$.

<a id="function-zeros-fldfung-fldfungelt"></a>
##### `Zeros(F, a): FldFunG, FldFunGElt -> [PlcFunElt]`

<a id="function-zeroes-fldfung-fldfungelt"></a>
##### `Zeroes(F, a): FldFunG, FldFunGElt -> [PlcFunElt]`

The zeros of the function field element $a$ in the function field $F$.

<a id="function-poles-fldfungelt"></a>
##### `Poles(a): FldFunGElt -> SeqEnum[PlcFunElt]`

<a id="function-poles-rngfunordelt"></a>
##### `Poles(a): RngFunOrdElt -> SeqEnum[PlcFunElt]`

A sequence containing the poles of the algebraic function $a$.

<a id="function-poles-fldfun-fldfungelt"></a>
##### `Poles(F, a): FldFun, FldFunGElt -> [PlcFunElt]`

A sequence containing the poles of the function field element $a$ in the function field $F$.

<a id="function-degree-fldfunelt"></a>
##### `Degree(a): FldFunElt -> RngIntElt`

<a id="function-degree-rngfunordelt"></a>
##### `Degree(a): RngFunOrdElt -> RngIntElt`

The degree of the algebraic function $a$, being defined as the degree of the pole (or zero) divisor of $a$.

<a id="function-commonzeros-fldfungelt"></a>
##### `CommonZeros(L): [FldFunGElt] -> [PlcFunElt]`

Return the common zeros of the function field elements in the sequence $L$.

<a id="function-commonzeros-fldfung-seqenum-fldfungelt"></a>
##### `CommonZeros(F, L): FldFunG, SeqEnum[ FldFunGElt ] -> SeqEnum[ PlcFunElt ]`

Return the common zeros in the function field $F$ of the function field elements in the sequence $L$.

<a id="example-ex-0c032c"></a>
##### `Example: Minimal Polynomial and Representation Matrix (ex-0c032c)`

```magma
> R<x> := FunctionField(GF(9));
> P<y> := PolynomialRing(R);
> f := y^3 + y + x^5 + x + 1;
> F<a> := FunctionField(f);
> MinimalPolynomial(a);
y^3 + y + x^5 + x + 1
> RepresentationMatrix(a);
[                  0                   1                   0]
[                  0                   0                   1]
[    2*x^5 + 2*x + 2                   2                   0]
> O := IntegralClosure(ValuationRing(R), F);
> Denominator(a, O);
1/x^2
> O := IntegralClosure(PolynomialRing(GF(9)), F);
> Denominator(a, O);
1
> Zeros(a);
[ (x + 2, a), (x^3 + 2*x^2 + 1, a + x^3 + 2*x^2 + 1) ]
> Degree(a);
5
> P := RandomPlace(F, 2);
> P;
(x^2 + $.1^2*x + $.1^6, a + x^2 + $.1^5*x + 1)
> b := Evaluate(a, P);
> b;
$.1^3*$.1 + $.1^3
> c := Lift(b, P);
> c;
$.1^3*x + $.1^3
> Valuation(a, P);
0
> Valuation(a-c, P);
1
```

<a id="function-module-seqenum-fldfungelt-rng"></a>
##### `Module(L, R): SeqEnum[ FldFunGElt ], Rng -> Mod, Map, SeqEnum[ ModElt ]`

```magma
IsBasis  : BoolElt                    Default: false
PreImages: BoolElt                    Default: false
```

The $R$-module generated by the function field elements in the sequence $L$ as an abstract module, together with the map into the algebraic function field. The resulting modules can be used for intersection and inner sum computations.

If the optional parameter `IsBasis` is set `true` the function assumes that the given elements form a basis of the module to be computed.

If the optional parameter `PreImages` is set `true` then the preimages of the given elements under the map are returned as the third return value.

Both optional parameters are mainly used to save computation time.

<a id="function-relations-seqenum-fldfunelt-rng"></a>
##### `Relations(L, R): SeqEnum[ FldFunElt ], Rng -> ModTupRng`

<a id="function-relations-seqenum-fldfunelt-rng-rngintelt"></a>
##### `Relations(L, R, m): SeqEnum[ FldFunElt ], Rng, RngIntElt -> ModTupRng`

The module of $R$-linear relations between the function field elements of the sequence $L$. The integer $m$ is used for the following: Let the elements of $L$ be $a_1, \dots, a_n$, $V$ be the relation module $\subseteq R^n$ and define $M := \{\, \sum_{i=1}^m v_i a_i \,|\, v = (v_i)_i \in V \,\}$. The function tries to compute a generating system of $V$ such that the corresponding generating system of $M$ consists of “small” elements.

<a id="function-roots-rngupolelt-divfunelt"></a>
##### `Roots(f, D): RngUPolElt, DivFunElt -> SeqEnum[ FldFunElt ]`

Compute the roots of the polynomial $f$ which lie in the Riemann-Roch space of the divisor $D$.

<a id="example-ex-7f09fd"></a>
##### `Example: Module and Relations over Relative Fields (ex-7f09fd)`

This example shows the capability of `Module` and `Relations` with relative function fields.

```magma
> PR<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(PR);
> FR1<a> := FunctionField(y^3 - x);
> P<y> := PolynomialRing(FR1);
> FR2<c> := FunctionField(y^2 - a);
> MFR1F := MaximalOrderFinite(FR1);
> m, f := Module([c, c + a], MFR1F);
> f(m.1);
1
> f(m.2);
c
> m, f := Module([c, c + a], FR1);
> f(m.1);
c
> f(m.2);
1
> m;
KModule m of dimension 2 over FR1
> Relations([c, c + a], FR1, 1);
Vector space of degree 2, dimension 0 over FR1
User basis:
Matrix with 0 rows and 2 columns
```

#### Other Operations on Elements

<a id="function-productrepresentation-fldfungelt"></a>
##### `ProductRepresentation(a): FldFunGElt -> [FldFunGElt], [RngIntElt]`

<a id="function-productrepresentation-rngfunordelt"></a>
##### `ProductRepresentation(a): RngFunOrdElt -> [RngElt], [RngIntElt]`

Return a product representation for the function field or order element $a$.

<a id="function-productrepresentation-fldfungelt-rngintelt"></a>
##### `ProductRepresentation(Q, S): [FldFunGElt], [RngIntElt] -> FldFunGElt`

<a id="function-powerproduct-fldfungelt-rngintelt"></a>
##### `PowerProduct(Q, S): [FldFunGElt], [RngIntElt] -> FldFunGElt`

Return the element given by the product representation of function field elements in the sequence $Q$ and exponents in the sequence $S$. It is expensive to put large elements in product representation into sets or to test for them for equality.

<a id="function-rationalfunction-fldfungelt"></a>
##### `RationalFunction(a): FldFunGElt -> RngElt`

<a id="function-rationalfunction-fldfungelt-rng"></a>
##### `RationalFunction(a, R): FldFunGElt, Rng -> RngElt`

Return the algebraic function $a$ as a rational function in free variables with respect to the defining polynomial over the coefficient field.

If the ring $R$ is provided it must appear in the tower of coefficient fields of the parent of $a$ and the result is a polynomial over $R$ with respect to all the defining polynomials of the extensions in between.

<a id="function-differentiation-fldfungelt-fldfungelt"></a>
##### `Differentiation(x, a): FldFunGElt, FldFunGElt -> FldFunGElt`

The first differentiation resp. derivative of the function field element $a$ with respect to the separating element $x$.

<a id="function-fldfungelt-differentiation"></a>
##### `Differentiation(x, n, a): FldFunGElt, RngIntElt, FldFunGElt -> FldFunGElt`

The $n$th differentiation of the function field element $a$ with respect to the separating element $x$. In characteristic zero the $n$th differentiation equals the $n$th derivative times $1/n!$.

<a id="function-differentiationsequence-fldfungelt-rngintelt-fldfungelt"></a>
##### `DifferentiationSequence(x, n, a): FldFunGElt, RngIntElt, FldFunGElt -> SeqEnum`

The $0$-th up to the $n$-th differentiation of the function field element $a$ with respect to the separating element $x$.

<a id="function-primepowerrepresentation-fldfungelt-rngintelt-fldfungelt"></a>
##### `PrimePowerRepresentation(x, k, a): FldFunGElt, RngIntElt, FldFunGElt -> SeqEnum`

Return the coefficients of the representation of the function field element $a$ as a linear combination of $k$-th prime powers and powers of the function field element $x$. More precisely, let $p > 0$ be the characteristic of $F$. Then $F^{p^k}$ is a subfield of $F$ of index $p^k$ and $F$ can be viewed as a $F^{p^k}$-vector space. A basis is given by $1, x, \dots, x^{p^k-1}$ for $x$ a separating element. The function returns $\lambda_1, \dots, \lambda_{p^k-1} \in F^{p^k}$ such that $a = \sum_i \lambda_i x^i$.

<a id="function-different-rngfunordelt"></a>
##### `Different(a): RngFunOrdElt -> RngFunOrdElt`

The different of the element $a$ of an order of an algebraic function field.

<a id="function-rationalreconstruction-fldfunelt-rngupolelt"></a>
##### `RationalReconstruction(e, f): FldFunElt, RngUPolElt -> BoolElt, FldFunElt`

For an element $e$ of some function field $K$ with integral coefficients $e = \sum e_i\alpha^i$, $e_i\in k[x]$ and some polynomial $f\in k[x]$ find the (essentially) unique $E = \sum E_i\alpha_i$ with $E_i\in k(x)$ and $E_i = e_i \bmod f$, where the numerator and denominator of the $E_i$ have degree bounded by half the degree of $f$. If such $E_i$ exists they are unique, the corresponding element $\sum E_i\alpha^i$ for the function field will be returned as a second return value, the first being `true` to indicate success. If no such element exists, `false` will be returned.

<a id="function-coefficientheight-rngfunordelt"></a>
##### `CoefficientHeight(a): RngFunOrdElt -> RngIntElt`

<a id="function-coefficientheight-fldfunelt"></a>
##### `CoefficientHeight(a): FldFunElt -> RngIntElt`

The (naive) height of the element as defined as the largest degree of any coefficient or denominator polynomial occurring in the coefficients of $a$.

<a id="function-coefficientlength-rngfunordelt"></a>
##### `CoefficientLength(a): RngFunOrdElt -> RngIntElt`

<a id="function-coefficientlength-fldfunelt"></a>
##### `CoefficientLength(a): FldFunElt -> RngIntElt`

The (naive) length or size of the element, defined as the sum of the degrees of all polynomials occurring as coefficients or denominators in the coefficient representation of $a$.

<a id="example-ex-d8f7df"></a>
##### `Example: Product Representation of Elements (ex-d8f7df)`

```magma
> F<z> := GF(13, 3);
> PF<x> := PolynomialRing(F);
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - ConstantField(FF1).1>;
> ProductRepresentation([Random(FF2, 2) : i in [1 .. 3]], [2, 3, 2]);
(((z^476*x + z^319)*b + (z^1861*x + z^439))*d^2 + ((z^348*x + z^931)*b +
    (z^328*x + z^2076))*d + (z^152*x + z^1723)*b + z^1044*x + z^1119)^2 *
(((z^1024*x + z^2085)*b + (z^798*x + z^335))*d^2 + ((z^310*x + z^932)*b +
    (z^281*x + z^1393))*d + (z^1844*x + z^66)*b + z^2127*x + z^1788)^3 *
(((z^1478*x + z^1782)*b + (z^687*x + z^1898))*d^2 + ((z^560*x + z^425)*b +
    (z^2081*x + z^164))*d + (z^60*x + z^890)*b + z^258*x + z^1739)^2
> ProductRepresentation($1);
[
    ((z^476*x + z^319)*b + (z^1861*x + z^439))*d^2 + ((z^348*x + z^931)*b +
        (z^328*x + z^2076))*d + (z^152*x + z^1723)*b + z^1044*x + z^1119,
    ((z^1024*x + z^2085)*b + (z^798*x + z^335))*d^2 + ((z^310*x + z^932)*b +
        (z^281*x + z^1393))*d + (z^1844*x + z^66)*b + z^2127*x + z^1788,
    ((z^1478*x + z^1782)*b + (z^687*x + z^1898))*d^2 + ((z^560*x + z^425)*b +
        (z^2081*x + z^164))*d + (z^60*x + z^890)*b + z^258*x + z^1739
]
[ 2, 3, 2 ]
> r := Random(FF2, 3);
> RationalFunction(r);
((z^1568*x^2 + z^1591*x + z^1260)*b + (z^746*x^2 + z^1405*x + z^1721))*y^2 +
    ((z^990*x^2 + z^689*x + z^470)*b + (z^1324*x^2 + z^195*x + z^1082))*y +
    (z^331*x^2 + z^1995*x + z^1521)*b + z^1323*x^2 + z^852*x + z^2162
> RationalFunction(r, CoefficientField(FF2));
((z^1568*x^2 + z^1591*x + z^1260)*b + (z^746*x^2 + z^1405*x + z^1721))*$.1^2 +
    ((z^990*x^2 + z^689*x + z^470)*b + (z^1324*x^2 + z^195*x + z^1082))*$.1 +
    (z^331*x^2 + z^1995*x + z^1521)*b + z^1323*x^2 + z^852*x + z^2162
> RationalFunction(r, PF);
(z^1568*x^2 + z^1591*x + z^1260)*$.1^2*$.2 + (z^746*x^2 + z^1405*x +
    z^1721)*$.1^2 + (z^990*x^2 + z^689*x + z^470)*$.1*$.2 + (z^1324*x^2 +
    z^195*x + z^1082)*$.1 + (z^331*x^2 + z^1995*x + z^1521)*$.2 + z^1323*x^2 +
    z^852*x + z^2162
> Differentiation(FF2!x, r);
((z^836*x^2 + z^2140*x + z^1077)/x*b + (z^929*x + z^1405))*d^2 + ((z^258*x^2 +
    z^1238*x + z^287)/x*b + (z^1507*x + z^195))*d + (z^1795*x^2 + z^348*x +
    z^1338)/x*b + z^1506*x + z^852
> Differentiation(FF2!b, r);
((z^1112*x + z^1588)*b + (z^1019*x^2 + z^127*x + z^1260))*d^2 + ((z^1690*x +
    z^378)*b + (z^441*x^2 + z^1421*x + z^470))*d + (z^1689*x + z^1035)*b +
    z^1978*x^2 + z^531*x + z^1521
> Differentiation(FF2!d, r);
>> Differentiation(FF2!d, r);
                  ^
Runtime error in 'Differentiation': First element must be a separating element
> MFR2I := MaximalOrderInfinite(FF2);
> Different(Numerator(r, MFR2I));
[ [ (z^1095*x^5 + z^849*x^4 + z^111*x^3 + z^853*x^2 + z^224*x + z^1340)/x^6,
    (z^666*x^4 + z^1902*x^3 + z^2086*x^2 + z^1119*x + z^1973)/x^5 ], [
    (z^1673*x^5 + z^699*x^4 + z^1465*x^3 + z^1060*x^2 + z^761*x + z^1979)/x^6,
    (z^1034*x^4 + z^1185*x^3 + z^833*x^2 + z^2044*x + z^1701)/x^5 ], [
    (z^516*x^5 + z^1545*x^4 + z^509*x^3 + z^832*x^2 + z^606*x + z^700)/x^6,
    (z^1033*x^4 + z^983*x^3 + z^1375*x^2 + z^89*x + z^271)/x^5 ] ]
```

<a id="fldfung-ideals"></a>
<a id="id1"></a>
### Ideals

Ideals for function field orders $O$ are $O$-modules $I \subseteq F$ for which there is a $d \in F$ such that $dI \subseteq O$ is a non-zero ideal of $O$, that is they are fractional ideals of $O$. Over the coefficient ring of $O$ they are also free modules of rank $n$, where $n$ equals the degree $[F:k(x, \alpha_1, \ldots, \alpha_r)]$.

#### Creation of Ideals

<a id="constructor-constructor-ideal-rngfunord-rngelt-rngelt-rngfunordidl"></a>
##### `ideal< O | a₁, a₂, ... , aₘ >: RngFunOrd, RngElt, ..., RngElt -> RngFunOrdIdl`

Given an order $O$, as well as elements $a_1, a_2, \ldots, a_m$ coercible into the field of fractions $F$ of $O$, create the fractional ideal of $O$ generated by these elements.

Note that, contrary to the general case for the constructors, the right hand side elements are not necessarily contained in the left hand side.

<a id="constructor-constructor-ideal-rngfunord-algmatelt-rngelt-rngfunordidl"></a>
##### `ideal< O | T, d >: RngFunOrd, AlgMatElt, RngElt -> RngFunOrdIdl`

<a id="constructor-constructor-ideal-rngfunord-modded-rngelt-rngfunordidl"></a>
##### `ideal< O | T, d >: RngFunOrd, ModDed, RngElt -> RngFunOrdIdl`

The ideal of the order $O$ of an algebraic function field whose basis is the matrix or dedekind module $T$ over the coefficient ring of $O$ divided by the element $d$ of the denominator ring of $O$.

<a id="constructor-constructor-ideal-rngfunord-algmatelt-rngfunordidl-rngfunordidl"></a>
##### `ideal< O | T, S >: RngFunOrd, AlgMatElt, [RngFunOrdIdl] -> RngFunOrdIdl`

<a id="constructor-constructor-ideal-rngfunord-algmatelt-rngfunordidl-rngfunordidl-rngfunordidl"></a>
##### `ideal< O | T, I₁, ..., Iₙ >: RngFunOrd, AlgMatElt, RngFunOrdIdl, ..., RngFunOrdIdl -> RngFunOrdIdl`

The ideal of the order $O$ of an algebraic function field whose basis is the matrix $T$ over the coefficient ring of $O$ along with the coefficient ideals $I_1, ..., I_n$ or those in $S$.

<a id="operation-op-times-rngelt-rngfunord"></a>
##### `x * O: RngElt, RngFunOrd -> RngFunOrdIdl`

<a id="operation-op-times-rngfunord-rngelt"></a>
##### `O * x: RngFunOrd, RngElt -> RngFunOrdIdl`

Create the ideal $x*O$ where $x$ is coercible into the function field of the order $O$.

<a id="function-ideal-plcfunelt"></a>
##### `Ideal(P): PlcFunElt -> RngFunOrdIdl`

Create a prime ideal corresponding to the place $P$.

<a id="function-ideals-divfunelt"></a>
##### `Ideals(D): DivFunElt -> RngFunOrdIdl, RngFunOrdIdl`

Create two ideals of the ‘finite’ and ‘infinite’ maximal order respectively corresponding to the divisor $D$.

<a id="operation-op-rngfunord-rngfunordidl"></a>
##### `O !! I: RngFunOrd, RngFunOrdIdl -> RngFunOrdIdl`

Return the ideal $I$ as an ideal of the order $O$.

#### Parent and Category

<a id="function-parent-rngfunordidl"></a>
##### `Parent(I): RngFunOrdIdl -> PowIdl`

<a id="function-category-rngfunordidl"></a>
##### `Category(I): RngFunOrdIdl -> Cat`

#### Arithmetic Operators

<a id="operation-op-plus-rngfunordidl-rngfunordidl"></a>
##### `I + J: RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

<a id="operation-op-times-rngfunordidl-rngfunordidl"></a>
##### `I * J: RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

<a id="operation-op-div-rngfunordidl-rngfunordidl"></a>
##### `I / J: RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

<a id="operation-op-pow-rngfunordidl-rngintelt"></a>
##### `I ^ k: RngFunOrdIdl, RngIntElt -> RngFunOrdIdl`

The denominator ideal $J$ is required to be invertible. The ideal $I$ is required to be invertible for negative $k$.

<a id="operation-op-times-rngelt-rngfunordidl"></a>
##### `c * I: RngElt, RngFunOrdIdl -> RngFunOrdIdl`

<a id="operation-op-times-rngfunordidl-rngelt"></a>
##### `I * c: RngFunOrdIdl, RngElt -> RngFunOrdIdl`

<a id="operation-op-div-rngfunordidl-rngelt"></a>
##### `I / c: RngFunOrdIdl, RngElt -> RngFunOrdIdl`

<a id="operation-op-div-rngelt-rngfunordidl"></a>
##### `c / I: RngElt, RngFunOrdIdl -> RngFunOrdIdl`

The principal ideal generated by the ring element $c$ divided by the ideal $I$.

<a id="function-idealquotient-rngfunordidl-rngfunordidl"></a>
##### `IdealQuotient(I, J): RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

<a id="function-colonideal-rngfunordidl-rngfunordidl"></a>
##### `ColonIdeal(I, J): RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

The colon ideal $[I:J]$ of elements which multiply all elements of the ideal $J$ into the ideal $I$.

<a id="function-chineseremaindertheorem-rngfunordidl-rngfunordidl-rngfunordelt-rngfunordelt"></a>
##### `ChineseRemainderTheorem(I1, I2, e1, e2): RngFunOrdIdl, RngFunOrdIdl, RngFunOrdElt, RngFunOrdElt -> RngFunOrdElt`

<a id="function-crt-rngfunordidl-rngfunordidl-rngfunordelt-rngfunordelt"></a>
##### `CRT(I1, I2, e1, e2): RngFunOrdIdl, RngFunOrdIdl, RngFunOrdElt, RngFunOrdElt -> RngOrdElt`

Returns an element $e$ of the order $O$ such that $(e_1 - e)$ is in the ideal $I_1$ of $O$ and $(e_2 - e)$ is in the ideal $I_2$.

#### Roots of Ideals

<a id="function-ispower-rngfunordidl-rngintelt"></a>
##### `IsPower(I, n): RngFunOrdIdl, RngIntElt -> BoolElt, RngFunOrdIdl`

Return whether the ideal $I$ has an $n$th root and if so return an $n$th root.

<a id="function-root-rngfunordidl-rngintelt"></a>
##### `Root(I, n): RngFunOrdIdl, RngIntElt -> RngFunOrdIdl`

Return the $n$th root of the ideal $I$.

<a id="function-issquare-rngfunordidl"></a>
##### `IsSquare(I): RngFunOrdIdl -> BoolElt, RngFunOrdIdl`

Return whether the ideal $I$ is a square and if so return a square root.

<a id="function-squareroot-rngfunordidl"></a>
##### `SquareRoot(I): RngFunOrdIdl -> RngFunOrdIdl`

<a id="function-sqrt-rngfunordidl"></a>
##### `Sqrt(I): RngFunOrdIdl -> RngFunOrdIdl`

Return a square root of the ideal $I$.

<a id="example-ex-eaf22a"></a>
##### `Example: Testing Whether an Ideal Is a Square (ex-eaf22a)`

A simple creation of an ideal and the use of `IsSquare` is shown below.

```magma
> P<x> := PolynomialRing(GF(79));
> P<y> := PolynomialRing(P);
> Fa<a> := FunctionField(y^2 - x);
> P<y> := PolynomialRing(Fa);
> Fb<b> := FunctionField(y^2 - a);
> P<y> := PolynomialRing(Fb);
> Fc<c> := FunctionField(y^2 + a*b);
> I := a*b*c*MaximalOrderInfinite(Fc);
> IsSquare(I^2);
true Fractional ideal of Maximal Order of Fc over Maximal Order of Fb over
Maximal Equation Order of Fa over Valuation ring of Univariate rational function
field over GF(79) with generator 1/x
Basis:
Pseudo-matrix over Maximal Order of Fb over Maximal Equation Order of Fa over
Valuation ring of Univariate rational function field over GF(79) with generator
1/x
Fractional ideal of Maximal Order of Fb over Maximal Equation Order of Fa over
Valuation ring of Univariate rational function field over GF(79) with generator
1/x
Generators:
1
((78*x^2 + 71*x + 78)/x^2*a + (23*x^2 + 15*x + 78)/x^2)*b + (67*x^2 + 60*x +
    78)/x^2*a + (3*x^2 + 47*x + 78)/x * ( 1 0 )
Fractional ideal of Maximal Order of Fb over Maximal Equation Order of Fa over
Valuation ring of Univariate rational function field over GF(79) with generator
1/x
Generators:
1
((59*x^2 + 44*x + 78)/x^2*a + (4*x^2 + 48*x + 78)/x^2)*b + (29*x^2 + 46*x +
    78)/x^2*a + (71*x + 78)/x * ( 0 1 )
> _, II := $1;
> II eq I;
true
> MaximalOrderFinite(Fc)!!I;
Ideal of Maximal Order of Fc over Maximal Equation Order of Fb over Maximal
Equation Order of Fa over Univariate Polynomial Ring in x over GF(79)
Generators:
a*b*c
a*b*c
```

#### Equality and Membership

<a id="operation-op-eq-rngfunordidl-rngfunordidl"></a>
##### `I eq J: RngFunOrdIdl, RngFunOrdIdl -> BoolElt`

<a id="operation-op-ne-rngfunordidl-rngfunordidl"></a>
##### `I ne J: RngFunOrdIdl, RngFunOrdIdl -> BoolElt`

<a id="operation-op-in-rngfunordidl-powidl"></a>
##### `I in S: RngFunOrdIdl, PowIdl -> BoolElt`

<a id="operation-op-notin-rngfunordidl-powidl"></a>
##### `I notin S: RngFunOrdIdl, PowIdl -> BoolElt`

#### Predicates on Ideals

<a id="function-iszero-rngfunordidl"></a>
##### `IsZero(I): RngFunOrdIdl -> BoolElt`

Returns `true` if and only if the ideal $I$ is the zero ideal of the order $O$.

<a id="function-isone-rngfunordidl"></a>
##### `IsOne(I): RngFunOrdIdl -> BoolElt`

Returns `true` if and only if the ideal $I$ is the identity ideal of the order $O$, i.e. $I = O$.

<a id="function-isintegral-rngfunordidl"></a>
##### `IsIntegral(I): RngFunOrdIdl -> BoolElt`

Returns `true` if and only if the ideal $I$ is integral (a true ideal of its order).

<a id="function-isprime-rngfunordidl"></a>
##### `IsPrime(I): RngFunOrdIdl -> BoolElt`

Returns `true` if and only if the ideal $I$ is prime.

<a id="function-isprincipal-rngfunordidl"></a>
##### `IsPrincipal(I): RngFunOrdIdl -> BoolElt, FldFunElt`

Returns `true` and a generator if the fractional ideal $I$ is principal, `false` otherwise. The function field has to be global.

##### Predicates on Prime Ideals

<a id="function-isinert-rngfunordidl"></a>
###### `IsInert(P): RngFunOrdIdl -> BoolElt`

Return `true` if the inertia degree of the prime ideal $P$ is the degree of its order.

<a id="function-isinert-rngfunordidl-rngfunord"></a>
###### `IsInert(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-isinert-rngelt-rngfunord"></a>
###### `IsInert(P, O): RngElt, RngFunOrd -> BoolElt`

Return `true` if there is an inert ideal in the order $O$ above the prime ideal $P$.

<a id="function-isramified-rngfunordidl"></a>
###### `IsRamified(P): RngFunOrdIdl -> BoolElt`

Return `true` if the ramification index of the prime ideal $P$ is not $1$.

<a id="function-isramified-rngfunordidl-rngfunord"></a>
###### `IsRamified(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-isramified-rngelt-rngfunord"></a>
###### `IsRamified(P, O): RngElt, RngFunOrd -> BoolElt`

Return `true` if there is a ramified ideal in the order $O$ above the prime ideal $P$.

<a id="function-issplit-rngfunordidl"></a>
###### `IsSplit(P): RngFunOrdIdl -> BoolElt`

Return `true` if the prime ideal $P$ is not the only ideal lying above the prime ideal it lies above.

<a id="function-issplit-rngfunordidl-rngfunord"></a>
###### `IsSplit(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-issplit-rngelt-rngfunord"></a>
###### `IsSplit(P, O): RngElt, RngFunOrd -> BoolElt`

Return `true` if there are at least $2$ distinct ideals which lie in the order $O$ above the prime ideal $P$.

<a id="function-istamelyramified-rngfunordidl"></a>
###### `IsTamelyRamified(P): RngFunOrdIdl -> BoolElt`

Return whether the prime ideal $P$ is not wildly ramified.

<a id="function-istamelyramified-rngfunordidl-rngfunord"></a>
###### `IsTamelyRamified(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-istamelyramified-rngelt-rngfunord"></a>
###### `IsTamelyRamified(P, O): RngElt, RngFunOrd -> BoolElt`

Return whether the prime ideal $P$ is not wildly ramified in the order $O$.

<a id="function-istotallyramified-rngfunordidl"></a>
###### `IsTotallyRamified(P): RngFunOrdIdl -> BoolElt`

Return whether the ramification index of the prime ideal $P$ is the same as the degree of its order over its coefficient order.

<a id="function-istotallyramified-rngfunordidl-rngfunord"></a>
###### `IsTotallyRamified(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-istotallyramified-rngelt-rngfunord"></a>
###### `IsTotallyRamified(P, O): RngElt, RngFunOrd -> BoolElt`

Return whether there are any totally ramified ideals in the order $O$ lying above the prime ideal $P$.

<a id="function-istotallysplit-rngfunordidl"></a>
###### `IsTotallySplit(P): RngFunOrdIdl -> BoolElt`

Return whether there are as many ideals as the degree of the order of the prime ideal $P$ lying over the prime $P$ lies over.

<a id="function-istotallysplit-rngfunordidl-rngfunord"></a>
###### `IsTotallySplit(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-istotallysplit-rngelt-rngfunord"></a>
###### `IsTotallySplit(P, O): RngElt, RngFunOrd -> BoolElt`

Return whether there are as many ideals of the order $O$ which lie above the prime ideal $P$ as the degree of $O$.

<a id="function-isunramified-rngfunordidl"></a>
###### `IsUnramified(P): RngFunOrdIdl -> BoolElt`

Return whether the ramification index of the prime ideal $P$ is $1$.

<a id="function-isunramified-rngfunordidl-rngfunord"></a>
###### `IsUnramified(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-isunramified-rngelt-rngfunord"></a>
###### `IsUnramified(P, O): RngElt, RngFunOrd -> BoolElt`

Return whether all the ideals of the order $O$ which lie above the prime ideal $P$ are unramified.

<a id="function-iswildlyramified-rngfunordidl"></a>
###### `IsWildlyRamified(P): RngFunOrdIdl -> BoolElt`

Return whether the ramification index of the prime ideal $P$ is a multiple of the characteristic of the residue field of $P$.

<a id="function-iswildlyramified-rngfunordidl-rngfunord"></a>
###### `IsWildlyRamified(P, O): RngFunOrdIdl, RngFunOrd -> BoolElt`

<a id="function-iswildlyramified-rngelt-rngfunord"></a>
###### `IsWildlyRamified(P, O): RngElt, RngFunOrd -> BoolElt`

Return whether any of the ideals of the order $O$ which lie above the prime ideal $P$ are wildly ramified.

<a id="ideal-ops-further"></a>
<a id="fldfung-ideal-ops"></a>
#### Further Ideal Operations

<a id="operation-op-meet-rngfunordidl-rngfunordidl"></a>
##### `I meet J: RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

The intersection of the ideals $I$ and $J$.

<a id="function-gcd-rngfunordidl-rngfunordidl"></a>
##### `Gcd(I, J): RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

Given invertible ideals of an order $O$, returns the greatest common divisor of the ideals $I$ and $J$.

<a id="function-lcm-rngfunordidl-rngfunordidl"></a>
##### `Lcm(I, J): RngFunOrdIdl, RngFunOrdIdl -> RngFunOrdIdl`

Given invertible ideals of an order $O$, returns the least common multiple of the ideals $I$ and $J$.

<a id="function-factorization-rngfunordidl"></a>
##### `Factorization(I): RngFunOrdIdl -> [ <RngFunOrdIdl, RngIntElt> ]`

<a id="function-factorisation-rngfunordidl"></a>
##### `Factorisation(I): RngFunOrdIdl -> [<RngFunOrdIdl, RngIntElt>]`

Factorization of the ideal $I$ (as sequence of prime ideal, exponent pairs). The order must be maximal.

<a id="function-decomposition-rngfunord-rngelt"></a>
##### `Decomposition(O, p): RngFunOrd, RngElt -> [ RngFunOrdIdl ]`

```magma
Al: MonStgElt                    Default: 
```

<a id="function-decomposition-rngfunord-rngfunordidl"></a>
##### `Decomposition(O, p): RngFunOrd, RngFunOrdIdl -> [ RngFunOrdIdl ]`

A sequence containing all prime ideals of the order $O$ lying above the prime element or ideal $p$ of any coefficient ring of $O$. If $O$ is an extension of a polynomial ring over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and `Al` is set to `"Montes"` then the decomposition will be computed using the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)].

<a id="function-decomposition-rngfunord"></a>
##### `Decomposition(O): RngFunOrd -> [ RngFunOrdIdl ]`

A sequence containing all prime ideals of the ‘infinite’ maximal order $O$.

<a id="function-decompositiontype-rngfunord-rngelt"></a>
##### `DecompositionType(O, p): RngFunOrd, RngElt -> [ <RngIntElt, RngIntElt> ]`

<a id="function-decompositiontype-rngfunord-rngfunordidl"></a>
##### `DecompositionType(O, p): RngFunOrd, RngFunOrdIdl -> [ <RngIntElt, RngIntElt> ]`

Sequence of tuples of residue degrees and ramification indices of the prime ideals of the order $O$ lying over $p$, a prime polynomial or ideal or element of valuation ring of valuation $1$.

<a id="function-decompositiontype-rngfunord"></a>
##### `DecompositionType(O): RngFunOrd -> [ <RngIntElt, RngIntElt> ]`

Sequence of tuples of residue degrees and ramification indices of the prime ideals of the ‘infinite’ maximal order $O$.

<a id="function-multiplicatorring-rngfunordidl-2"></a>
##### `MultiplicatorRing(I): RngFunOrdIdl -> RngFunOrd`

Returns the multiplicator ring of the ideal $I$ of the order $O$, that is, the subring of elements of the field of fractions of $O$ that multiply $I$ into itself.

<a id="function-pmaximalorder-rngfunord-rngfunordidl-2"></a>
##### `pMaximalOrder(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrd`

The $p$-maximal over order of the order $O$ where $p$ is a prime ideal of the coefficient ring of $O$. See also the description in Section [Orders and Ideals](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#fldfung-ord-idl).

<a id="function-pradical-rngfunord-rngfunordidl-2"></a>
##### `pRadical(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrdIdl`

Returns the $p$-radical of an order $O$ for a prime ideal $p$ of the coefficient ring of $O$, defined as the ideal consisting of elements of $O$ for which some power lies in the ideal $pO$.

It is possible to call this function even if $p$ is not prime. In this case the $p$-trace-radical will be computed, i.e.

$$
\{ x\in F \mid {\operatorname{Tr}}(xO)\subseteq C\}
$$

for F the field of fractions of $O$ and $C$ the order of $p$ (if $p$ is an ideal) or the parent of $p$ otherwise. If $p$ is square free and all divisors are larger than the field degree, this is the intersection of the radicals for all $l$ dividing $p$.

<a id="function-valuation-rngelt-rngfunordidl"></a>
##### `Valuation(a, P): RngElt, RngFunOrdIdl -> RngIntElt`

<a id="function-valuation-rngfunordidl-rngfunordidl"></a>
##### `Valuation(I, P): RngFunOrdIdl, RngFunOrdIdl -> RngIntElt`

The valuation of $a$ or the ideal $I$ at the prime ideal $P$. The element $a$ must be coercible into the field of fractions of $P$’s order. If $P$ has been constructed using the Montes algorithm then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used to compute the valuation.

<a id="function-order-rngfunordidl"></a>
##### `Order(I): RngFunOrdIdl -> RngFunOrd`

The order of the ideal $I$.

<a id="function-denominator-rngfunordidl"></a>
##### `Denominator(I): RngFunOrdIdl -> RngElt`

The “smallest” element $d$ of the coefficient ring of the order $O$ of the ideal $I$ such that $dI \subseteq O$.

<a id="function-minimum-rngfunordidl"></a>
##### `Minimum(I): RngFunOrdIdl -> Any`

A generator $m$ of the ideal $R \cap dI$ where $R$ is the coefficient ring of the ideal’s order and $d$ is the denominator of the ideal $I$ ($d$ is the second return value).

<a id="operation-op-meet-rngfunordidl-rng"></a>
##### `I meet R: RngFunOrdIdl, Rng -> Any`

The intersection of the ideal $I$ with a coefficient ring $R$ of its order.

<a id="function-integralsplit-rngfunordidl"></a>
##### `IntegralSplit(I): RngFunOrdIdl -> RngFunOrdIdl, RngElt`

The integral ideal $dI$ and $d$, where $d$ is the denominator of the ideal $I$.

<a id="function-norm-rngfunordidl"></a>
##### `Norm(I): RngFunOrdIdl -> Any`

The norm of the ideal $I$, as element of the coefficient field of the algebraic function field to which $I$ belongs.

<a id="function-twoelement-rngfunordidl"></a>
##### `TwoElement(I): RngFunOrdIdl -> RngElt, RngElt`

Given an ideal $I$ with function field $F$ as the function field of its order $O$, returns two elements $a, b \in F$ such that $I = aO + bO$.

<a id="function-generators-rngfunordidl"></a>
##### `Generators(I): RngFunOrdIdl -> [ RngFunOrdElt ]`

Given a (fractional) ideal $I$ of the order $O$, return a sequence of elements of the function field $F$ that generate $I$ as an ideal.

<a id="function-basis-rngfunordidl"></a>
##### `Basis(I): RngFunOrdIdl -> [FldFunElt]`

<a id="function-basis-rngfunordidl-rng"></a>
##### `Basis(I, R): RngFunOrdIdl, Rng -> [ RngElt ]`

A basis of the ideal $I$ as a free module over the coefficient ring of its order, coerced into the ring $R$ if given.

<a id="function-basismatrix-rngfunordidl"></a>
##### `BasisMatrix(I): RngFunOrdIdl -> AlgMatElt`

Let $(b_1, \dots, b_n)$ be the basis of the ideal $I$ and let $(\omega_1, \dots, \omega_n)$ be the basis of the order $O$. A matrix $B$ with coefficients in the rational function field is returned such that $(b_1, \dots, b_n) = (\omega_1, \dots, \omega_n) B^t$.

<a id="function-transformationmatrix-rngfunordidl"></a>
##### `TransformationMatrix(I): RngFunOrdIdl -> AlgMatElt, RngElt`

Let $(b_1, \dots, b_n)$ be the basis of the ideal $I$ and let $(\omega_1, \dots, \omega_n)$ be the basis of the order $O$. A matrix $T$ with coefficients in the coefficient ring of $O$ and a denominator $d$ are returned such that $(b_1, \dots, b_n) = (\omega_1, \dots, \omega_n) T^t / d$.

<a id="function-coefficientideals-rngfunordidl"></a>
##### `CoefficientIdeals(I): RngFunOrdIdl -> [RngFunOrdIdl]`

The coefficient ideals of the ideal $I$ in a relative extension. These are the ideals $\{A_i\}$ of the coefficient ring of the order of $I$ such that for every element $e \in I$, $e = \sum_i a_i*b_i$ where $\{b_i\}$ is the basis returned for $I$ and each $a_i \in A_i$.

<a id="function-different-rngfunordidl"></a>
##### `Different(I): RngFunOrdIdl -> RngFunOrdIdl`

The different of the (possibly fractional) ideal $I$ of an order of an algebraic function field.

<a id="function-codifferent-rngfunordidl"></a>
##### `Codifferent(I): RngFunOrdIdl -> RngFunOrdIdl`

The codifferent of the ideal $I$. This will be the inverse of the different of $I$ if I is an ideal of a maximal order.

<a id="function-divisor-rngfunordidl"></a>
##### `Divisor(I): RngFunOrdIdl -> DivFunElt`

The divisor corresponding to the ideal factorization of the ideal $I$.

<a id="function-divisor-rngfunordidl-rngfunordidl"></a>
##### `Divisor(I, J): RngFunOrdIdl, RngFunOrdIdl -> DivFunElt`

The divisor corresponding to the ideal factorization of the ideals $I$ and $J$ belonging to the ‘finite’ and ‘infinite’ maximal order.

<a id="function-coefficientheight-rngfunordidl"></a>
##### `CoefficientHeight(I): RngFunOrdIdl -> RngIntElt`

For an ideal $I$ the coefficient height is defined to be the maximum integer occurring in the current representation of the ideal: If the ideal is given via two elements, this will be the maximal coefficient height of the generators, otherwise the maximal entry of the basis matrix.

<a id="function-coefficientlength-rngfunordidl"></a>
##### `CoefficientLength(I): RngFunOrdIdl -> RngIntElt`

For an ideal $I$ the coefficient length is defined to be the size of the current representation: If the ideal is given via two elements, this will be the sum of the coefficient lengths of the generators, otherwise the sum of the entries of the basis matrix.

<a id="example-ex-bdacf7"></a>
##### `Example: Ideal Operations in a Relative Field (ex-bdacf7)`

```magma
> PR<x> := FunctionField(Rationals());
> P<y> := PolynomialRing(PR);
> FR1<a> := FunctionField(y^3 - x + 1/x^3);
> P<y> := PolynomialRing(FR1);
> FR2<c> := FunctionField(y^2 - a/x^3*y + 1);
> I := ideal<MaximalOrderFinite(FR2) |
> [ x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
> 468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237, x^9 + 1639*x^8 +
> 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 + 468363837*x^3 +
> 242625823*x^2 + 68744019*x + 8052237, (x^15 + 1639*x^14 + 863249*x^13 +
> 148609981*x^12 + 404988066*x^11 + 567876948*x^10 + 468363837*x^9 +
> 242625823*x^8 + 68744019*x^7 + 8052237*x^6)*c, (x^15 + 1639*x^14 +
> 863249*x^13 + 148609981*x^12 + 404988066*x^11 + 567876948*x^10 +
> 468363837*x^9 + 242625823*x^8 + 68744019*x^7 + 8052237*x^6)*c ]>;
> I;
Ideal of Maximal Order of FR2 over Maximal Order of FR1 over Univariate
Polynomial Ring in x over Rational Field
Basis:
Pseudo-matrix over Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x over Rational
Field
Generator:
x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
    468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237 * ( 1 0 )
Fractional ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Generator:
(x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
    468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237)/x^2 * ( 0 1 )
> J := ideal<MaximalOrderFinite(FR2) |
> [ x^3 + 278*x^2 + 164*x + 742, x^3 + 278*x^2 + 164*x + 742, (x^9 + 278*x^8 +
> 164*x^7 + 742*x^6)*c, (x^9 + 278*x^8 + 164*x^7 + 742*x^6)*c ]>;
> J;
Ideal of Maximal Order of FR2 over Maximal Order of FR1 over Univariate
Polynomial Ring in x over Rational Field
Basis:
Pseudo-matrix over Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x over Rational
Field
Generator:
x^3 + 278*x^2 + 164*x + 742 * ( 1 0 )
Fractional ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Generator:
(x^3 + 278*x^2 + 164*x + 742)/x^2 * ( 0 1 )
> Generators(J);
[
    x^3 + 278*x^2 + 164*x + 742,
    x^3 + 278*x^2 + 164*x + 742,
    (x^7 + 278*x^6 + 164*x^5 + 742*x^4)*c,
    (x^7 + 278*x^6 + 164*x^5 + 742*x^4)*c
]

> TwoElement(J);
x^3 + 278*x^2 + 164*x + 742
((3/2*x^10 + 419*x^9 + 802*x^8 + 1441*x^7 + 1484*x^6)*a^2 + (3/2*x^8 + 417*x^7 +
    246*x^6 + 1113*x^5)*a + (3/2*x^8 + 837/2*x^7 + 663*x^6 + 1359*x^5 +
    1113*x^4))*c + (x^6 + 277*x^5 - 114*x^4 + 578*x^3 - 742*x^2)*a^2 + (3*x^5 +
    834*x^4 + 492*x^3 + 2226*x^2)*a - x^3 - 278*x^2 - 164*x - 742
> Minimum(I);
Ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x over Rational
Field
Generator:
x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
    468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237 1
> Basis(J);
[ 1, x^6*c ]
> Basis(I);
[ 1, x^6*c ]
> I eq J;
false
> II, d := IntegralSplit(I);
> II;
Ideal of Maximal Order of FR2 over Maximal Order of FR1 over Univariate
Polynomial Ring in x over Rational Field
Basis:
Pseudo-matrix over Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x over Rational
Field
Generator:
x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
    468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237 * ( 1 0 )
Fractional ideal of Maximal Order of FR1 over Univariate Polynomial Ring in x
over Rational Field
Generator:
(x^9 + 1639*x^8 + 863249*x^7 + 148609981*x^6 + 404988066*x^5 + 567876948*x^4 +
    468363837*x^3 + 242625823*x^2 + 68744019*x + 8052237)/x^2 * ( 0 1 )
> d;
1
> IsIntegral(I);
true
> GCD(I, J)*LCM(I, J) eq I*J;
true
```

##### Functions on Prime Ideals

<a id="function-ramificationindex-rngfunordidl"></a>
###### `RamificationIndex(I): RngFunOrdIdl -> RngIntElt`

<a id="function-ramificationdegree-rngfunordidl"></a>
###### `RamificationDegree(I): RngFunOrdIdl -> RngIntElt`

The ramification index of the prime ideal $I$ over the corresponding prime of its coefficient ring.

<a id="function-degree-rngfunordidl"></a>
###### `Degree(I): RngFunOrdIdl -> RngIntElt`

<a id="function-inertiadegree-rngfunordidl"></a>
###### `InertiaDegree(I): RngFunOrdIdl -> RngIntElt`

<a id="function-residueclassdegree-rngfunordidl"></a>
###### `ResidueClassDegree(I): RngFunOrdIdl -> RngIntElt`

The residue class degree (inertia degree) of the prime ideal $I$ over the corresponding prime of its coefficient ring.

<a id="function-residueclassfield-rngfunordidl"></a>
###### `ResidueClassField(I): RngFunOrdIdl -> Rng, Map`

The residue class field of the prime ideal $I$ and the residue class mapping.

<a id="function-place-rngfunordidl"></a>
###### `Place(I): RngFunOrdIdl -> PlcFunElt`

The place corresponding to the prime ideal $I$, where $I$ is defined over the ‘finite’ or ‘infinite’ maximal order.

<a id="function-safeuniformizer-rngfunordidl"></a>
###### `SafeUniformizer(P): RngFunOrdIdl -> RngFunOrdElt`

For an ideal $I$ of a maximal order in a function field, this returns an element which has valuation $1$ at the given prime and which has valuation $0$ at all other primes lying over the same prime of the underlying rational function field. See also [`LocalUniformizer`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-fldfung-localuniformizer) (for places) below.

<a id="function-weakapproximation-rngfunordidl-rngintelt"></a>
###### `WeakApproximation(I, V): [RngFunOrdIdl], [RngIntElt] -> FldFunElt`

Compute an element in the function field of the order of the ideals in $I$ which has valuation $V[i]$ at the prime ideal $I[i]$.

<a id="example-ex-a0157f"></a>
###### `Example: Factoring an Ideal of a Maximal Order (ex-a0157f)`

```magma
> R<x> := FunctionField(GF(3));
> P<y> := PolynomialRing(R);
> f := y^4 + x*y + x^4 + x + 1;
> F<a> := FunctionField(f);
> O := MaximalOrderFinite(F);
> x*O;
Ideal of O
Generator:
x
> L := Factorization(x*O);
> L;
[ <Ideal of O
Generators:
x
a^2 + a + 2, 1>, <Ideal of O
Generators:
x
a^2 + 2*a + 2, 1> ]
> P1 := L[1][1];
> P2 := L[2][1];
> BasisMatrix(P1);
[x 0 0 0]
[0 x 0 0]
[2 1 1 0]
[1 1 0 1]
> P1 meet P2 eq x*O;
true
> IsPrime(P1);
true
> Place(P1);
(x, a^2 + a + 2)
```

#### Quotient Rings

Quotients of orders defined over maximal orders and their integral ideals can be formed resulting in an object with type `RngFunOrdRes`. Elements of such orders can be created and elementary arithmetic and predicates may be applied to them.

##### Operations on Quotient Rings

The creation of quotient rings and the functions which may be applied to them are described.

<a id="constructor-constructor-quo-rngfunord-rngfunordidl-rngfunordres"></a>
###### `quo< O | I >: RngFunOrd, RngFunOrdIdl -> RngFunOrdRes`

<a id="constructor-constructor-quo-rngfunord-modded-rngfunordres"></a>
###### `quo< O | M >: RngFunOrd, ModDed -> RngFunOrdRes`

<a id="constructor-constructor-quo-rngfunord-algmatelt-rngfunordres"></a>
###### `quo< O | M >: RngFunOrd, AlgMatElt -> RngFunOrdRes`

<a id="constructor-constructor-quo-rngfunord-rngelt-rngelt-rngfunordres"></a>
###### `quo< O | S >: RngFunOrd, RngElt, ..., RngElt -> RngFunOrdRes`

Creates the quotient ring $Q=O/I$ of the order $O$. The right hand side of the constructor may contain an ideal or anything that the ideal constructor can create an ideal from.

<a id="constructor-constructor-quo-rngfunord-rngupolelt-rngfunordres"></a>
###### `quo< O | p >: RngFunOrd, RngUPolElt -> RngFunOrdRes`

<a id="constructor-constructor-quo-rngfunord-rngupolelt-rngintelt-rngfunordres"></a>
###### `quo< O | p, r >: RngFunOrd, RngUPolElt, RngIntElt -> RngFunOrdRes`

Construct the quotient ring $Q=O/p^r$ where $p$ is a prime polynomial in a coefficient ring of $O$.

<a id="function-modulus-rngfunordres"></a>
###### `Modulus(OQ): RngFunOrdRes -> RngFunOrdIdl`

Return the denominator of the quotient ring $OQ$, i.e. $I$ where $OQ = O/I$.

<a id="example-ex-d5cfa1"></a>
###### `Example: Quotient Rings of Ideals (ex-d5cfa1)`

Creation of quotient rings is shown. The orders are the same as for the ideal examples.

```magma
> I;
Ideal of O
Generator:
a^2
> Basis(I);
[
    x^8 + 2*x^5 + 2*x^4 + x^2 + 2*x + 1,
    a + 2*x^7 + x^4 + 2*x^3 + 2*x + 2,
    a^2,
    a^3
]
> Q := quo<Order(I) | I>;
> Q;
Quotient Ring of Ideal of O
Generators:
a^2
a^2
> Modulus(Q);
Ideal of O
Generators:
a^2
a^2
```

##### Elements of Quotients

Functions for elements of the quotient rings are predominantly arithmetic.

<a id="operation-op-rngfunordres-elt"></a>
###### `OQ ! a: RngFunOrdRes, Elt -> RngFunOrdResElt`

Coerce the element $a$ into the quotient $OQ$ where $a$ is anything that can be coerced into the order $OQ$ is a quotient of.

<a id="operation-operation-mod-rngfunordelt-rngfunordidl-rngfunordelt"></a>
###### `a mod I: RngFunOrdElt, RngFunOrdIdl -> RngFunOrdElt`

A canonical representative of the element $a$ (belonging to an order $O$) in the quotient ring $O/I$.

<a id="operation-op-times-rngfunordreselt-rngfunordreselt"></a>
###### `a * b: RngFunOrdResElt, RngFunOrdResElt -> RngFunOrdResElt`

<a id="operation-op-plus-rngfunordreselt-rngfunordreselt"></a>
###### `a + b: RngFunOrdResElt, RngFunOrdResElt -> RngFunOrdResElt`

<a id="operation-op-minus-rngfunordreselt-rngfunordreselt"></a>
###### `a - b: RngFunOrdResElt, RngFunOrdResElt -> RngFunOrdResElt`

<a id="operation-op-div-rngfunordreselt-rngfunordreselt"></a>
###### `a / b: RngFunOrdResElt, RngFunOrdResElt -> RngFunOrdResElt`

<a id="operation-operation-rngfunordreselt-rngfunordreselt"></a>
###### `- a: RngFunOrdResElt -> RngFunOrdResElt`

<a id="operation-op-pow-rngfunordreselt-rngintelt"></a>
###### `a ^ n: RngFunOrdResElt, RngIntElt -> RngFunOrdResElt`

<a id="operation-op-eq-rngfunordreselt-rngfunordreselt"></a>
###### `a eq b: RngFunOrdResElt, RngFunOrdResElt -> BoolElt`

<a id="operation-op-ne-rngfunordreselt-rngfunordreselt"></a>
###### `a ne b: RngFunOrdResElt, RngFunOrdResElt -> BoolElt`

<a id="function-iszero-rngfunordreselt"></a>
###### `IsZero(a): RngFunOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the zero element of the quotient ring $OQ$.

<a id="function-isone-rngfunordreselt"></a>
###### `IsOne(a): RngFunOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the one element of the quotient ring $OQ$.

<a id="function-isminusone-rngfunordreselt"></a>
###### `IsMinusOne(a): RngFunOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ is the minus one element of the quotient ring $OQ$.

<a id="function-isunit-rngfunordreselt"></a>
###### `IsUnit(a): RngFunOrdResElt -> BoolElt`

Returns `true` if and only if the quotient ring element $a$ has an inverse in the quotient ring $OQ$.

<a id="function-eltseq-rngfunordreselt"></a>
###### `Eltseq(a): RngFunOrdResElt -> []`

<a id="function-elementtosequence-rngfunordreselt"></a>
###### `ElementToSequence(a): RngFunOrdResElt -> []`

The coefficients of the quotient ring element $a$ in the field of fractions of the coefficient ring of the order of the quotient ring containing $a$.

### Places

#### Creation of Structures

<a id="function-places-fldfun"></a>
##### `Places(F): FldFun -> PlcFun`

The set of places of the algebraic function field $F/k$.

<a id="creation-element"></a>
<a id="fldfung-places"></a>
#### Creation of Elements

##### General Function Field Places

<a id="function-fldfung-decomp"></a>
###### `Decomposition(F, P): FldFunG, PlcFunElt -> [ PlcFunElt ]`

```magma
Al: MonStgElt                    Default: 
```

A sequence containing all places of $F/k$ lying above the place $P$ of any coefficient field of $F$. The function field $F$ must be a finite extension of $k(x)$. If $F$ is an extension of a rational function field over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial, $P$ is a finite place and `Al` is set to `"Montes"` then the Montes algorithm [[Sta18](https://docs.magma-maths.org/references.md#cite-2015arxiv150601904s)] will be used to compute the decomposition.

<a id="function-decompositiontype-fldfun-plcfunelt"></a>
###### `DecompositionType(F, P): FldFun, PlcFunElt -> [ <RngIntElt, RngIntElt> ]`

Sequence of tuples of residue degrees and ramification indices of the places of $F/k$ lying over the place P of the coefficient field $k(x)$ of $F$. The function field $F$ must be a finite extension of $k(x)$.

<a id="function-zeros-fldfunelt"></a>
###### `Zeros(a): FldFunElt -> [ PlcFunElt ]`

<a id="function-zeros-rngfunordelt-2"></a>
###### `Zeros(a): RngFunOrdElt -> [ PlcFunElt ]`

A sequence containing all zeros of the algebraic function $a$.

<a id="function-poles-fldfunelt"></a>
###### `Poles(a): FldFunElt -> [ PlcFunElt ]`

<a id="function-poles-rngfunordelt-2"></a>
###### `Poles(a): RngFunOrdElt -> [ PlcFunElt ]`

A sequence containing all poles of the algebraic function $a$.

<a id="operation-op-plcfun-rngfunordidl"></a>
###### `S ! I: PlcFun, RngFunOrdIdl -> PlcFunElt`

<a id="function-place-rngfunordidl-2"></a>
###### `Place(I): RngFunOrdIdl -> PlcFunElt`

The place corresponding to the prime ideal $I$, where $I$ is defined over the ‘finite’ or ‘infinite’ maximal order and $S$ is the set of places of a function field.

<a id="function-support-divfunelt"></a>
###### `Support(D): DivFunElt -> [ PlcFunElt ], [ RngIntElt ]`

<a id="function-support-plcfunelt"></a>
###### `Support(P): PlcFunElt -> [ PlcFunElt ], [ RngIntElt ]`

Sequences containing the places and exponents occurring in the divisor $D$.

<a id="procedure-assignnames-plcfunelt-monstgelt-ref"></a>
###### `AssignNames(~P, s): PlcFunElt, [ MonStgElt ]`

Change the print name employed when displaying $P$ to be the first element in the sequence of strings $s$ which must have length $1$.

<a id="function-infiniteplaces-fldfun"></a>
###### `InfinitePlaces(F): FldFun -> [PlcFunElt]`

The infinite places of the function field $F$.

##### Global Function Field Places

In this section $F/k$ denotes a global function field.

<a id="function-hasplace-fldfun-rngintelt"></a>
###### `HasPlace(F, m): FldFun, RngIntElt -> PlcFunElt`

Returns `true` and a place of degree $m$ if and only if there exists such in the function field $F/k$; `false` otherwise.

<a id="function-hasrandomplace-fldfun-rngintelt"></a>
###### `HasRandomPlace(F, m): FldFun, RngIntElt -> BoolElt, PlcFunElt`

Returns `true` and a random place of degree $m$ in the function field $F/k$ or (`false` if there are none).

<a id="function-randomplace-fldfun-rngintelt"></a>
###### `RandomPlace(F, m): FldFun, RngIntElt -> PlcFunElt`

Returns a random place of degree $m$ in the function field $F/k$ or throws an error if there is none.

<a id="function-places-fldfun-rngintelt"></a>
###### `Places(F, m): FldFun, RngIntElt -> SeqEnum[PlcFunElt]`

A sequence containing the places of degree $m$ of the function field $F/k$.

<a id="example-ex-92c345"></a>
###### `Example: Creating Places (ex-92c345)`

Some creation of places is illustrated below.

```magma
> P<t> := PolynomialRing(Integers());
> N := NumberField(t^2 + 2);
> P<x> := PolynomialRing(N);
> P<y> := PolynomialRing(P);
> F<c> := FunctionField(y^4 + x^5 - N.1^7);
> F;
Algebraic function field defined over Univariate rational function field over N
by
y^4 + x^5 + 8*N.1
> Zeros(c);
[ (x^5 + 8*N.1, c + x^5 + 8*N.1) ]
> P<y> := PolynomialRing(F);
> F2<d> := FunctionField(y^2 + F!N.1);
> Decomposition(F2, $1[1]);
[ (x^5 + 8*N.1, c + 2*x^5 + 16*N.1) ]
> DecompositionType(F2, $2[1]);
[ <2, 1> ]
> Places(F2)!$3[1];
(x^5 + 8*N.1, c + 2*x^5 + 16*N.1)
```

#### Related Structures

##### Parent and Category

The sets of function field places form the Magma category `PlcFun`. The notional power structure exists as parent but allows no operations.

<a id="function-functionfield-plcfun"></a>
###### `FunctionField(S): PlcFun -> FldFun`

The corresponding function field of the set of places $S$.

<a id="function-divisorgroup-fldfung"></a>
###### `DivisorGroup(F): FldFunG -> DivFun`

The group of divisors of the algebraic function field $F/k$, which is the free abelian group generated by the elements of the set of places of $F/k$.

#### Structure Invariants

##### General Function Fields

<a id="function-weierstrassplaces-fldfung-2"></a>
###### `WeierstrassPlaces(F): FldFunG -> [PlcFunElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The Weierstrass places of the function field $F/k$. The semantics of calling `WeierstrassPlaces()` with $F/k$ or the zero divisor of $F/k$ are identical. See the description of [`WeierstrassPlaces`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-weierstrassplaces).

##### Global Function Fields

In this section $F/k$ denotes a global function field.

<a id="function-numberofplacesofdegreeoneoverexactconstantfield-fldfun-rngintelt"></a>
###### `NumberOfPlacesOfDegreeOneOverExactConstantField(F, m): FldFun, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecf-fldfung-rngintelt"></a>
###### `NumberOfPlacesOfDegreeOneECF(F, m): FldFunG, RngIntElt -> RngIntElt`

The number of places of degree one in the constant field extension of degree $m$ of the function field $F/k$. Contrary to the `Degree()` function the degree is here taken over the respective exact constant fields.

<a id="function-numberofplacesofdegreeoneoverexactconstantfieldbound-fldfun-rngintelt"></a>
###### `NumberOfPlacesOfDegreeOneOverExactConstantFieldBound(F, m): FldFun, RngIntElt -> RngIntElt`

<a id="function-numberofplacesofdegreeoneecfbound-fldfung-rngintelt"></a>
###### `NumberOfPlacesOfDegreeOneECFBound(F, m): FldFunG, RngIntElt -> RngIntElt`

The minimum of the Serre and Ihara bound on the number of places of degree one in the constant field extension of degree $m$ of the function field $F/k$. Contrary to the `Degree()` function the degree is here taken over the respective exact constant fields.

<a id="function-numberofplacesofdegreeoverexactconstantfield-fldfung-rngintelt"></a>
###### `NumberOfPlacesOfDegreeOverExactConstantField(F, m): FldFunG, RngIntElt -> RngIntElt`

<a id="function-numberofplacesdegecf-fldfung-rngintelt"></a>
###### `NumberOfPlacesDegECF(F, m): FldFunG, RngIntElt -> RngIntElt`

The number of places of degree $m$ of the function field $F/k$. Contrary to the `Degree()` function the degree is here taken over the respective exact constant fields.

#### Structure Predicates

<a id="operation-op-eq-plcfun-plcfun"></a>
##### `S1 eq S2: PlcFun, PlcFun -> BoolElt`

<a id="operation-op-ne-plcfun-plcfun"></a>
##### `S1 ne S2: PlcFun, PlcFun -> BoolElt`

#### Element Operations

<a id="id2"></a>
##### Parent and Category

<a id="function-parent-plcfunelt"></a>
###### `Parent(P): PlcFunElt -> PlcFun`

<a id="function-category-plcfunelt"></a>
###### `Category(P): PlcFunElt -> Cat`

##### Arithmetic Operators

<a id="operation-operation-plcfunelt-divfunelt"></a>
###### `- P: PlcFunElt -> DivFunElt`

<a id="operation-op-plus-plcfunelt-plcfunelt"></a>
###### `P1 + P2: PlcFunElt, PlcFunElt -> DivFunElt`

<a id="operation-op-minus-plcfunelt-plcfunelt"></a>
###### `P1 - P2: PlcFunElt, PlcFunElt -> DivFunElt`

<a id="operation-op-times-rngintelt-plcfunelt"></a>
###### `k * P: RngIntElt, PlcFunElt -> DivFunElt`

<a id="operation-operation-div-plcfunelt-rngintelt-divfunelt"></a>
###### `P div k: PlcFunElt, RngIntElt -> DivFunElt`

<a id="operation-operation-mod-plcfunelt-rngintelt-divfunelt"></a>
###### `P mod k: PlcFunElt, RngIntElt -> DivFunElt`

<a id="function-quotrem-plcfunelt-rngintelt"></a>
###### `Quotrem(P, k): PlcFunElt, RngIntElt -> DivFunElt, DivFunElt`

Returns divisors $D_1, D_2$ such that the place $P = kD_1 + D_2$ and the exponents in $D_2$ are of absolute value less than $|k|$. The operations `div` and `mod` yield $D_1$ resp. $D_2$.

##### Equality and Membership

<a id="operation-op-eq-plcfunelt-plcfunelt"></a>
###### `P1 eq P2: PlcFunElt, PlcFunElt -> BoolElt`

<a id="operation-op-ne-plcfunelt-plcfunelt"></a>
###### `P1 ne P2: PlcFunElt, PlcFunElt -> BoolElt`

<a id="operation-op-in-plcfunelt-plcfun"></a>
###### `P in S: PlcFunElt, PlcFun -> BoolElt`

<a id="operation-op-notin-plcfunelt-plcfun"></a>
###### `P notin S: PlcFunElt, PlcFun -> BoolElt`

##### Predicates on Elements

<a id="function-isfinite-plcfunelt"></a>
###### `IsFinite(P): PlcFunElt -> BoolElt`

Returns `true` if the place $P$ is a ‘finite’ place.

<a id="function-isweierstrassplace-plcfunelt"></a>
###### `IsWeierstrassPlace(P): PlcFunElt -> BoolElt`

<a id="function-isweierstrassplace-fldfung-plcfunelt"></a>
###### `IsWeierstrassPlace(F, P): FldFunG, PlcFunElt -> BoolElt`

Whether the degree one place $P$ is a Weierstraß place of its function field $F$. See the description of [`WeierstrassPlaces`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-weierstrassplaces).

##### Other Element Operations

<a id="function-functionfield-plcfunelt"></a>
###### `FunctionField(P): PlcFunElt -> FldFun`

The function field that corresponds to the place $P$.

<a id="function-degree-plcfunelt"></a>
###### `Degree(P): PlcFunElt -> RngIntElt`

The degree of the place $P$ over the constant field of definition $k$.

<a id="function-ramificationindex-plcfunelt"></a>
###### `RamificationIndex(P): PlcFunElt -> RngIntElt`

<a id="function-ramificationdegree-plcfunelt"></a>
###### `RamificationDegree(P): PlcFunElt -> RngIntElt`

The ramification index of the place $P$ over its subplace of the rational function field $k(x)$ (the function field of $P$ must be a finite extension of $k(x)$).

<a id="function-inertiadegree-plcfunelt"></a>
###### `InertiaDegree(P): PlcFunElt -> RngIntElt`

<a id="function-residueclassdegree-plcfunelt"></a>
###### `ResidueClassDegree(P): PlcFunElt -> RngIntElt`

The degree of inertia (or residue class degree) of a place $P$ over the corresponding subplace of the rational function field (the function field of $P$ must be a finite extension of $k(x)$)

<a id="function-minimum-plcfunelt"></a>
###### `Minimum(P): PlcFunElt -> RngElt`

A monic prime polynomial in $k[x]$ or $1/x$ or an ideal, corresponding to the place of the coefficient field of the function field of the place $P$ which $P$ lies above (the function field of $P$ must be a finite extension of $k(x)$).

<a id="function-residueclassfield-plcfunelt"></a>
###### `ResidueClassField(P): PlcFunElt -> Rng, Map`

The residue class field of the place $P$ and the map from the order of the place into the field.

<a id="function-evaluate-rngelt-plcfunelt"></a>
###### `Evaluate(a, P): RngElt, PlcFunElt -> RngElt`

Evaluate the algebraic function $a$ at the place $P$. If it is not defined at $P$, infinity is returned.

<a id="function-lift-rngelt-plcfunelt-2"></a>
###### `Lift(a, P): RngElt, PlcFunElt -> FldFunElt`

<a id="function-lift-infty-plcfunelt"></a>
###### `Lift(i, P): Infty, PlcFunElt -> FldFunElt`

Lift the element $a$ of the residue class field of the place $P$ (including infinity) to an algebraic function.

<a id="function-twogenerators-plcfunelt"></a>
###### `TwoGenerators(P): PlcFunElt -> FldFunGElt, FldFunGElt`

Two algebraic functions having the place $P$ as their unique common zero.

<a id="function-fldfung-localuniformizer"></a>
###### `LocalUniformizer(P): PlcFunElt -> FldFunGElt`

<a id="function-uniformizingelement-plcfunelt"></a>
###### `UniformizingElement(P): PlcFunElt -> FldFunGElt`

A local uniformizing parameter at the place $P$.

<a id="function-valuation-fldfunelt-plcfunelt-2"></a>
###### `Valuation(a, P): FldFunElt, PlcFunElt -> RngIntElt`

The valuation of the element $a$ at the place $P$.

<a id="function-ideal-plcfunelt-2"></a>
###### `Ideal(P): PlcFunElt -> RngFunOrdIdl`

Create a prime ideal corresponding to the place $P$.

<a id="function-norm-plcfunelt"></a>
###### `Norm(P): PlcFunElt -> DivFunElt`

The divisor of the norm of the ideal of the place $P$.

<a id="example-ex-bbb5e4"></a>
###### `Example: Counting Places of a Given Degree (ex-bbb5e4)`

```magma
> R<x> := FunctionField(GF(9));
> P<y> := PolynomialRing(R);
> f := y^4 + (2*x^5 + x^4 + 2*x^3 + x^2)*y^2 + x^8
>      + 2*x^6 + x^5 +x^4 + x^3 + x^2;
> F<a> := FunctionField(f);
> Genus(F);
7
> NumberOfPlacesDegECF(F, 2);
28
> P := RandomPlace(F, 2);
> P;
(x^2 + $.1^2*x + $.1^7, a + $.1^5*x + $.1^5)
> LocalUniformizer(P);
x^2 + $.1^2*x + $.1^7
> TwoGenerators(P);
x^2 + $.1^2*x + $.1^7 a + $.1^5*x + $.1^5
> ResidueClassField(P);
Finite field of size 3^4
> Evaluate(1/LocalUniformizer(P), P);
Infinity
> Valuation(1/LocalUniformizer(P), P);
-1
```

#### Completion at Places

<a id="function-completion-fldfun-plcfunelt"></a>
##### `Completion(F, p): FldFun, PlcFunElt -> RngSerLaur, Map`

<a id="function-completion-rngfunord-plcfunelt"></a>
##### `Completion(O, p): RngFunOrd, PlcFunElt -> RngSerPow, Map`

```magma
Precision: RngIntElt                    Default: 20
```

The completion of the algebraic function field $F$ or an order $O$ of such at the place $p$ of $F$ or the function field of $O$. The map from $F$ or $O$ into the series ring is returned also.

The series ring returned is an infinite precision ring whose default precision for elements is given by the `Precision` parameter.

<a id="divfunelt"></a>
<a id="id1"></a>
### Divisors

Divisors are represented in at least one of 4 ways. They can be represented

- as a linear combination of places (as given by [`Support`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-support)),
- by an ideal of a finite maximal order and an ideal of a corresponding infinite maximal order (as given by [`Ideals`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-ideals))
- in a reduced representation (as given by [`Reduction`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-reduction)) or
- as a complementary divisor to another divisor (as given by [`ComplementaryDivisor`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-complementarydivisor)).

While the representation as a linear combination of places can be efficient for divisor arithmetic, the reduced representation is more efficient for computations like [`Dimension`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-dimension). Computing the [`Support`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-support) of a divisor will ensure it has a representation as a linear combination stored. When divisors are combined in binary operations extra representations may need to be computed.

#### Creation of Structures

<a id="function-divisorgroup-fldfun-2"></a>
##### `DivisorGroup(F): FldFun -> DivFun`

Create the group of divisors of the algebraic function field $F/k$.

#### Creation of Elements

<a id="function-divisor-plcfunelt"></a>
##### `Divisor(P): PlcFunElt -> DivFunElt`

<a id="operation-op-divfun-plcfunelt"></a>
##### `Div ! P: DivFun, PlcFunElt -> DivFunElt`

<a id="operation-operation-plcfunelt-divfunelt"></a>
##### `1 * P: PlcFunElt -> DivFunElt`

Given a place $P$ in a function field, return the prime divisor $1*P$.

<a id="operation-op-divfun-rngelt"></a>
##### `Div ! a: DivFun, RngElt -> DivFunElt`

<a id="function-divisor-fldfunelt"></a>
##### `Divisor(a): FldFunElt -> DivFunElt`

<a id="function-divisor-rngfunordelt-2"></a>
##### `Divisor(a): RngFunOrdElt -> DivFunElt`

Given an algebraic function $a$, return the principal divisor $(a)$.

<a id="operation-op-divfun-rngfunordidl"></a>
##### `Div ! I: DivFun, RngFunOrdIdl -> DivFunElt`

<a id="function-divisor-rngfunordidl-2"></a>
##### `Divisor(I): RngFunOrdIdl -> DivFunElt`

The divisor corresponding to the factorization of the ideal $I$.

<a id="function-divisor-rngfunordidl-rngfunordidl-2"></a>
##### `Divisor(I, J): RngFunOrdIdl, RngFunOrdIdl -> DivFunElt`

The divisor corresponding to the ideal factorization of the ideals $I$ and $J$ belonging to the ‘finite’ and ‘infinite’ maximal order.

<a id="function-identity-divfun"></a>
##### `Identity(G): DivFun -> DivFunElt`

<a id="function-id-divfun"></a>
##### `Id(G): DivFun -> DivFunElt`

Given the group $G$ of divisors of a function field, return the zero divisor.

<a id="function-canonicaldivisor-fldfung"></a>
##### `CanonicalDivisor(F): FldFunG -> DivFunElt`

A canonical divisor of the function field $F/k$.

<a id="function-differentdivisor-fldfung"></a>
##### `DifferentDivisor(F): FldFunG -> DivFunElt`

The different divisor of the underlying extension of the function field $F/k(x)$.

<a id="procedure-assignnames-divfunelt-monstgelt-ref"></a>
##### `AssignNames(~D, s): DivFunElt, [ MonStgElt ]`

Change the print name employed when displaying $D$ to be the contents of $s$ which must have length $1$ in this case.

#### Related Structures

##### Parent and Category

The group of divisors form the Magma category `DivFun`. The notional power structure exists as parent but allows no operations.

<a id="function-functionfield-divfun"></a>
###### `FunctionField(G): DivFun -> FldFun`

Given the group $G$ of divisors of a function field $F/k$, return $F$.

<a id="function-places-fldfun-2"></a>
###### `Places(F): FldFun -> PlcFun`

The set of places of the algebraic function field $F/k$.

#### Structure Invariants

<a id="function-numberofsmoothdivisors-rngintelt-rngintelt-seqenum-rngelt"></a>
##### `NumberOfSmoothDivisors(n, m, P): RngIntElt, RngIntElt, SeqEnum[RngElt] -> RngElt`

The number of effective divisors of degree less equal $n$ who consist of places of degree less equal $m$ only. The sequence element $P[i]$ contains the (generic) number of places of degree $1 \leq i \leq \min \{ n, m \}$. The formula used is described in [[Hes99](https://docs.magma-maths.org/references.md#cite-he2)].

<a id="function-divisorofdegreeone-fldfung"></a>
##### `DivisorOfDegreeOne(F): FldFunG -> DivFunElt`

A divisor of degree one over the exact constant field of the global function field $F/k$.

#### Structure Predicates

<a id="operation-op-eq-divfun-divfun"></a>
##### `Div1 eq Div2: DivFun, DivFun -> BoolElt`

<a id="operation-op-ne-divfun-divfun"></a>
##### `Div1 ne Div2: DivFun, DivFun -> BoolElt`

#### Element Operations

##### Arithmetic Operators

<a id="operation-operation-divfunelt-divfunelt"></a>
###### `- D: DivFunElt -> DivFunElt`

<a id="operation-op-plus-divfunelt-divfunelt"></a>
###### `D1 + D2: DivFunElt, DivFunElt -> DivFunElt`

<a id="operation-op-minus-divfunelt-divfunelt"></a>
###### `D1 - D2: DivFunElt, DivFunElt -> DivFunElt`

<a id="operation-op-times-rngintelt-divfunelt"></a>
###### `k * D: RngIntElt, DivFunElt -> DivFunElt`

<a id="operation-operation-div-divfunelt-rngintelt-divfunelt"></a>
###### `D div k: DivFunElt, RngIntElt -> DivFunElt`

<a id="operation-operation-mod-divfunelt-rngintelt-divfunelt"></a>
###### `D mod k: DivFunElt, RngIntElt -> DivFunElt`

<a id="operation-op-plus-plcfunelt-divfunelt"></a>
###### `P + D: PlcFunElt, DivFunElt -> DivFunElt`

<a id="operation-op-plus-divfunelt-plcfunelt"></a>
###### `D + P: DivFunElt, PlcFunElt -> DivFunElt`

<a id="operation-op-minus-divfunelt-plcfunelt"></a>
###### `D - P: DivFunElt, PlcFunElt -> DivFunElt`

<a id="operation-op-minus-plcfunelt-divfunelt"></a>
###### `P - D: PlcFunElt, DivFunElt -> DivFunElt`

<a id="function-quotrem-divfunelt-rngintelt"></a>
###### `Quotrem(D, k): DivFunElt, RngIntElt -> DivFunElt, DivFunElt`

Returns divisors $D_1, D_2$ such that the divisor $D = kD_1 + D_2$ and the exponents in $D_2$ are of absolute value less than $|k|$. The operations `div` and `mod` yield $D_1$ resp. $D_2$.

<a id="function-gcd-divfunelt-divfunelt"></a>
###### `GCD(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

<a id="function-gcd-divfunelt-divfunelt-2"></a>
###### `Gcd(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

<a id="function-greatestcommondivisor-divfunelt-divfunelt"></a>
###### `GreatestCommonDivisor(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

The greatest common divisor of the divisors $D1$ and $D2$.

<a id="function-lcm-divfunelt-divfunelt"></a>
###### `LCM(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

<a id="function-lcm-divfunelt-divfunelt-2"></a>
###### `Lcm(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

<a id="function-leastcommonmultiple-divfunelt-divfunelt"></a>
###### `LeastCommonMultiple(D1, D2): DivFunElt, DivFunElt -> DivFunElt`

The least common multiple of the divisors $D1$ and $D2$.

##### Equality, Comparison, and Membership

<a id="operation-op-eq-divfunelt-divfunelt"></a>
###### `D1 eq D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-ne-divfunelt-divfunelt"></a>
###### `D1 ne D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-le-divfunelt-divfunelt"></a>
###### `D1 le D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-lt-divfunelt-divfunelt"></a>
###### `D1 lt D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-ge-divfunelt-divfunelt"></a>
###### `D1 ge D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-gt-divfunelt-divfunelt"></a>
###### `D1 gt D2: DivFunElt, DivFunElt -> BoolElt`

<a id="operation-op-in-divfunelt-divfun"></a>
###### `D in Div: DivFunElt, DivFun -> BoolElt`

<a id="operation-op-notin-divfunelt-divfun"></a>
###### `D notin Div: DivFunElt, DivFun -> BoolElt`

##### Predicates on Elements

<a id="function-iszero-divfunelt"></a>
###### `IsZero(D): DivFunElt -> BoolElt`

<a id="function-iseffective-divfunelt"></a>
###### `IsEffective(D): DivFunElt -> BoolElt`

<a id="function-ispositive-divfunelt"></a>
###### `IsPositive(D): DivFunElt -> BoolElt`

<a id="function-isspecial-divfunelt"></a>
###### `IsSpecial(D): DivFunElt -> BoolElt`

<a id="function-isprincipal-divfunelt"></a>
###### `IsPrincipal(D): DivFunElt -> BoolElt, FldFunElt`

<a id="function-iscanonical-divfunelt"></a>
###### `IsCanonical(D): DivFunElt -> BoolElt, DiffFunElt`

Returns `true` iff the divisor $D$ is canonical and a differential having $D$ as its divisor.

<a id="example-ex-749efd"></a>
###### `Example: Divisors on a Relative Function Field (ex-749efd)`

We show some simple creations and operations on divisors.

```magma
> PF<x> := PolynomialRing(GF(13, 2));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b>;
> CanonicalDivisor(FF2);
Complementary divisor of Divisor in ideal representation:
Ideal of Maximal Equation Order of FF2 over Maximal Equation Order of FF1 over
Univariate Polynomial Ring in x over GF(13^2)
Generator:
1, Fractional ideal of Maximal Order of FF2 over Maximal Equation Order of FF1
over Valuation ring of Univariate rational function field over GF(13^2) with
generator 1/x
Generator:
x^2
> IsCanonical($1);
true
> D := Divisor(b) + Divisor(d);
> E := Divisor(Random(FF2, 2)*MaximalOrderFinite(FF2),
> Random(FF2, 2)*MaximalOrderInfinite(FF2));
> d := D + E;
> d;
Divisor in reduced representation:
Dtilde :
Divisor in ideal representation:
Fractional ideal of Maximal Equation Order of FF2 over Maximal Equation Order of
FF1 over Univariate Polynomial Ring in x over GF(13^2)
Basis:
Pseudo-matrix over Maximal Equation Order of FF1 over Univariate Polynomial Ring
in x over GF(13^2)
Ideal of Maximal Equation Order of FF1 over Univariate Polynomial Ring in x over
GF(13^2)
Generator:
1 * ( 1 0 0 )
Ideal of Maximal Equation Order of FF1 over Univariate Polynomial Ring in x over
GF(13^2)
Generator:
1 * ( 0 1 0 )
Fractional ideal of Maximal Equation Order of FF1 over Univariate Polynomial
Ring in x over GF(13^2)
Generators:
1
($.1^137*x^12 + $.1^80*x^11 + $.1^22*x^10 + $.1^79*x^9 + $.1^88*x^8 +
   $.1^138*x^7 + $.1^130*x^6 + $.1^127*x^5 + $.1^163*x^4 + $.1^78*x^3 + 6*x^2 +
   $.1^41*x + $.1^146)/(x^12 + $.1^166*x^11 + $.1^50*x^10 + $.1^136*x^9 +
   $.1^32*x^8 + $.1^46*x^7 + $.1^134*x^6 + $.1^64*x^5 + 8*x^4 + $.1^93*x^3 +
   $.1^153*x^2 + $.1^162*x)*b + ($.1^24*x + $.1^153)/(x^11 + $.1^166*x^10 +
   $.1^50*x^9 + $.1^136*x^8 + $.1^32*x^7 + $.1^46*x^6 + $.1^134*x^5 +
   $.1^64*x^4 + 8*x^3 + $.1^93*x^2 + $.1^153*x + $.1^162) * ( $.1^161*x^11 +
   $.1^74*x^10 + $.1^145*x^9 + $.1^72*x^8 + $.1^122*x^7 + $.1^123*x^6 + 3*x^5 +
   $.1^133*x^4 + 2*x^3 + $.1^105*x^2 + $.1^102*x $.1^48*x^11 + $.1^82*x^10 +
   4*x^9 + $.1^102*x^8 + $.1^145*x^7 + $.1^118*x^6 + $.1^129*x^5 + $.1^102*x^4
   + $.1^138*x^3 + $.1^146*x^2 + $.1^134*x 1 ) , Ideal of Maximal Order of FF2
over Maximal Equation Order of FF1 over Valuation ring of Univariate rational
function field over GF(13^2) with generator 1/x
Basis:
Pseudo-matrix over Maximal Equation Order of FF1 over Valuation ring of
Univariate rational function field over GF(13^2) with generator 1/x
Ideal of Maximal Equation Order of FF1 over Valuation ring of Univariate
rational function field over GF(13^2) with generator 1/x
Generator:
1/x^2 * ( 1 0 0 )
Ideal of Maximal Equation Order of FF1 over Valuation ring of Univariate
rational function field over GF(13^2) with generator 1/x
Generators:
1/x^3
($.1^21*x^3 + $.1^86*x^2 + $.1^151*x + $.1^48)/x^6*b + $.1^79/x^3 * ( 0 1 0 )
Ideal of Maximal Equation Order of FF1 over Valuation ring of Univariate
rational function field over GF(13^2) with generator 1/x
Generator:
1/x^3*b * ( 0 0 1 ) ,
r : 0,
A :
Divisor in ideal representation:
Ideal of Maximal Equation Order of FF2 over Maximal Equation Order of FF1 over
Univariate Polynomial Ring in x over GF(13^2)
Generator:
1, Fractional ideal of Maximal Order of FF2 over Maximal Equation Order of FF1
over Valuation ring of Univariate rational function field over GF(13^2) with
generator 1/x
Generators:
x
x,
a :
(x)^-1 * (b)
```

A nicer (but potentially more expensive) way to print, would be to ensure the divisor had a representation as a linear combination of places and exponents.

```magma
> p, e := Support(d);
> d;
4*(x, (($.1^24*x + 9)*b + ($.1^133*x + $.1^117))*d^2 + (($.1^83*x + $.1^36)*b +
    ($.1^97*x + $.1^2))*d + ($.1^101*x + $.1^165)*b + $.1^108*x) + (x + $.1^102,
    (($.1^141*x + $.1^113)*b + ($.1^157*x + $.1^48))*d^2 + (($.1^94*x + $.1^92)*b
    + ($.1^167*x + $.1^79))*d + ($.1^36*x + $.1^85)*b + $.1^18*x + 6) + (x^2 +
    $.1^47*x + 8, (($.1^19*x^3 + $.1^155*x^2 + $.1^75*x + $.1^106)*b + (8*x^3 +
    $.1^131*x^2 + $.1^125*x + $.1^46))*d^2 + (($.1^86*x^3 + $.1^11*x^2 +
    $.1^141)*b + ($.1^94*x^3 + $.1^127*x^2 + 6*x + $.1^57))*d + ($.1^68*x^3 +
    $.1^82*x^2 + $.1^52*x + $.1^69)*b + $.1^95*x^3 + $.1^55*x^2 + $.1^30*x +
    $.1) + (x^8 + $.1^138*x^7 + $.1^91*x^6 + $.1^59*x^5 + $.1^25*x^4 +
    $.1^74*x^3 + 6*x^2 + $.1^153*x + 5, (($.1^86*x^10 + 12*x^9 + $.1^5*x^8 +
    $.1^7*x^7 + $.1^123*x^6 + $.1^8*x^5 + $.1^77*x^4 + $.1^43*x^3 + $.1^110*x^2
    + $.1^124*x + $.1^51)*b + ($.1^78*x^9 + $.1^105*x^8 + $.1^153*x^7 + 6*x^6 +
    $.1^142*x^5 + $.1^152*x^4 + $.1^54*x^3 + $.1^9*x^2 + $.1^43*x + $.1^37))*d^2
    + (($.1^63*x^10 + $.1^125*x^9 + $.1^156*x^8 + $.1^44*x^7 + $.1^27*x^6 +
    $.1^127*x^5 + $.1^160*x^4 + $.1^46*x^3 + 9*x^2 + 8*x + $.1^37)*b +
    ($.1^99*x^10 + $.1^119*x^9 + $.1^103*x^8 + $.1^25*x^7 + $.1*x^6 +
    $.1^114*x^5 + $.1^133*x^4 + $.1^34*x^3 + $.1^4*x^2 + $.1^40*x + $.1^71))*d +
    ($.1^86*x^10 + $.1^7*x^9 + $.1^142*x^8 + 4*x^7 + $.1^161*x^6 + 2*x^5 +
    $.1^17*x^4 + $.1^50*x^3 + $.1^100*x^2 + $.1^144*x + $.1^12)*b + $.1^31*x^10
    + $.1^40*x^9 + 8*x^8 + 9*x^7 + $.1^39*x^6 + $.1^120*x^5 + $.1^114*x^4 +
    $.1^116*x^3 + $.1^43*x^2 + $.1^103*x + $.1^93) - 15*(1/x, (($.1^114*x^2 +
    $.1^96*x + 12)/x^3*b + ($.1^153*x^2 + 4*x + 12)/x^3)*d^2 + (($.1^17*x^2 +
    $.1^124*x + 12)/x^3*b + ($.1^159*x^2 + $.1^124*x + 12)/x^3)*d + ($.1^159*x^2
    + 6*x + 12)/x^3*b + ($.1^21*x + 12)/x^2)
> g := GCD(D, E);
> l := LCM(D, E);
> g + l eq d;
true
> g le D;
true
> l ge E;
true
```

##### Other Element Operations

<a id="function-functionfield-divfunelt"></a>
###### `FunctionField(D): DivFunElt -> FldFun`

Given a divisor $D$, return the function field.

<a id="function-degree-divfunelt"></a>
###### `Degree(D): DivFunElt -> RngIntElt`

The degree of the divisor $D$ over $k$, the constant field of definition.

<a id="function-divfunelt-support"></a>
###### `Support(D): DivFunElt -> [ PlcFunElt ]`

A sequence containing the places occurring in the divisor $D$.

<a id="function-numerator-divfunelt"></a>
###### `Numerator(D): DivFunElt -> DivFunElt`

<a id="function-zerodivisor-divfunelt"></a>
###### `ZeroDivisor(D): DivFunElt -> DivFunElt`

The numerator of the divisor $D$.

<a id="function-denominator-divfunelt"></a>
###### `Denominator(D): DivFunElt -> DivFunElt`

<a id="function-poledivisor-divfunelt"></a>
###### `PoleDivisor(D): DivFunElt -> DivFunElt`

The denominator of the divisor $D$.

<a id="function-divfunelt-ideals"></a>
###### `Ideals(D): DivFunElt -> RngFunOrdIdl, RngFunOrdIdl`

Create two ideals of the ‘finite’ and ‘infinite’ maximal order respectively corresponding to the divisor $D$.

<a id="function-norm-divfunelt"></a>
###### `Norm(D): DivFunElt -> DivFunElt`

The divisor of the norms of the ideals of the divisor $D$.

<a id="function-finitesplit-divfunelt"></a>
###### `FiniteSplit(D): DivFunElt -> DivFunElt, DivFunElt`

<a id="function-finitedivisor-divfunelt"></a>
###### `FiniteDivisor(D): DivFunElt -> DivFunElt`

<a id="function-infinitedivisor-divfunelt"></a>
###### `InfiniteDivisor(D): DivFunElt -> DivFunElt`

Split the divisor $D$ into its finite and infinite part, returning either $2$ divisors which are the sum of the finite places in $D$ and the sum of the infinite places in $D$ or the appropriate one of these.

<a id="function-divfunelt-dimension"></a>
###### `Dimension(D): DivFunElt -> RngIntElt`

The dimension of the Riemann-Roch space ${\cal L}(D)$ of the divisor $D$ over $k$, the constant field of definition.

<a id="function-indexofspeciality-divfunelt"></a>
###### `IndexOfSpeciality(D): DivFunElt -> RngIntElt`

The index of speciality of the divisor $D$, which equals the dimension of ${\cal L}(W-D)$ where $W$ is a canonical divisor.

<a id="function-shortbasis-divfunelt"></a>
###### `ShortBasis(D : parameters): DivFunElt -> [RngElt], [RngIntElt]`

```magma
Reduction     : BoolElt                      Default: true
Simplification: MonStgElt                    Default: "Full"
```

Compute a basis for the Riemann-Roch space of $D$ in short form:

Let $F = k(x,y)$ be an algebraic function field defined by $f(x,y)=0$ over $k$. Given a divisor $D$ of $F/k$ this function returns a basis of the $k$-vector space

$$
{\cal
   L}(D) = \{ a \in F^\times \;|\; (a) \geq -D \} \cup \{ 0 \}
$$

in the short form $B = [ \, b_1 \dots, b_n \, ], \; [ \, d_1, \dots, d_n \, ]$ with $b_i \in F^\times$ and $d_i \in \Z$ for all $1 \leq i \leq n$, where $n$ denotes the degree in $y$ of the defining equation $f$ of $F$, such that

$$
{\cal L}(D) = \left\{ \sum_{i=1}^n
   \lambda_i b_i \;|\; \lambda_i \in k[x] \ {\rm with\  deg\ }
   \lambda_i \leq d_i \ {\rm for\ } 1 \leq i \leq n \right\}.
$$

The optional argument `Reduction` controls whether to use divisor reduction internally or not; it defaults to `true`. For small divisors this is sometimes faster.

The optional argument `Simplification` controls whether the resulting basis is simplified or not; it defaults to `"Full"`. Simplification sometimes is not insignificantly expensive and can be avoided by setting the parameter to `"None"`.

The algorithm is described in [[Hes99](https://docs.magma-maths.org/references.md#cite-he2)].

<a id="function-basis-divfunelt"></a>
###### `Basis(D : parameters): DivFunElt -> [ FldFunElt ]`

```magma
Reduction     : BoolElt                      Default: true
Simplification: MonStgElt                    Default: "Full"
```

A sequence containing a basis of the Riemann-Roch space ${\cal L}(D)$, for the divisor $D$.

The optional argument `Reduction` controls whether to use divisor reduction internally or not; it defaults to `true`. For small divisors this is sometimes faster.

The optional argument `Simplification` controls whether the resulting basis is simplified or not; it defaults to `"Full"`. Simplification sometimes is not insignificantly expensive and can be avoided by setting the parameter to `"None"`.

<a id="function-riemannrochspace-divfunelt"></a>
###### `RiemannRochSpace(D): DivFunElt -> ModFld, Map`

<a id="function-riemannrochspace-plcfunelt"></a>
###### `RiemannRochSpace(P): PlcFunElt -> ModFld, Map`

Given a function field $F/k$ and a divisor $D$ belonging to $F/k$, return a vector space $V$ and a $k$-linear mapping $h: V \longrightarrow F$ such that $V$ is isomorphic to the Riemann-Roch space ${\cal L}(D) \subset F$ under $h$.

<a id="function-valuation-divfunelt-plcfunelt"></a>
###### `Valuation(D, P): DivFunElt, PlcFunElt -> RngIntElt`

The exponent of the place $P$ in the divisor $D$.

<a id="function-divfunelt-reduction"></a>
###### `Reduction(D): DivFunElt -> DivFunElt, RngIntElt, DivFunElt, FldFunElt`

<a id="function-reduction-divfunelt-divfunelt"></a>
###### `Reduction(D, A): DivFunElt, DivFunElt -> DivFunElt, RngIntElt, DivFunElt, FldFunElt`

Let $D$ be a divisor. Denote the result of both functions by $\tilde{D}$, $r$, $A$, and $a$ (for the second function the input $A$ always equals the output $A$). The divisor $A$ has (must have) positive degree and the following holds:

**(i)**
$D = \tilde{D} + rA - (a)$,

**(ii)**
$\tilde{D} \ge 0$ and $\deg(\tilde{D}) < g + \deg(A)$ (over the exact constant field),

**(iii)**
$\tilde{D}$ has minimal degree among all such divisors satisfying (i), (ii).

<a id="function-divfunelt-gapnumbers"></a>
###### `GapNumbers(D, P): DivFunElt, PlcFunElt -> SeqEnum[RngIntElt]`

The sequence of gap numbers of the divisor $D$ at $P$ where $P$ must be a place of degree one:

Let $F/k$ be an algebraic function field, $D$ a divisor, and $P$ a place of degree one. An integer $m \geq 1$ is a gap number of $D$ at $P$ if $\dim \bigl( D + (m-1)P \bigr) = \dim(D + mP)$ holds. The gap numbers $m$ of $D$ satisfy $1 \leq m \leq 2g-1-\deg(D)$ and their cardinality equals the index of speciality $i(D)$. `GapNumbers(D, P)` returns such a particular sequence. The sequences of gap numbers of $D$ at various $P$ are independent of constant field extensions for perfect $k$ and are the same for all but a finite number of places $P$ of degree one (consider e.g. $k$ algebraically closed). If $P$ is omitted in the function call, this uniform sequence is returned by `GapNumbers(D)`. The places $P$ where $D$ has different sequences of gap numbers are called Weierstraß places of $D$ and are returned by `WeierstrassPlaces(D)`. In the above mentioned functions it is equivalent to replace $D$ by either $F$ or the zero divisor.

<a id="function-gapnumbers-divfunelt"></a>
###### `GapNumbers(D): DivFunElt -> SeqEnum[RngIntElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The sequence of global gap numbers of the divisor $D$. A separating element used internally for the computation can be specified, it defaults to `SeparatingElement(F)`. See the description of [`GapNumbers`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divfunelt-gapnumbers).

<a id="example-ex-bddf6b"></a>
###### `Example: Riemann-Roch Space of a Divisor (ex-bddf6b)`

Consider the function field $F$ defined by the curve of genus $7$ defined by

$$
y^4 + (2*x^5 + x^4 + 2*x^3 + x^2)*y^2 + x^8 + 2*x^6 + x^5 +x^4 + x^3 + x^2
$$

We construct the function field $F/{\bf F}_{9}$ and compute the Riemann-Roch space corresponding to a certain divisor.

```magma
> k<w> := GF(9);
> R<x> := FunctionField(k);
> P<y> := PolynomialRing(R);
> f := y^4 + (2*x^5 + x^4 + 2*x^3 + x^2)*y^2 + x^8
>      + 2*x^6 + x^5 +x^4 + x^3 + x^2;
> F<a> := FunctionField(f);
> Genus(F);
7
> P1 := RandomPlace(F, 1);
> P2 := RandomPlace(F, 1);
> D := P1 - P2;
> D;
(1/x, w^7/x^7*a^3 + w^5/x^5*a^2 + w^3/x^2*a + w) - (x, 2/(x^4 + x^2 + 2*x)*a^3 +
    w^3/x*a^2 + (w^5*x^3 + w^3*x + w^7)/(x^3 + x + 2)*a + w^5)
> IsPrincipal(336*D);
true
> infty := Poles(F!x)[1];
> V, h := RiemannRochSpace(11*infty);
> V;
KModule V of dimension 5 over GF(3^2)
> h;
Mapping from: ModFld: V to FldFun: F
> B := h(Basis(V));
> B;
[
    x/(x^3 + x + 2)*a^3 + (2*x^4 + 2*x^3 + x)/(x^3 + x + 2)*a,
    1/(x^3 + x + 2)*a^3 + (2*x^3 + 2*x^2 + 1)/(x^3 + x + 2)*a,
    a^2 + 2*x^3 + 2*x^2,
    1/x*a^2 + 2*x^2 + 2*x,
    1
]
> (B[2] + 2*B[3])@@h;
(    0     1     2     0     0)
```

<a id="example-ex-3b8680"></a>
###### `Example: Algebraic Relation for Sine and Cosine (ex-3b8680)`

As a trivial but illustrative example we consider the algebraic function field generated by $\sin(x)$ and $\cos(x)$ over $Q$ and construct a single function $a(x)$ such that $\sin(x)$ and $\cos(x)$ can be expressed in terms of $a(x)$:

```magma
> Qc<c> := PolynomialRing(RationalField());
> Qcs<s> := PolynomialRing(Qc);
> F<s> := FunctionField(s^2 + c^2 - 1);
> c := F!c;
> Genus(F);
0
> Zeros(s);
[ (c - 1, s), (c + 1, s) ]
> Zeros(c-1);
[ (c - 1, s) ]
> P := Zeros(c-1)[1];
> Degree(P);
1
> Dimension(1*P);
2
> Basis(1*P);
[ 1/(c - 1)*s, 1 ]
> a := Basis(1*P)[1];
> Degree(a);
1
> MinimalPolynomial(a);
$.1^2 + (c + 1)/(c - 1)
> (a^2 - 1)/(a^2 + 1);
c
> a * ((a^2 - 1)/(a^2 + 1) - 1);
s
```

<a id="example-ex-f4fe11"></a>
###### `Example: Sine and Cosine via Exponentials (ex-f4fe11)`

Over $Q(i)$ the familiar identities

$$
\cos(x) = (\exp(ix) + \exp(-ix))/2
$$

$$
\sin(x) = (\exp(ix) - \exp(-ix))/(2i).
$$

hold. In Magma one can proceed as follows:

```magma
> Qx<x> := PolynomialRing(RationalField());
> k<i> := NumberField(x^2 + 1);
> kc<c> := PolynomialRing(k);
> kcs<s> := PolynomialRing(kc);
> F<s> := FunctionField(s^2 + c^2 - 1);
> c := F!c;
> Genus(F);
0
> e := c + i*s;
> ebar := c - i*s;
> Degree(e);
1
> c eq (e + ebar) / 2;
true
> s eq (e - ebar) / (2*i);
true
```

<a id="function-divfunelt-ramificationdivisor"></a>
###### `RamificationDivisor(D): DivFunElt -> DivFunElt`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The ramification divisor of the divisor $D$ (using `SeparatingElement` for the computation which defaults to `SeparatingElement(F)` for $F/k$ the function field of $D$):

Let $F/k$ be an algebraic function field, $x$ a separating variable, and $D$ a divisor. The ramification divisor of $D$ is defined to be $i(D) \, ( W - D ) + \bigl( W_x(D) \bigr) + \nu \, (dx),$ where $W$ is a canonical divisor of $F/k$, $W_x(D)$ is the determinant of the Wronskian matrix of $D$ with respect to $x$ and $\nu$ is the sum of the Wronskian orders of $D$ with respect to $x$. It is effective and consists of the Weierstraß places of $D$. The constant field $k$ is required to be exact.

<a id="function-divfunelt-weierstrassplaces"></a>
###### `WeierstrassPlaces(D): DivFunElt -> [PlcFunElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

The Weierstrass places of the divisor $D$ (using `SeparatingElement` for the computation which defaults to `SeparatingElement(F)` for $F/k$ the function field of $D$):

Let $F/k$ be an algebraic function field, $D$ a divisor, and $P$ a place of degree one. An integer $m \geq 1$ is a gap number of $D$ at $P$ if $\dim \bigl( D + (m-1)P \bigr) = \dim(D + mP)$ holds. The gap numbers $m$ of $D$ at $P$ satisfy $1 \leq m \leq 2g-1-\deg(D)$ and their cardinality equals the index of speciality $i(D)$. The sequences of gap numbers of $D$ are independent of constant field extensions for perfect $k$ and are the same for all but a finite number of places $P$ of degree one (consider e.g. $k$ algebraically closed). The places $P$ of degree one at which $D$ has different sequences of gap numbers are called Weierstraß places of $D$.

This function returns a list of all places of $F/k$ (having not necessarily degree one) which are lying below Weierstraß places of $D$ viewed in $F \bar{k} / \bar{k}$ ($k$ perfect). The constant field $k$ is required to be exact. Note that if the characteristic of $F$ is positive this function is currently quite slow for large genus because of `Differentiation()`.

<a id="function-isweierstrassplace-divfunelt-plcfunelt"></a>
###### `IsWeierstrassPlace(D, P): DivFunElt, PlcFunElt -> BoolElt`

Given a divisor $D$ and a degree $1$ place $P$ of a function field, return whether $P$ is a weierstrass place of $D$.

<a id="function-divfunelt-wronskianorders"></a>
###### `WronskianOrders(D): DivFunElt -> [RngIntElt]`

```magma
SeparatingElement: FldFunGElt                    Default: 
```

Let $D$ be a divisor of an algebraic function field $F/k$ with separating element $x$ and let $v_1, \dots v_l$ be a basis of ${\cal L}(D)$. For the differentiation $D_x$ with respect to $x$ consider the successively smallest $\nu_1 \leq \dots \leq \nu_l \in \Z^{\geq 0}$ such that the rows $D_x^{(\nu_i)}(v_1), \dots, D_x^{(\nu_i)}(v_l)$, $1 \leq i \leq l$ are $F$-linearly independent. The numbers $\nu_1, \dots, \nu_l$ are the Wronskian orders of $D$ with respect to $x$ and are returned. If $D$ has dimension zero, the empty list is returned. The constant field $k$ is required to be exact.

The separating element can be given by setting the `SeparatingElement` parameter appropriately.

<a id="function-divfunelt-complementarydivisor"></a>
###### `ComplementaryDivisor(D): DivFunElt -> DivFunElt`

Return the complementary divisor $D^\#$ of the divisor $D$. The function field $F/k$ of $D$ must be a finite extension of a rational function field $k(x)$. The divisor $D^\#$ equals $\operatorname{Diff}(F/k(x)) - D$ for $F$ the function field of $D$ and $\operatorname{Diff}(F/k(x))$ the different divisor of $F/k(x)$.

<a id="function-differentialbasis-divfunelt"></a>
###### `DifferentialBasis(D): DivFunElt -> [DiffFunElt]`

A basis of the space of differentials of the divisor $D$. See [`DifferentialBasis`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/differentials.md#function-differentials-subspaces-differentialbasis) for details.

<a id="function-differentialspace-divfunelt"></a>
###### `DifferentialSpace(D): DivFunElt -> ModFld, Map`

A vector space and the isomorphism from this space to the differential space of the divisor $D$.

<a id="function-parametrization-fldfun-divfunelt"></a>
###### `Parametrization(F, D): FldFun, DivFunElt -> FldFunElt, [FldFunRatUElt]`

An element $x$ in $F$ which is a non constant element of the basis of the divisor $D$ having degree one and a sequence of elements $L$ in the rational function field are returned such that $x$ generates the function field $F$ over the constant field and $L$ contains the images of the generators of $F$ over its constant field in the rational function field.

#### Functions related to Divisor Class Groups of Global Function Fields

Let $F/k$ be a global function field. The group of divisor classes is isomorphic to the product of a copy of $\Z$ and the group of divisors classes of degree zero which is a finite abelian group. Magma features an algorithm to compute the divisor class group by computing an abelian group $G$ in the form $\Z/c_1\Z\times \dots \times \Z/c_{2g}\Z\times \Z$ with integers $c_1 | \dots | c_{2g}$ and a surjective homomorphism $f: Div(F) \ar G$ from the divisor group to $G$ whose kernel consists precisely of the principal divisors.

The algorithm employed is a randomized index calculus style method of expected subexponential running time for “small” constant field size and “large” genus. A description of this and other algorithms of this section can be found in [[Hes99](https://docs.magma-maths.org/references.md#cite-he2)].

Elements in product representation may result from applying the maps returned by some of the computations below. It can be expensive to put these elements into sets and to test them for equality.

<a id="function-classgroupgenerationbound-rngintelt-rngintelt"></a>
##### `ClassGroupGenerationBound(q, g): RngIntElt, RngIntElt -> RngIntElt`

A bound $B$ such that the places of degree (over the exact constant field) less than or equal to $B$, taken together with the places of a divisor of degree one, generate the whole divisor class group of any global function field of genus $g$ over the exact constant field of $q$ elements.

<a id="function-classgroupgenerationbound-fldfung"></a>
##### `ClassGroupGenerationBound(F): FldFunG -> RngIntElt`

A bound $B$ such that all places of degree (over the exact constant field) less than or equal to $B$, taken together with the places of a divisor of degree one, generate the whole divisor class group of the function field $F$. Particular properties of the function field are taken into account.

<a id="function-classnumberapproximation-fldfung-fldreelt"></a>
##### `ClassNumberApproximation(F, e): FldFunG, FldReElt -> FldReElt`

An approximation of the class number of the global function field $F/k$ with multiplicative error less than $1+e$ for $e > 0$. The formula

$$
\biggl| \,\log \bigl( h \,/\, q^g \, \bigr) -
             \sum_{r=1}^{b} q^{-r}/r \bigl( N_r - (q^r + 1) \bigl)
              \biggr| \,\leq\,  2g q^{-b/2} / \bigl( (q^{1/2}-1)(b+1) \bigr)
$$

is used where $N_r$ denotes the number of places of degree one in the constant field extension of degree $r$ of $F/k$.

<a id="function-classnumberapproximationbound-rngintelt-rngintelt-fldreelt"></a>
##### `ClassNumberApproximationBound(q, g, e): RngIntElt, RngIntElt, FldReElt -> RngIntElt`

Returns an integer $B$ such that all places of degree less than or equal to $B$ of a global function field of genus g over the exact constant field of $q$ elements have to be considered in order to approximate the class number with multiplicative error less than $1+e$ for $e > 0$.

<a id="function-divisors-classes-classgroup"></a>
##### `ClassGroup(F : parameters): FldFun -> GrpAb, Map, Map`

```magma
DegreeBound     : RngIntElt                    Default: 
SizeBound       : RngIntElt                    Default: 
ReductionDivisor: DivFunElt                    Default: 
Proof           : BoolElt                      Default: 
```

The divisor class group of the function field $F/k$ as an abelian group, a map of representatives from the class group to the divisor group and the homomorphism from the divisor group onto the divisor class group.

The optional parameter `DegreeBound` allows to control the size of the factor basis which consists of all places of degree less equal `DegreeBound` (plus a small additional amount; the degree is taken over the exact constant field). If not provided the algorithm tries to choose an appropriate value.

The optional parameter `SizeBound` bounds the size of the factor basis to not exceed `SizeBound` places. Every time the factor basis has to be enlarged during the computation it will be by no more than `SizeBound` additional places. If not provided there is no bound on the size of the factor basis. Every enlargement of the factor basis will append all places of the next degree.

The optional parameter `ReductionDivisor` contains the reduction divisor used in the relation search stage. Reasonable choices are divisors of small positive degree. If not provided the algorithm tries to choose an appropriate reduction divisor.

The optional parameter `Proof` indicates whether the computed result should be proven in a proof step. If a small degree bound for the factor basis is used and the divisor class group happens to be a product of a large number of cyclic groups the proof step can be very time consuming and `Proof := false` might be helpful. Once a value is given for `Proof` it remains the default value until set differently. The initial value of `Proof` for every function field is `true`.

<a id="function-divisors-classes-classgroupabelianinvariants"></a>
##### `ClassGroupAbelianInvariants(F : parameters): FldFun -> SeqEnum`

```magma
DegreeBound     : RngIntElt                    Default: 
SizeBound       : RngIntElt                    Default: 
ReductionDivisor: DivFunElt                    Default: 
Proof           : BoolElt                      Default: 
```

Computes a sequence of integers containing the Abelian invariants of the divisor class group of the function field $F/k$.

The optional parameters are the same as for `ClassGroup`.

<a id="function-classnumber-fldfun"></a>
##### `ClassNumber(F): FldFun -> RngIntElt`

The order of the group of divisor classes of degree zero of the function field $F/k$.

<a id="example-ex-caa2d2"></a>
##### `Example: Divisor Class Group Computations (ex-caa2d2)`

Some class group calculations :

```magma
> Y<t> := PolynomialRing(Integers());
> R<x> := FunctionField(GF(9));
> P<y> := PolynomialRing(R);
> f := y^3 + y + x^5 + x + 1;
> F<alpha> := FunctionField(f);
> ClassNumberApproximation(F, 1.3);
24890.25505701632912193514
> ClassGroup(F);
Abelian Group isomorphic to Z/13 + Z/13 + Z/13 + Z/13 + Z
Defined on 5 generators
Relations:
    13*$.1 = 0
    13*$.2 = 0
    13*$.3 = 0
    13*$.4 = 0
Mapping from: Abelian Group isomorphic to Z/13 + Z/13 + Z/13 + Z/13 + Z
Defined on 5 generators
Relations:
    13*$.1 = 0
    13*$.2 = 0
    13*$.3 = 0
    13*$.4 = 0 to Divisor group of F
Mapping from: Divisor group of F to Abelian Group isomorphic to Z/13 + Z/13 +
Z/13 + Z/13 + Z
Defined on 5 generators
Relations:
    13*$.1 = 0
    13*$.2 = 0
    13*$.3 = 0
    13*$.4 = 0 given by a rule
> ClassNumber(F);
28561
> Evaluate(LPolynomial(F), 1);
28561
```

<a id="function-globalunitgroup-fldfun"></a>
##### `GlobalUnitGroup(F): FldFun -> GrpAb, Map`

The group of global units of the function field $F/k$, i. e. the multiplicative group of the exact constant field, as an Abelian group, together with the map into $F$.

<a id="function-isglobalunit-fldfunelt"></a>
##### `IsGlobalUnit(a): FldFunElt -> BoolElt`

Whether the function field element $a$ is a global unit, i.e. a constant (equivalent to `IsConstant`).

<a id="function-isglobalunitwithpreimage-fldfunelt"></a>
##### `IsGlobalUnitWithPreimage(a): FldFunElt -> BoolElt, GrpAbElt`

Returns `true` and the preimage of the function field element $a$ in the global unit group, `false` otherwise.

<a id="function-principaldivisormap-fldfung"></a>
##### `PrincipalDivisorMap(F): FldFunG -> Map`

The map from the multiplicative group of the function field to the group of divisors.

<a id="function-classgroupexactsequence-fldfung"></a>
##### `ClassGroupExactSequence(F): FldFunG -> Map, Map, Map`

Returns the three maps in the center of the exact sequence $0 \ar k^\times \ar F^\times \ar Div \ar Cl \ar 0$ where $k^\times$ is the global unit group of the function field, $F^\times$ is the multiplicative group of the function field, $Div$ is the divisor group and $Cl$ is the divisor class group.

<a id="function-sunitgroup-setenum-plcfunelt"></a>
##### `SUnitGroup(S): SetEnum[PlcFunElt] -> GrpAb, Map`

The group of $S$-units as an Abelian group and the map into the function field, where $S$ is a sequence of places of a function field.

<a id="function-issunit-fldfunelt-setenum-plcfunelt"></a>
##### `IsSUnit(a, S): FldFunElt, SetEnum[PlcFunElt] -> BoolElt`

Returns `true` if the function field element $a$ is an $S$-unit for the sequence of places $S$, `false` otherwise.

<a id="function-issunitwithpreimage-fldfunelt-setenum-plcfunelt"></a>
##### `IsSUnitWithPreimage(a, S): FldFunElt, SetEnum[PlcFunElt] -> BoolElt, GrpAbElt`

Returns `true` and the preimage of the function field element $a$ in the $S$-unit group if $a$ is an $S$-unit for the sequence of places $S$, `false` otherwise.

<a id="function-sregulator-setenum-plcfunelt"></a>
##### `SRegulator(S): SetEnum[PlcFunElt] -> RngIntElt`

The $S$-Regulator for the sequence of places $S$.

<a id="function-sprincipaldivisormap-setenum-plcfunelt"></a>
##### `SPrincipalDivisorMap(S): SetEnum[PlcFunElt] -> Map`

The map from the multiplicative group of the function field to the group of divisors (mod places in the sequence $S$).

<a id="function-issprincipal-divfunelt-setenum-plcfunelt"></a>
##### `IsSPrincipal(D, S): DivFunElt, SetEnum[PlcFunElt] -> BoolElt, FldFunElt`

Returns `true` and a generator if the divisor $D$ is principal modulo places in the sequence $S$, `false` otherwise

<a id="function-sclassgroup-setenum-plcfunelt"></a>
##### `SClassGroup(S): SetEnum[PlcFunElt] -> GrpAb, Map, Map`

The $S$-class group for the sequence of places $S$ as an Abelian group, a map of representatives from the $S$-class group to the group of divisors (mod places in $S$) and the homomorphism from the group of divisors (mod places in $S$) onto the $S$-class group.

<a id="function-sclassgroupexactsequence-setenum-plcfunelt"></a>
##### `SClassGroupExactSequence(S): SetEnum[PlcFunElt] -> Map, Map, Map`

Returns the three maps in the center of the exact sequence $0 \ar U(S) \ar F^\times \ar Div(S) \ar Cl(S) \ar 0$ where $U(S)$ is the $S$-unit group, $F^\times$ is the multiplicative group of the function field, $Div(S)$ is the group of divisors (mod places in the sequence $S$) and $Cl(S)$ is the $S$-class group.

<a id="function-sclassgroupabelianinvariants-setenum-plcfunelt"></a>
##### `SClassGroupAbelianInvariants(S): SetEnum[PlcFunElt] -> SeqEnum`

Computes a sequence of integers containing the Abelian invariants of the $S$-class group for the sequence of places $S$.

<a id="function-sclassnumber-setenum-plcfunelt"></a>
##### `SClassNumber(S): SetEnum[PlcFunElt] -> RngIntElt`

The order of the torsion part of the $S$-class group for the sequence of places $S$.

<a id="function-divisors-classes-classgroupprank"></a>
##### `ClassGroupPRank(F): FldFunG -> RngIntElt`

Compute the $p$-rank of the class group of $F/k$ where $p$ is the characteristic of $F/k$. More precisely: Let $F/k$ be a function field of characteristic $p$. Consider the subgroup $Cl^0(F/k)[p]$ of $p$-torsion elements of the group of divisor classes of degree zero. This function returns its dimension as an ${\bf F}_{p}$-vector space. Possible values range from $0$ to $g$, where $g$ is the genus of $F/k$. The field $k$ is currently required to be a finite field.

<a id="function-divisors-classes-hassewittinvariant"></a>
##### `HasseWittInvariant(F): FldFunG -> RngIntElt`

Return the Hasse–Witt invariant of $F/k$. More precisely: Let $F/k$ be a function field of characteristic $p$. Let $F \bar{k} / \bar{k}$ be the constant field extension by the algebraic closure $\bar{k}$ of $k$ within an algebraic closure $\bar{F}$ of $F/k$. Consider the subgroup $Cl^0(F \bar{k} / \bar{k})[p]$ of $p$-torsion elements of the group of divisor classes of degree zero. This function returns its dimension as an ${\bf F}_{p}$-vector space. Possible values range from $0$ to $g$, where $g$ is the genus of $F/k$. $k$ is required to be perfect.

<a id="function-tatelichtenbaumpairing-divfunelt-divfunelt-rngintelt"></a>
##### `TateLichtenbaumPairing(D1, D2, m): DivFunElt, DivFunElt, RngIntElt -> RngElt`

The Tate–Lichtenbaum pairing $Cl_0[m] \times Cl_0/mCl_0 \ar k$ for coprime divisors $D1$ and $D2$.

<a id="example-ex-7f9ab0"></a>
##### `Example: Tate-Lichtenbaum Pairing of Divisors (ex-7f9ab0)`

```magma
> k<w> := GF(9);
> R<x> := FunctionField(k);
> P<y> := PolynomialRing(R);
> f := y^4 + (2*x^5 + x^4 + 2*x^3 + x^2)*y^2 +
>             x^8 + 2*x^6 + x^5 + x^4 + x^3 + x^2;
> F<a> := FunctionField(f);
> D1 := Zeros(a)[1] - Poles(F!x)[1];
> D2 := Zeros(a)[4] - Poles(F!x)[2];
> G,mapfromG,maptoG:=ClassGroup(F : Proof:=false);
> Order(maptoG(D1));
48
> Order(maptoG(D2));
336
> TateLichtenbaumPairing(D1,D2,48);
w^7
> TateLichtenbaumPairing(D2,D1,336);
w^3
```

<a id="fldfung-differentials"></a>
<a id="id1"></a>
### Differentials

Spaces of differentials of function fields can be created and the differentials belonging to them manipulated. Divisors can be created from differentials and modules generated by a collection of differentials can be formed.

#### Creation of Structures

<a id="function-differentialspace-fldfung"></a>
##### `DifferentialSpace(F): FldFunG -> DiffFun`

The space of differentials of the algebraic function field $F/k$.

#### Creation of Elements

The simplest ways of creating a differential are given below.

<a id="function-differential-fldfungelt"></a>
##### `Differential(a): FldFunGElt -> DiffFunElt`

<a id="function-differential-rngfunordelt"></a>
##### `Differential(a): RngFunOrdElt -> DiffFunElt`

Create the differential $d(a)$ of the function field or order element $a$.

<a id="function-identity-difffun"></a>
##### `Identity(D): DiffFun -> DiffFunElt`

<a id="function-id-difffun"></a>
##### `Id(D): DiffFun -> DiffFunElt`

The identity differential of the space of differentials $D$.

<a id="function-iscanonical-divfunelt-2"></a>
##### `IsCanonical(D): DivFunElt -> BoolElt, DiffFunElt`

Returns `true` iff the divisor $D$ is canonical and a differential having $D$ as its divisor.

#### Related Structures

<a id="function-functionfield-difffun"></a>
##### `FunctionField(D): DiffFun -> FldFun`

The function field of the differentials in the space $D$.

<a id="function-functionfield-difffunelt"></a>
##### `FunctionField(d): DiffFunElt -> FldFun`

The function field of the differential $d$.

#### Subspaces

<a id="function-spaceofdifferentialsfirstkind-fldfung"></a>
##### `SpaceOfDifferentialsFirstKind(F): FldFunG -> ModFld, Map`

<a id="function-spaceofholomorphicdifferentials-fldfung"></a>
##### `SpaceOfHolomorphicDifferentials(F): FldFunG -> ModFld, Map`

A vector space and the isomorphism from this space to the space of differentials of the first kind (holomorphic differentials) of the function field $F/k$.

<a id="function-basisofdifferentialsfirstkind-fldfung"></a>
##### `BasisOfDifferentialsFirstKind(F): FldFunG -> SeqEnum[DiffFunElt]`

<a id="function-basisofholomorphicdifferentials-fldfung"></a>
##### `BasisOfHolomorphicDifferentials(F): FldFunG -> SeqEnum[DiffFunElt]`

A basis of the space of differentials of the first kind (holomorphic differentials) of the function field $F/k$.

<a id="function-differentials-subspaces-differentialbasis"></a>
##### `DifferentialBasis(D): DivFunElt -> [DiffFunElt]`

Computes a basis for the space of differentials

$$
\Omega(D) := \{\;
   \omega \in \Omega(F/k) \;|\; (\omega) \geq D \;\}
$$

for a divisor $D$ of an algebraic function field $F/k$.

<a id="function-differentialspace-divfunelt-2"></a>
##### `DifferentialSpace(D): DivFunElt -> ModFld, Map`

A vector space and the isomorphism from this space to the differential space of the divisor $D$.

<a id="example-ex-b69721"></a>
##### `Example: Differential Space of a Divisor (ex-b69721)`

This example illustrates the differential space of a divisor and some of the operations that can be done with it.

```magma
> Q := Rationals();
> Qx<x> := PolynomialRing(Q);
> Qxy<y> := PolynomialRing(Qx);
> f1 := y^2 - (x-1)*(x-2)*(x-3)*(x-5)*(x-6);
> F := FunctionField(f1);
> d := Divisor(F.1) + Divisor(F!BaseRing(F).1);
> V1 := DifferentialSpace(d);
> d := 2*Divisor(F.1) - Divisor(F!BaseRing(F).1);
> V2 := DifferentialSpace(d);
> V1;
KModule V1 of dimension 2 over Rational Field
> V2;
KModule V2 of dimension 2 over Rational Field
> V1 meet V2;
KModule of dimension 0 over Rational Field
> D := DifferentialSpace(F);
> v := V1 ! [2/9, 4/9]; v;
V1: (2/9 4/9)
> D!v;
(2/9*x^2 + 4/9*x) d(x)
> V1!$1;
V1: (2/9 4/9)
> BasisOfDifferentialsFirstKind(F);
[ (x/(x^5 - 17*x^4 + 107*x^3 - 307*x^2 + 396*x - 180)*F.1) d(x), (1/(x^5 -
    17*x^4 + 107*x^3 - 307*x^2 + 396*x - 180)*F.1) d(x) ]
```

#### Structure Predicates

<a id="operation-op-eq-difffun-difffun"></a>
##### `D1 eq D2: DiffFun, DiffFun -> BoolElt`

Return `true` if the spaces of differentials $D1$ and $D2$ are the same.

#### Operations on Elements

A number of general operations for elements are also provided for differentials as well as a number of specific functions for differentials.

##### Arithmetic Operators

<a id="operation-op-times-rngelt-difffunelt"></a>
###### `r * x: RngElt, DiffFunElt -> DiffFunElt`

<a id="operation-op-times-difffunelt-rngelt"></a>
###### `x * r: DiffFunElt, RngElt -> DiffFunElt`

<a id="operation-op-plus-difffunelt-difffunelt"></a>
###### `x + y: DiffFunElt, DiffFunElt -> DiffFunElt`

<a id="operation-operation-difffunelt-difffunelt"></a>
###### `- x: DiffFunElt -> DiffFunElt`

<a id="operation-op-minus-difffunelt-difffunelt"></a>
###### `x - y: DiffFunElt, DiffFunElt -> DiffFunElt`

<a id="operation-op-div-difffunelt-difffunelt"></a>
###### `x / y: DiffFunElt, DiffFunElt -> FldFunGElt`

<a id="operation-op-div-difffunelt-rngelt"></a>
###### `x / r: DiffFunElt, RngElt -> DiffFunElt`

The operations on differentials are inherited from the vector space structure of the space of differentials. Additionally, this space is one–dimensional as a vector space over the function field itself. The quotient $x/y$ of two differentials $x$ and $y$ then gives the unique $r \in F$ such that $x = ry$.

##### Equality and Membership

<a id="operation-op-eq-difffunelt-difffunelt"></a>
###### `x eq y: DiffFunElt, DiffFunElt -> BoolElt`

Returns `true` if $x$ and $y$ are the same differential.

<a id="operation-op-in-any-difffun"></a>
###### `x in D: Any, DiffFun -> BoolElt`

Returns `true` if $x$ is in the space of differentials $D$.

##### Predicates on Elements

<a id="function-isexact-difffunelt"></a>
###### `IsExact(d): DiffFunElt -> BoolElt, FldFunGElt`

Return whether $d$ is known to be an exact differential. If `true` additionally return a generator. If $d$ is not already known to be exact then no attempts to determine whether $d$ is exact or not are currently undertaken.

<a id="function-iszero-difffunelt"></a>
###### `IsZero(d): DiffFunElt -> BoolElt`

Return `true` if $d$ is the zero differential.

##### Functions on Elements

<a id="function-valuation-difffunelt-plcfunelt"></a>
###### `Valuation(d, P): DiffFunElt, PlcFunElt -> RngIntElt`

The valuation of the differential $d$ at the place $P$.

<a id="function-divisor-difffunelt"></a>
###### `Divisor(d): DiffFunElt -> DivFunElt`

The divisor $(d)$ of the differential $d$.

<a id="function-residue-difffunelt-plcfunelt"></a>
###### `Residue(d, P): DiffFunElt, PlcFunElt -> RngElt`

The residue of the differential $d$ at the place $P$, where $P$ must (currently) have degree one.

<a id="example-ex-7c77de"></a>
###### `Example: Functions on Differentials (ex-7c77de)`

```magma
> PF<x> := PolynomialRing(GF(31, 3));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b : Check := false>;
> Differential(d);
(26/x*d) d(x)
> I := Random(FF2, 2)*MaximalOrderInfinite(FF2);
> P := Place(Factorization(I)[1][1]);
> Valuation(Differential(d), P);
-2
> IsExact(Differential(Random(FF2, 2)));
true
```

<a id="function-module-seqenum-difffunelt-rng"></a>
###### `Module(L, R): SeqEnum[ DiffFunElt ], Rng -> Mod, Map, SeqEnum[ ModElt ]`

```magma
IsBasis  : BoolElt                    Default: false
PreImages: BoolElt                    Default: false
```

The $R$-module generated by the differentials in the sequence $L$ as an abstract module, together with the map into the space of differentials. The resulting modules can be used for intersection and inner sum computations.

If the optional parameter `IsBasis` is set `true` the function assumes that the given elements form a basis of the module to be computed.

If the optional parameter `PreImages` is set `true` then the preimages of the given elements under the map are returned as the third return value.

Both optional parameters are mainly used to save computation time.

<a id="function-relations-seqenum-difffunelt-rng"></a>
###### `Relations(L, R): SeqEnum[ DiffFunElt ], Rng -> ModTupRng`

<a id="function-relations-seqenum-difffunelt-rng-rngintelt"></a>
###### `Relations(L, R, m): SeqEnum[ DiffFunElt ], Rng, RngIntElt -> ModTupRng`

The module of $R$-linear relations between the differentials of the sequence $L$. The integer $m$ is used for the following: Let the elements of $L$ be $a_1, \dots, a_n$, $V$ be the relation module $\subseteq R^n$ and define $M := \{\, \sum_{i=1}^m v_i a_i \,|\, v = (v_i)_i \in V \,\}$. The function tries to compute a generating system of $V$ such that the corresponding generating system of $M$ consists of “small” elements.

<a id="example-ex-3e031a"></a>
###### `Example: Differentials as a Module (ex-3e031a)`

This example shows some of the conversions and operations possible with the results of `Module`.

```magma
> Q := Rationals();
> Qx<x> := PolynomialRing(Q);
> Qxy<y> := PolynomialRing(Qx);
> f1 := y^2 - (x-1)*(x-2)*(x-3)*(x-5)*(x-6);
> F := FunctionField(f1);
> D := DifferentialSpace(F);
> M7 := Module([Differential(3*F.1)], FieldOfFractions(Qx));
> M8 := Module([Differential(F.1), Differential(F!BaseRing(F).1)],
> FieldOfFractions(Qx));
> M12 := M7 meet M8;
> M16 := M7 + M8;
> assert M12 subset M7;
> assert M12 subset M8;
> assert M12 subset M16;
> r := M7![&+[Random([-100, 100])/Random([1, 100])*x^i : i in [1 .. 5]]/
> &+[Random([-100, 100])/Random([1,
> 100])*x^i : i in [1 .. 5]] : j in [1 .. Dimension(M7)]];
> assert M7!D!r eq r;
> r;
M7: ((1/100*x^4 + x^3 - x^2 + 1/100*x - 1/100)/(x^4 - 1/100*x^3 - 1/100*x^2 +
    1/100*x - 1/100))
> D!r;
((3/40*x^8 + 162/25*x^7 - 20937/200*x^6 + 114873/200*x^5 - 279531/200*x^4 +
    304167/200*x^3 - 24321/40*x^2 + 303/20*x - 297/50)/(x^9 - 1701/100*x^8 +
    2679/25*x^7 - 30789/100*x^6 + 19891/50*x^5 - 3593/20*x^4 - 63/10*x^3 +
    883/100*x^2 - 144/25*x + 9/5)*F.1) d(x)
```

<a id="function-cartier-difffunelt"></a>
###### `Cartier(b): DiffFunElt -> DiffFunElt`

<a id="function-cartier-difffunelt-rngintelt"></a>
###### `Cartier(b, r): DiffFunElt, RngIntElt -> DiffFunElt`

The result of applying the Cartier operator $r$ times to $b$. More precisely, let $F/k$ be a function field over the perfect field $k$, $x \in F$ be a separating variable and $b = g\,dx\,\in \Omega(F/k)$ with $g \in F$ be a differential. The Cartier operator is defined by $C(b) = \left( - d^{p-1} g / dx^{p-1} \right)^{1/p} dx.$ This function computes the $r$-th iterated application of $C$ to $b$.

##### Other

<a id="function-cartierrepresentation-fldfung"></a>
###### `CartierRepresentation(F): FldFunG -> AlgMatElt, SeqEnum[DiffFunElt]`

<a id="function-cartierrepresentation-fldfung-rngintelt"></a>
###### `CartierRepresentation(F, r): FldFunG, RngIntElt -> AlgMatElt, SeqEnum[DiffFunElt]`

Compute a row representation matrix of the Cartier operator on a basis of the space of holomorphic differentials of $F/k$ (applied $r$ times). More precisely, let $F/k$ be a function field over the perfect field $k$, $\omega_1, \dots, \omega_g \in \Omega(F/k)$ be a basis for the holomorphic differentials and $r \in {\mathbb{Z}}^{\geq 1}$. Let $M = (\lambda_{i,j})_{i,j} \in k^{g \times g}$ be the matrix such that

$$
C^r(\omega_i) =
   \sum_{m=1}^g \lambda_{i, m} \omega_m
$$

for all $1 \leq i \leq g$. This function returns $M$ and $(\omega_1, \dots, \omega_g)$.

<a id="example-ex-78c02f"></a>
###### `Example: Trivial Cartier Action on Differentials (ex-78c02f)`

An example of a trivial cartier action.

```magma
> PF<x> := PolynomialRing(GF(31, 3));
> P<y> := PolynomialRing(PF);
> FF1<b> := ext<FieldOfFractions(PF) | y^2 - x>;
> P<y> := PolynomialRing(FF1);
> FF2<d> := ext<FF1 | y^3 - b : Check := false>;
> Cartier(Differential(d), 4);
(0) d(x)
> CartierRepresentation(FF2, 3);
Matrix with 0 rows and 0 columns
[]
```

### Weil Descent

Weil Descent is a technique that can be applied to cryptosystem attacks amongst other things. The general idea is as follows. If $C$ is a curve defined over field $L$ and $K$ is a subfield of $L$, the group of points of the Jacobian of $C$, $Jac(C)$, over $L$ is isomorphic to the group of points of a higher-dimensional abelian variety, the *Weil restriction* of $Jac(C)$, over $K$. If a curve $D$ over $K$ can be found along with an algebraic homomorphism defined over $K$ from $Jac(D)$ to this Weil restriction, it is usually possible to transfer problems about $Jac(C)(L)$ (like discrete log problems) to $Jac(D)(K)$. $D$ will have larger genus than $C$, but we have descended to a smaller field. The advantage is that techniques like Index calculus, where the time complexity depends more strongly on the field size than the genus, can now be applied.

An important special case is where $C$ is an ordinary elliptic curve over a finite field of characteristic 2. In this case, Artin-Schreier theory gives a very concrete algorithm for computing a suitable $D$. This is the GHS attack (see [[PGS00](https://docs.magma-maths.org/references.md#cite-ghs)] or the chapter by F. Heß in [[Bla05](https://docs.magma-maths.org/references.md#cite-ad-ecc)]). There is a corresponding function [`WeilDescent`](https://docs.magma-maths.org/ArithmeticGeometry/EllipticCurvesOverFiniteFields/ec_weil_desc.md#function-crvell-ec-weil-desc) in the Elliptic Curve chapter that works with curves rather than function fields.

The functions below implement the GHS Weil Descent in a more general characteristic $p$ setting.

<a id="function-fldfung-weil-desc"></a>
#### `WeilDescent(E, k): FldFun, FldFin -> FldFunG, Map`

The main function. $E$ must be an “Artin-Schreier” function field over finite field $K$, an extension of $k$, of the following form. If $p$ is the characteristic of $K$, then the base field of $E$ is a rational function field $K(x)$ and $E.1$, the generator of $E$ over $K(x)$ has minimal polynomial of the form $y^p-y = c/x + a + b*x$ for $a,b,c \in K$. These parameters must satisfy $b,c \neq 0$ and at least one of the following conditions

i) $Trace_{K/k}(b) \neq 0$

ii) $Trace_{K/k}(c) \neq 0$

iii) $Trace_{K/{\mathbb{F}}_p}(a) = 0$

Then, if $E_1$ is the Galois closure of the separable field extension $E/k$ and $[K:k]=n$, there is an extension of the Frobenius generator of $G(K/k)$ to an automorphism of $E_1$ which fixes $x$ and is also of order $n$. If $F$ is the fixed field of this extension, then it has exact constant field $k$ and so it is the function field of a (geometrically irreducible) curve over $k$. This is the `WeilDescent` curve. It’s algebraic function field $F$ is the first return value.

Note that when $p=2$, $E$ is the function field of an ordinary elliptic curve in characteristic 2 (multiply the defining equation by $x^2$ and take $xy$ as the new $y$ variable) and conversely, any such elliptic curve can be put into this form in multiple ways.

The second return value is a map from the divisors of $E$ to the divisors of $F$ which represents the homomorphism `Jac(Curve(E))(K)` $\ar$ `Jac(Curve(F))(k)`. This map, however does not attempt any divisor reduction. For the characteristic 2 [`WeilDescent`](https://docs.magma-maths.org/ArithmeticGeometry/EllipticCurvesOverFiniteFields/ec_weil_desc.md#function-crvell-ec-weil-desc) function on elliptic curves mentioned in the introduction, if $F$ is hyperelliptic, the divisor map returned is the actual homomorphism from the elliptic curve (with function field $E$) to the Jacobian of the hyperelliptic curve with function field $F$. This may be more convenient for the user.

There are functions below that may be called to return the genus and other attributes of $F$ before actually going through with its construction.

One important special case, worth noting here, is that when $p = 2$ and $b$ or $c$ is in $k$, then the degree of $F$ is also 2 and so the descent curve is a hyperelliptic curve.

<a id="function-artinschreierextension-fldfin-fldfin-fldfin"></a>
#### `ArtinSchreierExtension(c, a, b): FldFin, FldFin, FldFin -> FldFun`

A convenience function to generate the function field which is an extension of $K(x)$ by the (irreducible) polynomial $y^p-y-c/x-a-bx$ where $K$ is a finite field which is the parent of $a,b,c$ and $p$ is the characteristic of $K$.

<a id="function-weildescentdegree-fldfun-fldfin"></a>
#### `WeilDescentDegree(E, k): FldFun, FldFin -> RngIntElt`

With $E$ and $k$ as in the main `WeilDescent` function, returns the degree of the descended function field $F$ over its rational base field $k(x)$. The computation only involves the Frobenius action on $a,b,c$ and the descent isn’t actually performed.

<a id="function-weildescentgenus-fldfun-fldfin"></a>
#### `WeilDescentGenus(E, k): FldFun, FldFin -> RngIntElt`

With $E$ and $k$ as in the main `WeilDescent` function, returns the genus of the descended function field $F$ over its rational base field $k(x)$. The computation only involves the Frobenius action on $a,b,c$ and the descent isn’t actually performed.

<a id="function-multiplyfrobenius-rngelt-rngupolelt-map"></a>
#### `MultiplyFrobenius(b, f, F): RngElt, RngUPolElt, Map -> RngElt`

This is a simple convenience function, useful for generating elements of $K$ on which the Frobenius has a given minimal polynomial when considered as an ${\mathbb{F}}_p$-linear map (see the example below).

The argument $b$ should be an element of a ring $R$, $f$ a polynomial over ring $R_0$, which is naturally a subring of $R$ and $F$ a map from $R$ to itself.

If $f = a_0+a_1x+\ldots$ then the function returns $f(F)(b)$ which is $a_0+a_1F(b)+a_2F(F(b))+\ldots$.

<a id="example-ex-469a62"></a>
#### `Example: GHS Weil Descent (ex-469a62)`

We demonstrate with an example of descent over a degree 31 extension in characteristic 2, which results in a genus 31 hyperelliptic function field, and a small characteristic 3 example.

```magma
> SetSeed(1);
> k<u> := GF(2^5);
> K<w> := GF(2^155);
> Embed(k, K);
> k2<t> := PolynomialRing(GF(2));
> h := (t^31-1) div (t^5 + t^2 + 1);
> frob := map< K -> K | x :-> x^#k >;
> b := MultiplyFrobenius(K.1,h,frob);
> E := ArtinSchreierExtension(K!1, K!0, b);
> WeilDescentGenus(E, k);
31
> WeilDescentDegree(E,k);
2
> C,div_map := WeilDescent(E, k);
> C;
Algebraic function field defined over Univariate rational function field over
GF(2^5) by
y^2 + u*y + u^18/($.1^32 + u^29*$.1^16 + u^14*$.1^8 + u^2*$.1^4 + $.1^2 +
    u^9*$.1 + u^5)
> // get the image of the place representing a K-rational point
> pl := Zeroes(E!(BaseField(E).1)-w)[1];
> D := div_map(pl);
> Degree(D); //31*32
992
> k := GF(3);
> K<w> := GF(3,4);
> a := w+1;
> c := w;
> b := c^3+c;
> E := ArtinSchreierExtension(c, a, b);
> WeilDescentDegree(E,k);
27
> WeilDescentGenus(E,k);
78
> C := WeilDescent(E, k);
> C;
Algebraic function field defined over Univariate rational function field over
GF(3) by
y^27 + 2*y^9 + y^3 + 2*y + (2*$.1^18 + 2*$.1^12 + 2*$.1^9 + 2)/($.1^9 + $.1^3 +
    1)
```

### Function Field Database

An optional database of function fields may be downloaded from the Magma website. This section defines the interface to that database. Each database is associated to a given finite field and extension degree. The supported combinations are:

**${\mathbb{F}}_2$:**
degrees 2, 3

**${\mathbb{F}}_3$:**
degree 2

**${\mathbb{F}}_4$:**
degrees 2, 3, 5

**${\mathbb{F}}_5$:**
degrees 2, 3, 4, 8

**${\mathbb{F}}_7$:**
degree 9

**${\mathbb{F}}_{11}$:**
degree 3

**${\mathbb{F}}_{13}$:**
degree 3

For each function field in the database, the following information is stored and may be used to limit the function fields of interest via the [`sub< D | : parameters>`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/database.md#constructor-alffdb-sub) constructor: The genus; the number of degree one places; the class number; and the class group.

#### Creation

<a id="function-functionfielddatabase-rngintelt-rngintelt"></a>
##### `FunctionFieldDatabase(q, d): RngIntElt, RngIntElt -> DB`

Returns a database object for the function fields of degree $d$ over ${\mathbb{F}}_q$.

<a id="constructor-alffdb-sub"></a>
##### `sub< D | : parameters>: DB -> DB`

```magma
Genus                  : RngIntElt                    Default: 
NumberOfDegreeOnePlaces: RngIntElt                    Default: 
```

Returns a sub-database of $D$, restricting (or further restricting, if $D$ is already a sub-database of the full database) the contents to those function fields satisfying the specified conditions. Note that it is not possible to “undo” restrictions with this constructor — the results are always at least as limited as $D$ is.

The parameter `Genus` may be used to restrict the search to fields with the specified genus.

The parameter `NumberOfDegreeOnePlaces` may be used to restrict the search to only those fields with the specified number of places of degree one.

#### Access

<a id="function-basefield-db"></a>
##### `BaseField(D): DB -> FldFin`

<a id="function-coefficientfield-db"></a>
##### `CoefficientField(D): DB -> FldFin`

Returns the finite field underlying each function field in the database.

<a id="function-degree-db"></a>
##### `Degree(D): DB -> RngIntElt`

Returns the degree of each function field in the database.

<a id="operation-operation-db-rngintelt"></a>
##### `# D: DB -> RngIntElt`

<a id="function-numberoffields-db"></a>
##### `NumberOfFields(D): DB -> RngIntElt`

Returns the number of function fields stored in the database.

<a id="function-functionfields-db"></a>
##### `FunctionFields(D): DB -> [ FldFunG ]`

Returns the sequence of function fields stored in the database.

<a id="example-ex-f1c514"></a>
##### `Example: Genus Distribution in the Function Field Database (ex-f1c514)`

The genus of a degree four function field is at most 6. We can see the distribution in a database by counting the size of appropriate sub-databases:

```magma
> D := FunctionFieldDatabase(5, 4);
> #D;
196380
> [ #sub<D |: Genus := g> : g in [0..6] ];
[ 60, 480, 960, 12960, 35040, 63120, 83760 ]
```

<a id="montes"></a>
<a id="montes-fld-fun"></a>
### The Montes Algorithm

The Montes algorithm can be considered as a factorization algorithm for polynomials over local fields. For a defining polynomial $f$ of a function field $K$ and a prime polynomial $p$ the Montes algorithm produces OM representations for all prime ideals of $K$ lying of over $p$, which parametrize the irreducible factors of $f$ over the $p$-adic series. The OM representation for prime ideals leads to an OM presentation of fractional ideals. The basic algorithms are explained in [[Bau14](https://docs.magma-maths.org/references.md#cite-bauch-thesis), [Bau16a](https://docs.magma-maths.org/references.md#cite-bauch2016382), [GMN13](https://docs.magma-maths.org/references.md#cite-montes-new-approach)] These OM representations allow the construction of ideals and divisors without the computation of a maximal order, which the construction of ideals of type `RngFunOrdIdl` require. The Montes algorithm can also be used to efficiently compute integral bases which can be use to construct maximal orders.

This section explains the use of the Montes Algorithm. For how to use the Montes algorithm to compute maximal orders of function fields see Section [Construction of Orders of Algebraic Function Fields](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#fldfung-max-ord), and decomposition of primes in function fields see Sections [Further Ideal Operations](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/ideals.md#fldfung-ideal-ops) and [Creation of Elements](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#fldfung-places).

<a id="function-montes-rngupolelt-rngupolelt"></a>
#### `Montes(f, p): RngUPolElt, RngUPolElt -> SeqEnum, SeqEnum, RngIntElt`

```magma
Field: BoolElt                    Default: false
```

Let $f$ be a monic polynomial with polynomial coefficients and $p$ be a prime polynomial. The Montes algorithm outputs the triple:

1. A sequence of OM representations for the $p$-adic irreducible factors of $f$.
2. A sequence of intervals with the position of the prime ideals in each disconnected tree of OM representations.
3. The $p$-index of $f$.

If the parameter `Field` is set to `true` the $\psi$ polynomial at the last level of each type of each OM representation will be computed.

<a id="example-ex-531fa2"></a>
#### `Example: Montes Algorithm for a Polynomial (ex-531fa2)`

Here is an example of how to use it:

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 +
>      (t^3 + 3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t;
> p := t;
> Montes(f,p);
[
    ,

]
[
    [ 1 ],
    [ 2 ]
]
0
```

The Montes algorithm can also be called for a function field $K$ if it is defined by a monic polynomial with polynomial coefficients.

<a id="procedure-montes-fldarith-rngelt"></a>
#### `Montes(K, p): FldArith, RngElt`

The Montes algorithm is applied to the defining polynomial of the function field $K$ at the prime $p$.

1. A sequence of OM representations for the prime ideals of $K$ is stored in ``K`PrimeIdeals[p]``.
2. The $p$-adic valuation of the index $[{\mathbb{Z}}_K:{\mathbb{Z}}[\theta]]$ is stored in ``K`LocalIndex[p]``

<a id="example-ex-bec397"></a>
#### `Example: Montes Algorithm for a Function Field (ex-bec397)`

Here’s an example of how to use it for a field :

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 +
>     (t^3 + 3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t;
> L := FunctionField(f);
> p := t+1;
> Montes(L,p);
> L`PrimeIdeals[p];
[
    OM prime ideal over t + 1
    of Algebraic function field defined over Univariate rational function field
    over GF(13) by
    x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 +
    3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
    having residual degree   1
    and ramification index   1
    Last phi polynomial is x + 12,
    OM prime ideal over t + 1
    of Algebraic function field defined over Univariate rational function field
    over GF(13) by
    x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 +
    3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
    having residual degree   4
    and ramification index   1
    Last phi polynomial is x^4 + x^3 + x^2 + x + 1
]
> L`LocalIndex[p];
0
```

<a id="procedure-sfl-omidl-rngintelt"></a>
#### `SFL(P, s): OMIdl, RngIntElt`

Perform the single factor lifting algorithm, [[GNP12](https://docs.magma-maths.org/references.md#cite-guardia20121318)], on the prime ideal $P$ in OM representation until the slope is at least $s$.

<a id="example-ex-8aed80"></a>
#### `Example: Refining an OM Prime Ideal Approximation (ex-8aed80)`

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3
> + 3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t;
> L := FunctionField(f);
> p := t+1;
> Montes(L,p);
> P := L`PrimeIdeals[p,1];
> P`Type[#P`Type]`slope;
1
> P`Type[#P`Type]`Phi; // the approximation
x + 12
> SFL(~P,10:update := true);
> P`Type[#P`Type]`slope;
10
> P`Type[#P`Type]`Phi; // the approximation
x + 6*t^9 + 2*t^8 + 11*t^7 + 3*t^6 + 2*t^5 + 2*t^4 + 11*t^3 + 3*t^2 + 12*t + 5
```

<a id="procedure-setusemontes-boolelt"></a>
#### `SetUseMontes(f): BoolElt`

<a id="procedure-setusemontes-cat-boolelt"></a>
#### `SetUseMontes(t, f): Cat, BoolElt`

Set whether the Montes algorithm is to be used for maximal order and prime decomposition calculations. The type $t$ can be `FldFun`. This setting can be overwritten by setting the `Al` parameter of the [`MaximalOrder`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/creation.md#function-fldfung-max-ord-al) and [`Decomposition`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/Places.md#function-fldfung-decomp) intrinsics to `"Montes"`.

<a id="function-getusemontes-cat"></a>
#### `GetUseMontes(t): Cat -> BoolElt`

Return whether the Montes algorithm will be used by default for computations of maximal orders and decompositions for types inheriting from type $t$, where $t$ can be `FldFun`.

<a id="procedure-setverbose-monstgelt-rngintelt-montes"></a>
#### `SetVerbose("Montes", v): MonStgElt, RngIntElt`

Set the level for verbose printing for the Montes algorithm to be $v \le 3$.

### Ideals in OM Representation

Ideals of type `RngFunOrdIdl` can have an OM representation computed from them. Similarly ideals constructed from the Montes algorithm in OM representation can be converted into ideals of type `RngFunOrdIdl`.

<a id="function-ideal-omidl"></a>
#### `Ideal(I): OMIdl -> RngOrdIdl`

Translates ideal $I$ in OM representation into a Magma representation.

<a id="function-omrepresentation-rngfunordidl"></a>
#### `OMRepresentation(I): RngFunOrdIdl -> OMIdl`

<a id="function-omrepresentation-rngordfracidl"></a>
#### `OMRepresentation(I): RngOrdFracIdl -> OMIdl`

Computes the OM representation of the ideal $I$ in a function field.

<a id="function-omrepresentation-fldarith-fldarithelt"></a>
#### `OMRepresentation(L, S): FldArith, [FldArithElt] -> OMIdl`

<a id="function-omrepresentation-fldarith-fldarithelt-2"></a>
#### `OMRepresentation(L, a): FldArith, FldArithElt -> OMIdl`

<a id="function-omrepresentation-fldarith-rngelt"></a>
#### `OMRepresentation(L, a): FldArith, RngElt -> OMIdl`

Given a function field $L$ and an element $a$ or sequence $S$ of elements in $L$, construct, in OM representation, the ideal generated by these elements.

<a id="example-ex-c49fbd"></a>
#### `Example: Converting OM Prime Ideals to Ideals (ex-c49fbd)`

```magma
> F<t> := FunctionField(Rationals());
> P<x> := PolynomialRing(F);
> L<a> := ext<F | x^2 + t>;
> Montes(L, Numerator(t + 1));
> Ideal(L`PrimeIdeals[t+1][1]);
Prime Ideal of Maximal Equation Order of L over Univariate Polynomial Ring in t
over Rational Field
Generators:
t + 1
a - 1
> OMRepresentation(L, [t^2 + 6*t + 5, (t + 5)*a + t + 5]);
OM ideal of the field Algebraic function field defined over Univariate rational
function field over Rational Field by
x^2 + t
generated by [
t^2 + 6*t + 5,
(t + 5)*a + t + 5
]

> Ideal($1);
Ideal of Maximal Equation Order of L over Univariate Polynomial Ring in t over
Rational Field
Generators:
t^2 + 6*t + 5
(-1/32*t^3 - 9/32*t^2 - 15/32*t + 25/32)*a + 1/32*t^3 + 5/32*t^2 + 7/32*t +
    35/32
```

#### Ideal Arithmetic

<a id="operation-op-plus-omidl-omidl"></a>
##### `I + J: OMIdl, OMIdl -> OMIdl`

<a id="operation-op-times-omidl-omidl"></a>
##### `I * J: OMIdl, OMIdl -> OMIdl`

<a id="operation-op-div-omidl-omidl"></a>
##### `I / J: OMIdl, OMIdl -> OMIdl`

The sum, product or quotient of ideals $I$ and $J$ in OM representation.

<a id="operation-op-pow-omidl-rngintelt"></a>
##### `I ^ n: OMIdl, RngIntElt -> OMIdl`

The $n$-th power of the ideal $I$ in OM representation.

<a id="example-ex-0a493e"></a>
##### `Example: Arithmetic of OM Ideals (ex-0a493e)`

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 +
>     (t^3 + 3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t;
> L := FunctionField(f);
> I := OMRepresentation(L,L.1+1);
> I;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
generated by [
$.1 + 1
]

> Montes(L, t + 1);
> P := L`PrimeIdeals[t+1, 1];
>      J := P^-2;
> I*J;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
having the factorization [
<t + 1, 1, -2>,
<t^4 + 10*t^3 + 4*t^2 + t + 7, 1, 1>
]

>  I^2;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
having the factorization [
<t^4 + 10*t^3 + 4*t^2 + t + 7, 1, 2>
]

> I/J;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
having the factorization [
<t + 1, 1, 2>,
<t^4 + 10*t^3 + 4*t^2 + t + 7, 1, 1>
]

> I+J;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
having the factorization  []
generated by [
1,
0
]
```

#### Ideal Predicates

<a id="function-isone-omidl"></a>
##### `IsOne(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether the ideal is generated by the $1$ element of the field.

<a id="function-iszero-omidl"></a>
##### `IsZero(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether the ideal contains only the $0$ element of the field.

<a id="operation-op-eq-omidl-omidl"></a>
##### `I eq J: OMIdl, OMIdl -> BoolElt`

Given two ideals $I$ and $J$ in OM representation returns whether these ideals are the same.

<a id="operation-op-in-rngelt-omidl"></a>
##### `a in I: RngElt, OMIdl -> BoolElt`

Given an element $a$ coercible into the field containing the ideal $I$ in OM representation return whether $a$ is contained in the ideal.

<a id="operation-op-subset-omidl-omidl"></a>
##### `I subset J: OMIdl, OMIdl -> BoolElt`

Given two ideals $I$ and $J$ in OM representation returns whether $I$ is contained in $J$.

<a id="function-isprime-omidl"></a>
##### `IsPrime(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether only the $1$ ideal and $I$ contain $I$.

<a id="function-isintegral-omidl"></a>
##### `IsIntegral(I): OMIdl -> BoolElt`

Given an ideal $I$ in OM representation returns whether all elements in the ideal $I$ are integral.

### Ideal Operations

<a id="function-pintegralbasis-omidl-rngelt"></a>
#### `pIntegralBasis(I, p): OMIdl, RngElt -> SeqEnum`

Given an ideal $I$ in OM representation and a prime element $p$ in the field containing $I$, compute a $p$-integral basis for $I$.

<a id="function-sintegralbasis-omidl-seqenum"></a>
#### `SIntegralBasis(I, S): OMIdl, SeqEnum -> SeqEnum`

<a id="function-sintegralbasis-rngordfracidl-rngintelt"></a>
#### `SIntegralBasis(I, S): RngOrdFracIdl, [RngIntElt] -> SeqEnum`

<a id="function-sintegralbasis-rngfunordidl-rngupolelt"></a>
#### `SIntegralBasis(I, S): RngFunOrdIdl, [RngUPolElt] -> SeqEnum`

Given an ideal $I$ in either representation and a sequence $S$ of primes in the field containing $I$, compute an $S$-integral basis of $I$ for the given set of primes $S$.

<a id="function-basis-omidl"></a>
#### `Basis(I): OMIdl -> SeqEnum`

```magma
HNF      : BoolElt                    Default: false
Separated: BoolElt                    Default: false
```

Given an ideal $I$ in OM representation, return a basis for $I$.

If `HNF` is set to `true` a triangular basis in Hermite form is returned.

If `Separated` is set to `true` the basis will be returned as a sequence of numerators and denominators.

<a id="example-ex-70e335"></a>
#### `Example: Integral Basis of an OM Ideal (ex-70e335)`

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^4 + (4*t + 4)*x^3 + (6*t^2 + 12*t + 6)*x^2 + (4*t^3 + 12*t^2 + 12*t
>                            + 4)*x + t^4 + 5*t^3 + 6*t^2 + 4*t + 1;
> L := FunctionField(f);
> p := t;
> I := OMRepresentation(L,[L.1,p^12]);
> pIntegralBasis(I,p);
[
    1,
    L.1 + 1,
    1/t*L.1^2 + 2/t*L.1 + 1/t,
    1/t^2*L.1^3 + 3/t^2*L.1^2 + 3/t^2*L.1 + 1/t^2
]
> pIntegralBasis(I,p:HNF:=true); // In HNF
[
    1,
    L.1,
    1/t*L.1^2 + 2/t*L.1 + 1/t,
    1/t^2*L.1^3 + 3/t^2*L.1^2 + 3/t^2*L.1 + 1/t^2
]
```

The $p$-integral basis is already the global basis :

```magma
> Basis(I);
[
    1,
    L.1 + 1,
    1/t*L.1^2 + 2/t*L.1 + 1/t,
    1/t^2*L.1^3 + 3/t^2*L.1^2 + 3/t^2*L.1 + 1/t^2
]
> Basis(I : HNF := true);
[
    1,
    L.1,
    1/t*L.1^2 + 2/t*L.1 + 1/t,
    1/t^2*L.1^3 + 3/t^2*L.1^2 + 3/t^2*L.1 + 1/t^2
]
```

<a id="function-twoelement-omidl"></a>
#### `TwoElement(I): OMIdl -> FldArithElt, FldArithElt`

Given an ideal $I$ in OM representation, return $a, b$ such that $e = a*e_1 + b*e_2$ for some $e_1, e_2$ for all $e \in I$.

<a id="function-norm-omidl"></a>
#### `Norm(I): OMIdl -> RngElt`

Given an ideal $I$ in OM representation, compute the norm of $I$.

<a id="function-valuation-fldarithelt-omidl"></a>
#### `Valuation(alpha, P : parameters): FldArithElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-fldratelt-omidl"></a>
#### `Valuation(alpha, P : parameters): FldRatElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-rngintelt-omidl"></a>
#### `Valuation(alpha, P : parameters): RngIntElt, OMIdl -> RngIntElt, FldElt`

<a id="function-valuation-rngupolelt-omidl"></a>
#### `Valuation(alpha, P : parameters): RngUPolElt, OMIdl -> RngIntElt, FldElt`

```magma
RED    : BoolElt                    Default: false,
MoreSFL: BoolElt                    Default: false
```

Compute the $P$-valuation $v$ of $\alpha$ at the prime ideal $P$.

Setting the parameter `MoreSFL` to `true` selects a single factor lifting algorithm. Setting the parameter `RED` to `true` returns also the class of $\alpha$ in $P^v/P^{(v+1)}$.

<a id="function-valuation-omidl-omidl"></a>
#### `Valuation(I, P): OMIdl, OMIdl -> RngIntElt`

Given ideals $I$ and $P$ in OM representation, return the valuation of $I$ at $P$.

<a id="operation-operation-mod-fldarithelt-omidl-fldarithelt"></a>
#### `a mod P: FldArithElt, OMIdl -> FldArithElt`

<a id="function-reduction-fldarithelt-omidl"></a>
#### `Reduction(a, P): FldArithElt, OMIdl -> FldArithElt`

<a id="function-reduction-fldarithelt-omidl-rngintelt"></a>
#### `Reduction(a, P, m): FldArithElt, OMIdl, RngIntElt -> [FldArithElt]`

Given an element $a$ of the field containing the prime ideal $P$, which is in OM representation, return $a'$ such that $a = a' + I$ and $a' \in P^0/P$.

If $m > 0$ is given then a sequence of length $m$ of elements in $P^0/P$ is returned representing the local expansion of $a$ at $P$ up to precision $m$.

<a id="function-factorization-omidl"></a>
#### `Factorization(I): OMIdl -> SeqEnum`

<a id="function-factorisation-omidl"></a>
#### `Factorisation(I): OMIdl -> SeqEnum`

Given an ideal $I$ in OM representation returns a sequence of tuples of primes $P_i$ and exponents $e_i$ such that $I = \prod_i P_i^{e_i}$.

<a id="example-ex-fbb1be"></a>
#### `Example: Creating an OM Ideal (ex-fbb1be)`

```magma
> k := GF(13);
> A<t> := PolynomialRing(k);
> Ax<x> := PolynomialRing(A);
> f := x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3
>         + 3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t;
> L := FunctionField(f);
> I := OMRepresentation(L,[1/L.1^2,12]);
> I;
OM ideal of the field Algebraic function field defined over Univariate rational
function field over GF(13) by
x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 + 3*t^2 +
3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
generated by [
(t^4 + 4*t^3 + 6*t^2 + 4*t + 1)/t^2*$.1^4 + (t^6 + 6*t^5 + 2*t^4 + 7*t^3 + 2*t^2
+ 5*t + 1)/t^2*$.1^3 + (t^8 + 8*t^7 + 2*t^6 + 4*t^5 + 5*t^4 + 3*t^3 + 7*t +
1)/t^2*$.1^2 + (t^7 + 7*t^6 + 7*t^5 + 5*t^4 + 3*t^3 + 4*t^2 + 6*t + 1)/t^2*$.1 +
(t^8 + 8*t^7 + 2*t^6 + 4*t^5 + 4*t^4 + t^3 + 12*t^2 + 7*t + 1)/t^2,
12
]

> TwoElement(I);
1
(9*t^9 + t^7 + 3*t^6 + 11*t^4 + 2*t^3 + 9*t^2 + 4*t + 1)/t^2*L.1^4 + (4*t^12 +
    8*t^11 + 5*t^10 + 9*t^9 + 2*t^8 + 10*t^7 + 12*t^6 + 6*t^5 + 5*t^4 + 12*t^3 +
    4*t^2 + 5*t + 1)/t^2*L.1^3 + (4*t^11 + 10*t^9 + 11*t^8 + 6*t^7 + 7*t^6 +
    10*t^5 + 5*t^4 + 10*t^3 + 3*t^2 + 7*t + 1)/t^2*L.1^2 + (4*t^12 + 8*t^11 +
    5*t^10 + 2*t^8 + 3*t^7 + 5*t^6 + 8*t^5 + 10*t^4 + 6*t^3 + 7*t^2 + 6*t +
    1)/t^2*L.1 + (4*t^9 + 5*t^8 + 5*t^6 + 11*t^5 + 5*t^4 + 10*t^3 + 3*t^2 + 7*t
    + 1)/t^2
> Norm(I);
1/t^2
> Factorization(I);
[
    <OM prime ideal over   t
    of Algebraic function field defined over Univariate rational function field
    over GF(13) by
    x^5 + (t^2 + 2*t + 1)*x^4 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x^3 + (t^3 +
    3*t^2 + 3*t + 1)*x^2 + (t^4 + 4*t^3 + 6*t^2 + 4*t + 1)*x + t
    having residual degree   1
    and ramification index   1
    Last phi polynomial is   x, -2>
]
> Montes(L, t+1);
> Valuation(I, L`PrimeIdeals[t][1]);
-2
> Valuation(I, L`PrimeIdeals[t+1][1]);
0
```

<a id="function-residuefield-omidl"></a>
#### `ResidueField(I): OMIdl -> Fld`

Given an ideal $I$ in OM representation returns the field $P^0/P$.

<a id="function-degree-omidl"></a>
#### `Degree(I): OMIdl -> RngIntElt`

Given a prime ideal $I$ in OM representation, contained in a function field, return the degree of the residue field over the constant field of the function field.

If $I$ is not prime then the degree of the first ideal in the factorization of $I$ is returned.

<a id="example-ex-7d7ba3"></a>
#### `Example: Degree and Residue Field of OM Ideals (ex-7d7ba3)`

```magma
> F<t> := FunctionField(Rationals());
> P<x> := PolynomialRing(F);
> L<a> := ext<F | x^2 + t>;
> Montes(L, Numerator(t)^2+1);
> L`PrimeIdeals[Numerator(t)^2+1];
[
    OM prime ideal over t^2 + 1
    of Algebraic function field defined over Univariate rational function field
    over Rational Field by
    x^2 + t
    having residual degree   2
    and ramification index   1
    Last phi polynomial is x^2 + t
]
> Degree($1[1]);
4
> ResidueField($2[1]);
Number Field with defining polynomial y^2 + $.1 over its ground field
```

### Divisors in OM representation

OM representations of ideals can be used to construct divisors without computing maximal orders which are required for the divisors of type `DivFunElt`.

For detailed information please see [[Bau14](https://docs.magma-maths.org/references.md#cite-bauch-thesis), [Bau16b](https://docs.magma-maths.org/references.md#cite-bauch2016lattices)].

#### Constructing Divisors in OM representation

<a id="function-omdivisor-omidl-omidl"></a>
##### `OMDivisor(If, Ii): OMIdl, OMIdl -> OMDiv`

Given an ideal $If$ in OM representation whose function field is marked as finite and an ideal $Ii$ in OM representation whose function field is marked as infinite, return the divisor in OM representation whose support is the places associated to the prime ideals which divide either $If$ or $Ii$ with coefficients the negative of valuation of $If$ and $Ii$ at the prime ideals.

<a id="function-omdivisor-omidl"></a>
##### `OMDivisor(I): OMIdl -> OMDiv`

Given an ideal $I$ in OM representation return the divisor in OM representation whose support is the places associated to the prime ideals which divide $I$ with coefficients the negative of the valuation of $I$ at the prime ideals.

<a id="function-omdivisor-fldfunelt"></a>
##### `OMDivisor(z): FldFunElt -> OMDiv`

Given a non zero element $z$ of a function field, return the principal divisor $\sum_P v_P(z) P$ in OM representation.

<a id="function-poledivisor-fldfunelt"></a>
##### `PoleDivisor(a): FldFunElt -> OMDiv`

Given a non zero element $a$ of a function field, return the divisor $\sum_{v_P(a)<0} -v_P(a) P$ in OM representation.

<a id="function-zerodivisor-fldfunelt"></a>
##### `ZeroDivisor(a): FldFunElt -> OMDiv`

Given a non zero element $a$ of a function field, return the divisor $\sum_{v_P(a)>0} v_P(a) P$ in OM representation.

<a id="function-omdivisorofdegreeone-fldfun"></a>
##### `OMDivisorOfDegreeOne(F): FldFun -> OMDiv`

Given a global function field $F$ returns a divisor of $F$ having degree 1.

<a id="function-referencedivisor-fldfun"></a>
##### `ReferenceDivisor(F): FldFun -> OMDiv`

Given a function field $F$, return, if set, the divisor $B$ in OM representation used to reduce a divisor $D$ of $F$ to $\tilde D$ such $D = \tilde D+kB + (a)$.

<a id="function-omdivisor-divfunelt"></a>
##### `OMDivisor(D): DivFunElt -> OMDiv`

Given a divisor $D$ of a function field of type `DivFunElt` compute an OM representation of $D$.

<a id="example-ex-42c816"></a>
##### `Example: Constructing Divisors in OM Representation (ex-42c816)`

```magma
> Fq := GF(13);
> A<t> := PolynomialRing(Fq);
> Ax<x> := PolynomialRing(A);
> f := x^5+(t+1)^16*x^4+ x^2+t^3*x+t^6;
> F := FunctionField(f);
> Montes(F,t);
> Ifin := F`PrimeIdeals[t,1];
> D := OMDivisor(Ifin);
> D;
Free repr. of divisor:  -1*P(t,1)
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)
Infinite ideal =
----------------------------------------

> Iinf := PrimesAtInfinity(F)[1];
> D := OMDivisor(Ifin,Iinf);
> D;
Free repr. of divisor:  -1*P(t,1)+( -1*P(1/t,1) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)
Infinite ideal = P(t,1)
----------------------------------------
> D := OMDivisor(F.1);
> D;
Principal divisor generated by: 12/t^6*$.1^4 + (12*t^16 + 10*t^15 + 10*t^14 +
12*t^13 + 12*t^3 + 10*t^2 + 10*t + 12)/t^6*$.1^3 + 12/t^6*$.1 + 12/t^3
----------------------------------------
Free repr. of divisor:  3*P(t,1)+ 3*P(t,2)+( 5*P(1/t,1)+ 5*P(1/t,2)+
-16*P(1/t,3) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)^-3*P(t,2)^-3
Infinite ideal = P(t,1)^-5*P(t,2)^-5*P(t,3)^16
----------------------------------------

> E := PoleDivisor(F.1);
> E;
Free repr. of divisor:  16*P(1/t,3)
----------------------------------------
Ideal repr. of divisor:
Finite ideal =
Infinite ideal = P(t,3)^-16
----------------------------------------

> C := ZeroDivisor(F.1);
> C;
Free repr. of divisor:  3*P(t,1)+ 3*P(t,2)+( 5*P(1/t,1)+ 5*P(1/t,2) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)^-3*P(t,2)^-3
Infinite ideal = P(t,1)^-5*P(t,2)^-5
----------------------------------------

> E  := Divisor(F.1);
> D  := OMDivisor(E);
> D;
Free repr. of divisor:  3*P(t,1)+ 3*P(t,2)+( 5*P(1/t,1)+ 5*P(1/t,2)+
-16*P(1/t,3) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)^-3*P(t,2)^-3
Infinite ideal = P(t,1)^-5*P(t,2)^-5*P(t,3)^16
----------------------------------------
```

#### Arithmetic with Divisors in OM representation

<a id="operation-op-times-rngintelt-omdiv"></a>
##### `k * D: RngIntElt, OMDiv -> OMDiv`

Given an integer $k$ and a divisor $D$ in OM representation return the scalar multiple $k D$.

<a id="operation-op-plus-omdiv-omdiv"></a>
##### `D1 + D2: OMDiv, OMDiv -> OMDiv`

Given divisors $D1$ and $D2$ in OM representation return their sum also in OM representation.

<a id="operation-op-minus-omdiv-omdiv"></a>
##### `D1 - D2: OMDiv, OMDiv -> OMDiv`

Given divisors $D1$ and $D2$ in OM representation return their difference also in OM representation.

<a id="function-gcd-omdiv-omdiv"></a>
##### `GCD(D1, D2): OMDiv, OMDiv -> OMDiv`

<a id="function-gcd-omdiv-omdiv-2"></a>
##### `Gcd(D1, D2): OMDiv, OMDiv -> OMDiv`

<a id="function-greatestcommondivisor-omdiv-omdiv"></a>
##### `GreatestCommonDivisor(D1, D2): OMDiv, OMDiv -> OMDiv`

Given divisors $D1$ and $D2$ in OM representation return their GCD in OM representation.

<a id="example-ex-31985e"></a>
##### `Example: Arithmetic of OM Divisors (ex-31985e)`

```magma
> Fq := GF(13);
> A<t> := PolynomialRing(Fq);
> Ax<x> := PolynomialRing(A);
> f := x^5+(t+1)^16*x^4+ x^2+t^3*x+t^6;
> F := FunctionField(f);
> Montes(F,t);
> Ifin := F`PrimeIdeals[t,1];
> D := OMDivisor(Ifin);
> E := PoleDivisor(F.1);
> C := ZeroDivisor(F.1);
> D + E;
Free repr. of divisor:  -1*P(t,1)+( 16*P(1/t,3) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)
Infinite ideal = P(t,3)^-16
----------------------------------------

> D - C;
Free repr. of divisor:  -4*P(t,1)+ -3*P(t,2)+( -5*P(1/t,1)+ -5*P(1/t,2) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)^4*P(t,2)^3
Infinite ideal = P(t,1)^5*P(t,2)^5
----------------------------------------

> 5*C;
Free repr. of divisor:  15*P(t,1)+ 15*P(t,2)+( 25*P(1/t,1)+ 25*P(1/t,2) )
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)^-15*P(t,2)^-15
Infinite ideal = P(t,1)^-25*P(t,2)^-25
----------------------------------------
> GCD(D, C);
Free repr. of divisor:  -1*P(t,1)
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)
Infinite ideal =
----------------------------------------

> GCD(D, E);
Free repr. of divisor:
----------------------------------------
Ideal repr. of divisor:
Finite ideal =
Infinite ideal =
----------------------------------------
```

#### Predicates on Divisors in OM representation

<a id="function-iseffective-omdiv"></a>
##### `IsEffective(D): OMDiv -> BoolElt`

<a id="function-ispositive-omdiv"></a>
##### `IsPositive(D): OMDiv -> BoolElt`

Given a divisor $D$ in OM representation, return whether the valuation of $D$ at every prime in its support is non negative.

<a id="function-isprincipal-omdiv"></a>
##### `IsPrincipal(D): OMDiv -> BoolElt`

Given a divisor $D$ in OM representation, return whether $D$ was constructed as the divisor of an element.

<a id="operation-op-eq-omdiv-omdiv"></a>
##### `D1 eq D2: OMDiv, OMDiv -> BoolElt`

Given divisors $D1$ and $D2$ in OM representation, return whether they are equal.

<a id="example-ex-c8e530"></a>
##### `Example: Predicates on OM Divisors (ex-c8e530)`

Continuing with the previous example :

```magma
> IsPrincipal(OMDivisor(F.1));
true
> IsPositive(OMDivisor(F.1));
false
> IsPositive(ZeroDivisor(F.1));
true
> ZeroDivisor(F.1) eq OMDivisor(F.1);
false
```

#### Other Operations on Divisors in OM representation

<a id="function-divisor-omdiv"></a>
##### `Divisor(D): OMDiv -> DivFunElt`

Given a divisor $D$ in OM representation return a divisor of type `DivFunElt`.

<a id="function-valuation-omdiv-omidl"></a>
##### `Valuation(D, P): OMDiv, OMIdl -> RngIntElt`

Given a divisor $D$ in OM representation and a prime ideal $P$ in OM representation, return the valuation of $D$ at $P$.

<a id="function-support-omdiv"></a>
##### `Support(D): OMDiv -> [OMIdl], [RngIntElt]`

Given a divisor $D$ in OM representation, return a sequence of primes at which $D$ has non zero valuation and a sequence of the valuations that $D$ has at those primes.

<a id="function-height-omdiv"></a>
##### `Height(D): OMDiv -> RngIntElt`

<a id="function-canonicalheight-omdiv"></a>
##### `CanonicalHeight(D): OMDiv -> RngIntElt`

Given a divisor $D$ in OM representation, return the sum of the products of the absolute values of the valuations returned by `Support` with the degree of the primes in the `Support` of $D$ and the maximum degree of the primes in the support of $D$.

<a id="function-degree-omdiv"></a>
##### `Degree(D): OMDiv -> RngIntElt`

Given a divisor $D$ in OM representation, return the sum of the products of the valuations returned by `Support` with the degrees of the primes in the support of $D$.

<a id="function-basis-omdiv"></a>
##### `Basis(D): OMDiv -> SeqEnum`

Given a divisor $D$ in OM representation, return a basis of the Riemann–Roch space of $D$.

<a id="function-dimension-omdiv"></a>
##### `Dimension(D): OMDiv -> RngIntElt`

Given a divisor $D$ in OM representation, return the dimension of its Riemann–Roch space.

<a id="function-reducedbasis-omdiv"></a>
##### `ReducedBasis(D): OMDiv -> SeqEnum`

Given a divisor $D$ in OM representation returns a reduced basis for the lattice corresponding to $D$, that is, the lattice given by its finite ideal.

<a id="function-semireducedbasis-omdiv"></a>
##### `SemiReducedBasis(D): OMDiv -> SeqEnum`

Given a divisor $D$ in OM representation returns a semi-reduced basis for the lattice corresponding to $D$, that is, the lattice given by its finite ideal.

<a id="function-successiveminima-omdiv"></a>
##### `SuccessiveMinima(D): OMDiv -> SeqEnum`

Given a divisor $D$ in OM representation returns the successive minima of the lattice given by the finite ideal of $D$.

<a id="function-approximatedsuccessiveminima-omdiv"></a>
##### `ApproximatedSuccessiveMinima(D): OMDiv -> SeqEnum`

Given a divisor $D$ in OM representation returns the ceiling of the successive minima of the lattice given by the finite ideal of $D$.

<a id="example-ex-e8bf40"></a>
##### `Example: Operations on OM Divisors (ex-e8bf40)`

Continuing with the previous example :

```magma
> Montes(F, t);
> Ifin := F`PrimeIdeals[t,1];
> D := OMDivisor(Ifin);
> D;
Free repr. of divisor:  -1*P(t,1)
----------------------------------------
Ideal repr. of divisor:
Finite ideal = P(t,1)
Infinite ideal =
----------------------------------------

> Support(D);
[
    OM prime ideal over   t
    of Algebraic function field defined over Univariate rational function field
    over GF(13) by
    x^5 + (t^16 + 3*t^15 + 3*t^14 + t^13 + t^3 + 3*t^2 + 3*t + 1)*x^4 + x^2 +
    t^3*x + t^6
    having residual degree   1
    and ramification index   1
    Last phi polynomial is x + 10*t^3
]
[ -1 ]
> Height(D);
1 1
> Degree(D);
-1
> Basis(OMDivisor(F.1));
[
    12/t^6*F.1^4 + (12*t^16 + 10*t^15 + 10*t^14 + 12*t^13 + 12*t^3 + 10*t^2 +
        10*t + 12)/t^6*F.1^3 + 12/t^6*F.1 + 12/t^3
]
> Dimension(OMDivisor(F.1));
1
> ReducedBasis(OMDivisor(F.1));
[
    12/t^6*F.1^4 + (12*t^16 + 10*t^15 + 10*t^14 + 12*t^13 + 12*t^3 + 10*t^2 +
        10*t + 12)/t^6*F.1^3 + 12/t^6*F.1 + 12/t^3,
    1/t^3*F.1^3 + (t^16 + 3*t^15 + 3*t^14 + t^13 + t^3 + 3*t^2 + 3*t +
        1)/t^3*F.1^2 + 1/t^3,
    12*F.1^2 + (12*t^16 + 10*t^15 + 10*t^14 + 12*t^13 + 12*t^3 + 10*t^2 + 10*t +
        12)*F.1,
    F.1 + t^16 + 3*t^15 + 3*t^14 + t^13 + t^3 + 3*t^2 + 3*t + 1,
    F.1^2 + (t^16 + 3*t^15 + 3*t^14 + t^13 + t^3)*F.1 + 10*t^18 + t^17 + 7*t^16
        + 11*t^15 + 7*t^14 + 12*t^13 + 10*t^5 + t^4 + 7*t^3 + 11*t^2 + 7*t
]
> SemiReducedBasis(OMDivisor(F.1));
[
    12/t^6*F.1^4 + (12*t^16 + 10*t^15 + 10*t^14 + 12*t^13 + 12*t^3 + 10*t^2 +
        10*t + 12)/t^6*F.1^3 + 12/t^6*F.1 + 12/t^3,
    1/t^3*F.1^3 + (t^16 + 3*t^15 + 3*t^14 + t^13 + t^3 + 3*t^2 + 3*t +
        1)/t^3*F.1^2 + 1/t^3,
    12*F.1^2 + (12*t^16 + 10*t^15 + 10*t^14 + 12*t^13 + 12*t^3 + 10*t^2 + 10*t +
        12)*F.1,
    F.1 + t^16 + 3*t^15 + 3*t^14 + t^13 + t^3 + 3*t^2 + 3*t + 1,
    F.1^2 + (t^16 + 3*t^15 + 3*t^14 + t^13 + t^3)*F.1 + 10*t^18 + t^17 + 7*t^16
        + 11*t^15 + 7*t^14 + 12*t^13 + 10*t^5 + t^4 + 7*t^3 + 11*t^2 + 7*t
]
> SuccessiveMinima(OMDivisor(F.1));
[ 0, 11/2, 11, 27/2, 16 ]
> ApproximatedSuccessiveMinima(OMDivisor(F.1));
[ 0, 6, 11, 14, 16 ]
```

<a id="function-field-class"></a>
<a id="fldfunab"></a>
## Class Field Theory for Global Function Fields

Global function fields admit a class field theory in the same way as number fields do (Chapter [Class Field Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheory/index-class-field-theory.md#fldab-main)). From a computational point of view the main difference is the use of divisors rather than ideals and the availability in general of analytical methods; see Section [Analytic Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#fldfunab-drinfeld).

Class field theory deals with the abelian extensions of a given field. In the number field case, all abelian extensions can be parameterized using more general class groups, in the case of global function fields, the same will be achieved using the divisor class group and extensions of it.

- [Ray Class Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md)
  - [`RayResidueRing(D): DivFunElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-rayresiduering-divfunelt)
  - [`RayClassGroup(D): DivFunElt → GrpAb, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)
  - [`RayClassGroupDiscLog(y, D): DivFunElt, DivFunElt → GrpAbElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-rayclassgroupdisclog-divfunelt-divfunelt)
  - [`RayClassGroupDiscLog(y, D): PlcFunElt, DivFunElt → GrpAbElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-rayclassgroupdisclog-plcfunelt-divfunelt)
  - [Example: Ray Class and Ray Residue Groups](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#example-ex-d6bc20)
- [Creation of Class Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md)
  - [`AbelianExtension(D, U): DivFunElt, GrpAb → FldFunAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-fldfunab-abelianextension)
  - [`MaximalAbelianSubfield(K): FldFunG → FldFunAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-maximalabeliansubfield-fldfung)
  - [`HilbertClassField(K, p): FldFun, PlcFunElt → FldFunAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-hilbertclassfield-fldfun-plcfunelt)
  - [`FunctionField(A): FldFunAb → FldFun`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-functionfield-fldfunab)
  - [`MaximalOrderFinite(A): FldFunAb → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-maximalorderfinite-fldfunab)
  - [`MaximalOrderInfinite(A): FldFunAb → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-maximalorderinfinite-fldfunab)
  - [Example: Creating Class Fields of a Function Field](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#example-ex-df5eee)
  - [Example: Degree 4 Class Fields with Many Places](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#example-ex-5a3adf)
- [Properties of Class Fields](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md)
  - [`Conductor(m): DivFunElt → DivFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-conductor-divfunelt)
  - [`Conductor(m, U): DivFunElt, GrpAb → DivFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-conductor-divfunelt-grpab)
  - [`Conductor(A): FldFunAb → DivFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-conductor-fldfunab)
  - [`DiscriminantDivisor(m, U): DivFunElt, GrpAb → DivFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-discriminantdivisor-divfunelt-grpab)
  - [`DiscriminantDivisor(A): FldFunAb → DivFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-discriminantdivisor-fldfunab)
  - [`DegreeOfExactConstantField(m): DivFunElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-degreeofexactconstantfield-divfunelt)
  - [`DegreeOfExactConstantField(m, U): DivFunElt, GrpAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-degreeofexactconstantfield-divfunelt-grpab)
  - [`DegreeOfExactConstantField(A): FldFunAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-degreeofexactconstantfield-fldfunab)
  - [`Genus(m, U): DivFunElt, GrpAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-genus-divfunelt-grpab)
  - [`Genus(A): FldFunAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-genus-fldfunab)
  - [`DecompositionType(m, U, p): DivFunElt, GrpAb, PlcFunElt → [<f,e>]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-decompositiontype-divfunelt-grpab-plcfunelt)
  - [`DecompositionType(A, p): FldFunAb, PlcFunElt → [<f,e>]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-decompositiontype-fldfunab-plcfunelt)
  - [`NumberOfPlacesOfDegreeOne(m, U): DivFunElt, GrpAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-numberofplacesofdegreeone-divfunelt-grpab)
  - [`NumberOfPlacesOfDegreeOne(A): FldFunAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-numberofplacesofdegreeone-fldfunab)
  - [`Degree(A): FldFunAb → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-degree-fldfunab)
  - [`BaseField(A): FldFunAb → FldFunG`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#function-basefield-fldfunab)
  - [`A eq B: FldFunAb, FldFunAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#operation-op-eq-fldfunab-fldfunab)
  - [`A subset B: FldFunAb, FldFunAb → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#operation-op-subset-fldfunab-fldfunab)
  - [`A meet B: FldFunAb, FldFunAb → FldFunAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#operation-op-meet-fldfunab-fldfunab)
  - [`A * B: FldFunAb, FldFunAb → FldFunAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/properties.md#operation-op-times-fldfunab-fldfunab)
- [The Ring of Witt Vectors of Finite Length](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md)
  - [`WittRing(F, n): Fld, RngIntElt → RngWitt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-wittring-fld-rngintelt)
  - [`W ! a: RngWitt, . → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-rngwitt)
  - [`BaseRing(W): RngWitt → Fld`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-basering-rngwitt)
  - [`BaseField(W): RngWitt → Fld`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-basefield-rngwitt)
  - [`Length(W): RngWitt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-length-rngwitt)
  - [`Eltseq(a): RngWittElt → [FldElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-eltseq-rngwittelt)
  - [`One(W): RngWitt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-one-rngwitt)
  - [`Zero(W): RngWitt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-zero-rngwitt)
  - [`W . 1: RngWitt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-operation-rngwitt-rngintelt-rngwittelt)
  - [`x in W: ., RngWitt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-in-rngwitt)
  - [`a eq b: RngWittElt, RngWittElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-eq-rngwittelt-rngwittelt)
  - [`a eq b: RngWitt, RngWitt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-eq-rngwitt-rngwitt)
  - [`a - b: RngWittElt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-minus-rngwittelt-rngintelt)
  - [`a - b: RngIntElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-minus-rngintelt-rngwittelt)
  - [`a - b: RngWittElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-minus-rngwittelt-rngwittelt)
  - [`- a: RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-operation-rngwittelt-rngwittelt)
  - [`a + b: RngWittElt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-plus-rngwittelt-rngintelt)
  - [`a + b: RngIntElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-plus-rngintelt-rngwittelt)
  - [`a + b: RngWittElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-plus-rngwittelt-rngwittelt)
  - [`a * b: RngWittElt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-times-rngwittelt-rngintelt)
  - [`a * b: RngIntElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-times-rngintelt-rngwittelt)
  - [`a * b: RngWittElt, RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-times-rngwittelt-rngwittelt)
  - [`a ^ n: RngWittElt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#operation-op-pow-rngwittelt-rngintelt)
  - [`FrobeniusMap(W): RngWitt → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-frobeniusmap-rngwitt)
  - [`FrobeniusImage(e): RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-frobeniusimage-rngwittelt)
  - [`VerschiebungMap(W): RngWitt → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-verschiebungmap-rngwitt)
  - [`VerschiebungImage(e): RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-verschiebungimage-rngwittelt)
  - [`Random(W): RngWitt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-random-rngwitt)
  - [`Random(W, n): RngWitt, RngIntElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-random-rngwitt-rngintelt)
  - [`TeichmuellerSystem(R): Any → [RngLocElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-teichmuellersystem-any)
  - [`TeichmuellerSystem(R): Rng → [RngLocElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-teichmuellersystem-rng)
  - [`LocalRing(W): RngWitt → RngLoc, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-localring-rngwitt)
  - [`ArtinSchreierMap(W): RngWitt → Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-artinschreiermap-rngwitt)
  - [`ArtinSchreierImage(e): RngWittElt → RngWittElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-artinschreierimage-rngwittelt)
  - [`FunctionField(e): RngWittElt → FldFun, Map`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-functionfield-rngwittelt)
  - [`MaximalOrderFinite(u): RngWittElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-maximalorderfinite-rngwittelt)
  - [`MaximalOrderInfinite(u): RngWittElt → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-maximalorderinfinite-rngwittelt)
  - [`SMaximalOrder(u, S): RngWittElt, [PlcFunElt] → RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-smaximalorder-rngwittelt-plcfunelt)
  - [`MaximalOrders(u): RngWittElt → RngFunOrd, RngFunOrd`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/witt-rings.md#function-maximalorders-rngwittelt)
- [The Ring of Twisted Polynomials](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md)
  - [Creation of Twisted Polynomial Rings](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#creation-of-twisted-polynomial-rings)
    - [`TwistedPolynomials(R): Rng → RngUPolTwst`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-twistedpolynomials-rng)
  - [Operations with the Ring of Twisted Polynomials](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operations-with-the-ring-of-twisted-polynomials)
    - [`One(R): RngUPolTwst → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-one-rngupoltwst)
    - [`Zero(R): RngUPolTwst → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-zero-rngupoltwst)
    - [`R eq S: RngUPolTwst, RngUPolTwst → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-eq-rngupoltwst-rngupoltwst)
    - [`BaseRing(R): RngUPolTwst → Rng`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-basering-rngupoltwst)
    - [`R . i: RngUPolTwst, RngIntElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-operation-rngupoltwst-rngintelt-rngupoltwstelt)
  - [Creation of Twisted Polynomials](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#creation-of-twisted-polynomials)
    - [`AdditivePolynomialFromRoots(x, P): RngElt, PlcFunElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-additivepolynomialfromroots-rngelt-plcfunelt)
    - [`Random(F, n): RngUPolTwst, RngIntElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-random-rngupoltwst-rngintelt)
    - [Example: Twisted and Additive Polynomials](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#example-ex-f3126f)
  - [Operations with Twisted Polynomials](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operations-with-twisted-polynomials)
    - [`A + B: RngIntElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-plus-rngintelt-rngupoltwstelt)
    - [`A + B: RngUPolTwstElt, RngIntElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-plus-rngupoltwstelt-rngintelt)
    - [`A + B: RngUPolTwstElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-plus-rngupoltwstelt-rngupoltwstelt)
    - [`A - B: RngIntElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-minus-rngintelt-rngupoltwstelt)
    - [`A - B: RngUPolTwstElt, RngIntElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-minus-rngupoltwstelt-rngintelt)
    - [`A - B: RngUPolTwstElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-minus-rngupoltwstelt-rngupoltwstelt)
    - [`- A: RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-operation-rngupoltwstelt-rngupoltwstelt)
    - [`A * B: RngUPolTwstElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-times-rngupoltwstelt-rngupoltwstelt)
    - [`A ^ n: RngUPolTwstElt, RngIntElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-pow-rngupoltwstelt-rngintelt)
    - [`A eq B: RngUPolTwstElt, RngUPolTwstElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#operation-op-eq-rngupoltwstelt-rngupoltwstelt)
    - [`IsZero(A): RngUPolTwstElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-iszero-rngupoltwstelt)
    - [`LeadingCoefficient(F): RngUPolTwstElt → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-leadingcoefficient-rngupoltwstelt)
    - [`ConstantCoefficient(F): RngUPolTwstElt → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-constantcoefficient-rngupoltwstelt)
    - [`Degree(F): RngUPolTwstElt → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-degree-rngupoltwstelt)
    - [`Quotrem(F, G): RngUPolTwstElt, RngUPolTwstElt → RngUPolTwstElt, RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-quotrem-rngupoltwstelt-rngupoltwstelt)
    - [`GCD(F, G): RngUPolTwstElt, RngUPolTwstElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-gcd-rngupoltwstelt-rngupoltwstelt)
    - [`BaseRing(F): RngUPolTwstElt → Rng`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-basering-rngupoltwstelt)
    - [`Polynomial(G): RngUPolTwstElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-polynomial-rngupoltwstelt)
    - [`SpecialEvaluate(F, x): RngUPolTwstElt, RngElt → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-specialevaluate-rngupoltwstelt-rngelt)
    - [`SpecialEvaluate(F, x): RngUPolElt, Any → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-specialevaluate-rngupolelt-any)
    - [`Eltseq(F): RngUPolTwstElt → [RngElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/twisted-polynomials.md#function-eltseq-rngupoltwstelt)
- [Analytic Theory](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md)
  - [`CarlitzModule(R, x): RngUPolTwst, RngUPolElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-carlitzmodule-rngupoltwst-rngupolelt)
  - [`CarlitzModule(R, x): RngUPolTwst, FldFunRatUElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-carlitzmodule-rngupoltwst-fldfunratuelt)
  - [Example: Abelian Extensions from the Carlitz Module](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#example-ex-15c3a6)
  - [`AnalyticDrinfeldModule(F, p): FldFun, PlcFunElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-analyticdrinfeldmodule-fldfun-plcfunelt)
  - [`Extend(D, x, p): RngUPolTwstElt, RngElt, PlcFunElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-extend-rngupoltwstelt-rngelt-plcfunelt)
  - [Example: Drinfeld Module on an Elliptic Curve](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#example-ex-cecb57)
  - [`Exp(x, p): RngElt, PlcFunElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-fldfunab-exp)
  - [`AnalyticModule(x, p): RngElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-analyticmodule-rngelt-plcfunelt)
  - [`CanNormalize(F): RngUPolTwstElt → BoolElt, RngUPolTwstElt, RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-cannormalize-rngupoltwstelt)
  - [`CanSignNormalize(F): RngUPolTwstElt → BoolElt, RngUPolTwstElt, RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-cansignnormalize-rngupoltwstelt)
  - [`AlgebraicToAnalytic(F, p): RngUPolTwstElt, PlcFunElt → RngUPolTwstElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-algebraictoanalytic-rngupoltwstelt-plcfunelt)
- [Related Functions](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md)
  - [`StrongApproximation(m, S): DivFunElt, [<PlcFunElt, FldFunElt>] → FldFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-strongapproximation-divfunelt-plcfunelt-fldfunelt)
  - [`StrongApproximation(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] → FldFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-strongapproximation-plcfunelt-fldfungelt-rngintelt)
  - [`ChineseRemainderTheorem(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] → FldFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-chineseremaindertheorem-plcfunelt-fldfungelt-rngintelt)
  - [`CRT(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] → FldFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-crt-plcfunelt-fldfungelt-rngintelt)
  - [Example: Strong Approximation](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#example-ex-8bc2d0)
  - [`NonSpecialDivisor(m): DivFunElt → DivFunElt, RngIntElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-nonspecialdivisor-divfunelt)
  - [`NormGroup(F): FldFun → DivFunElt, GrpAb`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-normgroup-fldfun)
  - [`Sign(a, p): FldFunElt, PlcFunElt → RngElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-sign-fldfunelt-plcfunelt)
  - [`ChangeModel(F, p): FldFun, PlcFunElt → FldFun`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-changemodel-fldfun-plcfunelt)
  - [`ArtinSchreierReduction(u, P): FldFunGElt, PlcFunElt → RngIntElt, FldFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/related.md#function-artinschreierreduction-fldfungelt-plcfunelt)
- [Enumeration of Places](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md)
  - [`PlaceEnumInit(K): FldFun → PlcEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenuminit-fldfun)
  - [`PlaceEnumInit(P): PlcFunElt → PlcEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenuminit-plcfunelt)
  - [`PlaceEnumInit(K, Pos): FldFun, [RngIntElt] → PlcEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenuminit-fldfun-rngintelt)
  - [`PlaceEnumCopy(R): PlcEnum → PlcEnum`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenumcopy-plcenum)
  - [`PlaceEnumPosition(R): PlcEnum → [RngIntElt]`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-fldfunab-placeenumposition)
  - [`PlaceEnumNext(R): PlcEnum → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenumnext-plcenum)
  - [`PlaceEnumCurrent(R): PlcEnum → PlcFunElt`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-placeenumcurrent-plcenum)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/bibliography.md)

### Ray Class Groups

The ray divisor class group ${\operatorname{Cl}}_m$ modulo a divisor $m$ of a global function field $K$ is defined via the following exact sequence:

$$
1 \to k^\times \to O^\times_m \to {\operatorname{Cl}}_m \to {\operatorname{Cl}}\to 1
$$

where $O^*_m$ is the group of units in the “residue ring” mod $m$, $k$ is the exact constant field of $K$ and ${\operatorname{Cl}}$ is the divisor class group of $K$. This follows the methods outlined in [[HPP97](https://docs.magma-maths.org/references.md#cite-pau2)].

<a id="function-rayresiduering-divfunelt"></a>
#### `RayResidueRing(D): DivFunElt -> GrpAb, Map`

Let $D = \sum n_iP_i$ be an effective divisor for some places $P_i$ (so $n_i>0$). The ray residue ring $R$ is the product of the unit groups of the local rings:

$$
R = O^\times_m := \prod (O_{P_i}/P_i^{n^i})^\times
$$

where $O_{P_i}$ is the valuation ring of $P_i$.

The map returned as the second return value is from the ray residue ring $R$ into the function field and admits a pointwise inverse for the computation of discrete logarithms.

<a id="function-fldfunab-rayclassgroup"></a>
#### `RayClassGroup(D): DivFunElt -> GrpAb, Map`

Let $D$ be an effective (positive) divisor. The ray class group modulo $D$ is a quotient of the group of divisors that are coprime to $D$ modulo certain principal divisors. It may be computed using the exact sequence:

$$
1 \to k^\times \to O^\times_m \to {\operatorname{Cl}}_m \to {\operatorname{Cl}}\to 1
$$

Note that in contrast to the number field case, the ray class group of a function field is infinite.

The map returned as the second return value is the map from the ray class group into the group of divisors and admits a pointwise inverse for the computation of discrete logarithms.

Since this function uses the class group of the function field in an essential way, it may be necessary for large examples to precompute the class group. Using [`ClassGroup`](https://docs.magma-maths.org/GlobalFields/AlgebraicFunctionFields/divisors.md#function-divisors-classes-classgroup) directly gives access to options that may be necessary for complicated fields.

<a id="function-rayclassgroupdisclog-divfunelt-divfunelt"></a>
#### `RayClassGroupDiscLog(y, D): DivFunElt, DivFunElt -> GrpAbElt`

<a id="function-rayclassgroupdisclog-plcfunelt-divfunelt"></a>
#### `RayClassGroupDiscLog(y, D): PlcFunElt, DivFunElt -> GrpAbElt`

Return the discrete log of the place or divisor $y$ in the ray class group modulo the divisor $D$. This is a version of the pointwise inverse of the map returned by [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup). The main difference is that using the intrinsics the values are cached, ie. if the same place (or divisor) is decomposed twice, the second time will be instantaneous.

A disadvantage is that in situations where a great number of discrete logarithms is computed for pairwise different divisors, a great amount of memory is wasted.

<a id="example-ex-d6bc20"></a>
#### `Example: Ray Class and Ray Residue Groups (ex-d6bc20)`

We will demonstrate the creation of some ray class and ray residue groups. First we have to create a function field:

```magma
> k<w> := GF(4);
> kt<t> := PolynomialRing(k);
> ktx<x> := PolynomialRing(kt);
> K := FunctionField(x^3-w*t*x^2+x+t);
```

Now, to create some divisors:

```magma
> lp := Places(K, 2);
> D1 := 4*lp[2]+2*lp[6];
> D2 := &+Support(D1);
```

And now the groups:

```magma
> G1, mG1 := RayResidueRing(D1); G1;
Abelian Group isomorphic to Z/2 + Z/2 + Z/2 + Z/2 + Z/2 + Z/2 +
Z/2 + Z/4 + Z/60 + Z/60
Defined on 10 generators
Relations:
    2*G1.1 = 0
    2*G1.2 = 0
    2*G1.3 = 0
    2*G1.4 = 0
    2*G1.5 = 0
    2*G1.6 = 0
    2*G1.7 = 0
    4*G1.8 = 0
    60*G1.9 = 0
    60*G1.10 = 0
> G2, mG2 := RayResidueRing(D2); G2;
Abelian Group isomorphic to Z/15 + Z/15
Defined on 2 generators
Relations:
    15*G2.1 = 0
    15*G2.2 = 0
```

$G_1 = O_{D_1}^\times$ should surject onto $D_2 = O_{D_2}^\times$ since $D_2 | D_1$:

```magma
> h := hom<G1 -> G2 | [G1.i@mG1@@mG2 : i in [1..Ngens(G1)]]>;
> Image(h) eq G2;
true
> [ h(G1.i) : i in [1..Ngens(G1)]];
[
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    G2.2,
    G2.1
]
```

Ray class groups are similar and can be mapped in the same way:

```magma
> R1, mR1 := RayClassGroup(D1);
> R2, mR2 := RayClassGroup(D2); R2;
Abelian Group isomorphic to Z/5 + Z/15 + Z
Defined on 3 generators
Relations:
    5*R2.1 = 0
    15*R2.2 = 0
> hR := hom<R1 -> R2 | [R1.i@mR1@@mR2 : i in [1..Ngens(R1)]]>;
> Image(hR);
Abelian Group isomorphic to Z/5 + Z/15 + Z
Defined on 3 generators in supergroup R2:
    $.1 = R2.1
    $.2 = R2.2
    $.3 = R2.3
Relations:
    5*$.1 = 0
    15*$.2 = 0
> $1 eq R2;
true
```

Note that the missing $C_3$ part in comparing $G_2$ and $R_2$ corresponds to factoring by $k^\times$. The free factor comes from the class group.

Now, let us investigate the defining exact sequence for $R_2$:

```magma
> C, mC := ClassGroup(K);
> h1 := map<K -> G2 | x :-> (K!x)@@mG2>;
> h2 := hom<G2 -> R2 | [ G2.i@mG2@@mR2 : i in [1..Ngens(G2)]]>;
> h3 := hom<R2 -> C | [ R2.i@mR2@@mC : i in [1..Ngens(R2)]]>;
> sub<G2 | [h1(x) : x in k | x ne 0]> eq Kernel(h2);
> Image(h2) eq Kernel(h3);
> Image(h3) eq C;
```

So indeed, the exact sequence property holds.

### Creation of Class Fields

Since the beginning of class field theory one of the core problems has been to find defining equations for the fields. Although most of the original proofs are essentially constructive, they rely on complicated and involved computations and thus were not suited for hand computations.

The method used here to compute defining equations is essentially the same as the one used for number fields. The main differences are due to the problem of $p$-extensions in characteristic $p$ where Artin-Schreier-Witt theory is used, and the fact that the divisor class group is infinite.

<a id="function-fldfunab-abelianextension"></a>
#### `AbelianExtension(D, U): DivFunElt, GrpAb -> FldFunAb`

Given an effective divisor $D$ and a subgroup $U$ of the ray class group, (see [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)), ${\operatorname{Cl}}_D$ of $D$ such that the quotient ${\operatorname{Cl}}_D/U$ is finite, create the extension defined by this data. Note that, at this point, no defining equations are computed.

<a id="function-maximalabeliansubfield-fldfung"></a>
#### `MaximalAbelianSubfield(K): FldFunG -> FldFunAb`

For a relative extension $K/k$ of global function fields, compute the maximal abelian subfield $K/A/k$ of $K/k$ as an abelian extension of $k$. In particular, this function compute the norm group of $K/k$ as a subgroup of a suitable ray class group.

<a id="function-hilbertclassfield-fldfun-plcfunelt"></a>
#### `HilbertClassField(K, p): FldFun, PlcFunElt -> FldFunAb`

For a global function field $K$ and a place $p$ of $K$, compute the (a) Hilbert class field of $K$ as an abelian extension of $K$. This field is characterised by being the maximal abelian unramified extension of $K$ where $p$ is totally split.

<a id="function-functionfield-fldfunab"></a>
#### `FunctionField(A): FldFunAb -> FldFun`

```magma
WithAut   : BoolElt                    Default: false
ClassField: Verbose                    Default: 3
```

Given an abelian extension of function fields as created by [`AbelianExtension`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/fields.md#function-fldfunab-abelianextension), compute defining equations for the corresponding (ray) class field.

More precisely: Let ${\operatorname{Cl}}/U = \prod {\operatorname{Cl}}/U_i$ be a decomposition of the norm group of $A$ such that the ${\operatorname{Cl}}/U_i$ are cyclic of prime power order. Then for each $U_i$ the function will compute a defining equation, thus $A$ is represented by the compositum.

If `WithAut` is `true`, the second sequence returned contains a generating automorphism for each of the fields returned as the first return value. If `WithAut` is `false`, the first (and only) return value is a function field in non-simple representation.

<a id="function-maximalorderfinite-fldfunab"></a>
#### `MaximalOrderFinite(A): FldFunAb -> RngFunOrd`

<a id="function-maximalorderinfinite-fldfunab"></a>
#### `MaximalOrderInfinite(A): FldFunAb -> RngFunOrd`

Compute a finite or an infinite maximal order of the function field of the abelian extension $A$.

This computes the maximal orders of each function field defined by each of the defining polynomials of the function field of $A$ then combines them and finishes off the computation by using the algorithm of [[BL94c](https://docs.magma-maths.org/references.md#cite-buchman-lenstra)] on the result. As the cyclic components are essentially Kummer, Artin–Schreier, or Artin–Schreier—Witt extensions the algorithms in [[Sut12](https://docs.magma-maths.org/references.md#cite-suth-max-kummer), [Sut13](https://docs.magma-maths.org/references.md#cite-suth-artin)] and [[Sut16](https://docs.magma-maths.org/references.md#cite-suth-asw)] are used to compute the maximal orders of the component function fields.

<a id="example-ex-df5eee"></a>
#### `Example: Creating Class Fields of a Function Field (ex-df5eee)`

First we have to create a function field, a divisor, and a ray class group:

```magma
> k<w> := GF(4);
> kt<t> := PolynomialRing(k);
> ktx<x> := PolynomialRing(kt);
> K := FunctionField(x^3-w*t*x^2+x+t);
> lp := Places(K, 2);
> D := 4*lp[2]+2*lp[6];
> R, mR := RayClassGroup(D);
```

Let us compute the maximal extension of exponent $5$ such that the infinite place is totally split. This means that we

- have to create a subgroup of $R$ containing the image of the infinite place
- compute the fifth power of $R$
- combine the two groups

and use this as input to the class field computation:

```magma
> inf := InfinitePlaces(K);
> U1 := sub<R | [x@@ mR : x in inf]>;
> U2 := sub<R | [5*R.i : i in [1..Ngens(R)]]>;
> U3 := sub<R | U1, U2>;
> A := AbelianExtension(D, U3);
> A;
Abelian extension of type [ 5 ]
Defined modulo 4*(t^2 + t + w, $.1 + w^2*t + 1) +
2*(t^2 + w^2*t + w^2, $.1 + w*t + w)
over Algebraic function field defined over
Univariate rational function field over GF(2^2) by
x^3 + w*t*x^2 + x + t
> FunctionField(A);
Algebraic function field defined over K by
$.1^5 + (w*K.1^2 + (w*t + w^2)*K.1 + (w^2*t^2 + t
    + w^2))*$.1^3 + ((t^2 + 1)*K.1^2 + w*t*K.1 +
    (w*t^4 + w))*$.1 + (t^3 + w*t^2 + w^2*t)*K.1^2
    + (w*t^4 + w^2*t^2 + w^2)*K.1 + t^4 + w^2*t^3
    + w^2*t + w
> E := $1;
> #InfinitePlaces(E);
10
```

Which shows that all the places in `inf` split completely. To finish we compute maximal orders of $A$.

```magma
> MaximalOrderFinite(A);
Maximal Order of Algebraic function field defined over K by
$.1^5 + (t*K.1^2 + (w*t^2 + w^2)*K.1 + (w*t^2 + t + w))*$.1^3 + ((t^2 + w)*K.1^2
    + w^2*t^3*K.1 + (t^4 + t^2 + w^2))*$.1 + (t^4 + w^2*t^2 + w*t + w)*K.1^2 +
    (w*t^5 + w*t^4 + w*t^3)*K.1 + w^2*t^5 + t^4 + w*t^3 + w^2*t + 1 over Maximal
    Equation Order of K over Univariate Polynomial Ring in t over GF(2^2)
> MaximalOrderInfinite(A);
Maximal Order of Algebraic function field defined over K by
$.1^5 + (w^2*K.1^2 + (w^2*t + 1)*K.1 + (t^2 + w*t + 1))*$.1^3 + ((w^2*t^2 +
    w^2)*K.1^2 + t*K.1 + (t^4 + 1))*$.1 + (w*t^3 + w^2*t^2 + t)*K.1^2 + (w^2*t^4
    + t^2 + 1)*K.1 + w*t^4 + t^3 + t + w^2 over Maximal Order of K over
    Valuation ring of Univariate rational function field over GF(2^2) with
    generator 1/t
> DiscriminantDivisor(A);
4*(t^2 + t + w, K.1 + w^2*t + 1) + 4*(t^2 + w^2*t + w^2, K.1 + w*t + w)
> $1 eq Divisor(Discriminant($3)) + Divisor(Discriminant($2));
true
```

<a id="example-ex-5a3adf"></a>
#### `Example: Degree 4 Class Fields with Many Places (ex-5a3adf)`

Now, suppose we still want the infinite places to split, but now we are looking for degree $4$ extensions such that the quotient of genus by number of rational places is maximal:

```magma
> q, mq := quo<R | U1>;
> l4 := [ x`subgroup : x in Subgroups(q : Quot := [4])];
> #l4;
7168
> A := [AbelianExtension(D, x@@mq) : x in l4];
> s4 := [<Genus(a), NumberOfPlacesOfDegreeOne(a), a> : a in A];
> Maximum([x[2]/x[1] : x in s4]);
16/5 15
> E := FunctionField(s4[15][3]);
> l22 := [ x`subgroup : x in Subgroups(q : Quot := [2,2])];
> #l22;
43435
```

Since this is quite a lot, we won’t investigate them here further. But we will compute the maximal orders.

```magma
> MaximalOrderFinite(s4[15][3]);
Maximal Order of E over Maximal Equation Order of K over Univariate Polynomial
Ring in t over GF(2^2)
> MaximalOrderInfinite(s4[15][3]);
Maximal Order of E over Maximal Order of K over Valuation ring of Univariate
rational function field over GF(2^2) with generator 1/t
```

### Properties of Class Fields

Let $D$ be an effective divisor and $U$ be a subgroup of the ray class group ${\operatorname{Cl}}_D$. The main existence theorem of class field theory asserts that there is exactly one function field corresponding to the quotient ${\operatorname{Cl}}_D/U$ whose Galois group is isomorphic to ${\operatorname{Cl}}_D/U$ in a canonical way.

Since the field is uniquely defined this way so are its invariants. Some of the invariants can easily be read off the groups involved. Therefore none of the functions listed here will compute a set of defining equations. They can therefore be used on very large fields.

<a id="function-conductor-divfunelt"></a>
#### `Conductor(m): DivFunElt -> DivFunElt`

Let $m$ be an effective divisor. This function computes the conductor of ${\operatorname{Cl}}_m$ which is the smallest divisor $f$ such that the projection ${\operatorname{Cl}}_m \to {\operatorname{Cl}}_f$ is surjective.

<a id="function-conductor-divfunelt-grpab"></a>
#### `Conductor(m, U): DivFunElt, GrpAb -> DivFunElt`

Let $m$ be an effective divisor and $U$ be a subgroup of the ray class group of $m$. This function computes the conductor of ${\operatorname{Cl}}_m/U$ which is the smallest divisor $f$ such that the projection $\pi:{\operatorname{Cl}}_m/U \to {\operatorname{Cl}}_f/\pi(U)$ is an isomorphism.

<a id="function-conductor-fldfunab"></a>
#### `Conductor(A): FldFunAb -> DivFunElt`

For an abelian extension $A$ of global function fields, compute its conductor, ie. the conductor of the norm group of $A$.

<a id="function-discriminantdivisor-divfunelt-grpab"></a>
#### `DiscriminantDivisor(m, U): DivFunElt, GrpAb -> DivFunElt`

Let $m$ be an effective divisor and $U$ a subgroup of ray class group such that ${\operatorname{Cl}}_m/U$ is finite. The discriminant divisor is defined as the norm of the different divisor.

<a id="function-discriminantdivisor-fldfunab"></a>
#### `DiscriminantDivisor(A): FldFunAb -> DivFunElt`

For an abelian extension $A$ of a global function field, compute its discriminant divisor, ie. the norm of the different divisor. Note that the discriminant divisor can be computed from the norm group, thus no defining equation is derived.

<a id="function-degreeofexactconstantfield-divfunelt"></a>
#### `DegreeOfExactConstantField(m): DivFunElt -> RngIntElt`

Let $m$ be an effective divisor. Since the ray class field modulo $m$ is always an infinite field extension containing the algebraic closure of the constant field, this returns $\infty$.

<a id="function-degreeofexactconstantfield-divfunelt-grpab"></a>
#### `DegreeOfExactConstantField(m, U): DivFunElt, GrpAb -> RngIntElt`

Let $m$ be an effective divisor and $U$ be a subgroup of the ray class group, (see [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)), modulo $m$. This function computes the degree of the algebraic closure of the constant field in the class field corresponding to ${\operatorname{Cl}}_m/U$. This can be infinite.

<a id="function-degreeofexactconstantfield-fldfunab"></a>
#### `DegreeOfExactConstantField(A): FldFunAb -> RngIntElt`

The degree of the exact constant field of the abelian extension $A$ of a global function field. This is the degree of the algebraic closure of the constant field of the base field of $A$ in $A$. The degree of this field can be computed from the norm group, thus no defining equation is derived.

<a id="function-genus-divfunelt-grpab"></a>
#### `Genus(m, U): DivFunElt, GrpAb -> RngIntElt`

Let $m$ be an effective divisor and $U$ be a subgroup of the ray class group, (see [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)), modulo $m$. This function computes the genus of the class field corresponding to ${\operatorname{Cl}}_m/U$.

<a id="function-genus-fldfunab"></a>
#### `Genus(A): FldFunAb -> RngIntElt`

The genus of the abelian extension $A$ of a global function field.

<a id="function-decompositiontype-divfunelt-grpab-plcfunelt"></a>
#### `DecompositionType(m, U, p): DivFunElt, GrpAb, PlcFunElt -> [<f,e>]`

Let $m$ be an effective divisor and $U$ be a subgroup of the ray class group, (see [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)), modulo $m$ such that the quotient ${\operatorname{Cl}}_m/U$ is finite. For a place $p$ this function will determine the decomposition type of the place in the extension defined by ${\operatorname{Cl}}_m/U$, i.e. it will return a sequence of pairs $\langle f, e\rangle$ containing the inertia degree and ramification index for all places above $p$.

<a id="function-decompositiontype-fldfunab-plcfunelt"></a>
#### `DecompositionType(A, p): FldFunAb, PlcFunElt -> [<f,e>]`

For an abelian extension $A$ of a global function field $k$ and a place $p$ of $k$, compute the degree and ramification index of all places $P$ lying above $p$.

<a id="function-numberofplacesofdegreeone-divfunelt-grpab"></a>
#### `NumberOfPlacesOfDegreeOne(m, U): DivFunElt, GrpAb -> RngIntElt`

Let $m$ be an effective divisor and $U$ be a subgroup of the ray class group, (see [`RayClassGroup`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/class-groups.md#function-fldfunab-rayclassgroup)), modulo $m$ such that the quotient ${\operatorname{Cl}}_m/U$ is finite. This function will compute the number of places of degree $1$ that the class field corresponding to ${\operatorname{Cl}}_m/U$ has.

<a id="function-numberofplacesofdegreeone-fldfunab"></a>
#### `NumberOfPlacesOfDegreeOne(A): FldFunAb -> RngIntElt`

For an abelian extension $A$ of global function fields, compute the number of places of $A$ that are of degree one over the constant field of the base field of $A$.

<a id="function-degree-fldfunab"></a>
#### `Degree(A): FldFunAb -> RngIntElt`

For an abelian extension $A$ of global function fields, return the degree of $A$ over its base ring.

<a id="function-basefield-fldfunab"></a>
#### `BaseField(A): FldFunAb -> FldFunG`

For an abelian extension $A$ of global function fields, return the base field, ie, the global field $k$ over which $A$ was created as an extension.

<a id="operation-op-eq-fldfunab-fldfunab"></a>
#### `A eq B: FldFunAb, FldFunAb -> BoolElt`

For two abelian extensions of the same base field, decide if they describe the same field, ie if the norm groups pulled back into a common over group, agree.

<a id="operation-op-subset-fldfunab-fldfunab"></a>
#### `A subset B: FldFunAb, FldFunAb -> BoolElt`

For two abelian extensions of the same base field, test if the first is contained in the second. This is done by comparing the norm groups in a common over group, thus defining equations are not computed.

<a id="operation-op-meet-fldfunab-fldfunab"></a>
#### `A meet B: FldFunAb, FldFunAb -> FldFunAb`

Compute the intersection of two abelian extensions of the same base field as an abelian extension.

<a id="operation-op-times-fldfunab-fldfunab"></a>
#### `A * B: FldFunAb, FldFunAb -> FldFunAb`

Compute the compositum of two abelian extensions of the same base field as an abelian extension. Since both fields are normal, the compositum is well defined and can be computed from the norm groups alone.

### The Ring of Witt Vectors of Finite Length

The ring of Witt vectors of length $n$ (type `RngWitt`) over a global function field $K$ parametrizes the cyclic extensions of $K$ of degree $p^n$ where $p$ is the characteristic of $K$. Witt vectors (type `RngWittElt`) can be defined over any ring with positive characteristic $p$. The ring of Witt vectors of length $n$ will always be of characteristic $p^n$. In the case of Witt vectors over finite fields, they can be seen as isomorphic to finite quotients of unramified $p$-adic rings.

The functionality offered here is mainly motivated by the class field theory which deals with vectors of short length only.

The Witt rings are based on code developed by David Kohel.

<a id="function-wittring-fld-rngintelt"></a>
#### `WittRing(F, n): Fld, RngIntElt -> RngWitt`

Creates the ring of Witt vectors of length $n$ where $F$ must be a field of positive characteristic.

<a id="operation-op-rngwitt"></a>
#### `W ! a: RngWitt, . -> RngWittElt`

Witt vectors of the Witt ring $W$ can be constructed from $a$ where $a$ is

- an element of the same ring
- an integer
- an element of the base ring
- a sequence of length `Length(W)` whose universe can be changed to the base ring of $W$.

<a id="function-basering-rngwitt"></a>
#### `BaseRing(W): RngWitt -> Fld`

<a id="function-basefield-rngwitt"></a>
#### `BaseField(W): RngWitt -> Fld`

The field of coefficients of the Witt ring $W$.

<a id="function-length-rngwitt"></a>
#### `Length(W): RngWitt -> RngIntElt`

The length (dimension) of the elements of the Witt ring $W$.

<a id="function-eltseq-rngwittelt"></a>
#### `Eltseq(a): RngWittElt -> [FldElt]`

The list of coefficients of the Witt vector $a$.

<a id="function-one-rngwitt"></a>
#### `One(W): RngWitt -> RngWittElt`

<a id="function-zero-rngwitt"></a>
#### `Zero(W): RngWitt -> RngWittElt`

The one and zero in the Witt ring $W$.

<a id="operation-operation-rngwitt-rngintelt-rngwittelt"></a>
#### `W . 1: RngWitt, RngIntElt -> RngWittElt`

The first non-trivial basis element of the Witt ring.

<a id="operation-op-in-rngwitt"></a>
#### `x in W: ., RngWitt -> BoolElt`

<a id="operation-op-eq-rngwittelt-rngwittelt"></a>
#### `a eq b: RngWittElt, RngWittElt -> BoolElt`

<a id="operation-op-eq-rngwitt-rngwitt"></a>
#### `a eq b: RngWitt, RngWitt -> BoolElt`

<a id="operation-op-minus-rngwittelt-rngintelt"></a>
#### `a - b: RngWittElt, RngIntElt -> RngWittElt`

<a id="operation-op-minus-rngintelt-rngwittelt"></a>
#### `a - b: RngIntElt, RngWittElt -> RngWittElt`

<a id="operation-op-minus-rngwittelt-rngwittelt"></a>
#### `a - b: RngWittElt, RngWittElt -> RngWittElt`

<a id="operation-operation-rngwittelt-rngwittelt"></a>
#### `- a: RngWittElt -> RngWittElt`

<a id="operation-op-plus-rngwittelt-rngintelt"></a>
#### `a + b: RngWittElt, RngIntElt -> RngWittElt`

<a id="operation-op-plus-rngintelt-rngwittelt"></a>
#### `a + b: RngIntElt, RngWittElt -> RngWittElt`

<a id="operation-op-plus-rngwittelt-rngwittelt"></a>
#### `a + b: RngWittElt, RngWittElt -> RngWittElt`

<a id="operation-op-times-rngwittelt-rngintelt"></a>
#### `a * b: RngWittElt, RngIntElt -> RngWittElt`

<a id="operation-op-times-rngintelt-rngwittelt"></a>
#### `a * b: RngIntElt, RngWittElt -> RngWittElt`

<a id="operation-op-times-rngwittelt-rngwittelt"></a>
#### `a * b: RngWittElt, RngWittElt -> RngWittElt`

<a id="operation-op-pow-rngwittelt-rngintelt"></a>
#### `a ^ n: RngWittElt, RngIntElt -> RngWittElt`

<a id="function-frobeniusmap-rngwitt"></a>
#### `FrobeniusMap(W): RngWitt -> Map`

The Frobenius map on the Witt ring $W$ which is defined to be the map sending vectors to vectors where every coefficient is raised to the $p$th power.

<a id="function-frobeniusimage-rngwittelt"></a>
#### `FrobeniusImage(e): RngWittElt -> RngWittElt`

Computes the image of the Witt vector $e$ under the Frobenius map.

<a id="function-verschiebungmap-rngwitt"></a>
#### `VerschiebungMap(W): RngWitt -> Map`

The verschiebungs map of the Witt ring $W$, i.e. shift all coefficients one position to the right and pad with a zero in front.

<a id="function-verschiebungimage-rngwittelt"></a>
#### `VerschiebungImage(e): RngWittElt -> RngWittElt`

Computes the image of the Witt vector $e$ under the verschiebung map.

<a id="function-random-rngwitt"></a>
#### `Random(W): RngWitt -> RngWittElt`

For finite Witt rings, i.e. Witt rings defined over finite fields, return a random element.

<a id="function-random-rngwitt-rngintelt"></a>
#### `Random(W, n): RngWitt, RngIntElt -> RngWittElt`

For Witt rings where the base field admits a random function with size restriction $n$.

<a id="function-teichmuellersystem-any"></a>
#### `TeichmuellerSystem(R): Any -> [RngLocElt]`

<a id="function-teichmuellersystem-rng"></a>
#### `TeichmuellerSystem(R): Rng -> [RngLocElt]`

A Teichmüller system for the local ring $R$, ie. a system of representatives for the residue class field of $R$ that is closed under multiplication.

<a id="function-localring-rngwitt"></a>
#### `LocalRing(W): RngWitt -> RngLoc, Map`

Any ring $W$ of Witt vectors of finite length over a finite field is isomorphic to some unramified local ring. This intrinsic will create the corresponding local ring and the embedding into it.

<a id="function-artinschreiermap-rngwitt"></a>
#### `ArtinSchreierMap(W): RngWitt -> Map`

Returns the map $x \mapsto F(x) - x$ where $F$ is the Frobenius map of the Witt ring $W$.

<a id="function-artinschreierimage-rngwittelt"></a>
#### `ArtinSchreierImage(e): RngWittElt -> RngWittElt`

This function computes the image of the Witt vector $e$ under the Artin-Schreier map.

<a id="function-functionfield-rngwittelt"></a>
#### `FunctionField(e): RngWittElt -> FldFun, Map`

```magma
WithAut: BoolElt                    Default: true
Check  : BoolElt                    Default: false
Abs    : BoolElt                    Default: false
```

A Witt vector $e = (e_1, \ldots, e_n)$ of length $n$ over $k$ where $e_1$ is not in the image of the Artin-Schreier map $e_1 \not\in \{x^p-x : x \in k\}$ defines a cyclic extension $K/k$ of degree $p^n$. This function will compute $K$.

If `WithAut` is `true` in addition to $K$ it will compute a generating automorphism and return it as second return value.

If `Abs` is `true`, the function will compute a $K$ as a single step extension of $k$, otherwise, $K$ will be constructed as a series of $n$ Artin-Schreier extensions.

If `Check` is `true`, it will be verified that the extension is of degree $p^n$. In particular the restrictions on $e_1$ are tested.

<a id="function-maximalorderfinite-rngwittelt"></a>
#### `MaximalOrderFinite(u): RngWittElt -> RngFunOrd`

<a id="function-maximalorderinfinite-rngwittelt"></a>
#### `MaximalOrderInfinite(u): RngWittElt -> RngFunOrd`

Given a Witt vector $u$ defined over a function field $F$ return the finite, respectively infinite, maximal order of the degree $p^n$ Artin–Schreier–Witt extension of $F$ defined by $u$. This uses the algorithm described in [[Sut16](https://docs.magma-maths.org/references.md#cite-suth-asw)].

<a id="function-smaximalorder-rngwittelt-plcfunelt"></a>
#### `SMaximalOrder(u, S): RngWittElt, [PlcFunElt] -> RngFunOrd`

Given a Witt vector $u$ of length $n$ defined over a function field $F$ of characteristic $p$ and a set $S$ of places of $F$ all contained in the same maximal order ${\mathbb{Z}}_F$ of $F$, return the minimal $S$-maximal order of the degree $p^n$ Artin–Schreier–Witt extension $E$ of $F$ defined by $u$ containing the equation order of $E$ which extends ${\mathbb{Z}}_F$. This uses the algorithm described in [[Sut16](https://docs.magma-maths.org/references.md#cite-suth-asw)].

<a id="function-maximalorders-rngwittelt"></a>
#### `MaximalOrders(u): RngWittElt -> RngFunOrd, RngFunOrd`

Given a Witt vector $u$ over a function field $F$ compute the finite and infinite maximal orders of the Artin–Schreier–Witt extension $F(\wp^-1(u))$ where $\wp$ is the Artin–Schreier operator. This uses the algorithm described in [[Sut16](https://docs.magma-maths.org/references.md#cite-suth-asw)].

### The Ring of Twisted Polynomials

The ring of twisted polynomials plays a core role in the analytic side of class field theory of global function fields. Twisted polynomials can be viewed as additive polynomials where the multiplication is the composition of two polynomials. Alternatively, they are the ring of polynomials in the Frobenius automorphism of the base field as indeterminate and multiplication defined in terms of application of the corresponding endomorphism. Thus Twisted polynomials have two natural polynomial representations:

\- as (arbitrary) polynomials in $F$, the Frobenius automorphism

\- as additive polynomials, ie. as polynomials where the only terms are $T^{q^i}$.

In Magma the first representation is used (as the degrees are lower), but the second can always be obtained by converting to a polynomial.

Since every endomorphism in positive characteristic can be represented by an additive polynomial (or an additive power series), this section can also be viewed as making the endomorphism ring accessible.

In Magma the ring of twisted polynomials is of type `RngUPolTwst` and individual elements are of type `RngUPolTwstElt`. Twisted polynomial rings can be created over any ring of characteristic $p>0$. They are left euclidean and therefore left PIR.

#### Creation of Twisted Polynomial Rings

<a id="function-twistedpolynomials-rng"></a>
##### `TwistedPolynomials(R): Rng -> RngUPolTwst`

```magma
q: RngIntElt                    Default: false
```

Given a ring $R$ of characteristic $p>0$, create the ring of twisted polynomials over $R$. If `q` is given it has to be a power of the characteristic $p$, it defaults to $q := p$. The multiplication in this ring $R<F>$ is defined by $rF = Fr^q$ for all $r\in R$. Elements if $R<F>$ are represented as polynomials in $F$.

#### Operations with the Ring of Twisted Polynomials

<a id="function-one-rngupoltwst"></a>
##### `One(R): RngUPolTwst -> RngUPolTwstElt`

For a ring $R$ of twisted polynomials return the polynomial representing $1$.

<a id="function-zero-rngupoltwst"></a>
##### `Zero(R): RngUPolTwst -> RngUPolTwstElt`

For a ring $R$ of twisted polynomials return the polynomial representing $0$.

<a id="operation-op-eq-rngupoltwst-rngupoltwst"></a>
##### `R eq S: RngUPolTwst, RngUPolTwst -> BoolElt`

For two rings of twisted polynomials $R$ and $S$ test if they are equal, that is if the underlying polynomial ring is considered equal by Magma. Generically that means to test if the base rings of $R$ and $S$ coincide.

<a id="function-basering-rngupoltwst"></a>
##### `BaseRing(R): RngUPolTwst -> Rng`

The coefficient ring of the ring $R$ of twisted polynomials.

<a id="operation-operation-rngupoltwst-rngintelt-rngupoltwstelt"></a>
##### `R . i: RngUPolTwst, RngIntElt -> RngUPolTwstElt`

For a ring of twisted polynomials $R$ and an integer $i$ which should be $1$, return the transcendental element of $R$.

#### Creation of Twisted Polynomials

Apart from creation from polynomials directly, twisted polynomial can also be created by specifying some finite ${\mathbb{F}}_q$-vector space where the corresponding additive polynomial will have its roots.

<a id="function-additivepolynomialfromroots-rngelt-plcfunelt"></a>
##### `AdditivePolynomialFromRoots(x, P): RngElt, PlcFunElt -> RngUPolTwstElt`

```magma
InfBound: RngIntElt                    Default: 5
Map     : Map                          Default: id
Class   : DivFunElt                    Default: 0
Limit   : RngIntElt                    Default: Infinity()
Scale   : RngElt                       Default: false
```

An additive polynomial is characterized by the fact that its set of zeros forms an ${\mathbb{F}}_q$ vector space. Conversely, given an ${\mathbb{F}}_p$-vector space $M$ in $R$ there is essentially one additive polynomial that has $M$ as its set of roots. Given a place $P$ and a ring element $x$, this function computes the additive polynomial with roots $L($`InfBound`$P)$, evaluated at $x$, ie. the module $M$ is a Riemann-Roch space. By choosing $x$ to be for example a transcendental element in a polynomial ring, the actual additive polynomial can be computed. If the parameter `Map` is given, the elements of the Riemann-Roch space are first mapped by this map before the polynomial is computed, thus allowing the creation of polynomials over the completion of a function field. If the parameter `Limit` is given, the polynomial is reduced modulo $x^{\tt Limit}$. If `Class` is set to a non-zero divisor, instead of $L(nP)$, the Riemann-Roch space $L(nP+$`Class`$)$ is used. If `Scale` is set to a ring element that is either compatible with elements of the Riemann-Roch space or with elements in the codomain of the map, the module is scaled as well, thus allowing for normalization.

<a id="function-random-rngupoltwst-rngintelt"></a>
##### `Random(F, n): RngUPolTwst, RngIntElt -> RngUPolTwstElt`

For $F$ the ring of twisted polynomials over a finite ring (ie. a ring that supports the generation of random elements, this function will return a polynomial of degree $n-1$ with randomly chosen coefficients.

<a id="example-ex-f3126f"></a>
##### `Example: Twisted and Additive Polynomials (ex-f3126f)`

```magma
> Fq<w> := GF(4);
> k<t> := RationalFunctionField(Fq);
> R := TwistedPolynomials(k:q := 4);
> R![1,1];
T_4 + 1
> R![w*t, 1];
T_4 + w*t
> $2 * $1;
T_4^2 + (w*t^4 + 1)*T_4 + w*t
> $2 * $3;
T_4^2 + (w*t + 1)*T_4 + w*t
> p := Places(k, 1)[2];
> a := AdditivePolynomialFromRoots(PolynomialRing(k).1, p
>          :InfBound := 2);
> a;
T_4^3 + ($.1^96 + $.1^84 + $.1^81 + $.1^72 + $.1^69 + $.1^66 + $.1^60
+ $.1^57 + $.1^54 + $.1^51 + $.1^48 + $.1^45 + $.1^42 + $.1^39 +
$.1^36 + $.1^30 + $.1^27 + $.1^24 + $.1^15 + $.1^12 + 1)/$.1^96*T_4^2
+ ($.1^96 + $.1^93 + $.1^90 + $.1^87 + $.1^72 + $.1^69 + $.1^66 +
$.1^63 + $.1^33 + $.1^30 + $.1^27 + $.1^24 + $.1^9 + $.1^6 + $.1^3 +
1)/$.1^108*T_4 + ($.1^90 + $.1^87 + $.1^84 + $.1^81 + $.1^78 + $.1^60
+ $.1^57 + $.1^54 + $.1^51 + $.1^48 + $.1^42 + $.1^39 + $.1^36 +
$.1^33 + $.1^30 + $.1^12 + $.1^9 + $.1^6 + $.1^3 + 1)/$.1^108
> R, mR := RiemannRochSpace(2*p);
> b := Polynomial(a);
> [ Evaluate(b, mR(x)) eq 0 : x in R];
[ true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true ]
> AdditivePolynomialFromRoots(PolynomialRing(k).1, p:InfBound := 2,
>   Map := func<x|Expand(x, p:RelPrec := 100)>);
T_4^3 + ($.1^-96 + $.1^-84 + $.1^-81 + $.1^-72 + $.1^-69 + $.1^-66 +
$.1^-60 + $.1^-57 + $.1^-54 + $.1^-51 + $.1^-48 + $.1^-45 + $.1^-42 +
$.1^-39 + $.1^-36 + $.1^-30 + $.1^-27 + $.1^-24 + $.1^-15 + $.1^-12 +
1 + O($.1^4))*T_4^2 + ($.1^-108 + $.1^-105 + $.1^-102 + $.1^-99 +
$.1^-84 + $.1^-81 + $.1^-78 + $.1^-75 + $.1^-45 + $.1^-42 + $.1^-39 +
$.1^-36 + $.1^-21 + $.1^-18 + $.1^-15 + $.1^-12 + O($.1^-8))*T_4 +
$.1^-108 + $.1^-105 + $.1^-102 + $.1^-99 + $.1^-96 + $.1^-78 + $.1^-75
+ $.1^-72 + $.1^-69 + $.1^-66 + $.1^-60 + $.1^-57 + $.1^-54 + $.1^-51
+ $.1^-48 + $.1^-30 + $.1^-27 + $.1^-24 + $.1^-21 + $.1^-18 +
O($.1^-8)
```

#### Operations with Twisted Polynomials

<a id="operation-op-plus-rngintelt-rngupoltwstelt"></a>
##### `A + B: RngIntElt, RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-op-plus-rngupoltwstelt-rngintelt"></a>
##### `A + B: RngUPolTwstElt, RngIntElt -> RngUPolTwstElt`

<a id="operation-op-plus-rngupoltwstelt-rngupoltwstelt"></a>
##### `A + B: RngUPolTwstElt, RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-op-minus-rngintelt-rngupoltwstelt"></a>
##### `A - B: RngIntElt, RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-op-minus-rngupoltwstelt-rngintelt"></a>
##### `A - B: RngUPolTwstElt, RngIntElt -> RngUPolTwstElt`

<a id="operation-op-minus-rngupoltwstelt-rngupoltwstelt"></a>
##### `A - B: RngUPolTwstElt, RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-operation-rngupoltwstelt-rngupoltwstelt"></a>
##### `- A: RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-op-times-rngupoltwstelt-rngupoltwstelt"></a>
##### `A * B: RngUPolTwstElt, RngUPolTwstElt -> RngUPolTwstElt`

<a id="operation-op-pow-rngupoltwstelt-rngintelt"></a>
##### `A ^ n: RngUPolTwstElt, RngIntElt -> RngUPolTwstElt`

<a id="operation-op-eq-rngupoltwstelt-rngupoltwstelt"></a>
##### `A eq B: RngUPolTwstElt, RngUPolTwstElt -> BoolElt`

<a id="function-iszero-rngupoltwstelt"></a>
##### `IsZero(A): RngUPolTwstElt -> BoolElt`

<a id="function-leadingcoefficient-rngupoltwstelt"></a>
##### `LeadingCoefficient(F): RngUPolTwstElt -> RngElt`

For a twisted polynomial $F$, return the leading coefficient as an element of the coefficient ring.

<a id="function-constantcoefficient-rngupoltwstelt"></a>
##### `ConstantCoefficient(F): RngUPolTwstElt -> RngElt`

For a twisted polynomial $F$, return the constant coefficient as an element of the coefficient ring.

<a id="function-degree-rngupoltwstelt"></a>
##### `Degree(F): RngUPolTwstElt -> RngIntElt`

For a twisted polynomial $F$, return its degree. The degree of the underlying additive polynomial is $q$ times the degree of the twisted polynomial.

<a id="function-quotrem-rngupoltwstelt-rngupoltwstelt"></a>
##### `Quotrem(F, G): RngUPolTwstElt, RngUPolTwstElt -> RngUPolTwstElt, RngUPolTwstElt`

For twisted polynomials $F$ and $G$ in the same ring, perform a right division with remainder: This function computes $Q$ and $R$ such that $F = Q*G+R$ and the degree of $R$ is less than the degree of $G$. In general, unless the coefficient ring is algebraically closed or perfect, there is no left quotient, so the ring of twisted polynomials is a left-PID, but no right-PID.

<a id="function-gcd-rngupoltwstelt-rngupoltwstelt"></a>
##### `GCD(F, G): RngUPolTwstElt, RngUPolTwstElt -> RngUPolTwstElt`

For twisted polynomials $F$ and $G$ in the same ring, compute the creates common right divisor of $F$ and $G$, ie a twisted polynomial $H$ such that $F = f_1 H$ and $G = f_2 H$ for some twisted polynomials $f_1$ and $f_2$ and such that $H$ is monic of maximal degree.

<a id="function-basering-rngupoltwstelt"></a>
##### `BaseRing(F): RngUPolTwstElt -> Rng`

For a twisted polynomial $F$, return the coefficient ring of $F$, ie. the ring where all the coefficients of $F$ are from.

<a id="function-polynomial-rngupoltwstelt"></a>
##### `Polynomial(G): RngUPolTwstElt -> RngUPolElt`

For a twisted polynomial $G$, return the corresponding additive polynomial by replacing the transcendental element $F$ by $T^q$ and in general $F^i$ by $T^{q^i}$ for $i=0$, $\ldots$, degree of $G$.

<a id="function-specialevaluate-rngupoltwstelt-rngelt"></a>
##### `SpecialEvaluate(F, x): RngUPolTwstElt, RngElt -> RngElt`

For a twisted polynomial $F$, return the result of the evaluation of the corresponding additive polynomial at the point $x$.

<a id="function-specialevaluate-rngupolelt-any"></a>
##### `SpecialEvaluate(F, x): RngUPolElt, Any -> RngElt`

For a univariate polynomial $F$, return the evaluation of $F$ at $x$. This function in particular is optimized for sparse polynomials (for example additive polynomials) and imprecise coefficients. In the general case, a call to `Evaluate` will be faster.

<a id="function-eltseq-rngupoltwstelt"></a>
##### `Eltseq(F): RngUPolTwstElt -> [RngElt]`

For a twisted polynomial $F$, return a sequence containing its coefficients.

<a id="drinfeld"></a>
<a id="fldfunab-drinfeld"></a>
### Analytic Theory

Probably the most significant difference between the class field theories for number fields and function fields is the fact that function fields allow an analytic description of abelian extensions in general where number fields (currently) only admit the analytical view for extensions of the rationals (cyclotomic fields) and imaginary quadratic fields (CM-theory).

The analytic description is based on Drinfeld-modules of rank 1 (or in the case of the rational function field the Carlitz-module). Informally, a Drinfeld module is a representation of some (infinite) maximal order of a function field into the ring of additive polynomials over some appropriate ring containing the original field. Similar to CM-theory, abelian extensions are then generated by adjoining torsion points under this action.

<a id="function-carlitzmodule-rngupoltwst-rngupolelt"></a>
#### `CarlitzModule(R, x): RngUPolTwst, RngUPolElt -> RngUPolTwstElt`

<a id="function-carlitzmodule-rngupoltwst-fldfunratuelt"></a>
#### `CarlitzModule(R, x): RngUPolTwst, FldFunRatUElt -> RngUPolTwstElt`

For a rational function field $k = {\mathbb{F}}_q(t)$ and a polynomial $f$ in $k[t]$, compute the image of $f$ under the Carlitz module as an element in the ring of twisted polynomials $R$. Specifically, the Carlitz module is the representation induced by sending $t$ to $F+t$ where $F$ is the transcendental element of $R$, the Frobenius of $k$. As ${\mathbb{F}}_q[t]$ is freely generated by $t$, this defines a homomorphism (a representation) of ${\mathbb{F}}_q[t]$ into the twisted polynomials over $k$.

<a id="example-ex-15c3a6"></a>
#### `Example: Abelian Extensions from the Carlitz Module (ex-15c3a6)`

We demonstrate how the Carlitz-module can be used to define abelian extensions of the rational function field.

```magma
> Fq<w> := GF(4);
> k<t> := RationalFunctionField(Fq);
> R<T> := TwistedPolynomials(k:q := 4);
```

Suppose we want to create the Ray-class field modulo $p := t^2+t+w$, ie we want to find an abelian extension unramified outside $p$ and the infinite place.

```magma
> p := t^2+t+w;
> P := CarlitzModule(R, p);
> F := Polynomial(P);
> Factorisation(F);
[
    <T, 1>,
    <T^15 + (t^4 + t + 1)*T^3 + t^2 + t + w, 1>
]
> K := FunctionField($1[2][1]);
> a := Support(DifferentDivisor(K));
> a[1];
(t^2 + t + w, K.1)
> [ IsFinite(x) : x in a];
[ true, false, false, false, false, false ]
> RamificationIndex(a[1]);
15
```

So, this shows that the field has the ramification behaviour we wanted. However, the Carlitz-module will give us more information: We will demonstrate that the automorphism group of $K$ is isomorphic to the unit group of ${\mathbb{F}}_q[t]/p$ under this module.

```magma
> q, mq := quo<Integers(k)|p>;
> au := func<X|Evaluate(Polynomial(CarlitzModule(R, X)), K.1)>;
> [ <IsUnit(x), Evaluate(DefiningPolynomial(K), au(x@@mq)) eq 0>
>                   : x in q];
[ <true, true>, <true, true>, <true, true>, <true, true>, <true,
true>, <true, true>, <true, true>, <true, true>, <true, true>, <true,
true>, <true, true>, <true, true>, <true, true>, <true, true>, <true,
true>, <false, false> ]
```

Now we try to create the same field using the algebraic class field machinery:

```magma
> D, U := NormGroup(K);
> Conductor(D, U);
($.1^2 + $.1 + w) + (1/$.1)
```

So this also shows that $K$ is ramified exactly at $p$ and the infinite places and, since the multiplicity is one, tamely ramified at both places.

```magma
> A := AbelianExtension(D, U);
> F := FunctionField(A);
> F;
Algebraic function field defined over Algebraic function field defined
over GF(2^2) by
$.2 + 1 by
$.1^3 + ($.1^2 + $.1 + w)^2
$.1^5 + w^2*$.1^3 + w*$.1 + (w^2*$.1^4 + w^2*$.1^2 + 1)/($.1^6 + $.1^5
    + w^2*$.1^4 + $.1^3 + $.1^2 + w^2*$.1 + 1)
> HasRoot(Polynomial(K, DefiningPolynomials(F)[1]));
true K.1^10 + (t^2 + t + w)*K.1^4 + (t^2 + t + w)*K.1
> HasRoot(Polynomial(K, DefiningPolynomials(F)[2]));
true w/(t^2 + t + w)*K.1^12 + (w*t^2 + w*t + 1)/(t^2 + t + w)*K.1^6 +
    w*K.1^3
```

<a id="function-analyticdrinfeldmodule-fldfun-plcfunelt"></a>
#### `AnalyticDrinfeldModule(F, p): FldFun, PlcFunElt -> RngUPolTwstElt`

For $F$ a global function field and $p$ a place, compute an algebraic description of “the” Drinfeld module of rank $1$ defined for the ring of functions integral outside $p$. More precisely, let $R$ be the ring of functions integral outside $p$, ie. functions having their only poles at $R$. In Magma this is represented by changing the representation of the function field so that $p$ is the only infinite place. Then $R$ becomes simply the finite maximal order. Furthermore, let $C$ be the completion of $F$ at $p$ and $\tilde C$ be the closure of the algebraic closure of $C$, thus $D$ will play the role of the complex numbers in this theory, while $C$ is closely related to the reals. By means of mapping $R$ to its image in $D\subset C$, we obtain a lattice $\Lambda$ of rank 1. Related to this lattice are certain exponential functions (analytic functions where the set of zeros is $\Lambda$). The transformation behaviour of such functions can be used to define a map from $R$ to the endomorphisms of $C$, represented as additive (twisted) polynomials. In particular, under suitable normalisation, the lattice $\Lambda$ as defined above, the transformation behaviour can be realised over the Hilbert-class field of $F$. Since a Drinfeld module is uniquely defined by specifying a single image of a non-constant element of $R$, this function returns a non-constant (as first return value) and the image as a twisted polynomial over the Hilbert-class field as a second. In case the place is of degree one, the Drinfeld module will also be sign-normalized.

<a id="function-extend-rngupoltwstelt-rngelt-plcfunelt"></a>
#### `Extend(D, x, p): RngUPolTwstElt, RngElt, PlcFunElt -> RngUPolTwstElt`

Given $D$, the image of a non-constant element under a Drinfeld module for the ring $R$ of functions integral outside $p$, an element $x$ in $R$, compute the image of $x$.

<a id="example-ex-cecb57"></a>
#### `Example: Drinfeld Module on an Elliptic Curve (ex-cecb57)`

Although the code is not restricted to genus 1 (or 2) and even though hyperelliptic function fields can be handled in a more direct fashion, we will demonstrate the computation of a Drinfeld module on an elliptic curve.

We begin by defining a curve.

```magma
> k<w> := GF(4);
> kt<t> := PolynomialRing(k);
> kty<y> := PolynomialRing(kt);
> F := FunctionField(y^3+w*t^5+w*t);
> Genus(F);
1
> ClassNumber(F);
3
```

Now, to define a Drinfeld module, we need to single out an “infinite” place:

```magma
> p := InfinitePlaces(F)[1];
> Degree(p);
1
```

Since the place $p$ is of degree $1$, our Drinfeld module will be sign-normalised.

```magma
> A, D := AnalyticDrinfeldModule(F, p);
> H<h> := CoefficientRing(D);
> A;
w^2/(x + 1)*F.1
> D;
T_4^2 + ((w*x^5 + 1)/(x^5 + x)*$.1^2*h^2 + (w^2*x^5 + w^2*x^4 + w^2*x
+ 1)/(x^4 + x^3 + x^2 + x)*F.1^2*h + (x^4 + x^2 + w)/(x^2 +
1)*$.1^2)*T_4 + w^2/(x + 1)*F.1
```

So, the Drinfeld module is uniquely determined by the image of a single non-constant ($A$) which is chosen to have maximal valuation at $p$ and sign $1$.

The values of the Drinfeld module are defined over $H$ which is the Hilbert-class field of $F$, ie. the maximal abelian unramified extension where $p$ is completely split.

```magma
> Sign(A, p);
1
> Valuation(A, p);
-2
```

To compute the value of “the” Drinfeld module of a different element we use `Extend`:

```magma
> b := F!t;
> Extend(D, b, p);
w*T_4^3 + ((w*x^20 + w*x^19 + w*x^18 + w*x^17 + w*x^16 + w*x^15 +
w*x^14 + w*x^13 + w*x^12 + w*x^11 + w*x^10 + w*x^9 + w*x^8 + w*x^7 +
w*x^6 + w*x^5 + w*x^4 + w*x^3 + w*x^2 + w*x + w)/(x^4 + x^3 + x^2 +
x)*$.1^2*h^2 + (w^2*x^20 + w^2*x^19 + w^2*x^16 + w^2*x^15 + w^2*x^4 +
w^2*x^3 + w^2)/(x^3 + x^2 + x + 1)*$.1^2*h + (x^20 + x^18 + x^12 +
x^10 + w*x^4 + w*x^2 + w^2)/(x^2 + 1)*$.1^2)*T_4^2 + ((w*x^5 + w^2*x^3
+ w^2*x^2 + x + w)/(x^2 + 1)*$.1*h^2 + (w^2*x^5 + w^2*x^4 + x^3 +
w)/(x + 1)*$.1*h + (x^5 + w^2*x^3 + w*x^2 + w^2*x)*$.1)*T_4 + x
```

To compute a “Ray-class field” from here we can use the following:

```magma
> P := Places(F, 2)[1];
> a,b := TwoGenerators(P);
> GCD(Extend(D, a, p), Extend(D, b, p));
T_4^2 + ((w*x^5 + 1)/(x^5 + x)*$.1^2*h^2 + (w^2*x^5 + w^2*x^4 + w^2*x
+ 1)/(x^4 + x^3 + x^2 + x)*$.1^2*h + (x^4 + x^2 + w)/(x^2 +
1)*$.1^2)*T_4 + w^2/(x + 1)*$.1 + w^2
> Polynomial($1);
T_4^16 + ((w*x^5 + 1)/(x^5 + x)*F.1^2*h^2 + (w^2*x^5 + w^2*x^4 + w^2*x
    + 1)/(x^4 + x^3 + x^2 + x)*F.1^2*h + (x^4 + x^2 + w)/(x^2 +
    1)*F.1^2)*T_4^4 + (w^2/(x + 1)*F.1 + w^2)*T_4
> R := FunctionField($1 div Parent($1).1);
> R;
Algebraic function field defined over H by
T_4^15 + ((w*x^5 + 1)/(x^5 + x)*F.1^2*h^2 + (w^2*x^5 + w^2*x^4 + w^2*x
    + 1)/(x^4 + x^3 + x^2 + x)*F.1^2*h + (x^4 + x^2 + w)/(x^2 +
    1)*F.1^2)*T_4^3 + w^2/(x + 1)*F.1 + w^2
```

This should be an abelian extension over $F$, ramified only at $p$ and $P$. So let’s try to verify that:

```magma
> f := MinimalPolynomial(R.1, F);
> Degree(f);
45
> Ra := FunctionField(f:Check := false);
> NormGroup(Ra:Cond := 1*p+P);
(1/x, 1/x^2*F.1) + (x^2 + x + w^2, F.1 + x + 1)
Abelian Group isomorphic to Z
Defined on 1 generator in supergroup:
    $.1 = 2*$.1 + 3*$.2 + $.3 (free)
> D, sub_group := $1;
> W := AbelianExtension(D, sub_group);
> W;
Abelian extension of type [ 3, 15 ]
Defined modulo (1/x, 1/x^2*$.1) + (x^2 + x + w^2, $.1 + x + 1)
over Algebraic function field defined over Univariate rational
function field over GF(2^2) by
y^3 + w*t^5 + w*t
> FunctionField(W);
Algebraic function field defined over F by
$.1^3 + (x + 1)^-2 * (x^2 + x + w^2)^-1 * (F.1 + w*x + w) * (F.1 +
    w^2*x + w^2)
$.1^3 + (x) * (x + 1)^-4 * (F.1 + x + 1)^2 * (x^2 + x + w^2)^-1 * (F.1
    + w*x + w) * (F.1 + w^2*x + w^2)
$.1^5 + (1/(x^2 + 1)*F.1^2 + w^2/(x + 1)*F.1 + (x^2 + x + 1))*$.1^3 +
    (w/(x^2 + 1)*F.1^2 + w*x*F.1 + (x^4 + x^2 + 1))*$.1 + (x^2 + x +
    1)/(x^2 + 1)*F.1^2 + w^2*x*F.1 + x^4 + w^2*x^2 + w*x + w^2
> WW := $1;
> [HasRoot(Polynomial(Ra, x)) : x in DefiningPolynomials(WW)];
[ true, true, true]
```

<a id="function-fldfunab-exp"></a>
#### `Exp(x, p): RngElt, PlcFunElt -> RngUPolTwstElt`

```magma
InfBound: RngIntElt                    Default: 5
Map     : Map                          Default: id
Class   : DivFunElt                    Default: 0
Limit   : RngIntElt                    Default: Infinity()
Scale   : RngElt                       Default: false
```

In Drinfeld’s theory of elliptic modules, one associates an exponential function to a lattice. The transformation of this function under scaling of the lattice gives then rise to the “Drinfeld-module”. This function computes an approximation to the exponential of the “standard-lattice”. More precisely: let $R$ be the ring of functions integral outside the place $p$ and let $C$ be the completion of the function field at $p$. Considered as a subset of $C$, $R$ is a 1-dimensional lattice $\Lambda$ in Drinfelds sense. The exponential associated to this lattice is the function

$$
\exp: z \to z\prod'(1-z/l)
$$

where the product is taken over all non-zero lattice points $l$. This function can be seen to be an additive analytic function.

For $n>0$, let now $L(np)$ be the Riemann-Roch spaces and

$$
f_n : z \to z\prod'(1-z/l)
$$

(the product is over the non-zero elements of $L(np)$). It can be seen that $f_n \to \exp$ as $n\to\infty$. This intrinsic computes $f_n$ for $n$ equal the value of `InfBound`. If `Limit` is given then the twised polynomial representing $f_n$ is truncated at that term. If `Class` is given and contains the divisor $d$, then instead of $L(np)$ we use $L(np+d)$ which will approximate a (in general) non-isomorphic exponential coming from the lattice from the ideal representing the finite part of $d$.

If `Map` is given, then the map is applied to each element in $L(np)$ first, thus allowing to compute analytic approximations instead of alegebraic ones. Additionally, if `Scale` is given, the elements of $L(np)$ are multiplied by this value before the functions are formed, corresponding to a scaling of the lattice.

The exponential is evaluated at $x$, the first argument. Typically, $x$ will be the transcendental element of a polynomial ring, a twisted polynomial ring, or a power series ring.

<a id="function-analyticmodule-rngelt-plcfunelt"></a>
#### `AnalyticModule(x, p): RngElt, PlcFunElt -> RngElt`

```magma
InfBound: RngIntElt                    Default: 5
Map     : Map                          Default: id
Class   : DivFunElt                    Default: 0
Limit   : RngIntElt                    Default: Infinity()
Scale   : RngElt                       Default: false
```

Let $\Lambda$ be the lattice as described for [`Exp`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-fldfunab-exp) above. By Drinfeld’s theory, the exponential functions of $\Lambda$ and $x\Lambda$ are related through some polynomial. This function computed the polynomial for $x$, which is “the” image of $x$ under the Drinfeld module defined by $\Lambda$. The use of the parameters is as for [`Exp`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/drinfeld.md#function-fldfunab-exp) above.

<a id="function-cannormalize-rngupoltwstelt"></a>
#### `CanNormalize(F): RngUPolTwstElt -> BoolElt, RngUPolTwstElt, RngElt`

Let $F$ be a twisted polynomial, typically over a completion. This function tries to conjugate $F$ so that the coefficients are integral with small valuations. On success, `true`, the new polynomial, and the element used to normalise $F$ is returned.

<a id="function-cansignnormalize-rngupoltwstelt"></a>
#### `CanSignNormalize(F): RngUPolTwstElt -> BoolElt, RngUPolTwstElt, RngElt`

Let $F$ be a twisted polynomial, typically over a completion. This function tries to conjugate $F$ so that the highest coefficient is an element in the residue class field. On success, `true`, the new polynomial, and the element used to normalise $F$ is returned.

<a id="function-algebraictoanalytic-rngupoltwstelt-plcfunelt"></a>
#### `AlgebraicToAnalytic(F, p): RngUPolTwstElt, PlcFunElt -> RngUPolTwstElt`

Given a non-trivial image $F$ under a Drinfeld module with the “infinite place” $p$, compute a basis for a submodule of the lattice underlying $F$. The parameter `RelPrec` is used to limit the number of coefficients of the exponential that are reconstructed, thus it also limits the dimenstion of the submodule.

### Related Functions

This section list some related functions that are either useful in the context of class fields for function fields or are necessary for their computation. They will most certainly change their appearance.

<a id="function-strongapproximation-divfunelt-plcfunelt-fldfunelt"></a>
#### `StrongApproximation(m, S): DivFunElt, [<PlcFunElt, FldFunElt>] -> FldFunElt`

```magma
Strict   : BoolElt                      Default: false
Exception: DivFunElt                    Default: false
Raw      : BoolElt                      Default: false
```

Given an effective divisor $m$ and a sequence $S$ of pairs $(Q_i, e_i)$ of places and elements, find an element $a$ and a place $Q_0$ such that

$$
v_{Q_i}(a-e_i) \geq v_{Q_i}(m),
$$

and $a$ is integral everywhere outside $Q_i$ ($0\leq i\le n$).

If `Exception` is not `false`, it has to be a place that will be used for $Q_0$.

If `Strict` is `true`, the element $a$ will be chosen such

$$
v_{Q_i}(a-e_i) = v_{Q_i}(m)
$$

If `Raw` is `true`, different rather technical return values are computed that are used internally.

<a id="function-strongapproximation-plcfunelt-fldfungelt-rngintelt"></a>
#### `StrongApproximation(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] -> FldFunElt`

```magma
Strict: BoolElt                    Default: false
```

Given a sequence $S$ of either finite or infinite places of a function field, a sequence $Z$ of elements of a function field and a sequence $V$ of integers, return an element $z$ such that $z - Z[i]$ has valuation at least $V[i]$ at $S[i]$ and positive valuation at all other places of same finiteness as those in $S$ which do not appear in $S$. If the parameter `Strict` is set to `true` then $z$ will be computed such that $v_{S[i]}(z - Z[i]) = V[i]$.

<a id="function-chineseremaindertheorem-plcfunelt-fldfungelt-rngintelt"></a>
#### `ChineseRemainderTheorem(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] -> FldFunElt`

<a id="function-crt-plcfunelt-fldfungelt-rngintelt"></a>
#### `CRT(S, Z, V): [PlcFunElt], [FldFunGElt], [RngIntElt] -> FldFunElt`

```magma
IntegralOutside: BoolElt                    Default: false
```

Given a sequence $S$ of either finite or infinite places of a function field, a sequence $Z$ of elements of a function field and a sequence $V$ of integers, return an element $z$ such that $z - Z[i]$ has valuation at least $V[i]$ at $S[i]$. If the parameter `IntegralOutside` is set to `true` then $z$ will be computed such that it is integral at all other places of same finiteness as those in $S$ which do not appear in $S$.

<a id="example-ex-8bc2d0"></a>
#### `Example: Strong Approximation (ex-8bc2d0)`

We first have to define a function field and some places:

```magma
> k<w> := GF(4);
> kt<t> := PolynomialRing(k);
> ktx<x> := PolynomialRing(kt);
> K := FunctionField(x^3-w*t*x^2+x+t);
> lp := Places(K, 2);
```

We will now try to find an element $x$ in $K$ such that $v_{p_i}(x-e_i) \geq m_i$ for $p_i =$`lp[i]`, $m_i = i$ and random elements $e_i$:

```magma
> e := [Random(K, 3) : i in lp];
> m := [i : i in [1..#lp]];
> D := &+ [ m[i]*lp[i] : i in [1..#lp]];
> x := StrongApproximation(D, [<lp[i], e[i]> : i in [1..#lp]]);
> [Valuation(x-e[i], lp[i]) : i in [1..#lp]];
[ 1, 2, 3, 4, 5, 6 ]
```

Note, that we only required $\geq$ for the valuations, to enforce $=$ we would need to pass the `Strict` option. This will double the running time.

<a id="function-nonspecialdivisor-divfunelt"></a>
#### `NonSpecialDivisor(m): DivFunElt -> DivFunElt, RngIntElt`

```magma
Exception: DivFunElt                    Default: 
```

Given an effective divisor $m$, find a place $P$ coprime to $m$ and an integer $r\geq 0$ such that $rP-m$ is a non special divisor and return $r$ and $P$.

If `Exception` is specified, it must be an effective divisor $n$ coprime to $m$. In this case the function finds $r>0$ such that $rn-m$ is non special and returns $r$ and $n$.

<a id="function-normgroup-fldfun"></a>
#### `NormGroup(F): FldFun -> DivFunElt, GrpAb`

```magma
Cond : DivFunElt                     Default: 
AS   : RngWittElt                    Default: 
Extra: RngIntElt                     Default: 5
```

Given a global function field, try to compute its norm group. The norm group is defined to be the group generated by norms of unramified divisors. This group can be related to a subgroup of some ray class group.

Provided $F$ is abelian, this function will compute a divisor $m$ and a sub group $U$ of the ray class group modulo $m$ such that $F$ is isomorphic to the ray class field thus defined.

This function uses a heuristic algorithm. It will terminate after the size of the quotient by the norm group is less or equal than the degree for `Extra` many places.

If `Cond` is given, it must be an effective divisor that will be used as the potential conductor of $F$. Note: if `Cond` is too small, ie. a proper divisor of the true conductor, the result of this function will be wrong. However, if the conductor is not passed in, the discriminant divisor is used as a starting point. As this is in general far too large, the function will be much quicker if a better (smaller) starting point is passed in.

If `AS` is given, it must be a Witt vector $e$ of appropriate length and $F$ should be the corresponding function field. This allows a much better initial guess for the conductor than using the discriminant.

<a id="function-sign-fldfunelt-plcfunelt"></a>
#### `Sign(a, p): FldFunElt, PlcFunElt -> RngElt`

Given a function $a$ in some global function field and a place $p$ such that $a$ is integral at $p$ (has non-negative valuation) return the sign of $a$, ie. the first non-zero coefficient if the expansion of $a$ at $p$. The sign function is not unique. Magma choses a sign function when creating the residue class field map.

<a id="function-changemodel-fldfun-plcfunelt"></a>
#### `ChangeModel(F, p): FldFun, PlcFunElt -> FldFun`

Given a global function field $F$ and a place $p$, return a new function field $G$ that is ${\mathbb{F}}_q$-isomorphic to $F$ and has $p$ as the only infinite place.

<a id="function-artinschreierreduction-fldfungelt-plcfunelt"></a>
#### `ArtinSchreierReduction(u, P): FldFunGElt, PlcFunElt -> RngIntElt, FldFunElt`

Return the valuation of $u - (z^p - z)$ at $P$ and an element $z$ such that this valuation is either positive or not congruent to $0 \mod p$ where $p$ is the characteristic of the field of $u$.

### Enumeration of Places

In several situations one needs to loop over the places of a function field until either the one finds a place with special properties or until they generate a certain group. The functions listed here support this.

<a id="function-placeenuminit-fldfun"></a>
#### `PlaceEnumInit(K): FldFun -> PlcEnum`

```magma
Coprime: Any                        Default: 
All    : BoolElt                    Default: false
```

Initialises an enumeration process for places of the function field $K$. The enumeration process will loop over all irreducible polynomials of the underlying finite field and for each polynomial over all primes lying above it.

If `Coprime` is given, it should be either a set of places that should be ignored in the process or a divisor. In case a divisor is passed in only places coprime to the divisor will be returned.

If `All` is `false`, the infinite places won’t be considered.

<a id="function-placeenuminit-plcfunelt"></a>
#### `PlaceEnumInit(P): PlcFunElt -> PlcEnum`

```magma
Coprime: Any                    Default: 
```

Constructs an enumeration process for places starting at the place $P$.

If `Coprime` is given, it should be either a set of places that should be ignored in the process or a divisor. In case a divisor is passed in only places coprime to the divisor will be returned.

<a id="function-placeenuminit-fldfun-rngintelt"></a>
#### `PlaceEnumInit(K, Pos): FldFun, [RngIntElt] -> PlcEnum`

```magma
Coprime: Any                    Default: 
```

Constructs an enumeration environment that starts at the place of the function field $K$ indexed by *Pos* as returned from [`PlaceEnumPosition`](https://docs.magma-maths.org/GlobalFields/ClassFieldTheoryForGlobalFunctionFields/place-enumeration.md#function-fldfunab-placeenumposition).

<a id="function-placeenumcopy-plcenum"></a>
#### `PlaceEnumCopy(R): PlcEnum -> PlcEnum`

Copies the environment and the current state of the enumeration process for places $R$.

<a id="function-fldfunab-placeenumposition"></a>
#### `PlaceEnumPosition(R): PlcEnum -> [RngIntElt]`

Returns a list of integers that acts as an index to the places as enumerated by the environment $R$.

<a id="function-placeenumnext-plcenum"></a>
#### `PlaceEnumNext(R): PlcEnum -> PlcFunElt`

Returns the “next” place of the process $R$.

<a id="function-placeenumcurrent-plcenum"></a>
#### `PlaceEnumCurrent(R): PlcEnum -> PlcFunElt`

Returns the current place pointed to by the environment $R$, i.e. the last place returned by `PlaceEnumNext`.

<a id="artrep"></a>
## Artin Representations

- [Overview](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/overview.md)
- [Constructing Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md)
  - [`ArtinRepresentations(K): FldNum → SeqEnum`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#function-artinrepresentations-fldnum)
  - [`K !! ch: FldNum, AlgChtrElt → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#operation-op-fldnum-algchtrelt)
  - [`K !! ch: FldNum, SeqEnum → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#operation-op-fldnum-seqenum)
  - [`PermutationCharacter(K): FldNum → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#function-permutationcharacter-fldnum)
  - [`Determinant(A): ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#function-determinant-artrep)
  - [`ChangeField(A,K): ArtRep, FldNum → ArtRep, BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#function-changefield-artrep-fldnum)
  - [`K !! A: FldNum, ArtRep → ArtRep, BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#operation-op-fldnum-artrep)
  - [Example: Artin Representations of a Quadratic Field](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/functions.md#example-ex-81e6bd)
- [Basic Invariants](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md)
  - [`Field(A): ArtRep → FldNum`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-field-artrep)
  - [`BaseField(A): ArtRep → Fld`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-basefield-artrep)
  - [`Degree(A): ArtRep → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-degree-artrep)
  - [`Dimension(A): ArtRep → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-dimension-artrep)
  - [`Group(A): ArtRep → GrpPerm`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-group-artrep)
  - [`Character(A): ArtRep → AlgChtrElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-character-artrep)
  - [`Conductor(A): ArtRep → RngIntElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-conductor-artrep)
  - [`Decomposition(A): ArtRep → SeqEnum[Tup]`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-decomposition-artrep)
  - [`RationalDecomposition(A): ArtRep → SeqEnum[Tup]`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-rationaldecomposition-artrep)
  - [Example: Decomposing Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#example-ex-12f333)
  - [`DefiningPolynomial(A): ArtRep → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-definingpolynomial-artrep)
  - [`Minimize(A): ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-minimize-artrep)
  - [`OptimizedRepresentation(A): ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-optimizedrepresentation-artrep)
  - [`Kernel(A): ArtRep → FldNum`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-kernel-artrep)
  - [Example: Minimising an Artin Representation](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#example-ex-9129cc)
  - [`IsIrreducible(A): ArtRep → BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-isirreducible-artrep)
  - [`IsRamified(A, p): ArtRep, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-isramified-artrep-rngintelt)
  - [`IsWildlyRamified(A, p): ArtRep, RngIntElt → BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-iswildlyramified-artrep-rngintelt)
  - [`EulerFactor(A, p): ArtRep, RngIntElt → RngUPolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-eulerfactor-artrep-rngintelt)
  - [`EpsilonFactor(A): ArtRep → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-epsilonfactor-artrep)
  - [`RootNumber(A): ArtRep → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-rootnumber-artrep)
  - [`EpsilonFactor(A,p): ArtRep, RngIntElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-epsilonfactor-artrep-rngintelt)
  - [`RootNumber(A,p): ArtRep, RngIntElt → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-rootnumber-artrep-rngintelt)
  - [`EpsilonFactor(A,infty): ArtRep, Infty → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-epsilonfactor-artrep-infty)
  - [`RootNumber(A,infty): ArtRep, Infty → FldComElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-rootnumber-artrep-infty)
  - [Example: Invariants of Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#example-ex-2bf31b)
  - [`DirichletCharacter(A): ArtRep → GrpDrchElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-dirichletcharacter-artrep)
  - [`HeckeCharacter(A): ArtRep → GrpHeckeElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-heckecharacter-artrep)
  - [`ArtinRepresentation(ch): GrpDrchElt → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#function-artinrepresentation-grpdrchelt)
  - [Example: One-Dimensional Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/invariants.md#example-ex-db71ab)
- [Arithmetic](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md)
  - [`A1 + A2: ArtRep, ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#operation-op-plus-artrep-artrep)
  - [`A1 - A2: ArtRep, ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#operation-op-minus-artrep-artrep)
  - [`A1 * A2: ArtRep, ArtRep → ArtRep`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#operation-op-times-artrep-artrep)
  - [`A1 eq A2: ArtRep, ArtRep → BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#operation-op-eq-artrep-artrep)
  - [`A1 ne A2: ArtRep, ArtRep → BoolElt`](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#operation-op-ne-artrep-artrep)
  - [Example: Arithmetic of Artin Representations](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#example-ex-ba9cf8)
  - [Example: Artin Representations over Different Fields](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/arithmetic.md#example-ex-401593)
- [Implementation Notes](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/notes.md)
- [Bibliography](https://docs.magma-maths.org/GlobalFields/ArtinRepresentations/bibliography.md)

### Overview

An *Artin representation* is a complex representation of ${\operatorname{Gal}}(\bar{\mathbb{Q}}/{\mathbb{Q}})$ that factors through some finite quotient ${\operatorname{Gal}}(F/{\mathbb{Q}})$. In Magma, Artin representations are represented as characters of ${\operatorname{Gal}}(F/{\mathbb{Q}})$, not the actual modules. They are allowed to be virtual, except in the $L$-function machinery (see Chapter [$L$-series](https://docs.magma-maths.org/ModularArithmeticGeometry/ModularAbelianVarieties/lser.md#lser)).

<a id="functions"></a>
### Constructing Artin Representations

<a id="function-artinrepresentations-fldnum"></a>
#### `ArtinRepresentations(K): FldNum -> SeqEnum`

```magma
f                 : RngUPolElt                    Default: 
Ramification      : BoolElt                       Default: false
FactorDiscriminant: BoolElt                       Default: false
p0                : RngIntElt                     Default: 
```

Compute all irreducible Artin representations that factor through the normal closure $F$ of the number field $K$.

If $K$ is given as a relative extension $E/F$ (that is, `BaseField(K)` is not ${\mathbb{Q}}$), the representations returned are those of ${\operatorname{Gal}}(\bar F/F)$ that factor through the normal closure of $E$ over $F$, and `LSeries` returns the corresponding Artin $L$-series over $F$. To obtain the representations of ${\operatorname{Gal}}(\bar{\mathbb{Q}}/{\mathbb{Q}})$ instead, apply `ArtinRepresentations` to `AbsoluteField(K)`.

Such relative representations support the operations that derive one Artin representation from another: sums, differences, and tensor products of representations attached to the same field, `Decomposition` and `RationalDecomposition` return relative representations over the same base field, and `Kernel` returns the smallest extension of the base field through which the representation factors. `IsRamified`, `IsWildlyRamified`, `Minimize`, `OptimizedRepresentation`, `DirichletCharacter`, and `HeckeCharacter` are not implemented over a base field other than $\Q$, and raise an error for a relative representation rather than answering over $\Q$.

The Galois group $G={\operatorname{Gal}}(F/K)$ whose representations are constructed is represented as a permutation group on the roots of `f`, which must be a monic irreducible polynomial with integer coefficients that defines $K$. By default this is the defining polynomial of $K$ represented as an extension of ${\mathbb{Q}}$. (It is possible to specify any monic integral polynomial whose splitting field is $F$, even a reducible one, but `PermutationCharacter(K)` and the Dedekind $\zeta$-function of $K$ will not work correctly.)

The `Ramification` parameter specifies whether to pre-compute the inertia groups at all ramified primes and the conductors of all representations.

The parameter `FactorDiscriminant` determines whether to factorize the discriminant of `f` completely, even if it appears to contain large prime factors. The factorization is used to determine which primes ramify in $F/K$, which is necessary to compute the conductors. If the factorization is incomplete, Magma assumes that the primes in the unfactored part of the discriminant are unramified. One may specify

`FactorDiscriminant:=`

`<TrialLimit,PollardRhoLimit,ECMLimit,MPQSLimit,Proof>` and these 5 parameters are passed to the `Factorization` function; the default behaviour (`false`) is the same as `<10000,65535,10,0,false>`. When the factorization is incomplete, Magma will print “(?)” following the conductor values, when asked to print an Artin representation.

Finally, `p0` specifies which $p$-adic field to use for the roots of `f`, in particular in Galois group computations. It must be chosen so that `GaloisGroup(f:Prime:=p0)` is successful. By default it is chosen by the Galois group computation.

<a id="operation-op-fldnum-algchtrelt"></a>
#### `K !! ch: FldNum, AlgChtrElt -> ArtRep`

<a id="operation-op-fldnum-seqenum"></a>
#### `K !! ch: FldNum, SeqEnum -> ArtRep`

Writing $F$ for the normal closure of $K/{\mathbb{Q}}$, this function converts an abstract group character of ${\operatorname{Gal}}(F/{\mathbb{Q}})$ or the sequence of its trace values into an Artin representation.

<a id="function-permutationcharacter-fldnum"></a>
#### `PermutationCharacter(K): FldNum -> ArtRep`

Construct the permutation representation $A$ of the absolute Galois group of ${\mathbb{Q}}$ on the embeddings of $K$ into ${\mathbb{C}}$. This is an Artin representation of ${\operatorname{Gal}}(F/{\mathbb{Q}})$ of dimension $[K:{\mathbb{Q}}]$, where $F$ is the normal closure of $K$, and it is the same as the permutation representation of ${\operatorname{Gal}}(F/{\mathbb{Q}})$ on the cosets of ${\operatorname{Gal}}(F/K)$.

<a id="function-determinant-artrep"></a>
#### `Determinant(A): ArtRep -> ArtRep`

Construct the determinant of a given Artin representation. The result is given as a 1-dimensional Artin representation attached to the same field.

<a id="function-changefield-artrep-fldnum"></a>
#### `ChangeField(A, K): ArtRep, FldNum -> ArtRep, BoolElt`

<a id="operation-op-fldnum-artrep"></a>
#### `K !! A: FldNum, ArtRep -> ArtRep, BoolElt`

```magma
MinPrimes: RngIntElt                    Default: 20
```

Given an Artin representation (attached to some number field) that is known to factor through the Galois closure of $K$, attempts to recognize it as such. Returns “the resulting Artin representation attached to $K$”, `true` if successful, and 0, `false` if it proves that there is no such representation. The parameter `MinPrimes` specifies the number of additional primes for which to compare traces of Frobenius elements.

<a id="example-ex-81e6bd"></a>
#### `Example: Artin Representations of a Quadratic Field (ex-81e6bd)`

A quadratic field $K$ has two irreducible Artin representations the factor through ${\operatorname{Gal}}(K/{\mathbb{Q}})$, the trivial one and the quadratic character of $K$:

```magma
> K<i> := QuadraticField(-1);
> triv, sign := Explode(ArtinRepresentations(K));
> sign;
Artin representation C2: (1,-1) of Q(sqrt(-1))
```

An alternative way to define them is directly by their character:

```magma
> triv,sign:Magma;
QuadraticField(-1) !! [1,1]
QuadraticField(-1) !! [1,-1]
```

The regular representation of ${\operatorname{Gal}}(K/{\mathbb{Q}})$ is their sum:

```magma
> PermutationCharacter(K);
Artin representation C2: (2,0) of Q(sqrt(-1))
> $1 eq triv+sign;
true
```

Next, let $L=K(\sqrt{-2-i})$, presented as a relative extension of $K$. As $L$ is defined over $K$, `ArtinRepresentations` returns the representations of ${\operatorname{Gal}}(\bar K/K)$, here the trivial character and the quadratic character of ${\operatorname{Gal}}(L/K)$:

```magma
> P<x> := PolynomialRing(K);
> L := ext<K | x^2 + i + 2>;
> reps := ArtinRepresentations(L);
> [Dimension(A): A in reps];
[ 1, 1 ]
> BaseField(reps[2]) eq K;
true
```

The normal closure $F$ of $L$ over ${\mathbb{Q}}$ has ${\operatorname{Gal}}(F/{\mathbb{Q}})=D_4$, the dihedral group of order 8. Passing to the absolute field instead gives the Artin representations of ${\operatorname{Gal}}(\bar{\mathbb{Q}}/{\mathbb{Q}})$:

```magma
> Labs := AbsoluteField(L);
> GroupName(GaloisGroup(Labs));
D4
> [Dimension(A): A in ArtinRepresentations(Labs)];
[ 1, 1, 1, 1, 2 ]
```

We use `ChangeField` to lift Artin representations from ${\operatorname{Gal}}(K/{\mathbb{Q}})$ to ${\operatorname{Gal}}(F/{\mathbb{Q}})$, and check that it is still the same as an Artin representation.

```magma
> A := ChangeField(sign,L);
> A;
Artin representation D4: (1,1,-1,1,-1) of ext<Q(sqrt(-1))|x^2+i+2>
> A eq sign;
true
```

### Basic Invariants

<a id="function-field-artrep"></a>
#### `Field(A): ArtRep -> FldNum`

Number field $K$ such that $A$ factors through the Galois group of the normal closure of $K$.

<a id="function-basefield-artrep"></a>
#### `BaseField(A): ArtRep -> Fld`

The field $F$ over which $A$ is a representation of ${\operatorname{Gal}}(\bar F/F)$. This is ${\mathbb{Q}}$ unless $A$ was constructed as a relative Artin representation, in which case it is the base field of the defining relative extension.

<a id="function-degree-artrep"></a>
#### `Degree(A): ArtRep -> RngIntElt`

<a id="function-dimension-artrep"></a>
#### `Dimension(A): ArtRep -> RngIntElt`

Degree (=dimension) of an Artin representation $A$.

<a id="function-group-artrep"></a>
#### `Group(A): ArtRep -> GrpPerm`

The Galois group of the field through which $A$ factors.

<a id="function-character-artrep"></a>
#### `Character(A): ArtRep -> AlgChtrElt`

Character of an Artin representation $A$, represented as a complex-valued character of `Group(A)`.

<a id="function-conductor-artrep"></a>
#### `Conductor(A): ArtRep -> RngIntElt`

Conductor of an Artin representation $A$ (which must be a true representation, i.e. its character is not allowed to be a generalized character). Computes all the necessary local information if Artin representations were defined with `Ramification:=false`, so the first call to this function might take some time.

<a id="function-decomposition-artrep"></a>
#### `Decomposition(A): ArtRep -> SeqEnum[Tup]`

Decompose an Artin representation $A$ into irreducible constituents. Returns a sequence of tuples `[...<A_i,n_i>...]` with $A_i$ irreducible and $n_i$ its exponent in $A$ (nonzero but possibly negative). If $A$ is a relative Artin representation, the decomposition is taken in the Galois group over its base field, and the $A_i$ are relative Artin representations over that same base field.

<a id="function-rationaldecomposition-artrep"></a>
#### `RationalDecomposition(A): ArtRep -> SeqEnum[Tup]`

Decompose an Artin representation $A$ into constituents with rational-valued characters, each corresponding to a Galois conjugacy class of irreducibles. Returns a sequence of tuples `[...<A_i,n_i>...]` with $A_i$ having rational-valued character and $n_i$ its exponent in $A$ (nonzero but possibly negative). As with `Decomposition`, a relative Artin representation decomposes into relative Artin representations over the same base field.

<a id="example-ex-12f333"></a>
#### `Example: Decomposing Artin Representations (ex-12f333)`

We give an example to show the difference between these decompositions.

```magma
> K := NumberField(PolynomialWithGaloisGroup(12,15));
> DefiningPolynomial(K);
x^12 - 24*x^10 + 216*x^8 - 896*x^6 + 1680*x^4 - 1152*x^2 + 48
> GroupName(GaloisGroup(K));
C3:D4
> c := PermutationCharacter(K);
> Decomposition(c);
[ <Artin representation C3:D4: (1,1,1,1,1,1,1,1,1) of K, 1>,
  <Artin representation C3:D4: (1,1,1,-1,1,-1,1,1,1) of K, 1>,
  <Artin representation C3:D4: (2,2,2,0,-1,0,-1,-1,-1) of K, 2>,
  <Artin representation C3:D4: (2,-2,0,0,2,0,0,0,-2) of K, 1>,
  <Artin representation C3:D4: (2,-2,0,0,-1,0,-1-2*J,1+2*J,1) of K, 1>,
  <Artin representation C3:D4: (2,-2,0,0,-1,0,1+2*J,-1-2*J,1) of K, 1> ]
> RationalDecomposition(c);
[ <Artin representation C3:D4: (1,1,1,1,1,1,1,1,1) of K, 1>,
  <Artin representation C3:D4: (1,1,1,-1,1,-1,1,1,1) of K, 1>,
  <Artin representation C3:D4: (2,2,2,0,-1,0,-1,-1,-1) of K, 2>,
  <Artin representation C3:D4: (2,-2,0,0,2,0,0,0,-2) of K, 1>,
  <Artin representation C3:D4: (4,-4,0,0,-2,0,0,0,2) of K, 1>];
```

<a id="function-definingpolynomial-artrep"></a>
#### `DefiningPolynomial(A): ArtRep -> RngUPolElt`

Returns the polynomial whose roots `Group(A)` permutes.

<a id="function-minimize-artrep"></a>
#### `Minimize(A): ArtRep -> ArtRep`

```magma
Optimize: BoolElt                    Default: true
```

Returns $A$ attached to the smallest number field $K$ such that $A$ factors through its Galois closure. If `Optimize := true`, attempts to minimize the defining polynomial of $K$ using `OptimizedRepresentation`. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-optimizedrepresentation-artrep"></a>
#### `OptimizedRepresentation(A): ArtRep -> ArtRep`

Returns the same Artin representation, but over an isomorphic version of the field that has had its representation optimized. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-kernel-artrep"></a>
#### `Kernel(A): ArtRep -> FldNum`

Smallest Galois extension $K$ of the rationals through which $A$ factors. Note that this field may be enormous and incomputable. For a relative Artin representation this is instead the smallest extension of the base field, Galois over it, through which $A$ factors. In both cases the result is returned as a number field over $\Q$.

<a id="example-ex-9129cc"></a>
#### `Example: Minimising an Artin Representation (ex-9129cc)`

We take an $S_4$-extension of ${\mathbb{Q}}$ and compute its Artin representations.

```magma
> R<x> := PolynomialRing(Rationals());
> K := NumberField(x^4+9*x-2);
> A := ArtinRepresentations(K);
> [Dimension(a): a in A];
[ 1, 1, 2, 3, 3 ]
```

Then we minimize the 2-dimensional one, which factors through an $S_3$-quotient.

```magma
> B := Minimize(A[3]); B;
Artin representation S3: (2,0,-1) of ext<Q|x^3+8*x+81>
> Kernel(B);
Number Field with defining polynomial x^6 + 48*x^4 + 576*x^2 + 179195
   over the Rational Field
```

<a id="function-isirreducible-artrep"></a>
#### `IsIrreducible(A): ArtRep -> BoolElt`

Return `true` iff a given Artin representation is irreducible as a complex representation.

<a id="function-isramified-artrep-rngintelt"></a>
#### `IsRamified(A, p): ArtRep, RngIntElt -> BoolElt`

Return `true` iff a given Artin representation is ramified at $p$. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-iswildlyramified-artrep-rngintelt"></a>
#### `IsWildlyRamified(A, p): ArtRep, RngIntElt -> BoolElt`

Return `true` iff a given Artin representation is wildly ramified at $p$. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-eulerfactor-artrep-rngintelt"></a>
#### `EulerFactor(A, p): ArtRep, RngIntElt -> RngUPolElt`

```magma
R: Fld                    Default: ComplexField()
```

The local polynomial (Euler factor) of an Artin representation $A$ at the prime $p$. It is a polynomial with coefficients in the field $R$, which is complex numbers by default, and it is the inverse characteristic polynomial of (arithmetic) Frobenius at $p$ on the inertia invariant subspace of $A$.

<a id="function-epsilonfactor-artrep"></a>
#### `EpsilonFactor(A): ArtRep -> FldComElt`

Global epsilon-factor $\epsilon(A)$ of an Artin representation. Currently only implemented in a few basic cases, and raises an error otherwise. See Example [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex1).

<a id="function-rootnumber-artrep"></a>
#### `RootNumber(A): ArtRep -> FldComElt`

Global root number $\epsilon(A)/|\epsilon(A)|$ of an Artin representation. Currently only implemented in a few basic cases, and raises an error otherwise. See Example [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex1).

<a id="function-epsilonfactor-artrep-rngintelt"></a>
#### `EpsilonFactor(A, p): ArtRep, RngIntElt -> FldComElt`

Local epsilon-factor $\epsilon(A)$ of an Artin representation at $p$. Currently only implemented in a few basic cases, and raises an error otherwise. See Example [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex1).

<a id="function-rootnumber-artrep-rngintelt"></a>
#### `RootNumber(A, p): ArtRep, RngIntElt -> FldComElt`

Local root number $\epsilon_p(A)/|\epsilon_p(A)|$ of an Artin representation at $p$. Currently only implemented in a few basic cases, and raises an error otherwise. See Example [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex1).

<a id="function-epsilonfactor-artrep-infty"></a>
#### `EpsilonFactor(A, infty): ArtRep, Infty -> FldComElt`

<a id="function-rootnumber-artrep-infty"></a>
#### `RootNumber(A, infty): ArtRep, Infty -> FldComElt`

Local root number $w_\infty(A)$ of an Artin representation at infinity. See Example [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex1).

<a id="example-ex-2bf31b"></a>
#### `Example: Invariants of Artin Representations (ex-2bf31b)`

Here are the invariants of Artin representations that factor through the splitting field of $x^4-3$, a $D_4$-extension of ${\mathbb{Q}}$.

```magma
> R<x> := PolynomialRing(Rationals());
> K := NumberField(x^4-3);
> A := ArtinRepresentations(K);
> Degree(Kernel(A[5]),Rationals());
8
> [Dimension(a): a in A];
[ 1, 1, 1, 1, 2 ]
> Character(A[5]);
( 2, -2, 0, 0, 0 )
> [Conductor(a): a in A];
[ 1, 12, 3, 4, 576 ]
> [IsRamified(a,3): a in A];
[ false, true, true, false, true ]
> [IsWildlyRamified(a,3): a in A];
[ false, false, false, false, false ]
> EulerFactor(A[5],5);
x^2 + 1
> EpsilonFactor(A[5],3);
-3
```

<a id="function-dirichletcharacter-artrep"></a>
#### `DirichletCharacter(A): ArtRep -> GrpDrchElt`

Convert a one-dimensional Artin representation to a Dirichlet character. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-heckecharacter-artrep"></a>
#### `HeckeCharacter(A): ArtRep -> GrpHeckeElt`

Convert a one-dimensional Artin representation $A$ to a Hecke character. This is more natural than the previous, as in general Hecke characters will have $L$-functions matching that of the Artin representation, while Dirichlet characters only necessarily have $L$-functions when defined over the rationals. Raises an error when $A$ is a relative Artin representation, as this is not implemented over a base field other than $\Q$.

<a id="function-artinrepresentation-grpdrchelt"></a>
#### `ArtinRepresentation(ch): GrpDrchElt -> ArtRep`

```magma
field: FldNum                    Default: 
```

Convert a Dirichlet character `ch` to a one-dimensional Artin representation $A$. To avoid recomputation, the minimal field through which $A$ factors may be supplied by the `field` parameter. This now uses class field theory (thanks to C. Fieker).

<a id="example-ex-db71ab"></a>
#### `Example: One-Dimensional Artin Representations (ex-db71ab)`

An example that goes back and forth between the Dirichlet character and the Artin representation.

```magma
> load galpols;
> f := PolynomialWithGaloisGroup(8,46); // order 576
> K := NumberField(f); // octic field
> A := ArtinRepresentations(K);
> [Degree(a) : a in A];
[ 1, 1, 1, 1, 4, 4, 6, 6, 9, 9, 9, 9, 12 ]
> [Order(Character(Determinant(a))) : a in A];
[ 1, 2, 4, 4, 2, 2, 2, 1, 1, 2, 4, 4, 2 ]
> chi := DirichletCharacter(A[3]); // order 4
> Conductor(chi), Conductor(chi^2);
215 5
> Minimize(ArtinRepresentation(chi)); // disc = N(chi)^2*N(chi^2)
Artin representation C4: (1,-1,-I,I) of ext<Q|x^4+x^3-54*x^2-54*x+551>
> Factorization(Discriminant(Integers(Field($1))));
[ <5, 3>, <43, 2> ]
```

### Arithmetic

<a id="operation-op-plus-artrep-artrep"></a>
#### `A1 + A2: ArtRep, ArtRep -> ArtRep`

Direct sum of two Artin representations

<a id="operation-op-minus-artrep-artrep"></a>
#### `A1 - A2: ArtRep, ArtRep -> ArtRep`

Direct difference of two Artin representations

<a id="operation-op-times-artrep-artrep"></a>
#### `A1 * A2: ArtRep, ArtRep -> ArtRep`

Tensor product of two Artin representations

<a id="operation-op-eq-artrep-artrep"></a>
#### `A1 eq A2: ArtRep, ArtRep -> BoolElt`

Returns `true` iff the two Artin representations are equal

<a id="operation-op-ne-artrep-artrep"></a>
#### `A1 ne A2: ArtRep, ArtRep -> BoolElt`

Returns `true` iff the two Artin representations are not equal

Sums, differences, and tensor products of relative Artin representations attached to the same number field are relative Artin representations over the same base field. Arithmetic between representations attached to different number fields, which passes to the compositum, is available only over $\Q$.

<a id="example-ex-ba9cf8"></a>
#### `Example: Arithmetic of Artin Representations (ex-ba9cf8)`

For Artin representations constructed from the same number field, their arithmetic is just arithmetic of characters:

```magma
> P<x> := PolynomialRing(Rationals());
> K := NumberField(x^3-2);
> A := ArtinRepresentations(K: Ramification:=true);
> triv, sign, rho := Explode(A);
> triv;
Artin representation S3: (1,1,1) of ext<Q|x^3-2>, conductor 1
> rho;
Artin representation S3: (2,0,-1) of ext<Q|x^3-2>, conductor 108
> triv+rho;
Artin representation S3: (3,1,0) of ext<Q|x^3-2>, conductor 108
> sign*rho eq rho;
true
```

<a id="example-ex-401593"></a>
#### `Example: Artin Representations over Different Fields (ex-401593)`

When Artin representations factor through different fields, their arithmetic involves the compositum of the fields:

```magma
> K1 := QuadraticField(2);
> triv1, sign1 := Explode(ArtinRepresentations(K1));
> K2 := QuadraticField(3);
> triv2, sign2 := Explode(ArtinRepresentations(K2));
> twist := sign1*sign2;
> Field(twist);
Number Field with defining polynomial x^4 - 10*x^2 + 1 over the Rational Field
> sign3 := Minimize(twist);
> sign3;
Artin representation C2: (1,-1) of ext<Q|x^2-6>
> sign1*sign2*sign3 eq triv1;
true
```

<a id="notes"></a>
### Implementation Notes

The algorithms for recognizing Frobenius elements in Galois groups are described in [[DD13](https://docs.magma-maths.org/references.md#cite-ddfrob13)]. They rely on the cycle type identification, Serre’s trick for alternating groups, and the general machinery from [[DD13](https://docs.magma-maths.org/references.md#cite-ddfrob13)]. Magma is usually able to handle Galois groups of size $<10000$ acting on a small number of points easily, and much larger special groups such as $A_n$ and $S_n$.
