---
title: "Handbook of Magma Functions, Part VII: Local Fields"
version: "2.30-1"
canonical: "https://docs.magma-maths.org/LocalFields/index-local-fields.html"
---

# Local Fields

- [p-adic Rings and Their Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/index-padic-rings-and-their-extensions.md): p-adic ring background, creation, and extensions.
- [General p-adic Extensions](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/index-general-padic-extensions.md): General p-adic extension construction, operations, and maximal orders.
- [Power, Laurent, and Puiseux Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/index-power-laurent-and-puiseux-series.md): Power, Laurent, and Puiseux series ring creation and operations.
- [Lazy Power Series Rings](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/index-lazy-power-series-rings.md): Lazy power series ring creation, operations, and elements.
- [Algebraic Power Series Rings](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/index-algebraic-power-series-rings.md): Algebraic power series ring construction and accessors.
- [Valuation Rings](https://docs.magma-maths.org/LocalFields/ValuationRings/index-valuation-rings.md): Valuation ring creation, structure, and element operations.
- [Galois Rings](https://docs.magma-maths.org/LocalFields/GaloisRings/index-galois-rings.md): Galois ring creation, operations, and elements.
- [Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/index-newton-polygons.md): Newton polygon computation and applications to factorisation.
- [Series Rings over p-adic Rings](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/index-series-rings-over-padic-rings.md): Series rings over p-adic rings, matrices, and modules.
- [Local Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/index-local-galois-representations.md): Local Galois representation functions, invariants, and arithmetic.

<a id="rngloc"></a>
## $p$-Adic Rings and Their Extensions

- [Introduction](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/introduction.md)
- [Background](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/background.md)
- [Overview of the $p$-adics in Magma](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md)
  - [$p$-adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md#p-adic-rings)
  - [$p$-adic Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md#p-adic-fields)
  - [Free Precision Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md#free-precision-rings-and-fields)
  - [Precision of Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md#precision-of-extensions)
- [Creation of Local Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md)
  - [Creation Functions for the $p$-adics](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#creation-functions-for-the-p-adics)
    - [`pAdicRing(p, k): RngIntElt, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-padicring-rngintelt-rngintelt)
    - [`pAdicField(p, k): RngIntElt, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-padicfield-rngintelt-rngintelt)
    - [`pAdicRing(p): RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-padicring-rngintelt)
    - [`pAdicField(p): RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-padicfield-rngintelt)
    - [`pAdicQuotientRing(p, k): RngIntElt, RngIntElt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-padicquotientring-rngintelt-rngintelt)
    - [`quo<L | x>: RngPad, RngPadElt → .`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-quo-rngpad-rngpadelt)
    - [Example: Creating p-adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#example-ex-65d82a)
  - [Creation of Unramified Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#creation-of-unramified-extensions)
    - [`UnramifiedExtension(L, n): RngPad, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpad-rngintelt)
    - [`UnramifiedExtension(L, n): FldPad, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-fldpad-rngintelt)
    - [`UnramifiedExtension(L, n): RngPadRes, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpadres-rngintelt)
    - [`UnramifiedExtension(L, n): RngPadResExt, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpadresext-rngintelt)
    - [`ext<L | n>: RngPad, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpad-rngintelt-rngpad)
    - [`ext<L | n>: FldPad, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-fldpad-rngintelt-fldpad)
    - [`ext<L | n>: RngPadRes, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadres-rngintelt-rngpadresext)
    - [`ext<L | n>: RngPadResExt, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadresext-rngintelt-rngpadresext)
    - [`UnramifiedQuotientRing(K, k): FldFin, RngIntElt → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedquotientring-fldfin-rngintelt)
    - [`UnramifiedExtension(L, f): RngPad, RngUPolElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpad-rngupolelt)
    - [`UnramifiedExtension(L, f): FldPad, RngUPolElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-fldpad-rngupolelt)
    - [`UnramifiedExtension(L, f): RngPadRes, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpadres-rngupolelt)
    - [`UnramifiedExtension(L, f): RngPadResExt, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-unramifiedextension-rngpadresext-rngupolelt)
    - [`ext<L | f>: RngPad, RngUPolElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpad-rngupolelt-rngpad)
    - [`ext<L | f>: FldPad, RngUPolElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-fldpad-rngupolelt-fldpad)
    - [`ext<L | f>: RngPadRes, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadres-rngupolelt-rngpadresext)
    - [`ext<L | f>: RngPadResExt, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadresext-rngupolelt-rngpadresext)
    - [`IsInertial(f): RngUPolElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-isinertial-rngupolelt)
    - [`HasGNB(R, n, t): RngPad, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-has-gnb-func)
    - [`HasGNB(L, n, t): FldPad, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-hasgnb-fldpad-rngintelt-rngintelt)
    - [`HasGNB(R, n, t): RngPadRes, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-hasgnb-rngpadres-rngintelt-rngintelt)
    - [`HasGNB(R, n, t): RngPadResExt, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-hasgnb-rngpadresext-rngintelt-rngintelt)
    - [`CyclotomicUnramifiedExtension(R, f): FldPad, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-cyclotomicunramifiedextension-fldpad-rngintelt)
    - [`CyclotomicUnramifiedExtension(R, f): RngPad, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-cyclotomicunramifiedextension-rngpad-rngintelt)
    - [`CyclotomicUnramifiedExtension(R, f): RngPadRes, RngIntElt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-cyclotomicunramifiedextension-rngpadres-rngintelt)
    - [`CyclotomicUnramifiedExtension(R, f): RngPadResExt, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-cyclotomicunramifiedextension-rngpadresext-rngintelt)
    - [Example: Creating Unramified Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#example-ex-f8037d)
  - [Creation of Totally Ramified Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#creation-of-totally-ramified-extensions)
    - [`TotallyRamifiedExtension(L, f): RngPad, RngUPolElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-totallyramifiedextension-rngpad-rngupolelt)
    - [`TotallyRamifiedExtension(L, f): FldPad, RngUPolElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-totallyramifiedextension-fldpad-rngupolelt)
    - [`TotallyRamifiedExtension(L, f): RngPadRes, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-totallyramifiedextension-rngpadres-rngupolelt)
    - [`TotallyRamifiedExtension(L, f): RngPadResExt, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-totallyramifiedextension-rngpadresext-rngupolelt)
    - [`ext<L | f>: RngPad, RngUPolElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpad-rngupolelt-rngpad-2)
    - [`ext<L | f>: FldPad, RngUPolElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-fldpad-rngupolelt-fldpad-2)
    - [`ext<L | f>: RngPadRes, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadres-rngupolelt-rngpadresext-2)
    - [`ext<L | f>: RngPadResExt, RngUPolElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpadresext-rngupolelt-rngpadresext-2)
    - [`IsEisenstein(f): RngUPolElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-iseisenstein-rngupolelt)
    - [Example: Creating Totally Ramified Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#example-ex-11c692)
  - [Creation of Unbounded Precision Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#creation-of-unbounded-precision-extensions)
    - [`ext<L | m>: RngPad, Map → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-rngpad-map-rngpad)
    - [`ext<L | m>: FldPad, Map → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#constructor-constructor-ext-fldpad-map-rngpad)
    - [Example: Unbounded Precision Extensions from Maps](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#example-ex-2d52e1)
  - [Creation of Related Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#creation-of-related-rings)
    - [`IntegerRing(F): FldPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-integerring-fldpad)
    - [`Integers(F): FldPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-integers-fldpad)
    - [`RingOfIntegers(F): FldPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-ringofintegers-fldpad)
    - [`RingOfIntegers(R): RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-ringofintegers-rngpad)
    - [`FieldOfFractions(R): RngPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-fieldoffractions-rngpad)
    - [`SplittingField(f, R): RngUPolElt[RngInt], RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-splittingfield-rngupolelt-rngint-rngpad)
    - [`AbsoluteTotallyRamifiedExtension(R): RngPad → RngPad, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-absolutetotallyramifiedextension-rngpad)
  - [Other Elementary Constructions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#other-elementary-constructions)
    - [`Composite(R, S): RngPad, RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#function-composite-rngpad-rngpad)
  - [Attributes of Local Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attributes-of-local-rings-and-fields)
    - [``L`DefaultPrecision: RngPad → RngIntElt``](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attribute-attribute-l-defaultprecision-rngpad-rngintelt)
    - [``L`SeriesPrinting: RngPad → BoolElt``](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attribute-attribute-l-seriesprinting-rngpad-boolelt)
    - [``L`SeriesPrinting: FldPad → BoolElt``](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attribute-attribute-l-seriesprinting-fldpad-boolelt)
    - [``L`SeriesPrinting: RngPadRes → BoolElt``](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attribute-attribute-l-seriesprinting-rngpadres-boolelt)
    - [``L`SeriesPrinting: RngPadResExt → BoolElt``](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#attribute-attribute-l-seriesprinting-rngpadresext-boolelt)
    - [Example: Printing Elements as Series](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#example-ex-29e3f4)
- [Elementary Invariants](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md)
  - [`Prime(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-prime-rngpad)
  - [`Prime(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-prime-fldpad)
  - [`Prime(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-prime-rngpadres)
  - [`Prime(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-prime-rngpadresext)
  - [`InertiaDegree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpad)
  - [`InertiaDegree(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-fldpad)
  - [`InertiaDegree(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpadres)
  - [`InertiaDegree(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpadresext)
  - [`InertiaDegree(K, L): RngPad, RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpad-rngpad)
  - [`InertiaDegree(K, L): FldPad, FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-fldpad-fldpad)
  - [`InertiaDegree(K, L): RngPadRes, RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpadres-rngpadres)
  - [`InertiaDegree(K, L): RngPadResExt, RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-inertiadegree-rngpadresext-rngpadresext)
  - [`AbsoluteInertiaDegree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiadegree-rngpad)
  - [`AbsoluteInertiaDegree(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiadegree-fldpad)
  - [`AbsoluteInertiaDegree(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiadegree-rngpadres)
  - [`AbsoluteInertiaDegree(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiadegree-rngpadresext)
  - [`AbsoluteInertiaIndex(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiaindex-rngpad)
  - [`AbsoluteInertiaIndex(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiaindex-fldpad)
  - [`AbsoluteInertiaIndex(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiaindex-rngpadres)
  - [`AbsoluteInertiaIndex(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteinertiaindex-rngpadresext)
  - [`RamificationDegree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpad)
  - [`RamificationDegree(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-fldpad)
  - [`RamificationDegree(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpadres)
  - [`RamificationDegree(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpadresext)
  - [`RamificationIndex(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpad)
  - [`RamificationIndex(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-fldpad)
  - [`RamificationIndex(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpadres)
  - [`RamificationIndex(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpadresext)
  - [`RamificationDegree(K, L): RngPad, RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpad-rngpad)
  - [`RamificationDegree(K, L): FldPad, FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-fldpad-fldpad)
  - [`RamificationDegree(K, L): RngPadRes, RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpadres-rngpadres)
  - [`RamificationDegree(K, L): RngPadResExt, RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationdegree-rngpadresext-rngpadresext)
  - [`RamificationIndex(K, L): RngPad, RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpad-rngpad)
  - [`RamificationIndex(K, L): FldPad, FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-fldpad-fldpad)
  - [`RamificationIndex(K, L): RngPadRes, RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpadres-rngpadres)
  - [`RamificationIndex(K, L): RngPadResExt, RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-ramificationindex-rngpadresext-rngpadresext)
  - [`AbsoluteRamificationDegree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationdegree-rngpad)
  - [`AbsoluteRamificationDegree(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationdegree-fldpad)
  - [`AbsoluteRamificationDegree(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationdegree-rngpadres)
  - [`AbsoluteRamificationDegree(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationdegree-rngpadresext)
  - [`AbsoluteRamificationIndex(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationindex-rngpad)
  - [`AbsoluteRamificationIndex(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationindex-fldpad)
  - [`AbsoluteRamificationIndex(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationindex-rngpadres)
  - [`AbsoluteRamificationIndex(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluteramificationindex-rngpadresext)
  - [`AbsoluteDegree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absolutedegree-rngpad)
  - [`Degree(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpad)
  - [`Degree(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-fldpad)
  - [`Degree(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpadres)
  - [`Degree(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpadresext)
  - [`Degree(K, L): RngPad, RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpad-rngpad)
  - [`Degree(K, L): FldPad, FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-fldpad-fldpad)
  - [`Degree(K, L): RngPadRes, RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpadres-rngpadres)
  - [`Degree(K, L): RngPadResExt, RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-degree-rngpadresext-rngpadresext)
  - [`DefiningPolynomial(L): RngPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpad)
  - [`DefiningPolynomial(L): FldPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-fldpad)
  - [`DefiningPolynomial(L): RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpadres)
  - [`DefiningPolynomial(L): RngPadResExt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpadresext)
  - [`DefiningPolynomial(K, L): RngPad, RngPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpad-rngpad)
  - [`DefiningPolynomial(K, L): FldPad, FldPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-fldpad-fldpad)
  - [`DefiningPolynomial(K, L): RngPadRes, RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpadres-rngpadres)
  - [`DefiningPolynomial(K, L): RngPadResExt, RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpadresext-rngpadres)
  - [`DefiningPolynomial(K, L): RngPadResExt, RngPadResExt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingpolynomial-rngpadresext-rngpadresext)
  - [`DefiningMap(L): RngPad → Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingmap-rngpad)
  - [`DefiningMap(L): FldPad → Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingmap-fldpad)
  - [`HasDefiningMap(L): RngPad → BoolElt, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-hasdefiningmap-rngpad)
  - [`DefiningMap(L): FldPad → BoolElt, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-definingmap-fldpad-2)
  - [`PrimeRing(L): RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-primering-rngpad)
  - [`PrimeRing(L): RngPadRes → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-primering-rngpadres)
  - [`PrimeRing(L): RngPadResExt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-primering-rngpadresext)
  - [`PrimeField(L): FldPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-primefield-fldpad)
  - [`pAdicRing(L): RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-padicring-rngpad)
  - [`pAdicRing(L): RngPadRes → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-padicring-rngpadres)
  - [`pAdicRing(L): RngPadResExt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-padicring-rngpadresext)
  - [`pAdicField(L): FldPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-padicfield-fldpad)
  - [`BaseRing(L): RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-basering-rngpad)
  - [`BaseRing(L): RngPadRes → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-basering-rngpadres)
  - [`BaseRing(L): RngPadResExt → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-basering-rngpadresext)
  - [`CoefficientRing(L): RngPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-coefficientring-rngpad)
  - [`CoefficientRing(L): RngPadRes → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-coefficientring-rngpadres)
  - [`CoefficientRing(L): RngPadResExt → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-coefficientring-rngpadresext)
  - [`BaseField(L): FldPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-basefield-fldpad)
  - [`CoefficientField(L): FldPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-coefficientfield-fldpad)
  - [`BaseRing(L): FldPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-basering-fldpad)
  - [`ResidueClassField(L): RngPad → FldFin, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residueclassfield-rngpad)
  - [`ResidueClassField(L): RngPadRes → FldFin, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residueclassfield-rngpadres)
  - [`ResidueClassField(L): RngPadResExt → FldFin, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residueclassfield-rngpadresext)
  - [`ResidueSystem(R): RngPad → [RngPadElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residuesystem-rngpad)
  - [`ResidueSystem(R): RngPadRes → [RngPadEltRes]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residuesystem-rngpadres)
  - [`ResidueSystem(R): RngPadResExt → [RngPadEltResExt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residuesystem-rngpadresext)
  - [`ResidueSystem(R): FldPad → [FldPadElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-residuesystem-fldpad)
  - [`UniformizingElement(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-uniformizingelement-rngpad)
  - [`UniformizingElement(L): RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-uniformizingelement-rngpadres)
  - [`UniformizingElement(L): RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-uniformizingelement-rngpadresext)
  - [`UniformizingElement(L): FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-uniformizingelement-fldpad)
  - [`L . 1: RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#operation-operation-rngpad-rngpadelt)
  - [`L . 1: RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#operation-operation-rngpadres-rngpadreselt)
  - [`L . 1: RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#operation-operation-rngpadresext-rngpadresextelt)
  - [`L . 1: FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#operation-operation-fldpad-fldpadelt)
  - [`Precision(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-precision-rngpad)
  - [`Precision(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-precision-rngpadres)
  - [`Precision(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-precision-rngpadresext)
  - [`Precision(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-precision-fldpad)
  - [`HasPRoot(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-hasproot-rngpad)
  - [`HasRootOfUnity(L, n): RngPad, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-hasrootofunity-rngpad-rngintelt)
  - [`Discriminant(R): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-discriminant-rngpad)
  - [`Discriminant(K, k): RngPad, RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-discriminant-rngpad-rngpad)
  - [`AdditiveGroup(R): RngPadRes → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-additivegroup-rngpadres)
  - [Example: Elementary Invariants of Local Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#example-ex-899921)
  - [`AbsoluteRootNumber(K): FldPad → FldCycElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-absoluterootnumber-fldpad)
  - [`RootNumber(K): FldPad → FldCycElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#function-rootnumber-fldpad)
  - [Example: Root Numbers of p-adic Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/invariants.md#example-ex-f6c8be)
- [Operations on Structures](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md)
  - [`AssignNames(~L, S): RngPad, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#procedure-assignnames-rngpad-seqenum-ref)
  - [`AssignNames(~L, S): RngPadResExt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#procedure-assignnames-rngpadresext-seqenum-ref)
  - [`AssignNames(~L, S): FldPad, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#procedure-assignnames-fldpad-seqenum-ref)
  - [`Characteristic(L): RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-characteristic-rngpad)
  - [`Characteristic(L): RngPadRes → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-characteristic-rngpadres)
  - [`Characteristic(L): RngPadResExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-characteristic-rngpadresext)
  - [`Characteristic(L): FldPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-characteristic-fldpad)
  - [`# L: RngPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-operation-rngpad-rngintelt)
  - [`Name(L, k): RngPad, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-name-rngpad-rngintelt)
  - [`Name(L, k): RngPadRes, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-name-rngpadres-rngintelt)
  - [`Name(L, k): RngPadResExt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-name-rngpadresext-rngintelt)
  - [`Name(L, k): FldPad, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-name-fldpad-rngintelt)
  - [`ChangePrecision(L, k): RngPad, Any → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpad-any)
  - [`ChangePrecision(L, k): RngPad, Infty → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpad-infty)
  - [`ChangePrecision(~L, k): RngPad, Infty → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpad-infty-ref)
  - [`ChangePrecision(L, k): RngPad, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpad-rngintelt)
  - [`ChangePrecision(~L, k): RngPad, RngIntElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpad-rngintelt-ref)
  - [`ChangePrecision(L, k): RngPadRes, RngIntElt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpadres-rngintelt)
  - [`ChangePrecision(~L, k): RngPadRes, RngIntElt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpadres-rngintelt-ref)
  - [`ChangePrecision(L, k): RngPadResExt, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpadresext-rngintelt)
  - [`ChangePrecision(~L, k): RngPadResExt, RngIntElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-rngpadresext-rngintelt-ref)
  - [`ChangePrecision(L, k): FldPad, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-fldpad-rngintelt)
  - [`ChangePrecision(~L, k): FldPad, RngIntElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-fldpad-rngintelt-ref)
  - [`ChangePrecision(L, k): FldPad, Any → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-fldpad-any)
  - [`ChangePrecision(L, k): FldPad, Infty → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-fldpad-infty)
  - [`ChangePrecision(~L, k): FldPad, Infty → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-changeprecision-fldpad-infty-ref)
  - [`L eq K: RngPad, RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-eq-rngpad-rngpad)
  - [`L eq K: RngPadRes, RngPadRes → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-eq-rngpadres-rngpadres)
  - [`L eq K: RngPadResExt, RngPadResExt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-eq-rngpadresext-rngpadresext)
  - [`L eq K: FldPad, FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-eq-fldpad-fldpad)
  - [`L ne K: RngPad, RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-ne-rngpad-rngpad)
  - [`L ne K: RngPadRes, RngPadRes → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-ne-rngpadres-rngpadres)
  - [`L ne K: RngPadResExt, RngPadResExt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-ne-rngpadresext-rngpadresext)
  - [`L ne K: FldPad, FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#operation-op-ne-fldpad-fldpad)
  - [Example: Changing Precision of Local Structures](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#example-ex-23c278)
  - [Ramification Predicates](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#ramification-predicates)
    - [`IsRamified(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-isramified-rngpad)
    - [`IsRamified(R): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-isramified-fldpad)
    - [`IsUnramified(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-isunramified-rngpad)
    - [`IsUnramified(R): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-isunramified-fldpad)
    - [`IsTotallyRamified(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-istotallyramified-rngpad)
    - [`IsTotallyRamified(R): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-istotallyramified-fldpad)
    - [`IsTamelyRamified(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-istamelyramified-rngpad)
    - [`IsTamelyRamified(R): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-istamelyramified-fldpad)
    - [`IsWildlyRamified(R): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-iswildlyramified-rngpad)
    - [`IsWildlyRamified(R): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/structure-operations.md#function-iswildlyramified-fldpad)
- [Element Constructions and Conversions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md)
  - [Constructions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructions)
    - [`Zero(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-zero-rngpad)
    - [`Zero(L): RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-zero-rngpadres)
    - [`Zero(L): RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-zero-rngpadresext)
    - [`Zero(L): FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-zero-fldpad)
    - [`One(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-one-rngpad)
    - [`One(L): RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-one-rngpadres)
    - [`One(L): RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-one-rngpadresext)
    - [`One(L): FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-one-fldpad)
    - [`Random(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-random-rngpad)
    - [`Random(L): RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-random-rngpadres)
    - [`Random(L): RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-random-rngpadresext)
    - [`Representative(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-representative-rngpad)
    - [`Representative(L): RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-representative-rngpadres)
    - [`Representative(L): RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-representative-rngpadresext)
    - [`Representative(L): FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-representative-fldpad)
    - [`elt<L | u>: RngPad, RngElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngelt-rngpadelt)
    - [`elt<L | u>: RngPad, [RngElt] → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngelt-rngpadelt-2)
    - [`L ! u: RngPad, RngElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#operation-op-rngpad-rngelt)
    - [`L ! u: RngPad, [RngElt] → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#operation-op-rngpad-rngelt-2)
    - [`elt<L | u>: FldPad, RngElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngelt-fldpadelt)
    - [`elt<L | u>: FldPad, [RngElt] → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngelt-fldpadelt-2)
    - [`L ! u: FldPad, RngElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#operation-op-fldpad-rngelt)
    - [`L ! u: FldPad, [RngElt] → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#operation-op-fldpad-rngelt-2)
    - [`elt<L | u, r>: RngPad, RngElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngelt-rngintelt-rngpadelt)
    - [`elt<L | u, r>: RngPad, [RngElt], RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngelt-rngintelt-rngpadelt-2)
    - [`elt<L | u, r>: FldPad, RngElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngelt-rngintelt-fldpadelt)
    - [`elt<L | u, r>: FldPad, [RngElt], RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngelt-rngintelt-fldpadelt-2)
    - [`elt<L | v, u, r>: RngPad, RngIntElt, RngElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngintelt-rngelt-rngintelt-rngpadelt)
    - [`elt<L | v, u, r>: RngPad, RngIntElt, [RngElt], RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-rngpad-rngintelt-rngelt-rngintelt-rngpadelt-2)
    - [`elt<L | v, u, r>: FldPad, RngIntElt, RngElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngintelt-rngelt-rngintelt-fldpadelt)
    - [`elt<L | v, u, r>: FldPad, RngIntElt, [RngElt], RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#constructor-constructor-elt-fldpad-rngintelt-rngelt-rngintelt-fldpadelt-2)
    - [`BigO(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-bigo-rngpadelt)
    - [`BigO(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-bigo-fldpadelt)
    - [`O(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-o-rngpadelt)
    - [`O(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-o-fldpadelt)
    - [`UniformizingElement(L): RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-uniformizingelement-rngpad-2)
    - [`UniformizingElement(L): RngPadRes → RndPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-uniformizingelement-rngpadres-2)
    - [`UniformizingElement(L): RngPadResExt → RndPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-uniformizingelement-rngpadresext-2)
    - [`UniformizingElement(L): FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-uniformizingelement-fldpad-2)
    - [Example: Element Constructors and Imprecise Zeros](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#example-ex-9e5bd3)
    - [Example: Precision When Coercing Sequences](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#example-ex-b0924e)
  - [Element Decomposers](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#element-decomposers)
    - [`ElementToSequence(x): RngPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-elementtosequence-rngpadelt)
    - [`ElementToSequence(x): RngPadResElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-elementtosequence-rngpadreselt)
    - [`ElementToSequence(x): RngPadResExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-elementtosequence-rngpadresextelt)
    - [`ElementToSequence(x): FldPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-elementtosequence-fldpadelt)
    - [`Eltseq(x): RngPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-eltseq-rngpadelt)
    - [`Eltseq(x): RngPadResElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-eltseq-rngpadreselt)
    - [`Eltseq(x): RngPadResExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-eltseq-rngpadresextelt)
    - [`Eltseq(x): FldPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-eltseq-fldpadelt)
    - [`Coefficients(x): RngPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficients-rngpadelt)
    - [`Coefficients(x): RngPadResElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficients-rngpadreselt)
    - [`Coefficients(x): RngPadResExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficients-rngpadresextelt)
    - [`Coefficients(x): FldPadElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficients-fldpadelt)
    - [`Coefficient(x, i): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficient-rngpadelt-rngintelt)
    - [`Coefficient(x, i): RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficient-rngpadreselt-rngintelt)
    - [`Coefficient(x, i): RngPadResExtElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficient-rngpadresextelt-rngintelt)
    - [`Coefficient(x, i): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#function-coefficient-fldpadelt-rngintelt)
    - [Example: Galois Descent of a Polynomial](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/consconv-element.md#example-ex-716c79)
- [Operations on Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md)
  - [Arithmetic](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#arithmetic)
    - [`- x: RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-rngpadelt-rngpadelt)
    - [`- x: RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-rngpadreselt-rngpadreselt)
    - [`- x: RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-rngpadresextelt-rngpadresextelt)
    - [`- x: FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-fldpadelt-fldpadelt)
    - [`x + y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-plus-rngpadelt-rngpadelt)
    - [`x + y: RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-plus-rngpadreselt-rngpadreselt)
    - [`x + y: RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-plus-rngpadresextelt-rngpadresextelt)
    - [`x + y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-plus-fldpadelt-fldpadelt)
    - [`x - y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-minus-rngpadelt-rngpadelt)
    - [`x - y: RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-minus-rngpadreselt-rngpadreselt)
    - [`x - y: RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-minus-rngpadresextelt-rngpadresextelt)
    - [`x - y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-minus-fldpadelt-fldpadelt)
    - [`x * y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-times-rngpadelt-rngpadelt)
    - [`x * y: RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-times-rngpadreselt-rngpadreselt)
    - [`x * y: RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-times-rngpadresextelt-rngpadresextelt)
    - [`x * y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-times-fldpadelt-fldpadelt)
    - [`x ^ k: RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-pow-rngpadelt-rngintelt)
    - [`x ^ k: RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-pow-rngpadreselt-rngintelt)
    - [`x ^ k: RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-pow-rngpadresextelt-rngintelt)
    - [`x ^ k: FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-pow-fldpadelt-rngintelt)
    - [`x div y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadelt-rngpadelt-rngpadelt)
    - [`x div y: RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadreselt-rngpadreselt-rngpadreselt)
    - [`x div y: RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadresextelt-rngpadresextelt-rngpadresextelt)
    - [`x div y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-fldpadelt-fldpadelt-fldpadelt)
    - [`x div:= y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadelt-rngpadelt-rngpadelt-2)
    - [`x div:= y: RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadreselt-rngpadreselt-rngpadreselt-2)
    - [`x div:= y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-rngpadelt-rngpadelt-rngpadelt-3)
    - [`x div:= y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-operation-div-fldpadelt-fldpadelt-fldpadelt-2)
    - [`x / y: RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-div-rngpadelt-rngpadelt)
    - [`x / y: FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-div-fldpadelt-fldpadelt)
    - [`IsExactlyDivisible(x, y): RngPadElt, RngPadElt → BoolElt, RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isexactlydivisible-rngpadelt-rngpadelt)
    - [`IsExactlyDivisible(x, y): RngPadResElt, RngPadResElt → BoolElt, RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isexactlydivisible-rngpadreselt-rngpadreselt)
    - [`IsExactlyDivisible(x, y): RngPadResExtElt, RngPadResExtElt → BoolElt, RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isexactlydivisible-rngpadresextelt-rngpadresextelt)
    - [`IsExactlyDivisible(x, y): FldPadElt, FldPadElt → BoolElt, FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isexactlydivisible-fldpadelt-fldpadelt)
    - [Example: Division of Non-units](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-915090)
  - [Equality and Membership](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#equality-and-membership)
    - [`x eq y: RngPadResElt, RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-eq-rngpadreselt-rngpadreselt)
    - [`x eq y: RngPadResExtElt, RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-eq-rngpadresextelt-rngpadresextelt)
    - [`x eq y: RngPadElt, RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-eq-rngpadelt-rngpadelt)
    - [`x eq y: FldPadElt, FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-eq-fldpadelt-fldpadelt)
    - [`x ne y: RngPadResElt, RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-ne-rngpadreselt-rngpadreselt)
    - [`x ne y: RngPadResExtElt, RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-ne-rngpadresextelt-rngpadresextelt)
    - [`x ne y: RngPadElt, RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-ne-rngpadelt-rngpadelt)
    - [`x ne y: FldPadElt, FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-ne-fldpadelt-fldpadelt)
    - [`x in L: ., RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-in-rngpad)
    - [`x in L: ., FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-in-fldpad)
    - [`x notin L: ., RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-notin-rngpad)
    - [`x notin L: ., FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#operation-op-notin-fldpad)
    - [Example: Constructing an Unramified Extension](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-44ed45)
  - [Properties](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#properties)
    - [`IsZero(x): RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-iszero-rngpadelt)
    - [`IsZero(x): RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-iszero-rngpadreselt)
    - [`IsZero(x): RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-iszero-rngpadresextelt)
    - [`IsZero(x): FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-iszero-fldpadelt)
    - [`IsOne(x): RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isone-rngpadelt)
    - [`IsOne(x): RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isone-rngpadreselt)
    - [`IsOne(x): RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isone-rngpadresextelt)
    - [`IsOne(x): FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isone-fldpadelt)
    - [`IsMinusOne(x): RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isminusone-rngpadelt)
    - [`IsMinusOne(x): RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isminusone-rngpadreselt)
    - [`IsMinusOne(x): RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isminusone-rngpadresextelt)
    - [`IsMinusOne(x): FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isminusone-fldpadelt)
    - [`IsUnit(x): RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isunit-rngpadelt)
    - [`IsUnit(x): RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isunit-rngpadreselt)
    - [`IsUnit(x): RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isunit-rngpadresextelt)
    - [`IsUnit(x): FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isunit-fldpadelt)
    - [`IsIntegral(x): RngPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isintegral-rngpadelt)
    - [`IsIntegral(x): RngPadResElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isintegral-rngpadreselt)
    - [`IsIntegral(x): RngPadResExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isintegral-rngpadresextelt)
    - [`IsIntegral(x): FldPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-isintegral-fldpadelt)
  - [Precision and Valuation](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#precision-and-valuation)
    - [`Parent(x): RngPadElt → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-parent-rngpadelt)
    - [`Parent(x): RngPadResElt → RngPadRes`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-parent-rngpadreselt)
    - [`Parent(x): RngPadResExtElt → RngPadResExt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-parent-rngpadresextelt)
    - [`Parent(x): FldPadElt → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-parent-fldpadelt)
    - [`Precision(x): RngPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-precision-rngpadelt)
    - [`Precision(x): RngPadResElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-precision-rngpadreselt)
    - [`Precision(x): RngPadResExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-precision-rngpadresextelt)
    - [`Precision(x): FldPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-precision-fldpadelt)
    - [`AbsolutePrecision(x): RngPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-absoluteprecision-rngpadelt)
    - [`AbsolutePrecision(x): RngPadResElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-absoluteprecision-rngpadreselt)
    - [`AbsolutePrecision(x): RngPadResExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-absoluteprecision-rngpadresextelt)
    - [`AbsolutePrecision(x): FldPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-absoluteprecision-fldpadelt)
    - [`RelativePrecision(x): RngPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-relativeprecision-rngpadelt)
    - [`RelativePrecision(x): RngPadResElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-relativeprecision-rngpadreselt)
    - [`RelativePrecision(x): RngPadResExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-relativeprecision-rngpadresextelt)
    - [`RelativePrecision(x): FldPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-relativeprecision-fldpadelt)
    - [`ChangePrecision(x, k): RngUPolElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-rngupolelt-rngintelt)
    - [`ChangePrecision(~x, k): RngUPolElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-rngupolelt-rngintelt-ref)
    - [`ChangePrecision(x, k): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-rngpadelt-rngintelt)
    - [`ChangePrecision(~x, k): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-rngpadelt-rngintelt-ref)
    - [`ChangePrecision(x, k): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-fldpadelt-rngintelt)
    - [`ChangePrecision(~x, k): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-changeprecision-fldpadelt-rngintelt-ref)
    - [`Expand(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-expand-rngpadelt)
    - [`Expand(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-expand-fldpadelt)
    - [`Valuation(x): RngPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-valuation-rngpadelt)
    - [`Valuation(x): RngPadResElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-valuation-rngpadreselt)
    - [`Valuation(x): RngPadResExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-valuation-rngpadresextelt)
    - [`Valuation(x): FldPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-valuation-fldpadelt)
    - [Example: Relative and Absolute Precision](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-c75a3c)
    - [Example: Pitfalls of Unbounded Precision](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-a2d0b8)
  - [Logarithms and Exponentials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#logarithms-and-exponentials)
    - [`Log(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-log-rngpadelt)
    - [`Log(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-log-rngpadreselt)
    - [`Log(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-log-rngpadresextelt)
    - [`Log(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-log-fldpadelt)
    - [`Exp(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-exp-rngpadelt)
    - [`Exp(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-exp-rngpadreselt)
    - [`Exp(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-exp-rngpadresextelt)
    - [`Exp(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-exp-fldpadelt)
    - [Example: Timing Logarithms and Exponentials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-bfa7a7)
  - [Norm and Trace](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#norm-and-trace)
    - [`Norm(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadelt)
    - [`Norm(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadreselt)
    - [`Norm(x): RngPadResExtElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadresextelt)
    - [`Norm(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-fldpadelt)
    - [`Norm(x, R): RngPadElt, RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadelt-rngpad)
    - [`Norm(x, R): RngPadResElt, RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadreselt-rngpadres)
    - [`Norm(x, R): RngPadResExtElt, Rng → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-rngpadresextelt-rng)
    - [`Norm(x, R): FldPadElt, FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-norm-fldpadelt-fldpad)
    - [`Trace(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadelt)
    - [`Trace(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadreselt)
    - [`Trace(x): RngPadResExtElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadresextelt)
    - [`Trace(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-fldpadelt)
    - [`Trace(x, R): RngPadElt, RngPad → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadelt-rngpad)
    - [`Trace(x, R): RngPadResElt, RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadreselt-rngpadres)
    - [`Trace(x, R): RngPadResExtElt, Rng → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-rngpadresextelt-rng)
    - [`Trace(x, R): FldPadElt, FldPad → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-trace-fldpadelt-fldpad)
    - [`MinimalPolynomial(x): RngPadElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadelt)
    - [`MinimalPolynomial(x): RngPadResElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadreselt)
    - [`MinimalPolynomial(x): RngPadResExtElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadresextelt)
    - [`MinimalPolynomial(x): FldPadElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-fldpadelt)
    - [`MinimalPolynomial(x, R): RngPadElt, RngPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadelt-rngpad)
    - [`MinimalPolynomial(x, R): RngPadResElt, RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadreselt-rngpadres)
    - [`MinimalPolynomial(x, R): RngPadResExtElt, Rng → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-rngpadresextelt-rng)
    - [`MinimalPolynomial(x, R): FldPadElt, FldPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-minimalpolynomial-fldpadelt-fldpad)
    - [`CharacteristicPolynomial(x): RngPadElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadelt)
    - [`CharacteristicPolynomial(x): RngPadResElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadreselt)
    - [`CharacteristicPolynomial(x): RngPadResExtElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadresextelt)
    - [`CharacteristicPolynomial(x, R): RngPadElt, RngPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadelt-rngpad)
    - [`CharacteristicPolynomial(x, R): RngPadResElt, RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadreselt-rngpadres)
    - [`CharacteristicPolynomial(x, R): RngPadResExtElt, RngPadRes → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadresextelt-rngpadres)
    - [`CharacteristicPolynomial(x, R): RngPadResExtElt, RngPadResExt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-characteristicpolynomial-rngpadresextelt-rngpadresext)
    - [`GaloisImage(x, i): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-galoisimage-rngpadelt-rngintelt)
    - [`GaloisImage(x, i): RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-galoisimage-rngpadreselt-rngintelt)
    - [`GaloisImage(x, i): RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-galoisimage-rngpadresextelt-rngintelt)
    - [`GaloisImage(x, i): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-galoisimage-fldpadelt-rngintelt)
    - [Example: Arithmetic-Geometric Mean Point Counting](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#example-ex-1dd0a7)
    - [`EuclideanNorm(x): RngPadResElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-euclideannorm-rngpadreselt)
    - [`EuclideanNorm(x): RngRadResExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-euclideannorm-rngradresextelt)
  - [Power Relation (Algebraic Dependency)](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#power-relation-algebraic-dependency)
    - [`PowerRelation(x,n): FldPadElt, RngIntElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-powerrelation-fldpadelt-rngintelt)
  - [Teichmüller Lifts](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#teichmuller-lifts)
    - [`TeichmuellerLift(u, R): FldFinElt, RngPadResExt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-teichmuellerlift-fldfinelt-rngpadresext)
    - [`TeichmuellerLift(u, R): FldFinElt, RngPadRes → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/operation-element.md#function-teichmuellerlift-fldfinelt-rngpadres)
- [Linear Algebra](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/lin-alg.md)
- [Roots of Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md)
  - [`SquareRoot(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-squareroot-rngpadelt)
  - [`SquareRoot(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-squareroot-rngpadreselt)
  - [`SquareRoot(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-squareroot-rngpadresextelt)
  - [`SquareRoot(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-squareroot-fldpadelt)
  - [`Sqrt(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-sqrt-rngpadelt)
  - [`Sqrt(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-sqrt-rngpadreselt)
  - [`Sqrt(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-sqrt-rngpadresextelt)
  - [`Sqrt(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-sqrt-fldpadelt)
  - [`IsSquare(x): RngPadElt → BoolElt, RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-issquare-rngpadelt)
  - [`IsSquare(x): RngPadResElt → BoolElt, RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-issquare-rngpadreselt)
  - [`IsSquare(x): RngPadResExtElt → BoolElt, RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-issquare-rngpadresextelt)
  - [`IsSquare(x): FldPadElt → BoolElt, FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-issquare-fldpadelt)
  - [`InverseSquareRoot(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadelt)
  - [`InverseSquareRoot(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadreselt)
  - [`InverseSquareRoot(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadresextelt)
  - [`InverseSquareRoot(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-fldpadelt)
  - [`InverseSqrt(x): RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadelt)
  - [`InverseSqrt(x): RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadreselt)
  - [`InverseSqrt(x): RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadresextelt)
  - [`InverseSqrt(x): FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-fldpadelt)
  - [`InverseSquareRoot(x, y): RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadelt-rngpadelt)
  - [`InverseSquareRoot(x, y): RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadreselt-rngpadreselt)
  - [`InverseSquareRoot(x, y): RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-rngpadresextelt-rngpadresextelt)
  - [`InverseSquareRoot(x, y): FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesquareroot-fldpadelt-fldpadelt)
  - [`InverseSqrt(x, y): RngPadElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadelt-rngpadelt)
  - [`InverseSqrt(x, y): RngPadResElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadreselt-rngpadreselt)
  - [`InverseSqrt(x, y): RngPadResExtElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-rngpadresextelt-rngpadresextelt)
  - [`InverseSqrt(x, y): FldPadElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inversesqrt-fldpadelt-fldpadelt)
  - [`Root(x, n): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-root-rngpadelt-rngintelt)
  - [`Root(x, n): RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-root-rngpadreselt-rngintelt)
  - [`Root(x, n): RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-root-rngpadresextelt-rngintelt)
  - [`Root(x, n): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-root-fldpadelt-rngintelt)
  - [`IsPower(x, n): RngPadElt, RngIntElt → BoolElt, RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-ispower-rngpadelt-rngintelt)
  - [`IsPower(x, n): RngPadResElt, RngIntElt → BoolElt, RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-ispower-rngpadreselt-rngintelt)
  - [`IsPower(x, n): RngPadResExtElt, RngIntElt → BoolElt, RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-ispower-rngpadresextelt-rngintelt)
  - [`IsPower(x, n): FldPadElt, RngIntElt → BoolElt, FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-ispower-fldpadelt-rngintelt)
  - [`InverseRoot(x, n): RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadelt-rngintelt)
  - [`InverseRoot(x, n): RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadreselt-rngintelt)
  - [`InverseRoot(x, n): RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadresextelt-rngintelt)
  - [`InverseRoot(x, n): FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-fldpadelt-rngintelt)
  - [`InverseRoot(x, y, n): RngPadElt, RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadelt-rngpadelt-rngintelt)
  - [`InverseRoot(x, y, n): RngPadResElt, RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadreselt-rngpadreselt-rngintelt)
  - [`InverseRoot(x, y, n): RngPadResExtElt, RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-rngpadresextelt-rngpadresextelt-rngintelt)
  - [`InverseRoot(x, y, n): FldPadElt, FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/elt-roots.md#function-inverseroot-fldpadelt-fldpadelt-rngintelt)
- [Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md)
  - [Operations for Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#operations-for-polynomials)
    - [`GreatestCommonDivisor(f, g): RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-greatestcommondivisor-rngupolelt-rngupolelt)
    - [`Gcd(f, g): RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-gcd-rngupolelt-rngupolelt)
    - [`GCD(f, g): RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-gcd-rngupolelt-rngupolelt-2)
    - [`f div g: RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#operation-operation-div-rngupolelt-rngupolelt-rngupolelt)
    - [`f mod g: RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#operation-operation-mod-rngupolelt-rngupolelt-rngupolelt)
    - [`LeastCommonMultiple(f, g): RngUPolElt, RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-leastcommonmultiple-rngupolelt-rngupolelt)
    - [`Coefficient(f, i): RngUPolElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-coefficient-rngupolelt-rngintelt)
    - [`LeadingCoefficient(f): RngUPolElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-leadingcoefficient-rngupolelt)
    - [`Derivative(f): RngUPolElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-derivative-rngupolelt)
    - [`Evaluate(f, x): RngUPolElt, RngElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-evaluate-rngupolelt-rngelt)
    - [Example: GCDs of p-adic Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-8d80f7)
    - [`ShiftValuation(f, n): RngUPolElt, RngIntElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-shiftvaluation-rngupolelt-rngintelt)
  - [Roots of Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#roots-of-polynomials)
    - [Hensel Lifting of Roots](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#hensel-lifting-of-roots)
      - [`NewtonPolygon(f): RngUPolElt → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-newtonpolygon-rngupolelt)
      - [`ValuationsOfRoots(f): RngUPolElt → SeqEnum[<FldRatElt, RngIntElt>]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-valuationsofroots-rngupolelt)
      - [Example: Newton Polygons and Root Valuations](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-8d9abc)
      - [`HenselLift(f, x): RngUPolElt, RngPadElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadelt)
      - [`HenselLift(f, x): RngUPolElt, RngPadResElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadreselt)
      - [`HenselLift(f, x): RngUPolElt, RngPadResExtElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadresextelt)
      - [`HenselLift(f, x): RngUPolElt, FldPadElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-fldpadelt)
      - [`HenselLift(f, x, k): RngUPolElt, RngPadElt, RngIntElt → RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadelt-rngintelt)
      - [`HenselLift(f, x, k): RngUPolElt, RngPadResElt, RngIntElt → RngPadResElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadreselt-rngintelt)
      - [`HenselLift(f, x, k): RngUPolElt, RngPadResExtElt, RngIntElt → RngPadResExtElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngpadresextelt-rngintelt)
      - [`HenselLift(f, x, k): RngUPolElt, FldPadElt, RngIntElt → FldPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-fldpadelt-rngintelt)
      - [Example: Square Roots by Hensel Lifting](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-88d396)
    - [Functions returning Roots](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#functions-returning-roots)
      - [`Roots(f): RngUPolElt → [ <RngPadElt, RngIntElt> ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-roots-rngupolelt)
      - [`Roots(f, R): RngUPolElt, RngPad → [ <RngPadElt, RngIntElt> ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-roots-rngupolelt-rngpad)
      - [`HasRoot(f): RngUPolElt → BoolElt, RngPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hasroot-rngupolelt)
      - [Example: Ramified Quadratic Extensions of Z2](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-87cd32)
  - [Factorization](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#factorization)
    - [`HenselLift(f, s): RngUPolElt, [RngUPolElt] → [RngUPolElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-hensellift-rngupolelt-rngupolelt)
    - [Example: Hensel Factorization of Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-aacddc)
    - [`IsIrreducible(f): RngUPolElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-isirreducible-rngupolelt)
    - [`SquareFreeFactorization(f): RngUPolElt → [ < RngUPolElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-squarefreefactorization-rngupolelt)
    - [`Factorization(f): RngUPolElt → [ < RngUPolElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-factorization-rngupolelt)
    - [`LocalFactorization(f): RngUPolElt → [ < RngUPolElt, RngIntElt >]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-localfactorization-rngupolelt)
    - [`SuggestedPrecision(f): RngUPolElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-suggestedprecision-rngupolelt)
    - [`IsIsomorphic(f, g): RngUPolElt, RngUPolElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-isisomorphic-rngupolelt-rngupolelt)
    - [`Distance(f, g): RngUPolElt, RngUPolElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-distance-rngupolelt-rngupolelt)
    - [Example: Suggested Precision for Factorization](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-f1ae2a)
    - [Example: Local Factorizations and Galois Groups](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-836762)
    - [`SplittingField(f): RngUPolElt[FldPad] → FldPad, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-splittingfield-rngupolelt-fldpad)
    - [`SplittingField(f): RngUPolElt[RngPad] → FldPad, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#function-splittingfield-rngupolelt-rngpad)
    - [Example: Splitting Field over a p-adic Field](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/polynomials.md#example-ex-f42dd9)
- [Automorphisms of Local Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md)
  - [`Automorphisms(L): RngPad → [Map]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphisms-rngpad)
  - [`Automorphisms(L): FldPad → [Map]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphisms-fldpad)
  - [`Automorphisms(K, k): FldPad, FldPad → [Map]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphisms-fldpad-fldpad)
  - [`Automorphisms(K, k): RngPad, RngPad → [Map]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphisms-rngpad-rngpad)
  - [`AutomorphismGroup(L): RngPad → GrpPerm, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphismgroup-rngpad)
  - [`AutomorphismGroup(L): FldPad → GrpPerm, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphismgroup-fldpad)
  - [`AutomorphismGroup(K, k): RngPad, RngPad → GrpPerm, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphismgroup-rngpad-rngpad)
  - [`AutomorphismGroup(K, k): FldPad, FldPad → GrpPerm, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-automorphismgroup-fldpad-fldpad)
  - [`IsNormal(K): RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isnormal-rngpad)
  - [`IsNormal(K): FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isnormal-fldpad)
  - [`IsNormal(K, k): RngPad, RngPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isnormal-rngpad-rngpad)
  - [`IsNormal(K, k): FldPad, FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isnormal-fldpad-fldpad)
  - [`IsAbelian(K, k): FldPad, FldPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isabelian-fldpad-fldpad)
  - [`Continuations(m, L): Map, RngPad → [Map]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-continuations-map-rngpad)
  - [`IsIsomorphic(E, K): RngPad, RngPad → BooElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isisomorphic-rngpad-rngpad)
  - [`IsIsomorphic(E, K): FldPad, FldPad → BooElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-isisomorphic-fldpad-fldpad)
  - [Example: Automorphisms of a Local Ring](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#example-ex-b62260)
  - [`GaloisGroup(f): RngUPolElt[FldPad] → GrpPerm, SeqEnum, UserProgram`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-galoisgroup-rngupolelt-fldpad)
  - [`GaloisGroup(f): RngUPolElt[RngPad] → GrpPerm, SeqEnum, UserProgram`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#function-galoisgroup-rngupolelt-rngpad)
  - [Example: Galois Group of a Local Polynomial](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/autos.md#example-ex-286b99)
- [Completions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/completion.md)
  - [`Completion(O, P): RngOrd, RngOrdIdl → RngPad, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/completion.md#function-completion-rngord-rngordidl)
  - [`Completion(K, P): FldNum, RngOrdIdl → FldPad, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/completion.md#function-completion-fldnum-rngordidl)
  - [`LocalRing(P, k): RngOrdIdl, RngIntElt → RngPad, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/completion.md#function-localring-rngordidl-rngintelt)
  - [Example: Completion of a Number Field](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/completion.md#example-ex-2bb9ae)
- [Class Field Theory](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md)
  - [Unit Group](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#unit-group)
    - [`PrincipalUnitGroupGenerators(R): RngPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-principalunitgroupgenerators-rngpad)
    - [`PrincipalUnitGroupGenerators(R): FldPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-principalunitgroupgenerators-fldpad)
    - [`PrincipalUnitGroup(R): RngPad → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-principalunitgroup-rngpad)
    - [`PrincipalUnitGroup(R): RngPadResExt → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-principalunitgroup-rngpadresext)
    - [`PrincipalUnitGroup(R): RngPadRes → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-principalunitgroup-rngpadres)
    - [`UnitGroup(R): RngPad → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-unitgroup-rngpad)
    - [`UnitGroup(F): FldPad → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-unitgroup-fldpad)
    - [`UnitGroupGenerators(R): RngPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-unitgroupgenerators-rngpad)
    - [`UnitGroupGenerators(R): RngPadRes → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-unitgroupgenerators-rngpadres)
    - [`UnitGroupGenerators(F): FldPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-unitgroupgenerators-fldpad)
    - [`pSelmerGroup(p,F): RngIntElt, FldPad → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-pselmergroup-rngintelt-fldpad)
  - [Norm Group](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#norm-group)
    - [`NormGroup(R, m): FldPad, Map → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normgroup-fldpad-map)
    - [`NormGroup(R, m): RngPad, Map → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normgroup-rngpad-map)
    - [`NormEquation(R, m, b): FldPad, Map, RngElt → BoolElt, RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normequation-fldpad-map-rngelt)
    - [`NormEquation(R, m, b): RngPad, Map, RngElt → BoolElt, RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normequation-rngpad-map-rngelt)
    - [`NormEquation(m1, m2, G): Map, Map, GrpAb → GrpAb, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normequation-map-map-grpab)
    - [`Norm(m1, m2, G): Map, Map, GrpAb → GrpAb`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-norm-map-map-grpab)
    - [`NormKernel(m1, m2): Map, Map → GrpAb`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normkernel-map-map)
  - [Class Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#id2)
    - [`ClassField(m, G): Map, GrpAb → FldAb`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-classfield-map-grpab)
    - [`NormGroupDiscriminant(m, G): Map, GrpAb → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/class-fields.md#function-normgroupdiscriminant-map-grpab)
- [Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md)
  - [`AllExtensions(R, n): RngPad, RngIntElt → [RngPad]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#function-allextensions-rngpad-rngintelt)
  - [`AllExtensions(R, n): FldPad, RngIntElt → [RngPad]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#function-allextensions-fldpad-rngintelt)
  - [`NumberOfExtensions(R, n): RngPad, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#function-numberofextensions-rngpad-rngintelt)
  - [`OreConditions(R, n, j): RngPad, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#function-oreconditions-rngpad-rngintelt-rngintelt)
  - [`OreConditions(R, n, j): FldPad, RngIntElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#function-oreconditions-fldpad-rngintelt-rngintelt)
  - [Example: All Extensions of Degree 9 over Q3](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/extensions.md#example-ex-ea2536)
- [Exact $p$-Adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md)
  - [Introduction](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#introduction)
    - [`IsExactpAdic(x): Any → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isexactpadic-any)
  - [Exact $p$-adic Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#exact-p-adic-rings-and-fields)
    - [Construction of Exact $p$-adic Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#construction-of-exact-p-adic-rings-and-fields)
      - [`pAdicField(p : parameters): RngIntElt → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-padicfield-rngintelt-2)
      - [`pAdicRing(p : parameters): RngIntElt → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-padicring-rngintelt-2)
      - [`ext<K | f>: FldXPad, RngUPolElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-fldxpad-rngupolelt-rngxpad)
      - [`ext<K | f>: FldXPad, RngUPolXPadElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-fldxpad-rngupolxpadelt-rngxpad)
      - [`ext<K | f>: FldXPad, [RngXPadElt] → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-fldxpad-rngxpadelt-rngxpad)
      - [`ext<K | d>: FldXPad, RngIntElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-fldxpad-rngintelt-rngxpad)
      - [`ext<K | f>: RngXPad, RngUPolElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-rngxpad-rngupolelt-rngxpad)
      - [`ext<K | f>: RngXPad, RngUPolXPadElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-rngxpad-rngupolxpadelt-rngxpad)
      - [`ext<K | f>: RngXPad, [RngXPadElt] → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-rngxpad-rngxpadelt-rngxpad)
      - [`ext<K | d>: RngXPad, RngIntElt → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-ext-rngxpad-rngintelt-rngxpad)
      - [Example: Constructing Exact p-adic Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-72b734)
    - [Related Structures](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#related-structures)
      - [`RingOfIntegers(L): FldXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ringofintegers-fldxpad)
      - [`RingOfIntegers(L): RngXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ringofintegers-rngxpad)
      - [`IntegerRing(L): FldXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-integerring-fldxpad)
      - [`Integers(L): FldXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-integers-fldxpad)
      - [`IntegerRing(L): RngXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-integerring-rngxpad)
      - [`Integers(L): RngXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-integers-rngxpad)
      - [`FieldOfFractions(L): FldXPad → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-fieldoffractions-fldxpad)
      - [`FieldOfFractions(L): RngXPad → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-fieldoffractions-rngxpad)
      - [`BaseField(F): FldXPad → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-basefield-fldxpad)
      - [`CoefficientField(F): FldXPad → FldXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficientfield-fldxpad)
      - [`BaseRing(R): RngXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-basering-rngxpad)
      - [`CoefficientRing(R): RngXPad → RngXPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficientring-rngxpad)
      - [`ResidueClassField(L): FldXPad → FldFin, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-residueclassfield-fldxpad)
      - [`ResidueClassField(L): RngXPad → FldFin, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-residueclassfield-rngxpad)
      - [`pAdicQuotientRing(L, k): FldXPad, RngIntElt → RngPadRes, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-padicquotientring-fldxpad-rngintelt)
      - [`pAdicQuotientRing(L, k): RngXPad, RngIntElt → RngPadRes, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-padicquotientring-rngxpad-rngintelt)
      - [`quo<L | x>: RngXPad, Any → RngPadRes, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-quo-rngxpad-any-rngpadres-map)
      - [`quo<L | x>: FldXPad, Any → RngPadRes, Map`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-quo-fldxpad-any-rngpadres-map)
      - [`InfinitePrecisionApproximation(K): FldXPad → FldPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-infiniteprecisionapproximation-fldxpad)
      - [`InfinitePrecisionApproximation(K): RngXPad → RngPad`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-infiniteprecisionapproximation-rngxpad)
      - [`R eq T: RngXPad, RngXPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-eq-rngxpad-rngxpad)
      - [`R eq T: FldXPad, FldXPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-eq-fldxpad-fldxpad)
      - [Example: Structures Related to Exact p-adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-34e873)
    - [Generating Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#generating-elements)
      - [`R . i: FldXPad, RngIntElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-fldxpad-rngintelt-fldxpadelt)
      - [`R . i: RngXPad, RngIntElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-rngxpad-rngintelt-rngxpadelt)
      - [`Name(R, i): RngXPad, RngIntElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-name-rngxpad-rngintelt)
      - [`Name(R, i): FldXPad, RngIntElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-name-fldxpad-rngintelt)
      - [`AssignNames(~R, S): RngXPad, SeqEnum[MonStgElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#procedure-assignnames-rngxpad-seqenum-monstgelt-ref)
      - [`AssignNames(~R, S): FldXPad, SeqEnum[MonStgElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#procedure-assignnames-fldxpad-seqenum-monstgelt-ref)
      - [`Generator(R): FldXPad → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-generator-fldxpad)
      - [`Generator(R): RngXPad → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-generator-rngxpad)
      - [`UniformizingElement(R): FldXPad → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-uniformizingelement-fldxpad)
      - [`UniformizingElement(R): RngXPad → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-uniformizingelement-rngxpad)
      - [`ResidueGenerator(R): FldXPad → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-residuegenerator-fldxpad)
      - [`ResidueGenerator(R): RngXPad → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-residuegenerator-rngxpad)
      - [`AbsoluteGenerator(R): FldXPad → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absolutegenerator-fldxpad)
      - [`AbsoluteGenerator(R): RngXPad → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absolutegenerator-rngxpad)
      - [Example: Generating Elements of Exact p-adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-1abc7d)
    - [Invariants](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#invariants)
      - [`Prime(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-prime-fldxpad)
      - [`Prime(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-prime-rngxpad)
      - [`Degree(L, K): FldXPad, FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-degree-fldxpad-fldxpad)
      - [`Degree(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-degree-fldxpad)
      - [`Degree(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-degree-rngxpad)
      - [`Degree(L, K): RngXPad, RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-degree-rngxpad-rngxpad)
      - [`InertiaDegree(L, K): FldXPad, FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-inertiadegree-fldxpad-fldxpad)
      - [`InertiaDegree(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-inertiadegree-fldxpad)
      - [`InertiaDegree(L, K): RngXPad, RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-inertiadegree-rngxpad-rngxpad)
      - [`InertiaDegree(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-inertiadegree-rngxpad)
      - [`RamificationDegree(L, K): FldXPad, FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationdegree-fldxpad-fldxpad)
      - [`RamificationDegree(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationdegree-fldxpad)
      - [`RamificationIndex(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationindex-fldxpad)
      - [`RamificationIndex(L, K): FldXPad, FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationindex-fldxpad-fldxpad)
      - [`RamificationDegree(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationdegree-rngxpad)
      - [`RamificationDegree(L, K): RngXPad, RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationdegree-rngxpad-rngxpad)
      - [`RamificationIndex(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationindex-rngxpad)
      - [`RamificationIndex(L, K): RngXPad, RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationindex-rngxpad-rngxpad)
      - [`DefiningPolynomial(R): RngXPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-definingpolynomial-rngxpad)
      - [`DefiningPolynomial(R): FldXPad → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-definingpolynomial-fldxpad)
      - [`AbsoluteDegree(F): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absolutedegree-fldxpad)
      - [`AbsoluteInertiaDegree(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteinertiadegree-fldxpad)
      - [`AbsoluteInertiaIndex(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteinertiaindex-fldxpad)
      - [`AbsoluteRamificationDegree(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteramificationdegree-fldxpad)
      - [`AbsoluteRamificationIndex(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteramificationindex-fldxpad)
      - [`AbsoluteDegree(F): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absolutedegree-rngxpad)
      - [`AbsoluteInertiaDegree(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteinertiadegree-rngxpad)
      - [`AbsoluteInertiaIndex(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteinertiaindex-rngxpad)
      - [`AbsoluteRamificationDegree(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteramificationdegree-rngxpad)
      - [`AbsoluteRamificationIndex(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteramificationindex-rngxpad)
      - [`DiscriminantValuation(L): FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-discriminantvaluation-fldxpad)
      - [`DiscriminantValuation(L, K): FldXPad, FldXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-discriminantvaluation-fldxpad-fldxpad)
      - [`DiscriminantValuation(L, K): RngXPad, RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-discriminantvaluation-rngxpad-rngxpad)
      - [`DiscriminantValuation(L): RngXPad → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-discriminantvaluation-rngxpad)
      - [`RamificationPolygon(L): FldXPad → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-fldxpad)
      - [`RamificationPolygon(L, K): FldXPad, FldXPad → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-fldxpad-fldxpad)
      - [`RamificationPolygon(L, K): RngXPad, RngXPad → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-rngxpad-rngxpad)
      - [`RamificationPolygon(L): RngXPad → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-rngxpad)
      - [`RamificationPolygon(f): RngUPolXPadElt[FldXPad] → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-rngupolxpadelt-fldxpad)
      - [`RamificationPolygon(f): RngUPolXPadElt[RngXPad] → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationpolygon-rngupolxpadelt-rngxpad)
      - [Example: Invariants of Exact p-adic Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-5789a2)
  - [Exact $p$-adic Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#exact-p-adic-elements)
    - [`GetExactpAdicsPrintPrecision() → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-getexactpadicsprintprecision)
    - [`SetExactpAdicsPrintPrecision(k): Infty`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#procedure-setexactpadicsprintprecision-infty)
    - [`SetExactpAdicsPrintPrecision(k): RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#procedure-setexactpadicsprintprecision-rngintelt)
    - [`K ! x: FldXPad, Any → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-fldxpad-any)
    - [`R ! x: RngXPad, Any → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-rngxpad-any)
    - [`elt<K | x>: FldXPad, Any → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-elt-fldxpad-any-fldxpadelt)
    - [`elt<R | x>: RngXPad, Any → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#constructor-constructor-elt-rngxpad-any-rngxpadelt)
    - [`AbsolutePrecision(x): FldXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteprecision-fldxpadelt)
    - [`AbsolutePrecision(x): RngXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-absoluteprecision-rngxpadelt)
    - [`RelativePrecision(x): FldXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-relativeprecision-fldxpadelt)
    - [`RelativePrecision(x): RngXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-relativeprecision-rngxpadelt)
    - [`Valuation(x): FldXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuation-fldxpadelt)
    - [`Valuation(x): RngXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuation-rngxpadelt)
    - [`WeakValuation(x): RngXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-weakvaluation-rngxpadelt)
    - [`WeakValuation(x): FldXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-weakvaluation-fldxpadelt)
    - [`ShiftValuation(x, n): FldXPadElt, RngIntElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-shiftvaluation-fldxpadelt-rngintelt)
    - [`ShiftValuation(x, n): RngXPadElt, RngIntElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-shiftvaluation-rngxpadelt-rngintelt)
    - [`ValuationEq(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationeq-fldxpadelt-rngintelt)
    - [`ValuationEq(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationeq-fldxpadelt-infty)
    - [`ValuationEq(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationeq-rngxpadelt-rngintelt)
    - [`ValuationEq(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationeq-rngxpadelt-infty)
    - [`ValuationNe(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationne-fldxpadelt-rngintelt)
    - [`ValuationNe(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationne-fldxpadelt-infty)
    - [`ValuationNe(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationne-rngxpadelt-rngintelt)
    - [`ValuationNe(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationne-rngxpadelt-infty)
    - [`ValuationGe(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationge-fldxpadelt-rngintelt)
    - [`ValuationGe(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationge-fldxpadelt-infty)
    - [`ValuationGe(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationge-rngxpadelt-rngintelt)
    - [`ValuationGe(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationge-rngxpadelt-infty)
    - [`ValuationGt(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationgt-fldxpadelt-infty)
    - [`ValuationGt(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationgt-fldxpadelt-rngintelt)
    - [`ValuationGt(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationgt-rngxpadelt-rngintelt)
    - [`ValuationGt(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationgt-rngxpadelt-infty)
    - [`ValuationLe(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationle-fldxpadelt-infty)
    - [`ValuationLe(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationle-fldxpadelt-rngintelt)
    - [`ValuationLe(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationle-rngxpadelt-rngintelt)
    - [`ValuationLe(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationle-rngxpadelt-infty)
    - [`ValuationLt(x, n): FldXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationlt-fldxpadelt-rngintelt)
    - [`ValuationLt(x, n): FldXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationlt-fldxpadelt-infty)
    - [`ValuationLt(x, n): RngXPadElt, Infty → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationlt-rngxpadelt-infty)
    - [`ValuationLt(x, n): RngXPadElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-valuationlt-rngxpadelt-rngintelt)
    - [`IsUnit(x): RngXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isunit-rngxpadelt)
    - [`IsUnit(x): FldXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isunit-fldxpadelt)
    - [`IsIntegral(x): RngXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isintegral-rngxpadelt)
    - [`IsIntegral(x): FldXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isintegral-fldxpadelt)
    - [`IsWeaklyZero(x): StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isweaklyzero-stranyxpadelt)
    - [`IsWeaklyEqual(x, y): StrAnyXPadElt, StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isweaklyequal-stranyxpadelt-stranyxpadelt)
    - [`IsDefinitelyZero(x): StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isdefinitelyzero-stranyxpadelt)
    - [`IsDefinitelyEqual(x, y): StrAnyXPadElt, StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isdefinitelyequal-stranyxpadelt-stranyxpadelt)
    - [`CoerceAndLift(S, x): StrAnyXPad, Any → StrAnyXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coerceandlift-stranyxpad-any)
    - [Arithmetic with Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#arithmetic-with-elements)
      - [`x * y: FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-times-fldxpadelt-fldxpadelt)
      - [`x * y: RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-times-rngxpadelt-rngxpadelt)
      - [`x + y: FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-plus-fldxpadelt-fldxpadelt)
      - [`x + y: RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-plus-rngxpadelt-rngxpadelt)
      - [`- y: FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-fldxpadelt-fldxpadelt)
      - [`- y: RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-rngxpadelt-rngxpadelt)
      - [`x - y: RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-minus-rngxpadelt-rngxpadelt)
      - [`x - y: FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-minus-fldxpadelt-fldxpadelt)
      - [`x ^ n: FldXPadElt, RngIntElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-pow-fldxpadelt-rngintelt)
      - [`x ^ n: RngXPadElt, RngIntElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-pow-rngxpadelt-rngintelt)
      - [`x / y: FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-div-fldxpadelt-fldxpadelt)
      - [`x / y: RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-div-rngxpadelt-rngxpadelt)
      - [`x div y: RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-div-rngxpadelt-rngxpadelt-rngxpadelt)
      - [`Quotrem(x, y): RngXPadElt, RngXPadElt → RngXPadElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-quotrem-rngxpadelt-rngxpadelt)
      - [`GCD(x, y): FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-gcd-fldxpadelt-fldxpadelt)
      - [`Gcd(x, y): FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-gcd-fldxpadelt-fldxpadelt-2)
      - [`GreatestCommonDivisor(x, y): FldXPadElt, FldXPadElt → FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-greatestcommondivisor-fldxpadelt-fldxpadelt)
      - [`GCD(x, y): RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-gcd-rngxpadelt-rngxpadelt)
      - [`Gcd(x, y): RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-gcd-rngxpadelt-rngxpadelt-2)
      - [`GreatestCommonDivisor(x, y): RngXPadElt, RngXPadElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-greatestcommondivisor-rngxpadelt-rngxpadelt)
      - [`ExtendedGreatestCommonDivisor(x, y): FldXPadElt, FldXPadElt → FldXPadElt, FldXPadElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-extendedgreatestcommondivisor-fldxpadelt-fldxpadelt)
      - [`XGCD(x, y): FldXPadElt, FldXPadElt → FldXPadElt, FldXPadElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xgcd-fldxpadelt-fldxpadelt)
      - [`Xgcd(x, y): FldXPadElt, FldXPadElt → FldXPadElt, FldXPadElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xgcd-fldxpadelt-fldxpadelt-2)
      - [`ExtendedGreatestCommonDivisor(x, y): RngXPadElt, RngXPadElt → RngXPadElt, RngXPadElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-extendedgreatestcommondivisor-rngxpadelt-rngxpadelt)
      - [`XGCD(x, y): RngXPadElt, RngXPadElt → RngXPadElt, RngXPadElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xgcd-rngxpadelt-rngxpadelt)
      - [`Xgcd(x, y): RngXPadElt, RngXPadElt → RngXPadElt, RngXPadElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xgcd-rngxpadelt-rngxpadelt-2)
      - [Example: Arithmetic with Exact p-adic Elements](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-bdd87d)
  - [Polynomials over Exact $p$-adic Rings and Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#polynomials-over-exact-p-adic-rings-and-fields)
    - [Exact Polynomial Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#exact-polynomial-rings)
      - [`PolynomialRing(R : parameters): Rng → RngUPol`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-polynomialring-rng)
      - [`R eq T: RngUPolXPad, RngUPolXPad → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-eq-rngupolxpad-rngupolxpad)
      - [`BaseRing(R): RngUPolXPad → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-basering-rngupolxpad)
      - [`CoefficientRing(R): RngUPolXPad → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficientring-rngupolxpad)
      - [`R . i: RngUPolXPad, RngIntElt → RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-rngupolxpad-rngintelt-rngxpadelt)
      - [`Name(R, i): RngUPolXPad, RngIntElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-name-rngupolxpad-rngintelt)
      - [`Generator(R): RngUPolXPad → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-generator-rngupolxpad)
      - [`AssignNames(~R, S): RngUPolXPad, SeqEnum[MonStgElt]`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#procedure-assignnames-rngupolxpad-seqenum-monstgelt-ref)
      - [Example: Exact p-adic Polynomial Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-b44a56)
    - [Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#polynomials)
      - [`R ! f: RngUPolXPad, Any → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-rngupolxpad-any)
      - [`BaseRing(f): RngUPolXPadElt → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-basering-rngupolxpadelt)
      - [`CoefficientRing(f): RngUPolXPadElt → Rng`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficientring-rngupolxpadelt)
      - [`CanChangeRing(f, R): RngUPolXPadElt, Rng → BoolElt, RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-canchangering-rngupolxpadelt-rng)
      - [`ChangeRing(f, R): RngUPolXPadElt, Rng → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-changering-rngupolxpadelt-rng)
      - [`Degree(f): RngUPolXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-degree-rngupolxpadelt)
      - [`WeakDegree(f): RngUPolXPadElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-weakdegree-rngupolxpadelt)
      - [`Coefficient(f, i): RngUPolXPadElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficient-rngupolxpadelt-rngintelt)
      - [`Coefficients(f): RngUPolXPadElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coefficients-rngupolxpadelt)
      - [`ExactPolynomial(f): RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-exactpolynomial-rngupolxpadelt)
      - [`ExactPolynomial(f): RngUPolElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-exactpolynomial-rngupolelt)
      - [`Evaluate(f, x): RngUPolXPadElt, Any → RngAnyXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-evaluate-rngupolxpadelt-any)
      - [`Derivative(f, m): RngUPolXPadElt, RngIntElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-derivative-rngupolxpadelt-rngintelt)
      - [`Derivative(f): RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-derivative-rngupolxpadelt)
      - [`Discriminant(f): RngUPolXPadElt → RngAnyXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-discriminant-rngupolxpadelt)
      - [`Resultant(f, g): RngUPolXPadElt, RngUPolXPadElt → RngAnyXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-resultant-rngupolxpadelt-rngupolxpadelt)
      - [`IsInertial(f): RngUPolXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isinertial-rngupolxpadelt)
      - [`IsEisenstein(f): RngUPolXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-iseisenstein-rngupolxpadelt)
      - [`IsWeaklyZero(f): StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isweaklyzero-stranyxpadelt-2)
      - [`IsWeaklyEqual(f, g): StrAnyXPadElt, StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isweaklyequal-stranyxpadelt-stranyxpadelt-2)
      - [`IsDefinitelyZero(f): StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isdefinitelyzero-stranyxpadelt-2)
      - [`IsDefinitelyEqual(f, g): StrAnyXPadElt, StrAnyXPadElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isdefinitelyequal-stranyxpadelt-stranyxpadelt-2)
      - [`CoerceAndLift(S, x): StrAnyXPad, Any → StrAnyXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-coerceandlift-stranyxpad-any-2)
    - [Arithmetic](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#arithmetic)
      - [`x * y: RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-times-rngupolxpadelt-rngupolxpadelt)
      - [`- y: RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-rngupolxpadelt-rngupolxpadelt)
      - [`x + y: RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-plus-rngupolxpadelt-rngupolxpadelt)
      - [`x - y: RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-minus-rngupolxpadelt-rngupolxpadelt)
      - [`x / c: RngUPolXPadElt, RngElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-div-rngupolxpadelt-rngelt)
      - [`x ^ n: RngUPolXPadElt, RngIntElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-op-pow-rngupolxpadelt-rngintelt)
      - [`Quotrem(x, y): RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-quotrem-rngupolxpadelt-rngupolxpadelt)
      - [`x div y: RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-div-rngupolxpadelt-rngupolxpadelt-rngupolxpadelt)
      - [`x mod y: RngUPolXPadElt, RngUPolXPadElt → RngUPolXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#operation-operation-mod-rngupolxpadelt-rngupolxpadelt-rngupolxpadelt)
      - [Example: Arithmetic with Exact p-adic Polynomials](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-88ff30)
    - [Factorization and Roots](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#factorization-and-roots)
      - [`NewtonPolygon(f): RngUPolXPadElt[RngXPad] → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-newtonpolygon-rngupolxpadelt-rngxpad)
      - [`NewtonPolygon(f): RngUPolXPadElt[FldXPad] → NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-newtonpolygon-rngupolxpadelt-fldxpad)
      - [`Roots(f, R): RngUPolElt, FldXPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xroots)
      - [`Roots(f, R): RngUPolElt, RngXPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-roots-rngupolelt-rngxpad)
      - [`Roots(f, R): RngUPolXPadElt, RngXPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-roots-rngupolxpadelt-rngxpad)
      - [`Roots(f, R): RngUPolXPadElt, FldXPad → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-roots-rngupolxpadelt-fldxpad)
      - [`Roots(f): RngUPolXPadElt[FldXPad] → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-roots-rngupolxpadelt-fldxpad-2)
      - [`Roots(f): RngUPolXPadElt[RngXPad] → SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-roots-rngupolxpadelt-rngxpad-2)
      - [`HasRoot(f): RngUPolXPadElt[RngXPad] → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolxpadelt-rngxpad)
      - [`HasRoot(f): RngUPolXPadElt[FldXPad] → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolxpadelt-fldxpad)
      - [`HasRoot(f): RngUPolElt[RngXPad] → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolelt-rngxpad)
      - [`HasRoot(f): RngUPolElt[FldXPad] → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolelt-fldxpad)
      - [`HasRoot(f, R): RngUPolElt, FldXPad → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolelt-fldxpad-2)
      - [`HasRoot(f, R): RngUPolElt, RngXPad → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolelt-rngxpad-2)
      - [`HasRoot(f, R): RngUPolXPadElt, FldXPad → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolxpadelt-fldxpad-2)
      - [`HasRoot(f, R): RngUPolXPadElt, RngXPad → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-hasroot-rngupolxpadelt-rngxpad-2)
      - [`Factorization(f, R): RngUPolXPadElt, FldXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xfact)
      - [`Factorisation(f, R): RngUPolXPadElt, FldXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolxpadelt-fldxpad)
      - [`Factorisation(f, R): RngUPolXPadElt, RngXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolxpadelt-rngxpad)
      - [`Factorization(f, R): RngUPolXPadElt, RngXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorization-rngupolxpadelt-rngxpad)
      - [`Factorization(f, R): RngUPolElt, RngXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorization-rngupolelt-rngxpad)
      - [`Factorisation(f, R): RngUPolElt, RngXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolelt-rngxpad)
      - [`Factorisation(f, R): RngUPolElt, FldXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolelt-fldxpad)
      - [`Factorization(f, R): RngUPolElt, FldXPad → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorization-rngupolelt-fldxpad)
      - [`Factorization(f): RngUPolXPadElt[RngXPad] → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorization-rngupolxpadelt-rngxpad-2)
      - [`Factorization(f): RngUPolXPadElt[FldXPad] → SeqEnum, FldXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorization-rngupolxpadelt-fldxpad)
      - [`Factorisation(f): RngUPolXPadElt[RngXPad] → SeqEnum, RngXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolxpadelt-rngxpad-2)
      - [`Factorisation(f): RngUPolXPadElt[FldXPad] → SeqEnum, FldXPadElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-factorisation-rngupolxpadelt-fldxpad-2)
      - [`IsIrreducible(f): RngUPolXPadElt[RngXPad] → BoolElt, Rec`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isirreducible-rngupolxpadelt-rngxpad)
      - [`IsIrreducible(f): RngUPolXPadElt[FldXPad] → BoolElt, Rec`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isirreducible-rngupolxpadelt-fldxpad)
      - [`IsIrreducible(f): RngUPolElt[RngXPad] → BoolElt, Rec`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isirreducible-rngupolelt-rngxpad)
      - [`IsIrreducible(f): RngUPolElt[FldXPad] → BoolElt, Rec`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-isirreducible-rngupolelt-fldxpad)
      - [`IsHenselLiftable(f, x): RngUPolElt, FldXPadElt → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ishenselliftable-rngupolelt-fldxpadelt)
      - [`IsHenselLiftable(f, x): RngUPolElt, RngXPadElt → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ishenselliftable-rngupolelt-rngxpadelt)
      - [`IsHenselLiftable(f, x): RngUPolXPadElt, FldXPadElt → BoolElt, FldXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ishenselliftable-rngupolxpadelt-fldxpadelt)
      - [`IsHenselLiftable(f, x): RngUPolXPadElt, RngXPadElt → BoolElt, RngXPadElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ishenselliftable-rngupolxpadelt-rngxpadelt)
      - [`RamificationResidualPolynomial(f, face): RngUPolElt[FldXPad], NwtnPgonFace → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomial-rngupolelt-fldxpad-nwtnpgonface)
      - [`RamificationResidualPolynomial(f, face): RngUPolElt[RngXPad], NwtnPgonFace → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomial-rngupolelt-rngxpad-nwtnpgonface)
      - [`RamificationResidualPolynomial(f, face): RngUPolXPadElt[FldXPad], NwtnPgonFace → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomial-rngupolxpadelt-fldxpad-nwtnpgonface)
      - [`RamificationResidualPolynomial(f, face): RngUPolXPadElt[RngXPad], NwtnPgonFace → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomial-rngupolxpadelt-rngxpad-nwtnpgonface)
      - [`RamificationResidualPolynomials(f): RngUPolElt[FldXPad] → SeqEnum, NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomials-rngupolelt-fldxpad)
      - [`RamificationResidualPolynomials(f): RngUPolElt[RngXPad] → SeqEnum, NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomials-rngupolelt-rngxpad)
      - [`RamificationResidualPolynomials(f): RngUPolXPadElt[FldXPad] → SeqEnum, NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomials-rngupolxpadelt-fldxpad)
      - [`RamificationResidualPolynomials(f): RngUPolXPadElt[RngXPad] → SeqEnum, NwtnPgon`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-ramificationresidualpolynomials-rngupolxpadelt-rngxpad)
      - [Example: Factorization over Exact p-adic Fields](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#example-ex-95a032)
- [Bibliography](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/bibliography.md)

### Introduction

Magma supports finite extensions of the ring ${\mathbb{Z}}_p$ of $p$-adic integers or the field ${\mathbb{Q}}_p$ of $p$-adic numbers. Within this chapter, we mean these objects if we refer to local rings or fields. Section [Background](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/background.md#loc-background) provides more background information on the theory behind the $p$-adics.

Magma has three different models for working with these locals: fixed precision rings (`RngPadRes` and `RngPadResExt`, with element types `RngPadResElt` and `RngPadResExtElt`), free precision rings (`RngPad` and `FldPad`, with element types `RngPadElt` and `FldPadElt`) and exact $p$-adic rings (`RngXPad` and `FldXPad` with element types `RngXPadElt` and `FldXPadElt`). The merits of each model are discussed in Section [$p$-adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/overview.md#loc-local-rings).

Magma also contains a type of local field where extensions can be made by any irreducible polynomial. For more information on these local fields, see Chapter [General $p$-Adic Extensions](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/index-general-padic-extensions.md#locala).

<a id="loc-background"></a>
<a id="id1"></a>
### Background

The $p$-adic field $\Q_p$ arises naturally as the completion of $\Q$ with respect to an absolute value function $|x|_p = p^{-v_p(x)}$, where $v_p(x)$ is the $p$-adic *valuation* of $x$ (that is, a power of $p$ such that $x = p^{v_p(x)} {a \over b}$ but $p \nmid ab$). The *ring of integers* of $\Q_p$, denoted $\Z_p$, is the set of all elements of non-negative valuation. The ring $\Z_p$ has a unique maximal ideal, generated by the prime $p$; the *residue class field* $K$ is the quotient $\Z_p / p \Z_p$. Any element $x$ of $\Q_p$ can be expressed as a power series in the prime $p$, so that $x = \sum_{i=v}^{\infty} a_{i} p^{i}$, where $v$ is the valuation of $x$, $a_{v}$ is non-zero, and each $a_{i}$ is a lift of an element from the residue class field. In more general terms, $\Q_p$ is a local field, with its ring of integers $\Z_p$ being a local ring. A uniformizer $\pi$ of $\Q_p$ is the prime $p$.

More generally, consider an irreducible polynomial over some local field $L_1$ (such as ${\mathbb{Q}}_p$). Then the extension given by adjoining a root $\alpha$ of this polynomial to $L_1$, $L_2 = L_1[\alpha]$, is also a local field. Let $\pi_1$ and $\pi_2$ be uniformizers of $L_1$ and $L_2$, respectively. Then $\pi_2^e = \pi_1 u$, where $u$ is a unit of $L_2$. The number $e$ is the *ramification degree* of $L_2$ over $L_1$, and divides the degree $n$ of the extension. If $e = n$, we say $L_2$ is *totally ramified* over $L_1$; if $e = 1$, we say $L_2$ is *unramified* over $L_1$. The degree of the residue class field $K_2$ of $L_2$ over the residue class field $K_1$ of $L_1$ is $f = {n \over e}$. Finite extensions in Magma must be either *unramified* or *totally ramified*; Magma also allows towers of extensions to be built.

It is well known that up to isomorphism there is only one degree $n$ unramified extension of $L$, which can be obtained by adjoining a $p^n-1$-th root of unity $\zeta$ to $L$. This extension is Galois, with Galois group isomorphic to the cyclic group of order $n$. The Galois group is generated by the Frobenius automorphism $\sigma$, which takes $\zeta$ to $\zeta^p$. For some applications, it is necessary to have a fast Frobenius action, so Magma supports such a representation. However, the defining polynomial in this representation is particularly dense and can be expensive to construct, hence it is ill-suited for general applications. An unramified extension can only be defined by *inertial* polynomials, which are polynomials that keep their degree when mapped over the residue class field and are irreducible over the residue class field. Magma allows an unramified extension to be defined by any inertial polynomial.

All totally ramified extensions contain a root of an Eisenstein polynomial of $L$. An Eisenstein polynomial $f(x) = \sum_{i=0}^{n} a_i x^i$ satisfies $v_\pi(a_n) = 0$, $v_\pi(a_i) \ge 1$ for all $0 < i < n$, and $v_\pi(a_0) = 1$. Magma allows a totally ramified extension to be defined by any Eisenstein polynomial; note that this does not allow arbitrary representations of totally ramified extensions to be constructed.

<a id="overview"></a>
<a id="loc-overview"></a>
### Overview of the $p$-adics in Magma

<a id="local-rings"></a>
<a id="loc-local-rings"></a>
#### $p$-adic Rings

Since $p$-adic rings are completions (like the real numbers), it is difficult to represent their elements in an exact form. As described in Section [Background](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/background.md#loc-background), any element $x$ of a local ring $L$ can be expressed as a power series in the uniformizing element of $L$. Most problems can be solved by computing in a finite quotient of $L$, which is equivalent to truncating the infinite expansion of $x$ at some point. More precisely, we work in the quotient rings $L / \pi^{k} L$ for non-negative $k$, which is called the *precision* of the ring $L$.

Unfortunately, working with finite approximations to elements does have problems. Some operations on these approximations will yield results with reduced precision. For example, in a ring constructed with precision $k$ the quotient of two elements with valuations $v_1 \geq v_2$ lies in the local ring, but can only be determined up to $k - v_2$ digits. Also, it is only possible in general to construct an approximation to the GCD of two polynomials $f$ and $g$ over a local ring.

Magma offers three models for computing in a local ring $L$. The first model (the *fixed precision model*) allows the user to work with the quotient rings defined above. These quotient rings are finite structures, and their elements can easily be represented exactly; hence, many exact algorithms can be applied to them. On the other hand, precision management is left to the user, since operations which may lose precision, such as division, will still return results to the full precision of the ring. In the second model (the *free precision model*), the user works more directly with $L$, instead of a finite quotient of $L$. Each element is still represented by a finite approximation, however, these approximations can be of varying precisions, thus freeing the user from precision management. However, these rings are inexact (for instance, there is no zero element of the ring, only approximations to it), and hence many algorithms in Magma which are designed for exact rings may cause significant precision loss. The situation is analogous to the support for real numbers in Magma.

The third model is that of the exact $p$-adic rings which use a lazy representation and delay any computations to a precision. Such exact objects know how to compute digits to a given precision although they may not know what any of those digits are. These rings are explained further in Section [Exact $p$-Adic Rings](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#xpadic).

#### $p$-adic Fields

A local field in Magma is the field of fractions of a local ring. Representing a local field on a machine causes some trouble, since there is no algebraic structure in which truncations of the elements could be interpreted (as in the case of the finite quotients for the local rings). Moreover, all structural information of a local field is already contained in its ring of integers, so that the main motivation for supporting local fields is to provide some basic arithmetic.

An element $x$ of a local field $L$ is stored internally as $x = \pi^v u + O(\pi^{v + k})$, where $v$ is the (possibly negative) valuation of $x$, and $u$ is a unit known to precision $k$ in the ring of integers of $L$. It can happen that operations in a field yield elements with no known digits at all, since the unit parts may not overlap.

#### Free Precision Rings and Fields

Free precision rings and fields can be created with bounded or unbounded precision. If they are created with some bounded precision $k$, then no element in the structure can have precision greater than $k$. Thus, bounded free precision rings are “inexact” versions of the fixed precision rings. Unbounded precision structures can have elements with arbitrarily large, but not infinite, precision. In general, it is recommended that free precision structures are utilized unless speed is absolutely critical.

#### Precision of Extensions

In Magma, all measurements of precision are made with respect to a valuation function $v_{\pi}$ which takes the uniformizer $\pi$ of the local ring $L$ to unity (throughout this chapter, the subscript will be dropped on $v_{\pi}$ where there is no ambiguity). This can have surprising results. For instance, consider a local ring $L_{1}$ which extends $L_{2}$, such that the ramification degree of $L_{1}$ over $L_{2}$ is $e$. Let $\pi_{1}$ and $\pi_{2}$ be the uniformizing elements of $L_{1}$ and $L_{2}$, respectively. Then, $v_{\pi_{1}}(\pi_{1}) = 1$, and $v_{\pi_{1}}(\pi_{2}) = e$. Hence, an element of precision $k$ in $L_{2}$ will have precision $ek$ in when mapped into $L_{1}$. Thus, it is important to always remember in which ring precision is determined.

### Creation of Local Rings and Fields

A local ring in Magma can be constructed in two ways: as either a $p$-adic ring, or as an extension of another local ring. Magma supports the construction of towers of extensions of local rings; the only restriction is that each extension must be either unramified or totally ramified. As discussed in Section [Background](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/background.md#loc-background), Magma requires that the defining polynomial is either inertial or Eisenstein.

Additionally, the user must specify whether to construct a fixed precision or free precision structure, and, if necessary, assign a precision to the structure. For local rings the precision is interpreted as an absolute precision, specifying to what precision the element is known, but for local fields it is interpreted as a relative precision, specifying to what precision the unit part of the element is known.

<a id="elementary-padic"></a>
<a id="loc-elementary-creation-padic"></a>
#### Creation Functions for the $p$-adics

<a id="function-padicring-rngintelt-rngintelt"></a>
##### `pAdicRing(p, k): RngIntElt, RngIntElt -> RngPad`

<a id="function-padicfield-rngintelt-rngintelt"></a>
##### `pAdicField(p, k): RngIntElt, RngIntElt -> FldPad`

Given a prime integer $p$ and non-negative single-precision integer $k$, construct the bounded free precision ring (field) of $p$-adic integers with maximum precision $k$.

<a id="function-padicring-rngintelt"></a>
##### `pAdicRing(p): RngIntElt -> RngPad`

<a id="function-padicfield-rngintelt"></a>
##### `pAdicField(p): RngIntElt -> FldPad`

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

Given a prime integer $p$, construct the unbounded free precision ring (field) of $p$-adic numbers. The optional parameter `Precision`, which must be a non-negative single precision integer, controls the default precision to which elements are created, e.g., when coercing precise elements such as integers or rationals into the ring.

<a id="function-padicquotientring-rngintelt-rngintelt"></a>
##### `pAdicQuotientRing(p, k): RngIntElt, RngIntElt -> RngPadRes`

Given a prime integer $p$ and non-negative single precision integer $k$, construct the fixed precision quotient ring ${\mathbb{Z}}_{p} / p^{k} {\mathbb{Z}}_{p}$.

<a id="constructor-constructor-quo-rngpad-rngpadelt"></a>
##### `quo<L | x>: RngPad, RngPadElt -> .`

Given a local ring $L$, construct the quotient ring $L / xL$, where $x$ is an element of $L$.

<a id="example-ex-65d82a"></a>
##### `Example: Creating p-adic Rings (ex-65d82a)`

The creation of $p$-adic rings using the above functions is illustrated below.

```magma
> R := pAdicRing(5);
> R;
5-adic ring
> R`DefaultPrecision;
20
> R!1;
1 + O(5^20)
> R := pAdicRing(5 : Precision := 20);
> R!1;
1 + O(5^20)
> Q := quo<R | 5^20>;
> Q;
Quotient of the 5-adic ring modulo the ideal generated by 5^20
> Q!1;
1
> Q eq pAdicQuotientRing(5, 20);
true
```

<a id="elementary-ext-unram"></a>
<a id="loc-elementary-creation-ext-unram"></a>
#### Creation of Unramified Extensions

<a id="function-unramifiedextension-rngpad-rngintelt"></a>
##### `UnramifiedExtension(L, n): RngPad, RngIntElt -> RngPad`

<a id="function-unramifiedextension-fldpad-rngintelt"></a>
##### `UnramifiedExtension(L, n): FldPad, RngIntElt -> FldPad`

<a id="function-unramifiedextension-rngpadres-rngintelt"></a>
##### `UnramifiedExtension(L, n): RngPadRes, RngIntElt -> RngPadResExt`

<a id="function-unramifiedextension-rngpadresext-rngintelt"></a>
##### `UnramifiedExtension(L, n): RngPadResExt, RngIntElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpad-rngintelt-rngpad"></a>
##### `ext<L | n>: RngPad, RngIntElt -> RngPad`

<a id="constructor-constructor-ext-fldpad-rngintelt-fldpad"></a>
##### `ext<L | n>: FldPad, RngIntElt -> FldPad`

<a id="constructor-constructor-ext-rngpadres-rngintelt-rngpadresext"></a>
##### `ext<L | n>: RngPadRes, RngIntElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpadresext-rngintelt-rngpadresext"></a>
##### `ext<L | n>: RngPadResExt, RngIntElt -> RngPadResExt`

```magma
Cyclotomic: BoolElt                      Default: false
GNBType   : RngIntElt                    Default: 0
```

Given a local ring or field $L$ and a positive single precision integer $n$, construct the default unramified extension of $L$ of degree $n$. If $K$ is the residue class field of $L$, then the defining polynomial of the default degree $n$ extension of $K$ is lifted to be an inertial polynomial of $L$; this polynomial is used as the defining polynomial of the extension. If `Cyclotomic` is `true`, then the lift of the defining polynomial will be such that $p^n - 1$-st root of unity will be adjoined to $L$ (this representation makes computation of the Frobenius automorphism particularly efficient). The angle bracket notation can be used to assign a name to the generator of the extension, e.g. `K<t> := UnramifiedExtension(L, n)`. If `Cyclotomic` is `false` but `GNBType` is $t > 0$ then a Gaussian normal basis of type $t$ is used. This allows extremely fast multiple Frobenius computations but multiplication is slower than the usual or `Cyclotomic` representation if $t > 2$. Because of this, currently only 1 or 2 are legal values for $t$. Only certain extension degrees will have a Gaussian normal basis of type 1 or 2. To determine if this is true, the `HasGNB` functions described below may be used.

<a id="function-unramifiedquotientring-fldfin-rngintelt"></a>
##### `UnramifiedQuotientRing(K, k): FldFin, RngIntElt -> Rng`

Given a finite field $K$ and a non-negative single precision integer $k$, construct the fixed precision quotient ring which has residue class field $K$ and precision $k$. The angle bracket notation can be used to assign a name to the generator of the extension, e.g. `L<t> := UnramifiedExtension(K, f)`.

<a id="function-unramifiedextension-rngpad-rngupolelt"></a>
##### `UnramifiedExtension(L, f): RngPad, RngUPolElt -> RngPad`

<a id="function-unramifiedextension-fldpad-rngupolelt"></a>
##### `UnramifiedExtension(L, f): FldPad, RngUPolElt -> FldPad`

<a id="function-unramifiedextension-rngpadres-rngupolelt"></a>
##### `UnramifiedExtension(L, f): RngPadRes, RngUPolElt -> RngPadResExt`

<a id="function-unramifiedextension-rngpadresext-rngupolelt"></a>
##### `UnramifiedExtension(L, f): RngPadResExt, RngUPolElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpad-rngupolelt-rngpad"></a>
##### `ext<L | f>: RngPad, RngUPolElt -> RngPad`

<a id="constructor-constructor-ext-fldpad-rngupolelt-fldpad"></a>
##### `ext<L | f>: FldPad, RngUPolElt -> FldPad`

<a id="constructor-constructor-ext-rngpadres-rngupolelt-rngpadresext"></a>
##### `ext<L | f>: RngPadRes, RngUPolElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpadresext-rngupolelt-rngpadresext"></a>
##### `ext<L | f>: RngPadResExt, RngUPolElt -> RngPadResExt`

Given a local ring or field $L$ and a polynomial $f$ with coefficients coercible to $L$, construct the unramified extension of $L$ defined by $f$. The polynomial $f$ must be an inertial polynomial over $L$. The angle bracket notation can be used to assign a name to the generator of the extension, e.g. `K<t> := UnramifiedExtension(L, f)`. Free precision rings can only be extended by a polynomial if they are of bounded precision, in which case $f$ must be specified to the maximum precision of the ring.

<a id="function-isinertial-rngupolelt"></a>
##### `IsInertial(f): RngUPolElt -> BoolElt`

Given a polynomial $f$ with coefficients over a local ring or field $L$, return `true` if and only if $f$ is an inertial polynomial. A polynomial is inertial over $L$ if it is irreducible over the residue class field of $L$.

<a id="function-has-gnb-func"></a>
##### `HasGNB(R, n, t): RngPad, RngIntElt, RngIntElt -> BoolElt`

<a id="function-hasgnb-fldpad-rngintelt-rngintelt"></a>
##### `HasGNB(L, n, t): FldPad, RngIntElt, RngIntElt -> BoolElt`

<a id="function-hasgnb-rngpadres-rngintelt-rngintelt"></a>
##### `HasGNB(R, n, t): RngPadRes, RngIntElt, RngIntElt -> BoolElt`

<a id="function-hasgnb-rngpadresext-rngintelt-rngintelt"></a>
##### `HasGNB(R, n, t): RngPadResExt, RngIntElt, RngIntElt -> BoolElt`

Given a local ring or field, returns `true` iff the unramified extension of degree $n$ can be generated by a Gaussian Normal Basis (GNB) of Type $t$. A GNB allows particularly fast multiple Frobenius and Norm computations. Multiplication will tend to be slower though, unless $t = 1$.

<a id="function-cyclotomicunramifiedextension-fldpad-rngintelt"></a>
##### `CyclotomicUnramifiedExtension(R, f): FldPad, RngIntElt -> FldPad`

<a id="function-cyclotomicunramifiedextension-rngpad-rngintelt"></a>
##### `CyclotomicUnramifiedExtension(R, f): RngPad, RngIntElt -> RngPad`

<a id="function-cyclotomicunramifiedextension-rngpadres-rngintelt"></a>
##### `CyclotomicUnramifiedExtension(R, f): RngPadRes, RngIntElt -> RngPadRes`

<a id="function-cyclotomicunramifiedextension-rngpadresext-rngintelt"></a>
##### `CyclotomicUnramifiedExtension(R, f): RngPadResExt, RngIntElt -> RngPadResExt`

Given a local ring of field $R$, construct the unramified degree $f$ extension by adjoining a $p^f-1$-th root of unity to $R$. Functionally equivalent to calling `UnramifiedExtension(R, f:Cyclotomic := true)`.

<a id="example-ex-f8037d"></a>
##### `Example: Creating Unramified Extensions (ex-f8037d)`

The creation of unramified extensions of local rings using the above functions is illustrated below.

```magma
> R1 := pAdicRing(2, 20);
> R2 := ext<R1 | 5>;
> R2;
Unramified extension defined by the polynomial x^5 + x^2 + 1
 over 2-adic ring mod 2^20
> DefiningPolynomial(R2);
x^5 + x^2 + 1
> R3 := ext<R1 | 5 : Cyclotomic>;
> R3;
Cyclotomic unramified extension of degree 5 over 2-adic ring mod 2^20
> DefiningPolynomial(R3);
x^5 + 426248*x^4 - 14172*x^3 - 147105*x^2 + 293314*x - 1
> R3.1^(2^5-1);
1
> P1<x> := PolynomialRing(R1);
> f1 := x^3 + 3*x + 1;
> IsInertial(f1);
true
> R4 := ext<R1 | f1>;
> R4;
Unramified extension defined by the polynomial x^3 + 3*x + 1
 over 2-adic ring mod 2^20
> P2<y> := PolynomialRing(R2);
> f2 := y^3 + 3*y + 1;
> IsInertial(f2);
true
> ext<R2 | f2>;
Unramified extension defined by the polynomial x^3 + 3*x + 1
 over Unramified extension defined by the polynomial x^5 + x^2 + 1
 over 2-adic ring mod 2^20
```

<a id="elementary-ext-ram"></a>
<a id="loc-elementary-creation-ext-ram"></a>
#### Creation of Totally Ramified Extensions

<a id="function-totallyramifiedextension-rngpad-rngupolelt"></a>
##### `TotallyRamifiedExtension(L, f): RngPad, RngUPolElt -> RngPad`

<a id="function-totallyramifiedextension-fldpad-rngupolelt"></a>
##### `TotallyRamifiedExtension(L, f): FldPad, RngUPolElt -> FldPad`

<a id="function-totallyramifiedextension-rngpadres-rngupolelt"></a>
##### `TotallyRamifiedExtension(L, f): RngPadRes, RngUPolElt -> RngPadResExt`

<a id="function-totallyramifiedextension-rngpadresext-rngupolelt"></a>
##### `TotallyRamifiedExtension(L, f): RngPadResExt, RngUPolElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpad-rngupolelt-rngpad-2"></a>
##### `ext<L | f>: RngPad, RngUPolElt -> RngPad`

<a id="constructor-constructor-ext-fldpad-rngupolelt-fldpad-2"></a>
##### `ext<L | f>: FldPad, RngUPolElt -> FldPad`

<a id="constructor-constructor-ext-rngpadres-rngupolelt-rngpadresext-2"></a>
##### `ext<L | f>: RngPadRes, RngUPolElt -> RngPadResExt`

<a id="constructor-constructor-ext-rngpadresext-rngupolelt-rngpadresext-2"></a>
##### `ext<L | f>: RngPadResExt, RngUPolElt -> RngPadResExt`

Given a local ring or field $L$ and a polynomial $f$ with coefficients coercible to $L$, construct the totally ramified extension of $L$ defined by $f$. The polynomial $f$ must be an Eisenstein polynomial, that is, the leading coefficient is a unit, the constant coefficient has valuation $1$ and all other coefficients have valuation greater than or equal to $1$. The angle bracket notation can be used to assign a name to the generator of the extension, e.g. `K<t> := TotallyRamifiedExtension(L, f)`. Free precision rings can only be extended by a polynomial if they are of bounded precision, in which case $f$ must be specified to the maximum precision of the ring.

<a id="function-iseisenstein-rngupolelt"></a>
##### `IsEisenstein(f): RngUPolElt -> BoolElt`

Given a polynomial $f$ with coefficients over a local ring or field $L$, return `true` if and only if $f$ is an Eisenstein polynomial over $L$. An Eisenstein polynomial satisfies the following properties: the leading coefficient is a unit, the constant coefficient has valuation $1$ and all other coefficients have valuation greater than or equal to $1$.

<a id="example-ex-11c692"></a>
##### `Example: Creating Totally Ramified Extensions (ex-11c692)`

The creation of totally ramified extensions of local rings using the above functions is illustrated below.

```magma
> L1<a> := ext<pAdicRing(5, 20) | 4>;
> L1;
Unramified extension defined by the polynomial x^4 + 4*x^2 + 4*x + 2
 over 5-adic ring mod 5^20
> L2<b> := ext<L1 | x^4 + 125*x^2 + 5>;
> L2;
Totally ramified extension defined by the polynomial x^4 + 125*x^2 + 5
 over Unramified extension defined by the polynomial x^4 + 4*x^2 + 4*x + 2
 over 5-adic ring mod 5^20
> P<y> := PolynomialRing(L2);
> L3<c> := TotallyRamifiedExtension(L2, y^3 + b^4*a^5*y + b*a^2);
> L3;
Totally ramified extension defined by the polynomial x^3 + ((500*a^3 + 500*a^2 +
    250*a)*b^2 + 20*a^3 + 20*a^2 + 10*a)*x + a^2*b
 over Totally ramified extension defined by the polynomial x^4 + 125*x^2 + 5
 over Unramified extension defined by the polynomial x^4 + 4*x^2 + 4*x + 2
 over 5-adic ring mod 5^20
```

If the precision of the base ring is only $1$, then it is not possible to construct a ramified extension, as there is not enough precision to allow the constant coefficient to be non-zero to that precision.

```magma
> R<x> := PolynomialRing(Integers());
> L<a> := UnramifiedExtension(pAdicRing(5, 1), 3);
> TotallyRamifiedExtension(L, x^4 + 5);

>> TotallyRamifiedExtension(L, x^4 + 5);
                           ^
Runtime error in 'TotallyRamifiedExtension': Polynomial must be Eisenstein
> L<a> := UnramifiedExtension(pAdicRing(5, 2), x^5 + x^2 + 2);
> TotallyRamifiedExtension(L, x^4 + 5);
Totally ramified extension defined by the polynomial x^4 + 5 over Unramified
extension defined by the polynomial x^5 + x^2 + 2 over 5-adic ring mod 5^2
> ext<L | x^4 + 125*x^2 + 5>;
Totally ramified extension defined by the polynomial x^4 + 5 over Unramified
extension defined by the polynomial x^5 + x^2 + 2 over 5-adic ring mod 5^2
```

<a id="elementary-ext-map"></a>
<a id="loc-elementary-creation-ext-map"></a>
#### Creation of Unbounded Precision Extensions

Suppose we have an unbounded precision local ring or field $L$, and we wish to create a finite extension of it. If we need the default degree $n$ unramified extension, then we can use the construction functions defined in Section [Creation of Unramified Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#loc-elementary-creation-ext-unram) to construct this extension. However, suppose we wish to define the extension by some polynomial $f$. As there is no upper bound on the precision of elements of $L$, it is impossible for us to represent the polynomial $f$ sufficiently precisely, and hence we cannot use the creation functions defined in previous sections for this task. To allow such extensions to be created, Magma allows extensions to be defined by a map $\phi: {\mathbb{Z}}_{\ge 0} \to R[x]$, where $R$ is a ring whose elements are coercible to the quotient rings $L / \pi^k L$ for all $k \in {\mathbb{Z}}_{\ge 0}$. The map $\phi$, given an input precision $k$, returns the defining polynomial of the extension to precision $k$. Internally, whenever Magma needs to represent an element of the extension to some precision, it will use $\phi$ to compute the defining polynomial up to this precision. Magma may call $\phi$ on any precision between zero and the precision of the most precise element created by the user.

<a id="constructor-constructor-ext-rngpad-map-rngpad"></a>
##### `ext<L | m>: RngPad, Map -> RngPad`

<a id="constructor-constructor-ext-fldpad-map-rngpad"></a>
##### `ext<L | m>: FldPad, Map -> RngPad`

Given a free precision local ring or field $L$ and a map $m$ with domain ${\mathbb{Z}}$ and codomain $R[x]$, where elements of $R$ are coercible to the quotient rings $L / \pi^k L$ for all $k \in {\mathbb{Z}}_{\ge 0}$, construct an extension of $L$ defined by $m$. Given a non-negative single precision integer $k$, the map $m$ must return the defining polynomial of the extension to precision $k$, as a polynomial over $R$. The map $m$’s behaviour for other input values is undefined. Internally, Magma will coerce the value returned by the map $m$ to be a polynomial over $L / \pi^k L$. Examples of suitable codomains $R$ include the integers, rationals, or $L$ itself.

<a id="example-ex-2d52e1"></a>
##### `Example: Unbounded Precision Extensions from Maps (ex-2d52e1)`

The creation of extensions of local rings using maps is illustrated below. We show how it is possible to define an extension of a free precision ring using an “exact” polynomial.

```magma
> R := pAdicRing(2);
> Z := Integers();
> P<x> := PolynomialRing(Z);
> m := map<Z -> P | k :-> x^3 + x + 1>;
> R2 := ext<R | m>;
> R2;
Unramified extension defined by a map over 2-adic ring
> DefiningPolynomial(R2);
(1 + O(2^20))*$.1^3 + O(2^20)*$.1^2 + (1 + O(2^20))*$.1 + 1 + O(2^20)
> R2`DefaultPrecision := 1000;
> DefiningPolynomial(R2);
(1 + O(2^1000))*$.1^3 + O(2^1000)*$.1^2 + (1 + O(2^1000))*$.1 + 1 + O(2^1000)
```

<a id="elementary-misc"></a>
<a id="loc-elementary-creation-misc-map"></a>
#### Creation of Related Rings

<a id="function-integerring-fldpad"></a>
##### `IntegerRing(F): FldPad -> RngPad`

<a id="function-integers-fldpad"></a>
##### `Integers(F): FldPad -> RngPad`

<a id="function-ringofintegers-fldpad"></a>
##### `RingOfIntegers(F): FldPad -> RngPad`

Given a local field $F$, construct the ring of integers $R$ of $F$. The ring $R$ is the set of elements of $F$ of non-negative valuation.

<a id="function-ringofintegers-rngpad"></a>
##### `RingOfIntegers(R): RngPad -> RngPad`

Given a ring $R$, this function simply returns it, it is provided to support generic functionality for finite extensions of rings and fields.

<a id="function-fieldoffractions-rngpad"></a>
##### `FieldOfFractions(R): RngPad -> FldPad`

Given a local ring $R$, construct the field of fractions $F$ of $R$. The relative precision of $F$ is equal to the precision of $R$.

<a id="function-splittingfield-rngupolelt-rngint-rngpad"></a>
##### `SplittingField(f, R): RngUPolElt[RngInt], RngPad -> RngPad`

Given a polynomial $f$ over the integers and a $p$-adic ring $R$, compute an extension $S$ over $R$ such that $f$ splits into linear factors over $S$. The algorithms uses the R4-methods as developed by Pauli ([[Pau01b](https://docs.magma-maths.org/references.md#cite-pauli-r4)]).

<a id="function-absolutetotallyramifiedextension-rngpad"></a>
##### `AbsoluteTotallyRamifiedExtension(R): RngPad -> RngPad, Map`

Given a tower of ramified extensions over some unramified ring $S$, compute a more efficient representation of $R$, ie. an extension of $S$ that is totally ramified and defined by a single Eisenstein polynomial. The map returned allows to convert between the new and old representations.

#### Other Elementary Constructions

<a id="function-composite-rngpad-rngpad"></a>
##### `Composite(R, S): RngPad, RngPad -> RngPad`

For two $p$-adic fields that are normal over ${\mathbb{Q}}_p$, compute the compositum of $R$ and $S$, ie. the smallest field containing both $R$ and $S$.

#### Attributes of Local Rings and Fields

<a id="attribute-attribute-l-defaultprecision-rngpad-rngintelt"></a>
##### ``L`DefaultPrecision: RngPad -> RngIntElt``

Used to retrieve or set the default precision of the local ring or field $L$. This attribute is only relevant if $L$ is an unbounded free precision ring, in which case this will change the precision with which elements are created by default. For bounded precision structures, the default precision of the ring is equal to the upper bound on precision; attempting to set this attribute will result in an error in this case.

<a id="attribute-attribute-l-seriesprinting-rngpad-boolelt"></a>
##### ``L`SeriesPrinting: RngPad -> BoolElt``

This attribute controls whether elements of the ring or field $L$ are printed as a series in the uniformizing element of $L$. This attribute cannot be set for unramified extensions with Gaussian Normal bases of type 2.

<a id="attribute-attribute-l-seriesprinting-fldpad-boolelt"></a>
##### ``L`SeriesPrinting: FldPad -> BoolElt``

This attribute controls whether elements of the ring or field $L$ are printed as a series in the uniformizing element of $L$. This attribute cannot be set for unramified extensions with Gaussian Normal bases of type 2.

<a id="attribute-attribute-l-seriesprinting-rngpadres-boolelt"></a>
##### ``L`SeriesPrinting: RngPadRes -> BoolElt``

This attribute controls whether elements of the ring or field $L$ are printed as a series in the uniformizing element of $L$. This attribute cannot be set for unramified extensions with Gaussian Normal bases of type 2.

<a id="attribute-attribute-l-seriesprinting-rngpadresext-boolelt"></a>
##### ``L`SeriesPrinting: RngPadResExt -> BoolElt``

This attribute controls whether elements of the ring or field $L$ are printed as a series in the uniformizing element of $L$. This attribute cannot be set for unramified extensions with Gaussian Normal bases of type 2.

<a id="example-ex-29e3f4"></a>
##### `Example: Printing Elements as Series (ex-29e3f4)`

```magma
> Zp := pAdicRing(5, 10);
> Zp`SeriesPrinting := true;
> Zp!9348752038967;
2 + 3*5 + 3*5^2 + 5^3 + 2*5^4 + 2*5^5 + 5^7 + 5^9 + O(5^10)
> U := UnramifiedExtension(Zp, 4);
> U`SeriesPrinting := true;
> U![3294875629, 324, 1254234, 13454];
4*U.1^3 + 4*U.1^2 + 4*U.1 + 4 + (U.1^2 + 4*U.1)*5 + (3*U.1^3 + 4*U.1^2 +
    2*U.1)*5^2 + (2*U.1^3 + 3*U.1^2 + 2*U.1)*5^3 + (U.1^3 + U.1^2 + 1)*5^4 +
    (4*U.1^3 + U.1^2)*5^5 + 2*5^6 + (U.1^2 + 4)*5^7 + (3*U.1^2 + 4)*5^8 + 5^9 +
O(5^10)
> R := TotallyRamifiedExtension(U, Polynomial([10, 25, 125, 1]));
> R![[345, 21, 351345], [234, 2354,214], [2134, 2153254]];
(4*U.1 + 4 + 5 + (U.1 + 2)*5^3 + 3*5^4 + 4*U.1*5^5 + 2*U.1*5^6 + 2*U.1*5^7 +
    U.1*5^9)*R.1^2 + (4*U.1^2 + 4*U.1 + 4 + (2*U.1^2 + 1)*5 + (3*U.1^2 + 4*U.1 +
    4)*5^2 + (U.1^2 + 3*U.1 + 1)*5^3 + 3*U.1*5^4)*R.1 + U.1 + (4*U.1^2 + 4*U.1 +
    4)*5 + (3*U.1^2 + 3)*5^2 + 2*5^3 + 2*U.1^2*5^4 + 2*U.1^2*5^5 + 2*U.1^2*5^6 +
    4*U.1^2*5^7 + O(R.1^30)
> R`SeriesPrinting := true;
> R![[345, 21, 351345], [234, 2354,214], [2134, 2153254]];
U.1 + (4*U.1^2 + 4*U.1 + 4)*R.1 + (4*U.1 + 4)*R.1^2 + (3*U.1^2 + 3*U.1 +
    3)*R.1^3 + (4*U.1^2 + 2)*R.1^4 + 2*R.1^5 + 3*U.1*R.1^6 + (2*U.1^2 + 3*U.1 +
    2)*R.1^7 + (U.1^2 + 2)*R.1^8 + (3*U.1^2 + 4*U.1 + 2)*R.1^9 + (3*U.1^2 +
    3)*R.1^10 + (U.1 + 3)*R.1^11 + (2*U.1^2 + U.1)*R.1^12 + (U.1^2 + 4*U.1 +
    3)*R.1^13 + 3*R.1^14 + (4*U.1^2 + 3*U.1 + 2)*R.1^15 + (2*U.1^2 + 2)*R.1^16 +
    3*U.1^2*R.1^17 + (2*U.1^2 + 3*U.1 + 3)*R.1^18 + (4*U.1^2 + 3*U.1 + 4)*R.1^19 +
    (3*U.1^2 + 4)*R.1^20 + (U.1^2 + U.1 + 1)*R.1^21 + (3*U.1^2 + 4)*R.1^22 +
    (4*U.1^2 + 2*U.1)*R.1^23 + (2*U.1^2 + 4)*R.1^24 + (4*U.1 + 1)*R.1^25 +
    (4*U.1^2 + 2*U.1 + 1)*R.1^26 + (4*U.1^2 + 2)*R.1^27 + (U.1^2 + 2*U.1 +
    1)*R.1^28 + (U.1^2 + U.1 + 2)*R.1^29 + O(R.1^30)
```

### Elementary Invariants

These functions return some simple information partially defining a local ring.

<a id="function-prime-rngpad"></a>
#### `Prime(L): RngPad -> RngIntElt`

<a id="function-prime-fldpad"></a>
#### `Prime(L): FldPad -> RngIntElt`

<a id="function-prime-rngpadres"></a>
#### `Prime(L): RngPadRes -> RngIntElt`

<a id="function-prime-rngpadresext"></a>
#### `Prime(L): RngPadResExt -> RngIntElt`

Given a local ring or field $L$, return the prime $p$ defining the $p$-adic ring or field underlying $L$. This is also the characteristic of the residue class field of $L$.

<a id="function-inertiadegree-rngpad"></a>
#### `InertiaDegree(L): RngPad -> RngIntElt`

<a id="function-inertiadegree-fldpad"></a>
#### `InertiaDegree(L): FldPad -> RngIntElt`

<a id="function-inertiadegree-rngpadres"></a>
#### `InertiaDegree(L): RngPadRes -> RngIntElt`

<a id="function-inertiadegree-rngpadresext"></a>
#### `InertiaDegree(L): RngPadResExt -> RngIntElt`

Return the inertia degree of the local ring or field $L$ over its coefficient ring.

<a id="function-inertiadegree-rngpad-rngpad"></a>
#### `InertiaDegree(K, L): RngPad, RngPad -> RngIntElt`

<a id="function-inertiadegree-fldpad-fldpad"></a>
#### `InertiaDegree(K, L): FldPad, FldPad -> RngIntElt`

<a id="function-inertiadegree-rngpadres-rngpadres"></a>
#### `InertiaDegree(K, L): RngPadRes, RngPadRes -> RngIntElt`

<a id="function-inertiadegree-rngpadresext-rngpadresext"></a>
#### `InertiaDegree(K, L): RngPadResExt, RngPadResExt -> RngIntElt`

Return the inertia degree of the local ring or field $K$ relative to its subring $L$.

<a id="function-absoluteinertiadegree-rngpad"></a>
#### `AbsoluteInertiaDegree(L): RngPad -> RngIntElt`

<a id="function-absoluteinertiadegree-fldpad"></a>
#### `AbsoluteInertiaDegree(L): FldPad -> RngIntElt`

<a id="function-absoluteinertiadegree-rngpadres"></a>
#### `AbsoluteInertiaDegree(L): RngPadRes -> RngIntElt`

<a id="function-absoluteinertiadegree-rngpadresext"></a>
#### `AbsoluteInertiaDegree(L): RngPadResExt -> RngIntElt`

<a id="function-absoluteinertiaindex-rngpad"></a>
#### `AbsoluteInertiaIndex(L): RngPad -> RngIntElt`

<a id="function-absoluteinertiaindex-fldpad"></a>
#### `AbsoluteInertiaIndex(L): FldPad -> RngIntElt`

<a id="function-absoluteinertiaindex-rngpadres"></a>
#### `AbsoluteInertiaIndex(L): RngPadRes -> RngIntElt`

<a id="function-absoluteinertiaindex-rngpadresext"></a>
#### `AbsoluteInertiaIndex(L): RngPadResExt -> RngIntElt`

Return the inertia degree of the local ring or field $L$ over the $p$-adic ring.

<a id="function-ramificationdegree-rngpad"></a>
#### `RamificationDegree(L): RngPad -> RngIntElt`

<a id="function-ramificationdegree-fldpad"></a>
#### `RamificationDegree(L): FldPad -> RngIntElt`

<a id="function-ramificationdegree-rngpadres"></a>
#### `RamificationDegree(L): RngPadRes -> RngIntElt`

<a id="function-ramificationdegree-rngpadresext"></a>
#### `RamificationDegree(L): RngPadResExt -> RngIntElt`

<a id="function-ramificationindex-rngpad"></a>
#### `RamificationIndex(L): RngPad -> RngIntElt`

<a id="function-ramificationindex-fldpad"></a>
#### `RamificationIndex(L): FldPad -> RngIntElt`

<a id="function-ramificationindex-rngpadres"></a>
#### `RamificationIndex(L): RngPadRes -> RngIntElt`

<a id="function-ramificationindex-rngpadresext"></a>
#### `RamificationIndex(L): RngPadResExt -> RngIntElt`

Return the ramification degree of the local ring or field $L$ over its coefficient ring.

<a id="function-ramificationdegree-rngpad-rngpad"></a>
#### `RamificationDegree(K, L): RngPad, RngPad -> RngIntElt`

<a id="function-ramificationdegree-fldpad-fldpad"></a>
#### `RamificationDegree(K, L): FldPad, FldPad -> RngIntElt`

<a id="function-ramificationdegree-rngpadres-rngpadres"></a>
#### `RamificationDegree(K, L): RngPadRes, RngPadRes -> RngIntElt`

<a id="function-ramificationdegree-rngpadresext-rngpadresext"></a>
#### `RamificationDegree(K, L): RngPadResExt, RngPadResExt -> RngIntElt`

<a id="function-ramificationindex-rngpad-rngpad"></a>
#### `RamificationIndex(K, L): RngPad, RngPad -> RngIntElt`

<a id="function-ramificationindex-fldpad-fldpad"></a>
#### `RamificationIndex(K, L): FldPad, FldPad -> RngIntElt`

<a id="function-ramificationindex-rngpadres-rngpadres"></a>
#### `RamificationIndex(K, L): RngPadRes, RngPadRes -> RngIntElt`

<a id="function-ramificationindex-rngpadresext-rngpadresext"></a>
#### `RamificationIndex(K, L): RngPadResExt, RngPadResExt -> RngIntElt`

Return the ramification degree of the local ring or field $K$ relative to its subring $L$.

<a id="function-absoluteramificationdegree-rngpad"></a>
#### `AbsoluteRamificationDegree(L): RngPad -> RngIntElt`

<a id="function-absoluteramificationdegree-fldpad"></a>
#### `AbsoluteRamificationDegree(L): FldPad -> RngIntElt`

<a id="function-absoluteramificationdegree-rngpadres"></a>
#### `AbsoluteRamificationDegree(L): RngPadRes -> RngIntElt`

<a id="function-absoluteramificationdegree-rngpadresext"></a>
#### `AbsoluteRamificationDegree(L): RngPadResExt -> RngIntElt`

<a id="function-absoluteramificationindex-rngpad"></a>
#### `AbsoluteRamificationIndex(L): RngPad -> RngIntElt`

<a id="function-absoluteramificationindex-fldpad"></a>
#### `AbsoluteRamificationIndex(L): FldPad -> RngIntElt`

<a id="function-absoluteramificationindex-rngpadres"></a>
#### `AbsoluteRamificationIndex(L): RngPadRes -> RngIntElt`

<a id="function-absoluteramificationindex-rngpadresext"></a>
#### `AbsoluteRamificationIndex(L): RngPadResExt -> RngIntElt`

Return the ramification degree of the local ring or field $L$ over the $p$-adic ring.

<a id="function-absolutedegree-rngpad"></a>
#### `AbsoluteDegree(L): RngPad -> RngIntElt`

The degree of $L$ over ${\mathbb{Z}}_p$.

<a id="function-degree-rngpad"></a>
#### `Degree(L): RngPad -> RngIntElt`

<a id="function-degree-fldpad"></a>
#### `Degree(L): FldPad -> RngIntElt`

<a id="function-degree-rngpadres"></a>
#### `Degree(L): RngPadRes -> RngIntElt`

<a id="function-degree-rngpadresext"></a>
#### `Degree(L): RngPadResExt -> RngIntElt`

Return the degree of the local ring or field $L$ over its coefficient ring.

<a id="function-degree-rngpad-rngpad"></a>
#### `Degree(K, L): RngPad, RngPad -> RngIntElt`

<a id="function-degree-fldpad-fldpad"></a>
#### `Degree(K, L): FldPad, FldPad -> RngIntElt`

<a id="function-degree-rngpadres-rngpadres"></a>
#### `Degree(K, L): RngPadRes, RngPadRes -> RngIntElt`

<a id="function-degree-rngpadresext-rngpadresext"></a>
#### `Degree(K, L): RngPadResExt, RngPadResExt -> RngIntElt`

Return the degree of the local ring or field $K$ relative to its subring $L$.

<a id="function-definingpolynomial-rngpad"></a>
#### `DefiningPolynomial(L): RngPad -> RngUPolElt`

<a id="function-definingpolynomial-fldpad"></a>
#### `DefiningPolynomial(L): FldPad -> RngUPolElt`

<a id="function-definingpolynomial-rngpadres"></a>
#### `DefiningPolynomial(L): RngPadRes -> RngUPolElt`

<a id="function-definingpolynomial-rngpadresext"></a>
#### `DefiningPolynomial(L): RngPadResExt -> RngUPolElt`

Return the minimal polynomial of the generator of $L$ over its coefficient ring. If $L$ is $p$-adic, the polynomial $x - 1$ is returned. For free precision rings and fields, the coefficients of the defining polynomial are given to the default precision of $L$.

<a id="function-definingpolynomial-rngpad-rngpad"></a>
#### `DefiningPolynomial(K, L): RngPad, RngPad -> RngUPolElt`

<a id="function-definingpolynomial-fldpad-fldpad"></a>
#### `DefiningPolynomial(K, L): FldPad, FldPad -> RngUPolElt`

<a id="function-definingpolynomial-rngpadres-rngpadres"></a>
#### `DefiningPolynomial(K, L): RngPadRes, RngPadRes -> RngUPolElt`

<a id="function-definingpolynomial-rngpadresext-rngpadres"></a>
#### `DefiningPolynomial(K, L): RngPadResExt, RngPadRes -> RngUPolElt`

<a id="function-definingpolynomial-rngpadresext-rngpadresext"></a>
#### `DefiningPolynomial(K, L): RngPadResExt, RngPadResExt -> RngUPolElt`

Return the minimal polynomial of the generator of $K$ over its coefficient ring $L$.

<a id="function-definingmap-rngpad"></a>
#### `DefiningMap(L): RngPad -> Map`

<a id="function-definingmap-fldpad"></a>
#### `DefiningMap(L): FldPad -> Map`

Given a free precision local ring or field $L$, return the map that was used to define the extension (see Section [Creation of Unbounded Precision Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/creation.md#loc-elementary-creation-ext-map) for information on defining extension by maps). If a map was not used, then an error is raised.

<a id="function-hasdefiningmap-rngpad"></a>
#### `HasDefiningMap(L): RngPad -> BoolElt, Map`

<a id="function-definingmap-fldpad-2"></a>
#### `DefiningMap(L): FldPad -> BoolElt, Map`

Given a free precision local ring or field $L$, return `true` if $L$ is defined by a map; if so, the defining map is also returned.

<a id="function-primering-rngpad"></a>
#### `PrimeRing(L): RngPad -> RngPad`

<a id="function-primering-rngpadres"></a>
#### `PrimeRing(L): RngPadRes -> RngPadRes`

<a id="function-primering-rngpadresext"></a>
#### `PrimeRing(L): RngPadResExt -> RngPadRes`

<a id="function-primefield-fldpad"></a>
#### `PrimeField(L): FldPad -> FldPad`

<a id="function-padicring-rngpad"></a>
#### `pAdicRing(L): RngPad -> RngPad`

<a id="function-padicring-rngpadres"></a>
#### `pAdicRing(L): RngPadRes -> RngPadRes`

<a id="function-padicring-rngpadresext"></a>
#### `pAdicRing(L): RngPadResExt -> RngPadRes`

<a id="function-padicfield-fldpad"></a>
#### `pAdicField(L): FldPad -> FldPad`

Given a local ring or field $L$, return the $p$-adic ring or field which is a subring of $L$.

<a id="function-basering-rngpad"></a>
#### `BaseRing(L): RngPad -> RngPad`

<a id="function-basering-rngpadres"></a>
#### `BaseRing(L): RngPadRes -> RngPadRes`

<a id="function-basering-rngpadresext"></a>
#### `BaseRing(L): RngPadResExt -> Rng`

<a id="function-coefficientring-rngpad"></a>
#### `CoefficientRing(L): RngPad -> RngPad`

<a id="function-coefficientring-rngpadres"></a>
#### `CoefficientRing(L): RngPadRes -> RngPadRes`

<a id="function-coefficientring-rngpadresext"></a>
#### `CoefficientRing(L): RngPadResExt -> Rng`

<a id="function-basefield-fldpad"></a>
#### `BaseField(L): FldPad -> FldPad`

<a id="function-coefficientfield-fldpad"></a>
#### `CoefficientField(L): FldPad -> FldPad`

<a id="function-basering-fldpad"></a>
#### `BaseRing(L): FldPad -> FldPad`

Given a local ring or field $L$, return the base ring of $L$.

<a id="function-residueclassfield-rngpad"></a>
#### `ResidueClassField(L): RngPad -> FldFin, Map`

<a id="function-residueclassfield-rngpadres"></a>
#### `ResidueClassField(L): RngPadRes -> FldFin, Map`

<a id="function-residueclassfield-rngpadresext"></a>
#### `ResidueClassField(L): RngPadResExt -> FldFin, Map`

Given a local ring or field $L$, return the residue class field $K$ of $L$, and a map from $L$ to $K$.

<a id="function-residuesystem-rngpad"></a>
#### `ResidueSystem(R): RngPad -> [RngPadElt]`

<a id="function-residuesystem-rngpadres"></a>
#### `ResidueSystem(R): RngPadRes -> [RngPadEltRes]`

<a id="function-residuesystem-rngpadresext"></a>
#### `ResidueSystem(R): RngPadResExt -> [RngPadEltResExt]`

<a id="function-residuesystem-fldpad"></a>
#### `ResidueSystem(R): FldPad -> [FldPadElt]`

Given a $p$-adic ring or field $R$, compute a set of representatives of the residue class field of $R$ as elements of $R$.

<a id="function-uniformizingelement-rngpad"></a>
#### `UniformizingElement(L): RngPad -> RngPadElt`

<a id="function-uniformizingelement-rngpadres"></a>
#### `UniformizingElement(L): RngPadRes -> RngPadResElt`

<a id="function-uniformizingelement-rngpadresext"></a>
#### `UniformizingElement(L): RngPadResExt -> RngPadResExtElt`

<a id="function-uniformizingelement-fldpad"></a>
#### `UniformizingElement(L): FldPad -> FldPadElt`

Given a local ring or field $L$, return the uniformizing element of $L$.

<a id="operation-operation-rngpad-rngpadelt"></a>
#### `L . 1: RngPad -> RngPadElt`

<a id="operation-operation-rngpadres-rngpadreselt"></a>
#### `L . 1: RngPadRes -> RngPadResElt`

<a id="operation-operation-rngpadresext-rngpadresextelt"></a>
#### `L . 1: RngPadResExt -> RngPadResExtElt`

<a id="operation-operation-fldpad-fldpadelt"></a>
#### `L . 1: FldPad -> FldPadElt`

Given a local ring or field $L$, return an element $\alpha$ of $L$ such that if $K$ is $L$’s base ring or field, then the powers of $\alpha$ give a basis of $L$ as a vector space over $K$.

<a id="function-precision-rngpad"></a>
#### `Precision(L): RngPad -> RngIntElt`

<a id="function-precision-rngpadres"></a>
#### `Precision(L): RngPadRes -> RngIntElt`

<a id="function-precision-rngpadresext"></a>
#### `Precision(L): RngPadResExt -> RngIntElt`

<a id="function-precision-fldpad"></a>
#### `Precision(L): FldPad -> RngIntElt`

Given a local ring or field $L$, return the precision with which $L$ has been created. If $L$ is a local ring this is the maximum absolute precision to which its elements can be created. If $L$ is a local field this is the maximum relative precision to which its elements can be created. If $L$ is an unbounded free precision ring or field, then infinity is returned.

<a id="function-hasproot-rngpad"></a>
#### `HasPRoot(R): RngPad -> BoolElt`

Given a local ring $R$ extending ${\mathbb{Z}}_p$ for some prime $p$, decide if $R$ contains a primitive $p$-th root of unity.

<a id="function-hasrootofunity-rngpad-rngintelt"></a>
#### `HasRootOfUnity(L, n): RngPad, RngIntElt -> BoolElt`

Given a local ring $L$ and some positive integer $n$, decide if $L$ contains a primitive $n$th root of unity.

<a id="function-discriminant-rngpad"></a>
#### `Discriminant(R): RngPad -> RngPadElt`

Compute the discriminant of the local ring $R$ over its coefficient ring. Since $R$ is defined by either an inertial polynomial or an Eisenstein one, this is equivalent to computing the discriminant of the defining polynomial.

<a id="function-discriminant-rngpad-rngpad"></a>
#### `Discriminant(K, k): RngPad, RngPad -> RngPadElt`

Given $p$-adic rings $K/k$, compute the discriminant of $K$ as an extension of $k$.

<a id="function-additivegroup-rngpadres"></a>
#### `AdditiveGroup(R): RngPadRes -> GrpAb, Map`

The additive group of the $p$-adic quotient $R$ as an abelian group and the isomorphism from this group back to $R$.

<a id="example-ex-899921"></a>
#### `Example: Elementary Invariants of Local Rings (ex-899921)`

We illustrate the functions in this section for rings. Similar constructions can be used for fields.

```magma
> Zp := pAdicRing(5, 20);
> I<a> := UnramifiedExtension(Zp, 3);
> R<x> := PolynomialRing(I);
> L<b> := ext<I | x^3 + 5*a*x^2 + 5>;
> Prime(L);
5
> InertiaDegree(L);
1
```

The inertia degree of $L$ is returned as 1 because $L$ has been defined as a totally ramified extension of $I$. However, the inertia degree of $L$ over $Z_p$ is 3, because $I$ itself is an unramified extension of $Z_p$.

```magma
> InertiaDegree(L, Zp);
3
> Degree(L);
3
> Degree(L, Zp);
9
> DefiningPolynomial(L);
x^3 + 5*a*x^2 + 5
> P<y> := PolynomialRing(Zp);
> DefiningPolynomial(I);
y^3 + 3*y + 3
> BaseRing(L);
Unramified extension defined by the polynomial x^3 + 3*x + 3
 over 5-adic ring mod 5^20
> PrimeRing(L);
5-adic ring mod 5^20
> PrimeRing(I);
5-adic ring mod 5^20
> ResidueClassField(L);
Finite field of size 5^3
Mapping from: RngPad: L to GF(5^3)
> ResidueClassField(I);
Finite field of size 5^3
Mapping from: RngPad: I to GF(5^3)
```

Here, we see that the residue class fields of $I$ and $L$ are identical. This is due to the fact that $L$ is a totally ramified extension of $I$.

```magma
> UniformizingElement(L);
b
> Precision(L);
60
> Precision(I);
20
> R<a> := ext<pAdicRing(2) | 2>;
> DefiningPolynomial(R);
(1 + O(2^20))*$.1^2 + (1 + O(2^20))*$.1 + 1 + O(2^20)
> Precision(R);
Infinity
```

<a id="function-absoluterootnumber-fldpad"></a>
#### `AbsoluteRootNumber(K): FldPad -> FldCycElt`

The root number of a $p$-adic extension $K/{{\mathbb{Q}}}_p$ can be computed as in §3.3 of [[JR06](https://docs.magma-maths.org/references.md#cite-jones-roberts)], with the result returned (using their convention and not Deligne’s) as an element of ${{\mathbb{Q}}}(\zeta_4)$.

<a id="function-rootnumber-fldpad"></a>
#### `RootNumber(K): FldPad -> FldCycElt`

The root number of a relative $p$-adic extension can be computed by using `AbsoluteRootNumber` and an induction relation.

<a id="example-ex-f6c8be"></a>
#### `Example: Root Numbers of p-adic Extensions (ex-f6c8be)`

We compute the root numbers of some $p$-adic extensions.

```magma
> K := ext<pAdicField(2,20)|Polynomial([10,0,1])>; K;
Totally ramified extension defined by the polynomial x^2 + 10
 over 2-adic field mod 2^20
> RootNumber(K);
-zeta_4
> K := pAdicField(3,40);
> A := AllExtensions(K,3);
> _<x> := PolynomialRing(Integers(K)); // printing
> [<RootNumber(FieldOfFractions(a)),DefiningPolynomial(a)> : a in A];
[
    <zeta_4, x^3 + 3*x + 3>,
    <-zeta_4, x^3 + 6*x + 3>,
    <1, x^3 + 3*x^2 + 3>,
    <1, x^3 + 6*x^2 + 3>,
    <1, x^3 + 6*x^2 + 12>,
    <1, x^3 + 6*x^2 + 21>,
    <zeta_4, x^3 + 3>,
    <zeta_4, x^3 + 12>,
    <zeta_4, x^3 + 21>,
    <1, x^3 + 2*x + 1>
]
```

We take an example where the relative and absolute root numbers differ.

```magma
> K := pAdicField(3,20);
> L := ext<K|Polynomial([3,0,1])>; // both ramified
> M := ext<L|Polynomial([L.1,0,1])>; // both ramified
> RootNumber(M); // relative for M/L
zeta_4
> AbsoluteRootNumber(M); // absolute for M/Q3
-zeta_4
> RootNumber(L); // intermediate field
zeta_4
> X := AbsoluteTotallyRamifiedExtension(Integers(M));
> RootNumber(FieldOfFractions(X));
-zeta_4
```

### Operations on Structures

<a id="procedure-assignnames-rngpad-seqenum-ref"></a>
#### `AssignNames(~L, S): RngPad, SeqEnum`

<a id="procedure-assignnames-rngpadresext-seqenum-ref"></a>
#### `AssignNames(~L, S): RngPadResExt, SeqEnum`

<a id="procedure-assignnames-fldpad-seqenum-ref"></a>
#### `AssignNames(~L, S): FldPad, SeqEnum`

Assign a name to the generator of $L$. The sequence must have only one element, which must be a string. This element is assigned to be the name of the generator when $L$ is considered as a linear associative algebra over its base ring.

<a id="function-characteristic-rngpad"></a>
#### `Characteristic(L): RngPad -> RngIntElt`

<a id="function-characteristic-rngpadres"></a>
#### `Characteristic(L): RngPadRes -> RngIntElt`

<a id="function-characteristic-rngpadresext"></a>
#### `Characteristic(L): RngPadResExt -> RngIntElt`

<a id="function-characteristic-fldpad"></a>
#### `Characteristic(L): FldPad -> RngIntElt`

The characteristic of the local ring or field $L$.

<a id="operation-operation-rngpad-rngintelt"></a>
#### `# L: RngPad -> RngIntElt`

The number of elements in the local ring or field $L$. The cardinality is finite only if $L$ is a quotient ring or a bounded free precision ring.

Iterating over the elements of a local ring is possible if it is bounded, but it will take time in proportion to the cardinality of $L$. It is recommended only in the case of “small” local rings (i.e., rings for which the precision is be very small).

<a id="function-name-rngpad-rngintelt"></a>
#### `Name(L, k): RngPad, RngIntElt -> RngPadElt`

<a id="function-name-rngpadres-rngintelt"></a>
#### `Name(L, k): RngPadRes, RngIntElt -> RngPadResElt`

<a id="function-name-rngpadresext-rngintelt"></a>
#### `Name(L, k): RngPadResExt, RngIntElt -> RngPadResExtElt`

<a id="function-name-fldpad-rngintelt"></a>
#### `Name(L, k): FldPad, RngIntElt -> FldPadElt`

Given a local ring or field $L$ and an integer $k$, return the generator of $L$ if $k$ is 1; otherwise, raise an error.

<a id="function-changeprecision-rngpad-any"></a>
#### `ChangePrecision(L, k): RngPad, Any -> RngPad`

<a id="function-changeprecision-rngpad-infty"></a>
#### `ChangePrecision(L, k): RngPad, Infty -> RngPad`

<a id="function-changeprecision-rngpad-infty-ref"></a>
#### `ChangePrecision(~L, k): RngPad, Infty -> RngPad`

<a id="function-changeprecision-rngpad-rngintelt"></a>
#### `ChangePrecision(L, k): RngPad, RngIntElt -> RngPad`

<a id="function-changeprecision-rngpad-rngintelt-ref"></a>
#### `ChangePrecision(~L, k): RngPad, RngIntElt -> RngPad`

<a id="function-changeprecision-rngpadres-rngintelt"></a>
#### `ChangePrecision(L, k): RngPadRes, RngIntElt -> RngPadRes`

<a id="function-changeprecision-rngpadres-rngintelt-ref"></a>
#### `ChangePrecision(~L, k): RngPadRes, RngIntElt -> RngPadRes`

<a id="function-changeprecision-rngpadresext-rngintelt"></a>
#### `ChangePrecision(L, k): RngPadResExt, RngIntElt -> RngPadResExt`

<a id="function-changeprecision-rngpadresext-rngintelt-ref"></a>
#### `ChangePrecision(~L, k): RngPadResExt, RngIntElt -> RngPadResExt`

<a id="function-changeprecision-fldpad-rngintelt"></a>
#### `ChangePrecision(L, k): FldPad, RngIntElt -> FldPad`

<a id="function-changeprecision-fldpad-rngintelt-ref"></a>
#### `ChangePrecision(~L, k): FldPad, RngIntElt -> FldPad`

<a id="function-changeprecision-fldpad-any"></a>
#### `ChangePrecision(L, k): FldPad, Any -> FldPad`

<a id="function-changeprecision-fldpad-infty"></a>
#### `ChangePrecision(L, k): FldPad, Infty -> FldPad`

<a id="function-changeprecision-fldpad-infty-ref"></a>
#### `ChangePrecision(~L, k): FldPad, Infty -> FldPad`

Given a local ring or field $L$ and a non-negative single precision integer $k$, change the maximum precision with which elements can be created to be $k$. Depending on how $L$ and its subrings have been constructed, there may be an upper bound (possibly infinite for free structures) on the precision to which $L$ can be changed. For instance, the precision to which a defining polynomial has been given places a bound on the precision of the extension — no defining polynomial can be expanded beyond the precision with which it was originally specified.

<a id="operation-op-eq-rngpad-rngpad"></a>
#### `L eq K: RngPad, RngPad -> BoolElt`

<a id="operation-op-eq-rngpadres-rngpadres"></a>
#### `L eq K: RngPadRes, RngPadRes -> BoolElt`

<a id="operation-op-eq-rngpadresext-rngpadresext"></a>
#### `L eq K: RngPadResExt, RngPadResExt -> BoolElt`

<a id="operation-op-eq-fldpad-fldpad"></a>
#### `L eq K: FldPad, FldPad -> BoolElt`

Given local rings or fields $L$ and $K$, return whether or not $L$ and $K$ are the same object.

<a id="operation-op-ne-rngpad-rngpad"></a>
#### `L ne K: RngPad, RngPad -> BoolElt`

<a id="operation-op-ne-rngpadres-rngpadres"></a>
#### `L ne K: RngPadRes, RngPadRes -> BoolElt`

<a id="operation-op-ne-rngpadresext-rngpadresext"></a>
#### `L ne K: RngPadResExt, RngPadResExt -> BoolElt`

<a id="operation-op-ne-fldpad-fldpad"></a>
#### `L ne K: FldPad, FldPad -> BoolElt`

Given local rings or fields $L$ and $K$, return whether or not $L$ and $K$ are different objects.

<a id="example-ex-23c278"></a>
#### `Example: Changing Precision of Local Structures (ex-23c278)`

```magma
> Zp := pAdicRing(5, 20);
> I<a> := UnramifiedExtension(Zp, 3);
> R<x> := PolynomialRing(I);
> L<b> := ext<I | x^3 + 5*a*x^2 + 5>;
> ChangePrecision(Zp, Infinity());
5-adic ring
> L;
Totally ramified extension defined by the polynomial x^3 + 5*a*x^2 + 5
 over Unramified extension defined by the polynomial x^3 + 3*x + 3
 over 5-adic ring mod 5^20
> ChangePrecision(~L, 50);
> L;
Totally ramified extension defined by the polynomial x^3 + 5*$.1*x^2 + 5
 over Unramified extension defined by the polynomial x^3 + 3*x + 3
 over 5-adic ring mod 5^17
> #L;
8758115402030106693273309895561975820501\\
6371367282235734816767743111942667866287\\
592914886772632598876953125
> AssignNames(~L, ["t"]);
> L.1;
t
> b;
b
> L eq ChangePrecision(L, 10);
false
```

Note that $b$ is an element of the original ring $L$ with precision $60$ which is why it retains its print name.

#### Ramification Predicates

<a id="function-isramified-rngpad"></a>
##### `IsRamified(R): RngPad -> BoolElt`

<a id="function-isramified-fldpad"></a>
##### `IsRamified(R): FldPad -> BoolElt`

<a id="function-isunramified-rngpad"></a>
##### `IsUnramified(R): RngPad -> BoolElt`

<a id="function-isunramified-fldpad"></a>
##### `IsUnramified(R): FldPad -> BoolElt`

<a id="function-istotallyramified-rngpad"></a>
##### `IsTotallyRamified(R): RngPad -> BoolElt`

<a id="function-istotallyramified-fldpad"></a>
##### `IsTotallyRamified(R): FldPad -> BoolElt`

Return whether the local ring or field extension $R$ is ramified, unramified, or totally ramified.

<a id="function-istamelyramified-rngpad"></a>
##### `IsTamelyRamified(R): RngPad -> BoolElt`

<a id="function-istamelyramified-fldpad"></a>
##### `IsTamelyRamified(R): FldPad -> BoolElt`

<a id="function-iswildlyramified-rngpad"></a>
##### `IsWildlyRamified(R): RngPad -> BoolElt`

<a id="function-iswildlyramified-fldpad"></a>
##### `IsWildlyRamified(R): FldPad -> BoolElt`

Return whether the local ring or field extension $R$ is tamely ramified (the prime does not divide the ramification degree) or wildly ramified (the prime does divide the ramification degree).

### Element Constructions and Conversions

Local ring elements are implemented using a balanced mod representation. This allows small negative elements $x$ to be represented as $x$ rather than $p^k - x$ where $k$ is a $p$-adic precision.

<a id="constr-elt"></a>
<a id="loc-elt-constr"></a>
#### Constructions

To simplify the creation of elements in a local ring, various coercions are provided. The most obvious is to regard the integer ring or rational field as embedded in the $p$-adic ring or field. But there is a range of coercions available, including that of elements from the residue class field.

To create an element of a local field not lying in the local ring, constructors are provided that create an element coercible into the ring, and which increase or decrease this element’s valuation in the field.

<a id="function-zero-rngpad"></a>
##### `Zero(L): RngPad -> RngPadElt`

<a id="function-zero-rngpadres"></a>
##### `Zero(L): RngPadRes -> RngPadResElt`

<a id="function-zero-rngpadresext"></a>
##### `Zero(L): RngPadResExt -> RngPadResExtElt`

<a id="function-zero-fldpad"></a>
##### `Zero(L): FldPad -> FldPadElt`

Given a local ring or field $L$, create the additive identity of $L$. Note that if $L$ is an unbounded precision ring, this will only be the zero element to the default precision of the ring, and hence only an approximation to the additive identity of $L$. The valuation and hence the absolute precision of the zero of a field is infinite.

<a id="function-one-rngpad"></a>
##### `One(L): RngPad -> RngPadElt`

<a id="function-one-rngpadres"></a>
##### `One(L): RngPadRes -> RngPadResElt`

<a id="function-one-rngpadresext"></a>
##### `One(L): RngPadResExt -> RngPadResExtElt`

<a id="function-one-fldpad"></a>
##### `One(L): FldPad -> FldPadElt`

Given a local ring or field $L$, create the multiplicative identity of $L$. Note that if $L$ is an unbounded precision structure, this will only be the one element to the default precision of the ring, and hence only an approximation to the multiplicative identity of $L$.

<a id="function-random-rngpad"></a>
##### `Random(L): RngPad -> RngPadElt`

<a id="function-random-rngpadres"></a>
##### `Random(L): RngPadRes -> RngPadResElt`

<a id="function-random-rngpadresext"></a>
##### `Random(L): RngPadResExt -> RngPadResExtElt`

Given a local ring or field $L$, return a random element of $L$, which must be a quotient ring or bounded precision ring. The element will have the default precision of the ring.

<a id="function-representative-rngpad"></a>
##### `Representative(L): RngPad -> RngPadElt`

<a id="function-representative-rngpadres"></a>
##### `Representative(L): RngPadRes -> RngPadResElt`

<a id="function-representative-rngpadresext"></a>
##### `Representative(L): RngPadResExt -> RngPadResExtElt`

<a id="function-representative-fldpad"></a>
##### `Representative(L): FldPad -> FldPadElt`

Return an element of the local ring or field $L$.

<a id="constructor-constructor-elt-rngpad-rngelt-rngpadelt"></a>
##### `elt<L | u>: RngPad, RngElt -> RngPadElt`

<a id="constructor-constructor-elt-rngpad-rngelt-rngpadelt-2"></a>
##### `elt<L | u>: RngPad, [RngElt] -> RngPadElt`

<a id="operation-op-rngpad-rngelt"></a>
##### `L ! u: RngPad, RngElt -> RngPadElt`

<a id="operation-op-rngpad-rngelt-2"></a>
##### `L ! u: RngPad, [RngElt] -> RngPadElt`

<a id="constructor-constructor-elt-fldpad-rngelt-fldpadelt"></a>
##### `elt<L | u>: FldPad, RngElt -> FldPadElt`

<a id="constructor-constructor-elt-fldpad-rngelt-fldpadelt-2"></a>
##### `elt<L | u>: FldPad, [RngElt] -> FldPadElt`

<a id="operation-op-fldpad-rngelt"></a>
##### `L ! u: FldPad, RngElt -> FldPadElt`

<a id="operation-op-fldpad-rngelt-2"></a>
##### `L ! u: FldPad, [RngElt] -> FldPadElt`

Coerce the object $u$ into the local ring or field $L$. The resulting element will have as much precision as possible. The element $u$ is allowed to be one of the following:

**(i)**
An integer.

**(ii)**
An element of ${\mathbb{Z}}/ p^m{\mathbb{Z}}$; (where $m$ is a precision).

**(iii)**
An element of the residue class field of $L$.

**(iv)**
An element of a local ring or field with something in common with $L$.

**(v)**
A rational number. If $L$ is a ring then $u$ must not have valuation in the denominator.

**(vi)**
An element of a valuation ring over the rationals with the same prime as $L$.

**(vii)**
A sequence $s$. In this case, the sequence $s$ is coerced to a sequence $t$ over the base ring or field of $L$. This sequence is coerced to $\sum_{i=1}^{\#t} t[i] L.1^{i-1}$.

<a id="constructor-constructor-elt-rngpad-rngelt-rngintelt-rngpadelt"></a>
##### `elt<L | u, r>: RngPad, RngElt, RngIntElt -> RngPadElt`

<a id="constructor-constructor-elt-rngpad-rngelt-rngintelt-rngpadelt-2"></a>
##### `elt<L | u, r>: RngPad, [RngElt], RngIntElt -> RngPadElt`

<a id="constructor-constructor-elt-fldpad-rngelt-rngintelt-fldpadelt"></a>
##### `elt<L | u, r>: FldPad, RngElt, RngIntElt -> FldPadElt`

<a id="constructor-constructor-elt-fldpad-rngelt-rngintelt-fldpadelt-2"></a>
##### `elt<L | u, r>: FldPad, [RngElt], RngIntElt -> FldPadElt`

Create an element of the local ring or field $L$ by coercing $u$ into $L$ and returning with it precision $r$.

<a id="constructor-constructor-elt-rngpad-rngintelt-rngelt-rngintelt-rngpadelt"></a>
##### `elt<L | v, u, r>: RngPad, RngIntElt, RngElt, RngIntElt -> RngPadElt`

<a id="constructor-constructor-elt-rngpad-rngintelt-rngelt-rngintelt-rngpadelt-2"></a>
##### `elt<L | v, u, r>: RngPad, RngIntElt, [RngElt], RngIntElt -> RngPadElt`

<a id="constructor-constructor-elt-fldpad-rngintelt-rngelt-rngintelt-fldpadelt"></a>
##### `elt<L | v, u, r>: FldPad, RngIntElt, RngElt, RngIntElt -> FldPadElt`

<a id="constructor-constructor-elt-fldpad-rngintelt-rngelt-rngintelt-fldpadelt-2"></a>
##### `elt<L | v, u, r>: FldPad, RngIntElt, [RngElt], RngIntElt -> FldPadElt`

Create an element of the local ring or field $L$ by coercing $u$ into $L$, multiplying by the $v$-th power of the uniformizing element and returning it with precision $r$.

<a id="function-bigo-rngpadelt"></a>
##### `BigO(x): RngPadElt -> RngPadElt`

<a id="function-bigo-fldpadelt"></a>
##### `BigO(x): FldPadElt -> FldPadElt`

<a id="function-o-rngpadelt"></a>
##### `O(x): RngPadElt -> RngPadElt`

<a id="function-o-fldpadelt"></a>
##### `O(x): FldPadElt -> FldPadElt`

For an element $x$ of a local ring or field $L$ of valuation $v$, create an element of valuation $v$ and relative precision $0$. For rings this is the zero element in the quotient $L / \pi^v L$.

<a id="function-uniformizingelement-rngpad-2"></a>
##### `UniformizingElement(L): RngPad -> RngPadElt`

<a id="function-uniformizingelement-rngpadres-2"></a>
##### `UniformizingElement(L): RngPadRes -> RndPadResElt`

<a id="function-uniformizingelement-rngpadresext-2"></a>
##### `UniformizingElement(L): RngPadResExt -> RndPadResExtElt`

<a id="function-uniformizingelement-fldpad-2"></a>
##### `UniformizingElement(L): FldPad -> FldPadElt`

Given a local ring or field $L$, return the uniformizing element of $L$ to the default precision of $L$.

<a id="example-ex-9e5bd3"></a>
##### `Example: Element Constructors and Imprecise Zeros (ex-9e5bd3)`

Here we illustrate the usage of element constructors for local fields and imprecise zeros.

```magma
> Zp := pAdicRing(5, 20);
> I<a> := UnramifiedExtension(Zp, 3);
> R<x> := PolynomialRing(I);
> L<b> := ext<I | x^3 + 5*a*x^2 + 5>;
> K<pi> := ext<BaseField(FieldOfFractions(L)) | x^2 + 5>;
> K;
Totally ramified extension defined by the polynomial x^2 + 5
 over Unramified extension defined by the polynomial x^3 + 3*x + 3
 over 5-adic field mod 5^20
> elt<K | 64>;
64 + O(pi^40)
> P := PrimeField(K);
> elt<K | 2, 3/4, 6>;
pi^2*7 + O(pi^6)
> 4*$1;
pi^2*3 + O(pi^6)
> K!3/5;
pi^-2*3 + O(pi^38)
> O(K!40^200);
O(pi^400)
> Precision($1);
0
> O(K!0);
O(pi^40)
> O(K!1);
O(1)
> R<x> := PolynomialRing(Integers());
> K<pi> := ext<pAdicField(5, 100) | x^2 + 5>;
> elt<K | 64>;
64 + O(pi^200)
> Precision($1);
200
> K!3/10;
-pi^-2*3944304526105059027058642826413931148366032175545115023851394653320311 +
O(pi^198)
```

<a id="example-ex-b0924e"></a>
##### `Example: Precision When Coercing Sequences (ex-b0924e)`

There is a subtle interplay between the default precision of rings and fields and coercion of sequences, which we demonstrate here. We construct the 5-adic field $P$, and an unramified extension of $R$. We set the default precision of $R$ to be higher than that of $P$.

```magma
> P := pAdicRing(5);
> R := ext<P | 2>;
> P`DefaultPrecision;
20
> R`DefaultPrecision := 40;
> x := Random(R);
> x;
-1579801843431963201369145587*R.1 - 680575730458975039033394769 + O(5^40)
> s := [-680575730458975039033394769, -1579801843431963201369145587];
> R!s;
-13585890629962*R.1 + 47482939261481 + O(5^20)
> P`DefaultPrecision := 40;
> R!s;
-1579801843431963201369145587*R.1 - 680575730458975039033394769 + O(5^40)
```

As can be seen from the above, it is the default precision of the base ring, not the ring itself, which determines the precision of elements created by sequences.

#### Element Decomposers

<a id="function-elementtosequence-rngpadelt"></a>
##### `ElementToSequence(x): RngPadElt -> [ RngElt ]`

<a id="function-elementtosequence-rngpadreselt"></a>
##### `ElementToSequence(x): RngPadResElt -> [ RngElt ]`

<a id="function-elementtosequence-rngpadresextelt"></a>
##### `ElementToSequence(x): RngPadResExtElt -> [ RngElt ]`

<a id="function-elementtosequence-fldpadelt"></a>
##### `ElementToSequence(x): FldPadElt -> [ RngElt ]`

<a id="function-eltseq-rngpadelt"></a>
##### `Eltseq(x): RngPadElt -> [ RngElt ]`

<a id="function-eltseq-rngpadreselt"></a>
##### `Eltseq(x): RngPadResElt -> [ RngElt ]`

<a id="function-eltseq-rngpadresextelt"></a>
##### `Eltseq(x): RngPadResExtElt -> [ RngElt ]`

<a id="function-eltseq-fldpadelt"></a>
##### `Eltseq(x): FldPadElt -> [ RngElt ]`

<a id="function-coefficients-rngpadelt"></a>
##### `Coefficients(x): RngPadElt -> [ RngElt ]`

<a id="function-coefficients-rngpadreselt"></a>
##### `Coefficients(x): RngPadResElt -> [ RngElt ]`

<a id="function-coefficients-rngpadresextelt"></a>
##### `Coefficients(x): RngPadResExtElt -> [ RngElt ]`

<a id="function-coefficients-fldpadelt"></a>
##### `Coefficients(x): FldPadElt -> [ RngElt ]`

Given an element $x$ of a degree $n$ extension $K$ of $L$, these functions return a sequence $s$ of elements of $L$ such that $x = \sum_{i=1}^{n} s[i] K.1^{i-1}$.

<a id="function-coefficient-rngpadelt-rngintelt"></a>
##### `Coefficient(x, i): RngPadElt, RngIntElt -> RngPadElt`

<a id="function-coefficient-rngpadreselt-rngintelt"></a>
##### `Coefficient(x, i): RngPadResElt, RngIntElt -> RngPadResElt`

<a id="function-coefficient-rngpadresextelt-rngintelt"></a>
##### `Coefficient(x, i): RngPadResExtElt, RngIntElt -> RngElt`

<a id="function-coefficient-fldpadelt-rngintelt"></a>
##### `Coefficient(x, i): FldPadElt, RngIntElt -> FldPadElt`

Equivalent to, but more efficient than, `Coefficients(x)[i]`.

<a id="example-ex-716c79"></a>
##### `Example: Galois Descent of a Polynomial (ex-716c79)`

We want to perform a Galois descent for a polynomial, i.e. we interpret the product of the Galois conjugates of a polynomial in a subring.

```magma
> p := 3;
> L<a> := UnramifiedExtension(pAdicRing(p), 4 : Cyclotomic);
> R<x> := PolynomialRing(L);
> g := x^2 + (a+a^-2)*x + (a^-1+a^3+1);
> g;
(1 + O(3^20))*x^2 + (-151999392*a^3 - 428033534*a^2 + 1509587217*a - 64512399 +
    O(3^20))*x + 2*a^3 + 307453058*a^2 - 1732356354*a - 151999391 + O(3^20)
> a2 := a^(p^2);
> g2 := R ! [ &+[Eltseq(c)[i]*a2^(i-1) : i in [1..4]] : c in Eltseq(g) ];
```

Here `Eltseq` is being used to replace occurrences of $a$ in the element by $a_2$.

```magma
> h := g * g2;
> h;
(1 + O(3^20))*x^4 + (774759822*a^3 - 1559939781*a^2 + 644136111*a + 143311364 +
    O(3^20))*x^3 + (73899384*a^3 - 333497478*a^2 + 1655979363*a + 158024680 +
    O(3^20))*x^2 + (989668189*a^3 - 661853000*a^2 - 1685887308*a + 122035547 +
    O(3^20))*x - 1630826887*a^3 - 328410694*a^2 - 175290219*a + 1601599448 +
    O(3^20)
```

The polynomial $g_2$ is the image of $g$ under the automorphism induced by the square of the Frobenius automorphism. The product $h = g g_2$ has coefficients in the unramified extension of degree 2, which is the fixed field under the square of the Frobenius and is generated by $a^{10}$. Next, we determine a representation for the polynomial $h$ with coefficients lying in this unramified extension of degree 2.

```magma
> K<b> := UnramifiedExtension(pAdicRing(p), 2 : Cyclotomic);
> S<y> := PolynomialRing(K);
> M := RMatrixSpace(PrimeRing(L), 2, 4) ! 0;
> V := RSpace(PrimeRing(L), 4);
> M[1] := V ! Eltseq(a^0);
> M[2] := V ! Eltseq(a^10);
> sol := [ Solution(M, V ! Eltseq(c)) : c in Eltseq(h) ];
> h2 := S ! [ K ! Eltseq(s) : s in sol ];
> h2;
(1 + O(3^20))*y^4 + (-1237301755*b + 505889265 + O(3^20))*y^3 + (-542504216*b +
    1258167831 + O(3^20))*y^2 + (-280210015*b - 1205051127 + O(3^20))*y +
    1213139407*b + 1602993886 + O(3^20)
```

<a id="operation-element"></a>
<a id="loc-elt-ops"></a>
### Operations on Elements

#### Arithmetic

For local ring elements the usual operations are available. The quotient of two elements can be computed when the result lies in the ring (i.e. the valuation of the dividend is not smaller than that of the divisor). The precision of the result is reduced by the valuation of the divisor. The result of an operation with elements of reduced precision will have as much precision as possible. For addition and subtraction this is the minimum of the precisions of the two elements. For multiplication it is the minimum of $v_1 + k_2$ and $v_2 + k_1$, where $v_i$ and $k_i$ are the valuations and precisions of the two elements, respectively.

For local field elements the operations are performed with the maximum precision possible. For multiplication and division this is the minimum of the (relative) precisions of the two elements. For addition and subtraction of elements $x$ and $y$ with valuations $v_x$ and $v_y$ and precisions $k_x$ and $k_y$ the precision of $x \pm y$ is $\min(v_x+k_x, v_y+k_y) - v_p(x \pm y)$, which may even be $0$.

<a id="operation-operation-rngpadelt-rngpadelt"></a>
##### `- x: RngPadElt -> RngPadElt`

<a id="operation-operation-rngpadreselt-rngpadreselt"></a>
##### `- x: RngPadResElt -> RngPadResElt`

<a id="operation-operation-rngpadresextelt-rngpadresextelt"></a>
##### `- x: RngPadResExtElt -> RngPadResExtElt`

<a id="operation-operation-fldpadelt-fldpadelt"></a>
##### `- x: FldPadElt -> FldPadElt`

The negative of the element $x$.

<a id="operation-op-plus-rngpadelt-rngpadelt"></a>
##### `x + y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-op-plus-rngpadreselt-rngpadreselt"></a>
##### `x + y: RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="operation-op-plus-rngpadresextelt-rngpadresextelt"></a>
##### `x + y: RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="operation-op-plus-fldpadelt-fldpadelt"></a>
##### `x + y: FldPadElt, FldPadElt -> FldPadElt`

The sum of the elements $x$ and $y$.

<a id="operation-op-minus-rngpadelt-rngpadelt"></a>
##### `x - y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-op-minus-rngpadreselt-rngpadreselt"></a>
##### `x - y: RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="operation-op-minus-rngpadresextelt-rngpadresextelt"></a>
##### `x - y: RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="operation-op-minus-fldpadelt-fldpadelt"></a>
##### `x - y: FldPadElt, FldPadElt -> FldPadElt`

The difference of the elements $x$ and $y$.

<a id="operation-op-times-rngpadelt-rngpadelt"></a>
##### `x * y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-op-times-rngpadreselt-rngpadreselt"></a>
##### `x * y: RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="operation-op-times-rngpadresextelt-rngpadresextelt"></a>
##### `x * y: RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="operation-op-times-fldpadelt-fldpadelt"></a>
##### `x * y: FldPadElt, FldPadElt -> FldPadElt`

The product of the elements $x$ and $y$.

<a id="operation-op-pow-rngpadelt-rngintelt"></a>
##### `x ^ k: RngPadElt, RngIntElt -> RngPadElt`

<a id="operation-op-pow-rngpadreselt-rngintelt"></a>
##### `x ^ k: RngPadResElt, RngIntElt -> RngPadResElt`

<a id="operation-op-pow-rngpadresextelt-rngintelt"></a>
##### `x ^ k: RngPadResExtElt, RngIntElt -> RngPadResExtElt`

<a id="operation-op-pow-fldpadelt-rngintelt"></a>
##### `x ^ k: FldPadElt, RngIntElt -> FldPadElt`

The $k$-th power of the element $x$. If $k$ has valuation (when coerced) and $x$ has precision less than that of its parent ring, the power $x^k$ will have more precision than $x$.

<a id="operation-operation-div-rngpadelt-rngpadelt-rngpadelt"></a>
##### `x div y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-operation-div-rngpadreselt-rngpadreselt-rngpadreselt"></a>
##### `x div y: RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="operation-operation-div-rngpadresextelt-rngpadresextelt-rngpadresextelt"></a>
##### `x div y: RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="operation-operation-div-fldpadelt-fldpadelt-fldpadelt"></a>
##### `x div y: FldPadElt, FldPadElt -> FldPadElt`

The quotient of the elements $x$ and $y$. For elements of a local ring, this results in an error if the valuation of $x$ is smaller than that of $y$.

<a id="operation-operation-div-rngpadelt-rngpadelt-rngpadelt-2"></a>
##### `x div:= y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-operation-div-rngpadreselt-rngpadreselt-rngpadreselt-2"></a>
##### `x div:= y: RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="operation-operation-div-rngpadelt-rngpadelt-rngpadelt-3"></a>
##### `x div:= y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-operation-div-fldpadelt-fldpadelt-fldpadelt-2"></a>
##### `x div:= y: FldPadElt, FldPadElt -> FldPadElt`

Mutation operation: replace the element $x$ by its quotient upon division by $y$. For elements of a local ring, this results in an error if the valuation of $x$ is smaller than that of $y$.

<a id="operation-op-div-rngpadelt-rngpadelt"></a>
##### `x / y: RngPadElt, RngPadElt -> RngPadElt`

<a id="operation-op-div-fldpadelt-fldpadelt"></a>
##### `x / y: FldPadElt, FldPadElt -> FldPadElt`

The quotient of the elements $x$ and $y$. For elements of a local ring, the result will be returned in its field of fractions.

<a id="function-isexactlydivisible-rngpadelt-rngpadelt"></a>
##### `IsExactlyDivisible(x, y): RngPadElt, RngPadElt -> BoolElt, RngPadElt`

<a id="function-isexactlydivisible-rngpadreselt-rngpadreselt"></a>
##### `IsExactlyDivisible(x, y): RngPadResElt, RngPadResElt -> BoolElt, RngPadResElt`

<a id="function-isexactlydivisible-rngpadresextelt-rngpadresextelt"></a>
##### `IsExactlyDivisible(x, y): RngPadResExtElt, RngPadResExtElt -> BoolElt, RngPadResExtElt`

<a id="function-isexactlydivisible-fldpadelt-fldpadelt"></a>
##### `IsExactlyDivisible(x, y): FldPadElt, FldPadElt -> BoolElt, FldPadElt`

Return `true` if $x$ can be exactly divided by $y$; in this case also return the quotient.

<a id="example-ex-915090"></a>
##### `Example: Division of Non-units (ex-915090)`

Division of non-units in the ring will yield a result in the field of fractions. In that case the result has reduced precision. To ensure that the result is returned as a ring element, the operator `div` should be used.

```magma
> R := pAdicRing(2);
> pi := UniformizingElement(R);
> pi;
2 + O(2^20)
> 1 / pi;
2^-1 + O(2^18)
> Parent($1);
2-adic field
> 1 div pi;

>> 1 div pi;
     ^
Runtime error in 'div': Division is not exact
> IsExactlyDivisible(1, pi);
false
> IsExactlyDivisible(pi^2, pi);
true 2 + O(2^20)
```

#### Equality and Membership

It is possible to test whether two local ring or field elements are equal.

<a id="operation-op-eq-rngpadreselt-rngpadreselt"></a>
##### `x eq y: RngPadResElt, RngPadResElt -> BoolElt`

<a id="operation-op-eq-rngpadresextelt-rngpadresextelt"></a>
##### `x eq y: RngPadResExtElt, RngPadResExtElt -> BoolElt`

<a id="operation-op-eq-rngpadelt-rngpadelt"></a>
##### `x eq y: RngPadElt, RngPadElt -> BoolElt`

<a id="operation-op-eq-fldpadelt-fldpadelt"></a>
##### `x eq y: FldPadElt, FldPadElt -> BoolElt`

Given local ring or field elements $x$ and $y$, return `true` if and only if $x$ and $y$ are identical in value.

<a id="operation-op-ne-rngpadreselt-rngpadreselt"></a>
##### `x ne y: RngPadResElt, RngPadResElt -> BoolElt`

<a id="operation-op-ne-rngpadresextelt-rngpadresextelt"></a>
##### `x ne y: RngPadResExtElt, RngPadResExtElt -> BoolElt`

<a id="operation-op-ne-rngpadelt-rngpadelt"></a>
##### `x ne y: RngPadElt, RngPadElt -> BoolElt`

<a id="operation-op-ne-fldpadelt-fldpadelt"></a>
##### `x ne y: FldPadElt, FldPadElt -> BoolElt`

Given local ring or field elements $x$ and $y$, return `true` if and only if $x$ and $y$ are not identical in value.

<a id="operation-op-in-rngpad"></a>
##### `x in L: ., RngPad -> BoolElt`

<a id="operation-op-in-fldpad"></a>
##### `x in L: ., FldPad -> BoolElt`

Return `true` if and only if $x$ lies in the local ring or field $L$.

<a id="operation-op-notin-rngpad"></a>
##### `x notin L: ., RngPad -> BoolElt`

<a id="operation-op-notin-fldpad"></a>
##### `x notin L: ., FldPad -> BoolElt`

Return `true` if and only if $x$ does not lie in the local ring or field $L$.

<a id="example-ex-44ed45"></a>
##### `Example: Constructing an Unramified Extension (ex-44ed45)`

We demonstrate how an unramified extension can be constructed from a given degree. The idea is to interpret the minimal polynomial of a primitive element in the residue class field as a polynomial over ${\mathbb{Z}}_p$. The quotient of ${\mathbb{Z}}_p[x]$ by the ideal generated by this polynomial is isomorphic to the unramified extension and $a := \overline{x}$ is a first approximation for the $p^f-1$-th root of unity. This is improved by iterating $a \mapsto a^{p^f}$ until this remains fixed.

```magma
> p := 2;
> f := 5;
> Zp := pAdicRing(p, 25);
> R<x> := PolynomialRing(Zp);
> g := R ! MinimalPolynomial(GF(p,f).1);
> Q<r> := quo<R | g>;
> a := [ r, r^(p^f) ];
> while a[#a] ne a[#a-1] do
>     print a[#a];
>     Append(~a, a[#a]^(p^f));
> end while;
34*r^4 - 44*r^3 + 58*r^2 - 23*r + 36
12522914*r^4 + 12522004*r^3 - 12174790*r^2 - 8200343*r - 10407260
8242594*r^4 + 12409364*r^3 + 5143098*r^2 + 15781737*r - 3636572
5490082*r^4 + 8804884*r^3 - 11109830*r^2 + 11456361*r + 11698852
-15481438*r^4 - 5875180*r^3 + 5667386*r^2 + 7262057*r - 884060
> [ Minimum([ Valuation(c) : c in Eltseq(a[i] - a[i-1]) ]) : i in [2..#a-1] ];
[ 1, 6, 11, 16, 21 ]
```

The last statement demonstrates the convergence of the process. The polynomial defining the unramified extension could now easily be obtained as the minimal polynomial of the fixed element.

```magma
> U := ext<Zp | f>;
> MinimalPolynomial(U ! Eltseq(a[#a]));
x^5 - 13205240*x^4 - 3159900*x^3 - 13778593*x^2 + 9730498*x - 1
```

#### Properties

Local ring and field elements can be tested for certain properties. However, note that in unbounded free precision rings and fields, exact one, and minus one elements do not exist, only approximations to such elements — in these cases, the predicates will always return `false`.

<a id="function-iszero-rngpadelt"></a>
##### `IsZero(x): RngPadElt -> BoolElt`

<a id="function-iszero-rngpadreselt"></a>
##### `IsZero(x): RngPadResElt -> BoolElt`

<a id="function-iszero-rngpadresextelt"></a>
##### `IsZero(x): RngPadResExtElt -> BoolElt`

<a id="function-iszero-fldpadelt"></a>
##### `IsZero(x): FldPadElt -> BoolElt`

Given an element $x$ of a local ring or field, return `true` if and only if $x$ is the zero element of its parent ring or field.

<a id="function-isone-rngpadelt"></a>
##### `IsOne(x): RngPadElt -> BoolElt`

<a id="function-isone-rngpadreselt"></a>
##### `IsOne(x): RngPadResElt -> BoolElt`

<a id="function-isone-rngpadresextelt"></a>
##### `IsOne(x): RngPadResExtElt -> BoolElt`

<a id="function-isone-fldpadelt"></a>
##### `IsOne(x): FldPadElt -> BoolElt`

Given an element $x$ of a local ring or field, return `true` if and only if $x$ is the one element of its parent ring or field.

Note that this is always `false` for an element of a ring or field of unbounded precision.

<a id="function-isminusone-rngpadelt"></a>
##### `IsMinusOne(x): RngPadElt -> BoolElt`

<a id="function-isminusone-rngpadreselt"></a>
##### `IsMinusOne(x): RngPadResElt -> BoolElt`

<a id="function-isminusone-rngpadresextelt"></a>
##### `IsMinusOne(x): RngPadResExtElt -> BoolElt`

<a id="function-isminusone-fldpadelt"></a>
##### `IsMinusOne(x): FldPadElt -> BoolElt`

Given an element $x$ of a local ring or field, return `true` if and only if $x$ is the minus one element of its parent ring or field.

Note that this is always `false` for an element of a ring or field of unbounded precision.

<a id="function-isunit-rngpadelt"></a>
##### `IsUnit(x): RngPadElt -> BoolElt`

<a id="function-isunit-rngpadreselt"></a>
##### `IsUnit(x): RngPadResElt -> BoolElt`

<a id="function-isunit-rngpadresextelt"></a>
##### `IsUnit(x): RngPadResExtElt -> BoolElt`

<a id="function-isunit-fldpadelt"></a>
##### `IsUnit(x): FldPadElt -> BoolElt`

Given an element $x$ of a local ring or field, return `true` if and only if $x$ is a unit, that is, $x$ has valuation 0.

<a id="function-isintegral-rngpadelt"></a>
##### `IsIntegral(x): RngPadElt -> BoolElt`

<a id="function-isintegral-rngpadreselt"></a>
##### `IsIntegral(x): RngPadResElt -> BoolElt`

<a id="function-isintegral-rngpadresextelt"></a>
##### `IsIntegral(x): RngPadResExtElt -> BoolElt`

<a id="function-isintegral-fldpadelt"></a>
##### `IsIntegral(x): FldPadElt -> BoolElt`

Given an element $x$ of a local ring or field, return `true` if and only if $x$ has non-negative valuation.

#### Precision and Valuation

Note that the precision of an element may be modified.

<a id="function-parent-rngpadelt"></a>
##### `Parent(x): RngPadElt -> RngPad`

<a id="function-parent-rngpadreselt"></a>
##### `Parent(x): RngPadResElt -> RngPadRes`

<a id="function-parent-rngpadresextelt"></a>
##### `Parent(x): RngPadResExtElt -> RngPadResExt`

<a id="function-parent-fldpadelt"></a>
##### `Parent(x): FldPadElt -> FldPad`

Return the parent local ring or field of the element $x$.

<a id="function-precision-rngpadelt"></a>
##### `Precision(x): RngPadElt -> RngIntElt`

<a id="function-precision-rngpadreselt"></a>
##### `Precision(x): RngPadResElt -> RngIntElt`

<a id="function-precision-rngpadresextelt"></a>
##### `Precision(x): RngPadResExtElt -> RngIntElt`

<a id="function-precision-fldpadelt"></a>
##### `Precision(x): FldPadElt -> RngIntElt`

For a local ring element $x$, returns the precision to which it is known; for a local field element $x$, returns the precision to which its unit part is known.

<a id="function-absoluteprecision-rngpadelt"></a>
##### `AbsolutePrecision(x): RngPadElt -> RngIntElt`

<a id="function-absoluteprecision-rngpadreselt"></a>
##### `AbsolutePrecision(x): RngPadResElt -> RngIntElt`

<a id="function-absoluteprecision-rngpadresextelt"></a>
##### `AbsolutePrecision(x): RngPadResExtElt -> RngIntElt`

<a id="function-absoluteprecision-fldpadelt"></a>
##### `AbsolutePrecision(x): FldPadElt -> RngIntElt`

Returns the precision of a local ring or field element $x$.

<a id="function-relativeprecision-rngpadelt"></a>
##### `RelativePrecision(x): RngPadElt -> RngIntElt`

<a id="function-relativeprecision-rngpadreselt"></a>
##### `RelativePrecision(x): RngPadResElt -> RngIntElt`

<a id="function-relativeprecision-rngpadresextelt"></a>
##### `RelativePrecision(x): RngPadResExtElt -> RngIntElt`

<a id="function-relativeprecision-fldpadelt"></a>
##### `RelativePrecision(x): FldPadElt -> RngIntElt`

Returns the difference between the absolute precision and the valuation of the local ring or field element $x$.

<a id="function-changeprecision-rngupolelt-rngintelt"></a>
##### `ChangePrecision(x, k): RngUPolElt, RngIntElt -> RngPadElt`

<a id="function-changeprecision-rngupolelt-rngintelt-ref"></a>
##### `ChangePrecision(~x, k): RngUPolElt, RngIntElt -> RngPadElt`

<a id="function-changeprecision-rngpadelt-rngintelt"></a>
##### `ChangePrecision(x, k): RngPadElt, RngIntElt -> RngPadElt`

<a id="function-changeprecision-rngpadelt-rngintelt-ref"></a>
##### `ChangePrecision(~x, k): RngPadElt, RngIntElt -> RngPadElt`

<a id="function-changeprecision-fldpadelt-rngintelt"></a>
##### `ChangePrecision(x, k): FldPadElt, RngIntElt -> FldPadElt`

<a id="function-changeprecision-fldpadelt-rngintelt-ref"></a>
##### `ChangePrecision(~x, k): FldPadElt, RngIntElt -> FldPadElt`

Given a local ring or field element or polynomial over a local ring or field $x$ and a non-negative single precision integer $k$, change the precision of $x$ to $k$. If $k$ is smaller than the precision of $x$, $x$ is truncated; if $k$ is larger, then an element $y$ is returned such that $v(x - y) \ge k$. Note that the precision of an element cannot be changed to be greater than its parent. Any attempt to do so will result in the element gaining the precision of its parent.

<a id="function-expand-rngpadelt"></a>
##### `Expand(x): RngPadElt -> RngPadElt`

<a id="function-expand-fldpadelt"></a>
##### `Expand(x): FldPadElt -> FldPadElt`

Change the precision of the local ring or field element $x$ to be the maximum precision allowed by its parent. This results in an error if $x$ is an element of an unbounded free precision ring.

<a id="function-valuation-rngpadelt"></a>
##### `Valuation(x): RngPadElt -> RngIntElt`

<a id="function-valuation-rngpadreselt"></a>
##### `Valuation(x): RngPadResElt -> RngIntElt`

<a id="function-valuation-rngpadresextelt"></a>
##### `Valuation(x): RngPadResExtElt -> RngIntElt`

<a id="function-valuation-fldpadelt"></a>
##### `Valuation(x): FldPadElt -> RngIntElt`

Return the valuation of the local ring or field element $x$. This is always bounded by the absolute precision of the element.

<a id="example-ex-c75a3c"></a>
##### `Example: Relative and Absolute Precision (ex-c75a3c)`

The uses and properties of relative and absolute precision for field elements are illustrated here, as well as the results of `Expand`.

```magma
> R<x> := PolynomialRing(Integers());
> K<d> := ext<ext<pAdicField(5, 100) | 2> |  x^2 + 5>;
> x := d + d^7;
> x;
-d*124 + O(d^200)
> AbsolutePrecision(x);
200
> RelativePrecision(x);
199
> RelativePrecision(x + O(d^10));
9
> AbsolutePrecision(x + O(d^10));
10
> RelativePrecision(ChangePrecision(x, 19));
19
> RelativePrecision(ChangePrecision(x, 10));
10
> AbsolutePrecision(ChangePrecision(x, 10));
11
> Expand(ChangePrecision(x, 10));
d*3001 + O(d^201)
> Valuation(x);
1
> ChangePrecision(x, 20) - (x + O(d^21));
O(d^21)
```

The last two lines show that changing the precision of an element is equivalent to adding imprecision to the element effectively cancelling off all terms beyond that of relative valuation $20$.

<a id="example-ex-a2d0b8"></a>
##### `Example: Pitfalls of Unbounded Precision (ex-a2d0b8)`

As indicated above, `IsOne` for elements of an unbounded precision ring/field will always be false.

```magma
> IsOne(pAdicField(7)!1);
false
> IsMinusOne(pAdicField(7)!-1);
false
> IsZero(pAdicField(7)!0);
true
```

#### Logarithms and Exponentials

<a id="function-log-rngpadelt"></a>
##### `Log(x): RngPadElt -> RngPadElt`

<a id="function-log-rngpadreselt"></a>
##### `Log(x): RngPadResElt -> RngPadResElt`

<a id="function-log-rngpadresextelt"></a>
##### `Log(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-log-fldpadelt"></a>
##### `Log(x): FldPadElt -> FldPadElt`

The logarithm of the local ring or field element $x$, returned to the precision of $x$. Note that the power series of the logarithm function only converges if the valuation of $x-1$ is positive. For ring elements $x$, the answer lies in the ring (and not its field of fractions) only if the valuation of $x - 1$ is greater than or equal to the ramification degree of the ring divided by the prime.

The rate of convergence of `Log` is dependent on the valuation of $x - 1$. The greater the valuation the faster the convergence, as is illustrated in the example below.

<a id="function-exp-rngpadelt"></a>
##### `Exp(x): RngPadElt -> RngPadElt`

<a id="function-exp-rngpadreselt"></a>
##### `Exp(x): RngPadResElt -> RngPadResElt`

<a id="function-exp-rngpadresextelt"></a>
##### `Exp(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-exp-fldpadelt"></a>
##### `Exp(x): FldPadElt -> FldPadElt`

The exponential of the local ring or field element $x$, returned to the precision of $x$. Note that the power series of the exponential function only converges if the valuation of $x$ is strictly larger than $e/(p-1)$, where $e$ is the ramification degree of the parent ring of $x$.

<a id="example-ex-bfa7a7"></a>
##### `Example: Timing Logarithms and Exponentials (ex-bfa7a7)`

This example illustrates the relative timings of the `Log` function and the `Exp` function for rings and fields and for various valuations of $x - 1$ or $x$ as appropriate.

```magma
> K := ext<pAdicField(3, 20) | x^3 + x^2 + x + 2>;
> K<d> := ext<K | x^3 + 3*x^2 + 3*x + 3>;
> L<b> := IntegerRing(K);
> x := 1 + b;
> time Log(x);
Time: 0.070
> x := 1 + b^5;
> time Log(x);
874050819*b^2 + 1624571442*b - 914550768
Time: 0.010
> RelativePrecision(Exp(Log(x)) - x);
0
> x := b^2;
> time Exp(x);
1418565628*b^2 + 1334033745*b + 905945461
Time: 0.170
> RelativePrecision(Log(Exp(x)) - x);
0
> x := b^6;
> time Exp(x);
1700312013*b^2 - 72781965*b + 1129064707
Time: 0.020
> RelativePrecision(Log(Exp(x)) - x);
0
```

#### Norm and Trace

<a id="function-norm-rngpadelt"></a>
##### `Norm(x): RngPadElt -> RngPadElt`

<a id="function-norm-rngpadreselt"></a>
##### `Norm(x): RngPadResElt -> RngPadResElt`

<a id="function-norm-rngpadresextelt"></a>
##### `Norm(x): RngPadResExtElt -> RngElt`

<a id="function-norm-fldpadelt"></a>
##### `Norm(x): FldPadElt -> FldPadElt`

Given a local ring or field element $x$, return the norm of $x$ over the base ring of its parent.

<a id="function-norm-rngpadelt-rngpad"></a>
##### `Norm(x, R): RngPadElt, RngPad -> RngPadElt`

<a id="function-norm-rngpadreselt-rngpadres"></a>
##### `Norm(x, R): RngPadResElt, RngPadRes -> RngPadResElt`

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

<a id="function-norm-fldpadelt-fldpad"></a>
##### `Norm(x, R): FldPadElt, FldPad -> FldPadElt`

Given a local ring or field element $x$, return the norm of $x$ over the local ring or field $R$. The ring $R$ must be a subring of the parent of $x$.

<a id="function-trace-rngpadelt"></a>
##### `Trace(x): RngPadElt -> RngPadElt`

<a id="function-trace-rngpadreselt"></a>
##### `Trace(x): RngPadResElt -> RngPadResElt`

<a id="function-trace-rngpadresextelt"></a>
##### `Trace(x): RngPadResExtElt -> RngElt`

<a id="function-trace-fldpadelt"></a>
##### `Trace(x): FldPadElt -> FldPadElt`

Given a local ring or field element $x$, return the trace of $x$ over the base ring of its parent. The trace is the product of all conjugates of $x$.

<a id="function-trace-rngpadelt-rngpad"></a>
##### `Trace(x, R): RngPadElt, RngPad -> RngPadElt`

<a id="function-trace-rngpadreselt-rngpadres"></a>
##### `Trace(x, R): RngPadResElt, RngPadRes -> RngPadResElt`

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

<a id="function-trace-fldpadelt-fldpad"></a>
##### `Trace(x, R): FldPadElt, FldPad -> FldPadElt`

Given a local ring or field element $x$, return the trace of $x$ over the local ring or field $R$. The ring $R$ must be a subring of the parent of $x$. The trace is the sum of all conjugates of $x$.

<a id="function-minimalpolynomial-rngpadelt"></a>
##### `MinimalPolynomial(x): RngPadElt -> RngUPolElt`

<a id="function-minimalpolynomial-rngpadreselt"></a>
##### `MinimalPolynomial(x): RngPadResElt -> RngUPolElt`

<a id="function-minimalpolynomial-rngpadresextelt"></a>
##### `MinimalPolynomial(x): RngPadResExtElt -> RngUPolElt`

<a id="function-minimalpolynomial-fldpadelt"></a>
##### `MinimalPolynomial(x): FldPadElt -> RngUPolElt`

Given a local ring or field element $x$, return the minimal polynomial of $x$ over the base ring of its parent.

<a id="function-minimalpolynomial-rngpadelt-rngpad"></a>
##### `MinimalPolynomial(x, R): RngPadElt, RngPad -> RngUPolElt`

<a id="function-minimalpolynomial-rngpadreselt-rngpadres"></a>
##### `MinimalPolynomial(x, R): RngPadResElt, RngPadRes -> RngUPolElt`

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

<a id="function-minimalpolynomial-fldpadelt-fldpad"></a>
##### `MinimalPolynomial(x, R): FldPadElt, FldPad -> RngUPolElt`

Given a local ring or field element $x$, return the minimal polynomial of $x$ over the local ring or field $R$. The ring $R$ must be a subring of the parent of $x$.

<a id="function-characteristicpolynomial-rngpadelt"></a>
##### `CharacteristicPolynomial(x): RngPadElt -> RngUPolElt`

<a id="function-characteristicpolynomial-rngpadreselt"></a>
##### `CharacteristicPolynomial(x): RngPadResElt -> RngUPolElt`

<a id="function-characteristicpolynomial-rngpadresextelt"></a>
##### `CharacteristicPolynomial(x): RngPadResExtElt -> RngUPolElt`

Given a local ring element $x$, return the characteristic polynomial of $x$ over the base ring of its parent.

<a id="function-characteristicpolynomial-rngpadelt-rngpad"></a>
##### `CharacteristicPolynomial(x, R): RngPadElt, RngPad -> RngUPolElt`

<a id="function-characteristicpolynomial-rngpadreselt-rngpadres"></a>
##### `CharacteristicPolynomial(x, R): RngPadResElt, RngPadRes -> RngUPolElt`

<a id="function-characteristicpolynomial-rngpadresextelt-rngpadres"></a>
##### `CharacteristicPolynomial(x, R): RngPadResExtElt, RngPadRes -> RngUPolElt`

<a id="function-characteristicpolynomial-rngpadresextelt-rngpadresext"></a>
##### `CharacteristicPolynomial(x, R): RngPadResExtElt, RngPadResExt -> RngUPolElt`

Given a local ring or field element $x$, return the characteristic polynomial of $x$ over the local ring or field $R$. The ring $R$ must be a subring of the parent of $x$.

<a id="function-galoisimage-rngpadelt-rngintelt"></a>
##### `GaloisImage(x, i): RngPadElt, RngIntElt -> RngPadElt`

<a id="function-galoisimage-rngpadreselt-rngintelt"></a>
##### `GaloisImage(x, i): RngPadResElt, RngIntElt -> RngPadResElt`

<a id="function-galoisimage-rngpadresextelt-rngintelt"></a>
##### `GaloisImage(x, i): RngPadResExtElt, RngIntElt -> RngPadResExtElt`

<a id="function-galoisimage-fldpadelt-rngintelt"></a>
##### `GaloisImage(x, i): FldPadElt, RngIntElt -> FldPadElt`

Given a local ring or field element $x$, return the image of $x$ under the relative Frobenius automorphism composed with itself $i$ times, that is, $a \mapsto a^{(q^i)}$ where $a$ is a $p^f - 1$st root of unity of the parent of $x$ and $q$ is the cardinality of the residue class field of the base.

If the top part of the extension is totally ramified, $x$ will be returned. If the top part of the extension is unramified of degree $d$, this function gives easy access to the cyclic automorphism group of order $d$. If the functionality of `GaloisImage` is not sufficient, `AutomorphismGroup` may be used instead.

<a id="example-ex-1dd0a7"></a>
##### `Example: Arithmetic-Geometric Mean Point Counting (ex-1dd0a7)`

One important application of the $p$-adics is to counting points on elliptic curves over finite fields. This example demonstrates how a simple version of the Arithmetic-Geometric Mean (AGM) algorithm could be implemented in Magma.

```magma
> d := 50;
> FF := GF(2^d);
> E := EllipticCurve([FF | 1, 0, 0, 0, Random(FF)]);
> assert Degree(sub<BaseRing(E) | jInvariant(E)>) gt 2;
>
> n := (d + 1) div 2 + 3;
> R := ext<pAdicRing(2) | d>;
> R`DefaultPrecision := n;
>
> a6 := elt<R | jInvariant(E)^-1, 1>;
> lambda := 1 + 8 * a6;
>
> for k in [4..n] do
>     ChangePrecision(~lambda, k + 2);
>     lambda := (1 + lambda) * InverseSqrt(lambda) div 2;
> end for;

> lambda := 2 * lambda div (1 + lambda);
> Exp(Trace(Log(lambda)));
32196193 + O(2^26)
> Trace(E) mod 2^26;
32196193
```

<a id="function-euclideannorm-rngpadreselt"></a>
##### `EuclideanNorm(x): RngPadResElt -> RngIntElt`

<a id="function-euclideannorm-rngradresextelt"></a>
##### `EuclideanNorm(x): RngRadResExtElt -> RngIntElt`

Return the euclidean norm of the element $x$ of a fixed precision local ring.

#### Power Relation (Algebraic Dependency)

By taking small linear combinations of powers of a $p$-adic number, one can attempt to determine if it satisfies an algebraic relation.

<a id="function-powerrelation-fldpadelt-rngintelt"></a>
##### `PowerRelation(x, n): FldPadElt, RngIntElt -> RngUPolElt`

Given a $p$-adic number over $Q_p$, return a degree $n$ relation for its powers. If this has small coefficients compared to the precision, then the element is likely an approximation to an algebraic number satisfying the return polynomial.

<a id="teichmuller-lifts"></a>
#### Teichmüller Lifts

Another important operation is the determination of the canonical *Teichmüller lift* of an element $u$ in the residue field of a $p$-adic ring. By definition this is the unique root of unity of order prime to $p$ which reduces to $u$ modulo the maximal ideal.

<a id="function-teichmuellerlift-fldfinelt-rngpadresext"></a>
##### `TeichmuellerLift(u, R): FldFinElt, RngPadResExt -> RngPadResExtElt`

<a id="function-teichmuellerlift-fldfinelt-rngpadres"></a>
##### `TeichmuellerLift(u, R): FldFinElt, RngPadRes -> RngPadResElt`

For a fixed precision quotient ring $R$ of the $p$-adics or an unramified extension and a finite field element $u$, the function attempts to coerce $u$ into the residue class field of $R$ and then computes and returns its Teichmüller lift to $R$. This uses a fast iterative lifting method of Harley described in Chapter 12 of [[C+05](https://docs.magma-maths.org/references.md#cite-hb-ec-hc-crypto)]. For unramified extensions this works most efficiently with `Cyclotomic` or `Gaussian Normal` bases since it uses the Frobenius operation.

### Linear Algebra

All linear algebra over local rings and fields in Magma is implemented in terms of the fixed precision model. Internally, linear algebra over free precision models is performed over an appropriate quotient ring. The advantage of this method is that exact algorithms can be used to solve linear systems; the disadvantage is that the answer may be returned to less precision than is theoretically possible.

<a id="elt-roots"></a>
<a id="loc-elt-roots"></a>
### Roots of Elements

Roots of local ring and field elements can be found to some precision.

<a id="function-squareroot-rngpadelt"></a>
#### `SquareRoot(x): RngPadElt -> RngPadElt`

<a id="function-squareroot-rngpadreselt"></a>
#### `SquareRoot(x): RngPadResElt -> RngPadResElt`

<a id="function-squareroot-rngpadresextelt"></a>
#### `SquareRoot(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-squareroot-fldpadelt"></a>
#### `SquareRoot(x): FldPadElt -> FldPadElt`

<a id="function-sqrt-rngpadelt"></a>
#### `Sqrt(x): RngPadElt -> RngPadElt`

<a id="function-sqrt-rngpadreselt"></a>
#### `Sqrt(x): RngPadResElt -> RngPadResElt`

<a id="function-sqrt-rngpadresextelt"></a>
#### `Sqrt(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-sqrt-fldpadelt"></a>
#### `Sqrt(x): FldPadElt -> FldPadElt`

Given a local ring or field element $x$, return a square root of $x$. An error results if $x$ is not a square. The result may have less precision than $x$.

<a id="function-issquare-rngpadelt"></a>
#### `IsSquare(x): RngPadElt -> BoolElt, RngPadElt`

<a id="function-issquare-rngpadreselt"></a>
#### `IsSquare(x): RngPadResElt -> BoolElt, RngPadResElt`

<a id="function-issquare-rngpadresextelt"></a>
#### `IsSquare(x): RngPadResExtElt -> BoolElt, RngPadResExtElt`

<a id="function-issquare-fldpadelt"></a>
#### `IsSquare(x): FldPadElt -> BoolElt, FldPadElt`

Return whether the local ring or field element $x$ is the square of an element in its parent and if it is, the square root is returned. The result may have less precision than $x$.

<a id="function-inversesquareroot-rngpadelt"></a>
#### `InverseSquareRoot(x): RngPadElt -> RngPadElt`

<a id="function-inversesquareroot-rngpadreselt"></a>
#### `InverseSquareRoot(x): RngPadResElt -> RngPadResElt`

<a id="function-inversesquareroot-rngpadresextelt"></a>
#### `InverseSquareRoot(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-inversesquareroot-fldpadelt"></a>
#### `InverseSquareRoot(x): FldPadElt -> FldPadElt`

<a id="function-inversesqrt-rngpadelt"></a>
#### `InverseSqrt(x): RngPadElt -> RngPadElt`

<a id="function-inversesqrt-rngpadreselt"></a>
#### `InverseSqrt(x): RngPadResElt -> RngPadResElt`

<a id="function-inversesqrt-rngpadresextelt"></a>
#### `InverseSqrt(x): RngPadResExtElt -> RngPadResExtElt`

<a id="function-inversesqrt-fldpadelt"></a>
#### `InverseSqrt(x): FldPadElt -> FldPadElt`

Given a local ring or field element $x$, return an inverse square root of $x$. The element $x$ must be a unit. An error results if $x$ is not a square. The result may have less precision than $x$.

<a id="function-inversesquareroot-rngpadelt-rngpadelt"></a>
#### `InverseSquareRoot(x, y): RngPadElt, RngPadElt -> RngPadElt`

<a id="function-inversesquareroot-rngpadreselt-rngpadreselt"></a>
#### `InverseSquareRoot(x, y): RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="function-inversesquareroot-rngpadresextelt-rngpadresextelt"></a>
#### `InverseSquareRoot(x, y): RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="function-inversesquareroot-fldpadelt-fldpadelt"></a>
#### `InverseSquareRoot(x, y): FldPadElt, FldPadElt -> FldPadElt`

<a id="function-inversesqrt-rngpadelt-rngpadelt"></a>
#### `InverseSqrt(x, y): RngPadElt, RngPadElt -> RngPadElt`

<a id="function-inversesqrt-rngpadreselt-rngpadreselt"></a>
#### `InverseSqrt(x, y): RngPadResElt, RngPadResElt -> RngPadResElt`

<a id="function-inversesqrt-rngpadresextelt-rngpadresextelt"></a>
#### `InverseSqrt(x, y): RngPadResExtElt, RngPadResExtElt -> RngPadResExtElt`

<a id="function-inversesqrt-fldpadelt-fldpadelt"></a>
#### `InverseSqrt(x, y): FldPadElt, FldPadElt -> FldPadElt`

Given local ring or field elements $x$ and $y$, return an inverse square root of $x$ lifted from an initial approximation $y$. The element $x$ must be a unit. An error results if $x$ is not a square, or if $y$ is not a valid initial approximation to an inverse square root of $x$. The result may have less precision than $x$.

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

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

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

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

Return an $n$-th root of $x$ if one exists. An error results if $x$ is not an $n$-th power. The result may have less precision than $x$.

<a id="function-ispower-rngpadelt-rngintelt"></a>
#### `IsPower(x, n): RngPadElt, RngIntElt -> BoolElt, RngPadElt`

<a id="function-ispower-rngpadreselt-rngintelt"></a>
#### `IsPower(x, n): RngPadResElt, RngIntElt -> BoolElt, RngPadResElt`

<a id="function-ispower-rngpadresextelt-rngintelt"></a>
#### `IsPower(x, n): RngPadResExtElt, RngIntElt -> BoolElt, RngPadResExtElt`

<a id="function-ispower-fldpadelt-rngintelt"></a>
#### `IsPower(x, n): FldPadElt, RngIntElt -> BoolElt, FldPadElt`

Return whether $x$ is an $n$-th power of some element belonging to its parent and if it is return an $n$-th root. The result may have less precision than $x$.

<a id="function-inverseroot-rngpadelt-rngintelt"></a>
#### `InverseRoot(x, n): RngPadElt, RngIntElt -> RngPadElt`

<a id="function-inverseroot-rngpadreselt-rngintelt"></a>
#### `InverseRoot(x, n): RngPadResElt, RngIntElt -> RngPadResElt`

<a id="function-inverseroot-rngpadresextelt-rngintelt"></a>
#### `InverseRoot(x, n): RngPadResExtElt, RngIntElt -> RngPadResExtElt`

<a id="function-inverseroot-fldpadelt-rngintelt"></a>
#### `InverseRoot(x, n): FldPadElt, RngIntElt -> FldPadElt`

Given a local ring or field element $x$, return an inverse $n$-th root of $x$. The element $x$ must be a unit. An error results if $x$ is not an $n$-th power. The result may have less precision than $x$.

<a id="function-inverseroot-rngpadelt-rngpadelt-rngintelt"></a>
#### `InverseRoot(x, y, n): RngPadElt, RngPadElt, RngIntElt -> RngPadElt`

<a id="function-inverseroot-rngpadreselt-rngpadreselt-rngintelt"></a>
#### `InverseRoot(x, y, n): RngPadResElt, RngPadResElt, RngIntElt -> RngPadResElt`

<a id="function-inverseroot-rngpadresextelt-rngpadresextelt-rngintelt"></a>
#### `InverseRoot(x, y, n): RngPadResExtElt, RngPadResExtElt, RngIntElt -> RngPadResExtElt`

<a id="function-inverseroot-fldpadelt-fldpadelt-rngintelt"></a>
#### `InverseRoot(x, y, n): FldPadElt, FldPadElt, RngIntElt -> FldPadElt`

Given local ring or field elements $x$ and $y$, return an inverse $n$-th root of $x$ lifted from an initial approximation $y$. The element $x$ must be a unit. An error results if $x$ is not an $n$-th power, or if $y$ is not a valid initial approximation to an inverse $n$-th root of $x$. The result may have less precision than $x$.

### Polynomials

Various simple operations for polynomials as well as root finding and factorization functions have been implemented for polynomials over local rings and fields.

#### Operations for Polynomials

A number of functions for polynomials in general are applicable for polynomials over local rings and fields. Arithmetic functions, including `div` and `mod` can be used with such polynomials (though there may be some precision loss), as well as all the elementary functions to access coefficients and so forth. Derivatives can be taken and polynomials over local rings and fields can be evaluated at elements coercible into the coefficient ring. Along with GCD for these polynomials, the LCM of two polynomials can also be found.

Although the ring of polynomials over a local ring is not a principal ideal domain, it is useful to have a GCD function available. For example, for polynomials which are coprime over the local field, the ideal generated by the two polynomials contains some power of the uniformizing element of the local ring. This power determines whether an approximate factorization can be lifted to a proper factorization.

<a id="function-greatestcommondivisor-rngupolelt-rngupolelt"></a>
##### `GreatestCommonDivisor(f, g): RngUPolElt, RngUPolElt -> RngUPolElt`

<a id="function-gcd-rngupolelt-rngupolelt"></a>
##### `Gcd(f, g): RngUPolElt, RngUPolElt -> RngUPolElt`

<a id="function-gcd-rngupolelt-rngupolelt-2"></a>
##### `GCD(f, g): RngUPolElt, RngUPolElt -> RngUPolElt`

Determine the greatest common divisor of polynomials $f$ and $g$ where $f$ and $g$ are over a free precision local ring or field. The GCD returned is such that the cofactors of the polynomials will have coefficients in the ring (if the polynomial is not over a field). The process of computing the GCD of two polynomials may result in some inaccuracy. The GCD is computed by echelonizing the Sylvester matrix of $f$ and $g$.

<a id="operation-operation-div-rngupolelt-rngupolelt-rngupolelt"></a>
##### `f div g: RngUPolElt, RngUPolElt -> RngUPolElt`

<a id="operation-operation-mod-rngupolelt-rngupolelt-rngupolelt"></a>
##### `f mod g: RngUPolElt, RngUPolElt -> RngUPolElt`

<a id="function-leastcommonmultiple-rngupolelt-rngupolelt"></a>
##### `LeastCommonMultiple(f, g): RngUPolElt, RngUPolElt -> RngUPolElt`

<a id="function-coefficient-rngupolelt-rngintelt"></a>
##### `Coefficient(f, i): RngUPolElt, RngIntElt -> RngElt`

<a id="function-leadingcoefficient-rngupolelt"></a>
##### `LeadingCoefficient(f): RngUPolElt -> RngElt`

<a id="function-derivative-rngupolelt"></a>
##### `Derivative(f): RngUPolElt -> RngUPolElt`

<a id="function-evaluate-rngupolelt-rngelt"></a>
##### `Evaluate(f, x): RngUPolElt, RngElt -> RngElt`

<a id="example-ex-8d80f7"></a>
##### `Example: GCDs of p-adic Polynomials (ex-8d80f7)`

This example illustrates the usage and results of the GCD functions. Note the precision loss in the answer.

```magma
> L := pAdicRing(5, 20);
> R<x> := PolynomialRing(L);
> elts := [Random(L) : i in [1..3]];
> f := (x - elts[1])^3 * (x - elts[2])^2 * (x - elts[3]);
> f;
x^6 + 31722977012336*x^5 - 34568128687249*x^4 +
    4655751767246*x^3 + 11683626356181*x^2 -
    29833674388290*x + 32360011367900
> GCD(f, Derivative(f));
(1 + O(5^18))*x^3 - (934087632277 + O(5^18))*x^2 -
    (89130566204 + O(5^18))*x + 1178670674955 + O(5^18)
> f mod $1;
O(5^18)*x^5 + O(5^18)*x^4 + O(5^18)*x^3 + O(5^18)*x^2 +
    O(5^18)*x + O(5^19)
> (x - elts[1])^2 * (x - elts[2]);
x^3 + 14324701430223*x^2 + 26613750293171*x +
    31696248799955
> ChangePrecision($1, 18);
(1 + O(5^18))*x^3 - (934087632277 + O(5^18))*x^2 -
    (89130566204 + O(5^18))*x + 1178670674955 + O(5^18)
```

<a id="function-shiftvaluation-rngupolelt-rngintelt"></a>
##### `ShiftValuation(f, n): RngUPolElt, RngIntElt -> RngUPolElt`

Shifts the valuation of each coefficient of $f$ by $n$, ie. scales the polynomial by $\pi^n$.

#### Roots of Polynomials

##### Hensel Lifting of Roots

Roots of a polynomial $f$ defined over a local ring or field can be found by first determining their valuation (using the Newton polygon), finding a first approximation over the finite field and finally improving this approximation until the Hensel condition $v(f(a)) > 2v(f'(a))$ is satisfied.

<a id="function-newtonpolygon-rngupolelt"></a>
###### `NewtonPolygon(f): RngUPolElt -> NwtnPgon`

The Newton polygon of a polynomial $f = \sum_{i=0}^n c_i x^i$ (over a local ring or field) is the lower convex hull of the points $(i, v(c_i))$. The slopes of the Newton polygon determine the valuations of the roots of $f$ in a splitting ring and the number of roots with that valuation. The faces of the Newton polygon can be determined using the function `Faces` which returns the faces expressed as the line $mx + ny = c$ which coincides with the face. The function `GradientVector` will return the $m$ and $n$ values from the line so that the valuation (gradient) can be calculated. The function `EndVertices` will return the end points of the face, the $x$ coordinates of which will give the number of roots with valuation equal to the gradient of the face.

Newton polygons are discussed in greater detail in Chapter [Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/index-newton-polygons.md#newtonpgon) and are illustrated below.

<a id="function-valuationsofroots-rngupolelt"></a>
###### `ValuationsOfRoots(f): RngUPolElt -> SeqEnum[<FldRatElt, RngIntElt>]`

Return a sequence containing pairs which are valuations of roots of $f$ and the number of roots of $f$ which have that valuation.

<a id="example-ex-8d9abc"></a>
###### `Example: Newton Polygons and Root Valuations (ex-8d9abc)`

For a polynomial of the form $g := \prod (x - r_i)$ we demonstrate that the Newton polygon determines the valuations of the roots of $g$.

```magma
> Z3 := pAdicRing(3, 30);
> R<y> := PolynomialRing(Z3);
> pi := UniformizingElement(Z3);
> roots := [ pi^Random([0..3]) * Random(Z3) : i in [1..10] ];
> [ Valuation(r) : r in roots ];
[ 3, 1, 6, 3, 0, 3, 2, 3, 3, 2 ]
> g := &* [ y - r : r in roots ];
> N := NewtonPolygon(g);
> N;
Newton Polygon of y^10 + 44594997030169*y^9 - 85346683389318*y^8 +
    76213593390537*y^7 + 74689026811236*y^6 - 48671968754502*y^5 -
    58608670426020*y^4 - 63609139981179*y^3 + 77334553491246*y^2 +
    39962036019861*y - 94049035648173 over pAdicRing(3, 30)
> F := Faces(N);
> F;
[ <6, 1, 26>, <3, 1, 23>, <2, 1, 17>, <1, 1, 9>, <0, 1, 0> ]
> [GradientVector(F[i]) : i in [1 .. #F]];
[ <6, 1>, <3, 1>, <2, 1>, <1, 1>, <0, 1> ]
> [$1[i][1]/$1[i][2] : i in [1 ..#$1]];
[ 6, 3, 2, 1, 0 ]
> [EndVertices(F[i]) : i in [1 .. #F]];
[
    [ <0, 26>, <1, 20> ],
    [ <1, 20>, <6, 5> ],
    [ <6, 5>, <8, 1> ],
    [ <8, 1>, <9, 0> ],
    [ <9, 0>, <10, 0> ]
]
> [$1[i][2][1] - $1[i][1][1] : i in [1 .. #$1]];
[ 1, 5, 2, 1, 1 ]
```

So there is one root of valuation $6$, five of valuation $3$, two of valuation $2$, one of valuation $1$, and one root with valuation zero. This information could also have been gained using `ValuationsOfRoots`.

```magma
> ValuationsOfRoots(g);
[ <6, 1>, <3, 5>, <2, 2>, <1, 1>, <0, 1> ]
```

<a id="function-hensellift-rngupolelt-rngpadelt"></a>
###### `HenselLift(f, x): RngUPolElt, RngPadElt -> RngPadElt`

<a id="function-hensellift-rngupolelt-rngpadreselt"></a>
###### `HenselLift(f, x): RngUPolElt, RngPadResElt -> RngPadResElt`

<a id="function-hensellift-rngupolelt-rngpadresextelt"></a>
###### `HenselLift(f, x): RngUPolElt, RngPadResExtElt -> RngPadResExtElt`

<a id="function-hensellift-rngupolelt-fldpadelt"></a>
###### `HenselLift(f, x): RngUPolElt, FldPadElt -> FldPadElt`

<a id="function-hensellift-rngupolelt-rngpadelt-rngintelt"></a>
###### `HenselLift(f, x, k): RngUPolElt, RngPadElt, RngIntElt -> RngPadElt`

<a id="function-hensellift-rngupolelt-rngpadreselt-rngintelt"></a>
###### `HenselLift(f, x, k): RngUPolElt, RngPadResElt, RngIntElt -> RngPadResElt`

<a id="function-hensellift-rngupolelt-rngpadresextelt-rngintelt"></a>
###### `HenselLift(f, x, k): RngUPolElt, RngPadResExtElt, RngIntElt -> RngPadResExtElt`

<a id="function-hensellift-rngupolelt-fldpadelt-rngintelt"></a>
###### `HenselLift(f, x, k): RngUPolElt, FldPadElt, RngIntElt -> FldPadElt`

Return a root of the polynomial $f$ over a local ring or field by lifting the approximate root $x$ to a root with precision $k$ (or the default precision of the structure if not specified). This results in an error, if the Hensel condition $v(f(x)) > 2v(f'(x))$ is not satisfied.

<a id="example-ex-88d396"></a>
###### `Example: Square Roots by Hensel Lifting (ex-88d396)`

This examples illustrates how Hensel lifting is used to compute square roots.

```magma
> Zx<x> := PolynomialRing(Integers());
> L1<a> := ext<pAdicRing(3, 20) | 2>;
> L2<b> := ext<L1 | x^2 + 3*x + 3>;
> R<y> := PolynomialRing(L2);
> c := (a+b)^42;
> r := L2 ! Sqrt(ResidueClassField(L2) ! c);
> r;
a
> rr := HenselLift(y^2-c, r);
> rr;
(-1513703643*a - 1674232545)*b - 1219509587*a + 760894776
> Valuation(rr^2 - c);
40
> ChangePrecision(rr, 1);
a + O(b)
```

For $p=2$ the situation is a bit more difficult, since the derivative of $y^2 - c$ is not a unit at this point.

```magma
> Zx<x> := PolynomialRing(Integers());
> L1<a> := ext<pAdicRing(2, 20) | 2>;
> L2<b> := ext<L1 | x^2 + 2*x + 2>;
> R<y> := PolynomialRing(L2);
> c := (a+b)^42;
> r := L2 ! Sqrt(ResidueClassField(L2) ! c);
> r;
1
> HenselLift(y^2-c, r);

>> HenselLift(y^2-c, r);
             ^
Runtime error in 'HenselLift': Hensel lift condition is not satisfied
```

We have to find a better approximation for the square root first.

```magma
> for d in GF(2,2) do
>     if Valuation((r + b*L2!d)^2 - c) gt 4 then
>         print L2!d;
>     end if;
> end for;
a + 1
> r +:= b * (a+1);
> HenselLift( y^2-c, r );
(-199021*a + 100463)*b + 204032*a - 31859 + O(b^38)
> ChangePrecision($1, 1);
1 + O(b)
> ChangePrecision($2, 2);
(a + 1)*b + 1 + O(b^2)
```

The square root is an element of reduced precision, since the proper root is only guaranteed to coincide with the approximation up to valuation 18.

##### Functions returning Roots

These functions determine the roots of a polynomial from the factorization of the polynomial.

<a id="function-roots-rngupolelt"></a>
###### `Roots(f): RngUPolElt -> [ <RngPadElt, RngIntElt> ]`

<a id="function-roots-rngupolelt-rngpad"></a>
###### `Roots(f, R): RngUPolElt, RngPad -> [ <RngPadElt, RngIntElt> ]`

```magma
IsSquarefree: BoolElt                    Default: false
```

Return the roots of the polynomial $f$ over a local ring or field $R$ as a sequence of tuples of elements in $R$ and multiplicities. If $R$ is not specified it is taken to be the coefficient ring of $f$. If the polynomial is known to be squarefree, the root-finding algorithm may run considerably faster.

<a id="function-hasroot-rngupolelt"></a>
###### `HasRoot(f): RngUPolElt -> BoolElt, RngPadElt`

Try to find a root of the polynomial $f$ over a local ring or field. If a root is found, this function returns `true` and a root as a second value; otherwise it returns `false`.

<a id="example-ex-87cd32"></a>
###### `Example: Ramified Quadratic Extensions of Z2 (ex-87cd32)`

We generate the ramified extensions of ${\mathbb{Z}}_2$ of degree 2 by looping over some Eisenstein polynomials with small coefficients and checking whether a new polynomial has a root in one of the already known rings.

```magma
> Zx<x> := PolynomialRing(Integers());
> RamExt := [];
> for c0 in [2, -2, 6, -6] do
> for c1 in [0, 2, -2, 4, -4, 6, -6] do
>     g := x^2 + c1*x + c0;
>     new := true;
>     for L in RamExt do
>         if HasRoot(PolynomialRing(L)!g) then
>             new := false;
>             break L;
>         end if;
>     end for;
>     if new then
>         print "new field with polynomial", g;
>         Append(~RamExt, ext<pAdicRing(2, 20) | g>);
>     end if;
> end for;
> end for;
new field with polynomial x^2 + 2
new field with polynomial x^2 + 2*x + 2
new field with polynomial x^2 + 4*x + 2
new field with polynomial x^2 + 2*x - 2
new field with polynomial x^2 + 4*x - 2
new field with polynomial x^2 + 6
```

These are all such extensions, since the extensions of ${\mathbb{Q}}_2$ of degree 2 are in bijection to the 7 non-trivial classes of ${\mathbb{Q}}_2^* / ({\mathbb{Q}}_2^*)^2$ and one of these classes yields the unramified extension.

#### Factorization

It is possible to factorize (to some precision) polynomials over a local ring or field. Approximate factorizations can also be lifted to a factorization to greater precision.

<a id="function-hensellift-rngupolelt-rngupolelt"></a>
##### `HenselLift(f, s): RngUPolElt, [RngUPolElt] -> [RngUPolElt]`

Given a sequence $s$ of polynomials with coefficients that can be coerced into the coefficient ring of $f$ such that $f \equiv \prod_{i=1}^{\#s} s[i]$ modulo $\pi$, $s[i]$ and $[j]$ are co–prime modulo $\pi$ for all $i$ and $j$, and $s[i]$ is monic for all $i$, find a more accurate factorization $t[1], t[2], \dots t[\#s]$ such that $f \equiv \prod_{i=1}^{\#s} t[i]$ modulo $\pi^k$, where $k$ is the minimum precision of the coefficients of $f$.

<a id="example-ex-aacddc"></a>
##### `Example: Hensel Factorization of Polynomials (ex-aacddc)`

If the reduction of a polynomial over the residue class field is not a power of an irreducible polynomial, the factorization into powers of different irreducibles can be lifted to a factorization over the local ring.

```magma
> Z2 := pAdicRing(2, 25);
> R<x> := PolynomialRing(Z2);
> f := &* [ x - i : i in [1..8] ];
> F2 := ResidueClassField(Z2);
> Factorization( PolynomialRing(F2)!f );
[
    <$.1, 4>,
    <$.1 + 1, 4>
]
> h1 := x^4;
> h2 := (x+1)^4;
> h := HenselLift(f, [h1, h2]);
> h[1], h[2], f - h[1]*h[2];
x^4 - 20*x^3 + 140*x^2 - 400*x + 384
x^4 - 16*x^3 + 86*x^2 - 176*x + 105
0
```

<a id="function-isirreducible-rngupolelt"></a>
##### `IsIrreducible(f): RngUPolElt -> BoolElt`

Given a polynomial $f$ with coefficients lying in a local ring or field $L$, return `true` if and only if $f$ is irreducible over $L$. Currently, this only works over $p$-adic rings, unramified extensions of $p$-adic rings, totally ramified extensions of $p$-adic rings, and totally ramified extension of unramified extensions of $p$-adic rings.

<a id="function-squarefreefactorization-rngupolelt"></a>
##### `SquareFreeFactorization(f): RngUPolElt -> [ < RngUPolElt, RngIntElt > ]`

Return a sequence of tuples of polynomials and multiplicities where the polynomials are not divisible by any square of a polynomial. The product of the polynomials to the corresponding multiplicities is the polynomial $f$ (to some precision). Currently, this only works over $p$-adic rings, unramified extensions of $p$-adic rings, totally ramified extensions of $p$-adic rings, and totally ramified extension of unramified extensions of $p$-adic rings.

<a id="function-factorization-rngupolelt"></a>
##### `Factorization(f): RngUPolElt -> [ < RngUPolElt, RngIntElt > ]`

<a id="function-localfactorization-rngupolelt"></a>
##### `LocalFactorization(f): RngUPolElt -> [ < RngUPolElt, RngIntElt >]`

```magma
Certificates: BoolElt                    Default: false
IsSquarefree: BoolElt                    Default: false
Ideals      : BoolElt                    Default: false
Extensions  : BoolElt                    Default: false
```

Return the factorization of the polynomial $f$ over a local ring or field into irreducible factors as a sequence of pairs, the first entry giving the irreducible factor and the second its multiplicity.

Precision is important since for polynomials over rings of relatively small precision a correct factorization may not be possible and an error will result. A lower bound on the precision needed for the factorization to succeed is given by `SuggestedPrecision`; this precision may still be insufficient, however.

The precision the factorization is returned to is reduced for multiple factors.

The optional parameter `IsSquarefree` can be set to `true`, if the polynomial is known to be square-free. The `Certificates` parameter can be set to `true` to compute certificates for the irreducibility of the individual factors returned. This information can be used to compute the $p$-maximal order of the equation order defined by the factor. If the `Extensions` parameter is set to `true` then certificates will be returned which will include an extension given by each factor.

<a id="function-suggestedprecision-rngupolelt"></a>
##### `SuggestedPrecision(f): RngUPolElt -> RngIntElt`

For a polynomial $f$ over a local ring or field, return a precision at which the factorization of $f$ as given by `Factorization(f)` will be Hensel liftable to the correct factorization.

The precision returned is not guaranteed to be enough to obtain a factorization of the polynomial. It may be that a correct factorization cannot be found at that precision but may be possible with a little more precision.

Currently, this only works over $p$-adic rings, unramified extensions of $p$-adic rings, totally ramified extensions of $p$-adic rings, and totally ramified extension of unramified extensions of $p$-adic rings.

<a id="function-isisomorphic-rngupolelt-rngupolelt"></a>
##### `IsIsomorphic(f, g): RngUPolElt, RngUPolElt -> BoolElt`

Given two irreducible polynomials over the same $p$-adic field, test if the extensions defined by them are isomorphic.

<a id="function-distance-rngupolelt-rngupolelt"></a>
##### `Distance(f, g): RngUPolElt, RngUPolElt -> RngIntElt`

Given two Eisenstein polynomials of the same degree and discriminant compute their distance, i.e. the minimal weighted valuation of the difference of the coefficients.

<a id="example-ex-f1ae2a"></a>
##### `Example: Suggested Precision for Factorization (ex-f1ae2a)`

The use of `SuggestedPrecision` along with `Factorization` is illustrated below for a few different cases.

```magma
> L<b> := ext<ext<pAdicRing(5, 20) | 2> |  y^2 + 5*y + 5>;
> R<x> := PolynomialRing(L);
> f := (x - 1)^3*(x - b)^2*(x - b^2 + b - 1);
> SuggestedPrecision(f);
80
> Factorization(f);
[
    <x - b + O(b^40), 2>,
    <x - 1 + O(b^40), 3>,
    <x + 6*b + 4 + O(b^40), 1>
]
1 + O(b^40)
> f := (x + 2)^3*(x + b)*(x + 3)^4;
> f;
x^8 + (b + 18 + O(b^40))*x^7 + (18*b + 138 + O(b^40))*x^6 + (138*b + 584 +
    O(b^40))*x^5 + (584*b + 1473 + O(b^40))*x^4 + (1473*b + 2214 + O(b^40))*x^3
    + (2214*b + 1836 + O(b^40))*x^2 + (1836*b + 648 + O(b^40))*x + 648*b +
    O(b^40)
> SuggestedPrecision(f);
80
> Precision(L);
80
> P<y> := PolynomialRing(Integers());
> R<b> := ext<ext<pAdicRing(3, 20) | 2> |  y^2 + 3*y + 3>;
> P<x> := PolynomialRing(R);
> f := x^12 + 100*x^11 + 4050*x^10 + 83700*x^9 + 888975*x^8 + 3645000*x^7 -
> 10570500*x^6 - 107163000*x^5 + 100875375*x^4 + 1131772500*x^3 -
> 329614375*x^2 + 1328602500*x + 332150625;
> SuggestedPrecision(f);
48
> Factorization(f);
[
    <x + 153560934 + O(b^40), 1>,
    <x - 1595360367 + O(b^40), 1>,
    <x + 1273329451*$.1 - 1037496066 + O(b^40), 1>,
    <x + -1273329451*$.1 - 97370567 + O(b^40), 1>,
    <x^4 + (-1598252738*$.1 - 309919655 + O(b^40))*x^3 + (-280421715*$.1 -
        102998055 + O(b^40))*x^2 + (1263867503*$.1 + 923047935 + O(b^40))*x +
        -1252549104*$.1 - 786365260 + O(b^40), 1>,
    <x^4 + (1598252738*$.1 - 600198580 + O(b^40))*x^3 + (280421715*$.1 +
        457845375 + O(b^40))*x^2 + (-1263867503*$.1 - 1604687071 + O(b^40))*x +
        1252549104*$.1 + 1718732948 + O(b^40), 1>
]
1 + O(b^40)
> R<b> := ext<ext<pAdicRing(3, 25) | 2> |  y^2 + 3*y + 3>;
> P<x> := PolynomialRing(R);
> f := x^12 + 100*x^11 + 4050*x^10 + 83700*x^9 + 888975*x^8 + 3645000*x^7 -
> 10570500*x^6 - 107163000*x^5 + 100875375*x^4 + 1131772500*x^3 -
> 329614375*x^2 + 1328602500*x + 332150625;
> Factorization(f);
[
    <x + 143905694229 + O(b^50), 1>,
    <x - 399882754935 + O(b^50), 1>,
    <x + 46601526664*$.1 + 229090274400 + O(b^50), 1>,
    <x + -46601526664*$.1 + 135887221072 + O(b^50), 1>,
    <x^4 + (242476655332*$.1 + 187976437999 + O(b^50))*x^3 + (372805509192*$.1 -
        38457626466 + O(b^50))*x^2 + (126788105939*$.1 + 60198382752 +
        O(b^50))*x + 347425890996*$.1 + 215394267602 + O(b^50), 1>,
    <x^4 + (-242476655332*$.1 - 296976872665 + O(b^50))*x^3 + (-372805509192*$.1
        + 63219964593 + O(b^50))*x^2 + (-126788105939*$.1 - 193377829126 +
        O(b^50))*x + -347425890996*$.1 + 367831095053 + O(b^50), 1>
]
1 + O(b^50)
```

Note that the polynomial itself must have coefficients with precision at least that given by `SuggestedPrecision` (and not just the coefficient ring) for `Factorization` to succeed. Sometimes this will not be possible if the coefficients of the polynomial are not known to sufficient precision.

<a id="example-ex-836762"></a>
##### `Example: Local Factorizations and Galois Groups (ex-836762)`

In this example we demonstrate how factorizations of a rational polynomial over some local rings can give information on the Galois group.

```magma
> Zx<x> := PolynomialRing(Integers());
> g := x^5 - x + 1;
> Factorization(Discriminant(g));
[ <19, 1>, <151, 1> ]
> g2 := Factorization( PolynomialRing(pAdicRing(2, 10)) ! g );
> g2;
[
    <$.1^2 + 367*$.1 - 93, 1>,
    <$.1^3 - 367*$.1^2 - 386*$.1 + 11, 1>
]
> g3 := Factorization( PolynomialRing(pAdicRing(3, 10)) ! g );
> g3;
[
    <$.1^5 - $.1 + 1, 1>
]
> g7 := Factorization( PolynomialRing(pAdicRing(7, 10)) ! g );
> g7;
[
    <$.1^2 + 138071312*$.1 + 2963768, 1>,
    <$.1^3 - 138071312*$.1^2 + 132202817*$.1 - 84067650, 1>
]
```

This shows that the Galois group of $g$ contains elements of orders 2, 3, 5, and 6, and therefore is isomorphic to $S_5$.

<a id="function-splittingfield-rngupolelt-fldpad"></a>
##### `SplittingField(f): RngUPolElt[FldPad] -> FldPad, SeqEnum`

<a id="function-splittingfield-rngupolelt-rngpad"></a>
##### `SplittingField(f): RngUPolElt[RngPad] -> FldPad, SeqEnum`

```magma
Std: BoolElt                    Default: true
```

Splitting field $F$ of a squarefree polynomial $f$ over a $p$-adic ring or field $K$, and the roots of $f$ in $F$. The optional parameter `Std` (true by default) specifies whether $F/K$ should be converted to a standard form — at most one ramified extension over one unramified extension of $K$.

<a id="example-ex-f42dd9"></a>
##### `Example: Splitting Field over a p-adic Field (ex-f42dd9)`

```magma
> K:=pAdicField(3,20);
> R<x>:=PolynomialRing(K);
> F:=SplittingField(x^9-3);
> Degree(F,K), RamificationDegree(F,K), InertiaDegree(F,K);
54 54 1
```

### Automorphisms of Local Rings and Fields

The automorphisms of a local ring or field are determined by their images on the generators of the ring. All computations necessary to determine the automorphism group can be performed in the local ring.

<a id="function-automorphisms-rngpad"></a>
#### `Automorphisms(L): RngPad -> [Map]`

<a id="function-automorphisms-fldpad"></a>
#### `Automorphisms(L): FldPad -> [Map]`

Given a local ring or field $L$, returns the automorphisms of $L$ over its $p$-adic sub-field ${\mathbb{Q}}_p$ as a sequence of maps of $L$ into $L$.

<a id="function-automorphisms-fldpad-fldpad"></a>
#### `Automorphisms(K, k): FldPad, FldPad -> [Map]`

<a id="function-automorphisms-rngpad-rngpad"></a>
#### `Automorphisms(K, k): RngPad, RngPad -> [Map]`

Given a local ring or field $K$ over $k$, returns the $k$-automorphisms of $K$ as a sequence of maps of $K$ into $K$.

<a id="function-automorphismgroup-rngpad"></a>
#### `AutomorphismGroup(L): RngPad -> GrpPerm, Map`

<a id="function-automorphismgroup-fldpad"></a>
#### `AutomorphismGroup(L): FldPad -> GrpPerm, Map`

Return the automorphism group acting on $L$ over its $p$-adic sub-field ${\mathbb{Q}}_p$ as a permutation group (representing the regular action). Also return the map from the permutation group to the group of automorphisms represented explicitly (i.e. like returned from the function above).

<a id="function-automorphismgroup-rngpad-rngpad"></a>
#### `AutomorphismGroup(K, k): RngPad, RngPad -> GrpPerm, Map`

<a id="function-automorphismgroup-fldpad-fldpad"></a>
#### `AutomorphismGroup(K, k): FldPad, FldPad -> GrpPerm, Map`

Return the automorphism group acting on $K$ over its $p$-adic $k$ as a permutation group (representing the regular action). Also return the map from the permutation group to the group of automorphisms represented explicitly (i.e. like returned from the function above).

<a id="function-isnormal-rngpad"></a>
#### `IsNormal(K): RngPad -> BoolElt`

<a id="function-isnormal-fldpad"></a>
#### `IsNormal(K): FldPad -> BoolElt`

Given a $p$-adic ring or field $K$, test if $K$ is normal over it’s prime field ${\mathbb{Q}}_p$, ie. if $K$ admits exactly $n$ automorphisms where $n$ is the degree of $K$.

<a id="function-isnormal-rngpad-rngpad"></a>
#### `IsNormal(K, k): RngPad, RngPad -> BoolElt`

<a id="function-isnormal-fldpad-fldpad"></a>
#### `IsNormal(K, k): FldPad, FldPad -> BoolElt`

Given a $p$-adic ring or field $K$, test if $K$ is normal over the subfield $k$.

<a id="function-isabelian-fldpad-fldpad"></a>
#### `IsAbelian(K, k): FldPad, FldPad -> BoolElt`

Given $p$-adic fields $K/k$, test if the automorphism group of $K$ over $k$ is abelian.

<a id="function-continuations-map-rngpad"></a>
#### `Continuations(m, L): Map, RngPad -> [Map]`

For an automorphism $m$ of the $p$-adic ring $L$, compute all possible extensions of $m$ to $L$.

<a id="function-isisomorphic-rngpad-rngpad"></a>
#### `IsIsomorphic(E, K): RngPad, RngPad -> BooElt`

<a id="function-isisomorphic-fldpad-fldpad"></a>
#### `IsIsomorphic(E, K): FldPad, FldPad -> BooElt`

For two $p$-adic rings or fields, test if they are isomorphic over ${\mathbb{Q}}_p$.

<a id="example-ex-b62260"></a>
#### `Example: Automorphisms of a Local Ring (ex-b62260)`

We define an extension of ${\mathbb{Z}}_2$ with ramification degree 2 and inertia degree 2 and compute automorphisms.

```magma
> I<a> := ext<pAdicRing(2, 10) | 2>;
> R<x> := PolynomialRing(I);
> L<b> := ext<I | x^2 + 2*a*x + 2*a^2>;
> L;
Totally ramified extension defined by the polynomial
x^2 + (2*a)*x + -2*a - 2 over Unramified extension
defined by the polynomial x^2 + x + 1 over 2-adic ring
mod 2^10
> A := Automorphisms(L);
> [<A[i](a), A[i](b)> : i in [1 .. #A]];
[ <a, b + O(b^18)>, <a, -b + -2*a + O(b^18)>, <-a - 1,
a*b + O(b^18)>, <-a - 1, -a*b + 2*a + 2 + O(b^18)> ]
> AutomorphismGroup(L);
Permutation group acting on a set of cardinality 4
    Id($)
    (1, 2)(3, 4)
    (1, 3)(2, 4)
Mapping from: GrpPerm: $, Degree 4 to Power Structure
of Map given by a rule
```

<a id="function-galoisgroup-rngupolelt-fldpad"></a>
#### `GaloisGroup(f): RngUPolElt[FldPad] -> GrpPerm, SeqEnum, UserProgram`

<a id="function-galoisgroup-rngupolelt-rngpad"></a>
#### `GaloisGroup(f): RngUPolElt[RngPad] -> GrpPerm, SeqEnum, UserProgram`

Computes the Galois group $G$ of a squarefree polynomial $f$ over a $p$-adic ring or field $K$. Returns $G$ as a permutation group on the roots of $f$ in its splitting field $F$, the roots themselves, and a map $G\to{\operatorname{Aut}}(F/K)$.

<a id="example-ex-286b99"></a>
#### `Example: Galois Group of a Local Polynomial (ex-286b99)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> G,r,act:=GaloisGroup(x^4-2);
> G;                                     // permutation group on roots in r
Permutation group G acting on a set of cardinality 4
(1, 4, 2, 3)
(1, 2)
> GroupName(G);
D4
> F<pi>:=Universe(r); F;                          // splitting field F of f
Totally ramified extension defined by the polynomial x^8 + 8*x^7 + 24*x^6 +
   32*x^5 + 18*x^4 + 8*x^3 + 12*x^2 + 8*x + 2
 over 2-adic field mod 2^20
> sigma:=act(G.1);                                // an automorphism of F/K
> sigma;
Mapping from: FldPad: F to FldPad: F given by a rule [no inverse]
> sigma(F.1);
(43690*pi^7 - 5*pi^6 + 43677*pi^5 - 15*pi^4 + 43687*pi^3 + 43684*pi - 3)*pi +
   O(pi^136)
```

### Completions

Local rings can be obtained by completing an order at a prime ideal (see Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main) and [`Completion`](https://docs.magma-maths.org/GlobalFields/NumberFieldsAndOrders/operation.md#function-rngord-completion1)).

<a id="function-completion-rngord-rngordidl"></a>
#### `Completion(O, P): RngOrd, RngOrdIdl -> RngPad, Map`

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

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

The completion (as an unbounded precision local ring or field with default precision given by `Precision`) of the order or number field at the prime ideal $P$, and the embedding of the order or number field into the resulting local ring.

<a id="function-localring-rngordidl-rngintelt"></a>
#### `LocalRing(P, k): RngOrdIdl, RngIntElt -> RngPad, Map`

The completion (as a local ring) of the order of the prime ideal $P$ at $P$ with default precision $k$ and the embedding of the order into the resulting local ring.

<a id="example-ex-2bb9ae"></a>
#### `Example: Completion of a Number Field (ex-2bb9ae)`

Here we demonstrate the use of `Completion`.

```magma
> K := NumberField(x^6 - 5*x^5 + 31*x^4 - 85*x^3 + 207*x^2 - 155*x + 123);
> lp := Decomposition(K, 7);
> C, mC := Completion(K, lp[2][1]);
> C;
Totally ramified extension defined by a map over Unramified extension defined by
a map over 7-adic field
> mC;
Mapping from: FldNum: K to FldPad: C given by a rule
> mC(K.1);
(46564489*$.1 - 47959419)*C.1 - 116434149*$.1 - 61099304 + O(C.1^20)
> delta := (K.1 @ mC @@ mC) - K.1;
> delta;
8337821493402521350488*K.1^5 - 69073506960056896464432*K.1^4 +
    189847416443444330877726*K.1^3 - 453361530291976951337876*K.1^2 +
    336979647814116799276099*K.1 - 267520869714197002579071
> // Check the accuracy of the mappings using the valuation of the difference
> Valuation(delta, lp[2][1]);
18
> C`DefaultPrecision := 30;
> mC(K.1);
(1090965976127*$.1 - 1208477074641)*C.1 - 589359803563*$.1 + 288063654676 +
O(C.1^30)
> delta := (K.1 @ mC @@ mC) - K.1;
> delta;
-61980024244160371672868773433490783*K.1^5 +
    1189796803064803092593291088768968754*K.1^4 -
    3202353946933190588864309180653868957*K.1^3 +
    7537386928046164580731145031872017049*K.1^2 -
    5511297002936682579964210586013308810*K.1 +
    4438099444806431313582533435941098722
> Valuation(delta, lp[2][1]);
28
> C`DefaultPrecision := 10;
> mC(K.1);
(-7708*$.1 + 7759)*C.1 + 4747*$.1 - 5859 + O(C.1^10)
> delta := (K.1 @ mC @@ mC) - K.1;
> delta;
1908210240*K.1^5 - 7326424608*K.1^4 + 16701662320*K.1^3 - 35965440540*K.1^2 +
    41324075079*K.1 - 30476856505
> Valuation(delta, lp[2][1]);
8
```

<a id="class-fields"></a>
<a id="rngloc-fldab"></a>
### Class Field Theory

The class field theory of local fields classifies abelian extensions of local field in a way similar to the way global class field theory deals with extensions of number fields and global function fields.

While the origins of local class field theory are, via completions and localisations, in the global case, today it is a theory in its own. Although local class field theory can be used to obtain global results, it has very powerful generalisations that the global case (currently) does not allow.

Local class fields are classified in terms of the norm group, ie. the multiplicative group of norms of elements, rather than some ideal or divisor class group as in the global case. Since the multiplicative group of a local field is far better understood than the ideal group of a global field, the theory is much more explicit and easier in the local case.

#### Unit Group

In contrast to the case of global fields, the multiplicative group of both $p$-adic rings and fields has a well understood structure which can be computed by algorithms developed and implemented by S. Pauli [[Pau06](https://docs.magma-maths.org/references.md#cite-pauli-lcf)]. It should be noted that all the unit group related functions operate on fixed-precision rings only.

<a id="function-principalunitgroupgenerators-rngpad"></a>
##### `PrincipalUnitGroupGenerators(R): RngPad -> SeqEnum`

<a id="function-principalunitgroupgenerators-fldpad"></a>
##### `PrincipalUnitGroupGenerators(R): FldPad -> SeqEnum`

The principal units of a $p$-adic ring or field $R$ are elements of the form $1+\pi {\mathbb{Z}}_R$ where $\pi$ is a uniformizing element of $R$ and ${\mathbb{Z}}_R$ is the ring of integers. This function returns a sequence of generators for this group.

<a id="function-principalunitgroup-rngpad"></a>
##### `PrincipalUnitGroup(R): RngPad -> GrpAb, Map`

<a id="function-principalunitgroup-rngpadresext"></a>
##### `PrincipalUnitGroup(R): RngPadResExt -> GrpAb, Map`

<a id="function-principalunitgroup-rngpadres"></a>
##### `PrincipalUnitGroup(R): RngPadRes -> GrpAb, Map`

The principal units of a $p$-adic ring or field $R$ are elements of the form $1+\pi {\mathbb{Z}}_R$ where $\pi$ is a uniformizing element of $R$ and ${\mathbb{Z}}_R$ is the ring of integers. This function returns an abstract abelian group isomorphic to the group of principal units and an explicit isomorphism, ie. a map between the abstract group and the $p$-adic ring or field.

<a id="function-unitgroup-rngpad"></a>
##### `UnitGroup(R): RngPad -> GrpAb, Map`

Given a $p$-adic ring $R$ of fixed precision, this function computes an abstract abelian group isomorphic to the unit group as well as an explicit map between the abstract group and $R$.

<a id="function-unitgroup-fldpad"></a>
##### `UnitGroup(F): FldPad -> GrpAb, Map`

Given a $p$-adic field $F$ of fixed precision, this function computes an abstract abelian group isomorphic to the multiplicative group of $F$ as well as an explicit map between the abstract group and $F$.

<a id="function-unitgroupgenerators-rngpad"></a>
##### `UnitGroupGenerators(R): RngPad -> SeqEnum`

<a id="function-unitgroupgenerators-rngpadres"></a>
##### `UnitGroupGenerators(R): RngPadRes -> SeqEnum`

Given a $p$-adic ring with fixed precision, this function computes generators for its unit group.

<a id="function-unitgroupgenerators-fldpad"></a>
##### `UnitGroupGenerators(F): FldPad -> SeqEnum`

Given a $p$-adic field with fixed precision, this function computes generators for its multiplicative group.

<a id="function-pselmergroup-rngintelt-fldpad"></a>
##### `pSelmerGroup(p, F): RngIntElt, FldPad -> GrpAb, Map`

Given a $l$-adic field $F$, return the $p$-Selmer group, i.e., the group $F^*/F^{*p}$, as an abstract group, as well as the map from $F^*$ to the abstract group.

#### Norm Group

Given two $p$-adic field $F/k$ the norm group of $F$ in $k$, ie. the image of the norm map from $F$ to $k$ is the central object of local class field theory. Since the norm map will always operate on some multiplicative group, all functions in this section will take the map returned by `UnitGroup` as an argument as this then allows the convenient way of describing the norm group as a subgroup of some explicit finitely generated abelian group.

<a id="function-normgroup-fldpad-map"></a>
##### `NormGroup(R, m): FldPad, Map -> GrpAb, Map`

<a id="function-normgroup-rngpad-map"></a>
##### `NormGroup(R, m): RngPad, Map -> GrpAb, Map`

Given a $p$-adic ring or field $R$ extending $S$ and a description of the unit group of $S$ encoded by a map $m$ from some abstract abelian group to $S$ as computed by `UnitGroup`, compute the image of the norm map as a subgroup. The map returned is the embedding map returned form the subgroup constructor.

<a id="function-normequation-fldpad-map-rngelt"></a>
##### `NormEquation(R, m, b): FldPad, Map, RngElt -> BoolElt, RngElt`

<a id="function-normequation-rngpad-map-rngelt"></a>
##### `NormEquation(R, m, b): RngPad, Map, RngElt -> BoolElt, RngElt`

Given a $p$-adic ring $R$ defined over $S$, the unit group of $S$ encoded by the map $m$ as computed by `UnitGroup(S)` and some element $b\in S$, try to compute an element $a\in R$ such that the norm of $a$ equals $b$. In case such an element exists, it is returned as a second value.

<a id="function-normequation-map-map-grpab"></a>
##### `NormEquation(m1, m2, G): Map, Map, GrpAb -> GrpAb, Map`

Given two $p$-adic rings $R$ and $S$ and their unit groups $U_R$ and $U_S$ as parameterized by the maps $m_1: U_R \to R$ and $U_S\to S$ as well as a subgroup $G<U_S$, compute the preimage of $G$ under the norm map operating on the unit groups.

<a id="function-norm-map-map-grpab"></a>
##### `Norm(m1, m2, G): Map, Map, GrpAb -> GrpAb`

Given two $p$-adic rings $R$ and $S$ and their unit groups $U_R$ and $U_S$ as parameterized by the maps $m_1: U_R \to R$ and $U_S\to S$ as well as a subgroup $G<U_R$, compute the image of $G$ under the norm map operating on the unit groups.

<a id="function-normkernel-map-map"></a>
##### `NormKernel(m1, m2): Map, Map -> GrpAb`

Given two $p$-adic rings $R$ and $S$ and their unit groups $U_R$ and $U_S$ as parameterized by the maps $m_1: U_R \to R$ and $U_S\to S$ compute the kernel of the norm map from $U_R$ to $U_S$ as a subgroup of $U_R$.

<a id="id2"></a>
#### Class Fields

Class fields, that is abelian extensions are parameterized by their norm groups. Pauli, in [[Pau06](https://docs.magma-maths.org/references.md#cite-pauli-lcf)] gave explicit algorithms to solve the reverse problem of class field theory: given a suitable subgroup of some (abstractly given) multiplicatively group of some $p$-adic field, compute explicit defining equations for the class field.

<a id="function-classfield-map-grpab"></a>
##### `ClassField(m, G): Map, GrpAb -> FldAb`

Given a $p$-adic field $S$ and its multiplicative group $U_S$ specified by the map $m: U_S \to S$ and a suitable subgroup $G<U_S$, this function computes for each cyclic factor of $U_S/G$ an explicit defining equation for the class field corresponding to this factor.

<a id="function-normgroupdiscriminant-map-grpab"></a>
##### `NormGroupDiscriminant(m, G): Map, GrpAb -> RngIntElt`

Given a $p$-adic field $S$ and its multiplicative group $U_S$ specified by the map $m: U_S \to S$ and a suitable subgroup $G<U_S$, this function computes the valuation of the discriminant of the extension parameterized by $G$ without computing explicit equations for it.

### Extensions

It is a well known classical theorem that $p$-adic fields admit only finitely many different extensions of bounded degree (in contrast to number fields which have an infinite number of extensions of any degree). In his thesis, Pauli [[Pau01a](https://docs.magma-maths.org/references.md#cite-pauli-diss)] developed explicit methods to enumerate those extensions.

<a id="function-allextensions-rngpad-rngintelt"></a>
#### `AllExtensions(R, n): RngPad, RngIntElt -> [RngPad]`

<a id="function-allextensions-fldpad-rngintelt"></a>
#### `AllExtensions(R, n): FldPad, RngIntElt -> [RngPad]`

```magma
E     : RngIntElt                    Default: 0
F     : RngIntElt                    Default: 0
Galois: BoolElt                      Default: false
vD    : RngIntElt                    Default: -1
j     : RngIntElt                    Default: -1
```

Given a $p$-adic ring or field $R$ and some positive integer $n$, compute all the extensions of $R$ of degree $n$. At least one extension is given in every isomorphism class. The optional parameters can be used to impose restrictions on the fields returned. Note that $j$ and $vD$ must be unspecified (as $-1$) when $F\neq 1$ or when $E$ and $F$ are both not given.

The optional parameters can be used to limit the extensions in various ways:

**`E`**
specifies the ramification index. $0$ implies no restriction.

**`F`**
specifies the inertia degree, $0$ implies no restriction.

**`vD`**
specifies the valuation of the discriminant, $-1$ implies no restriction.

**`j`**
specifies the valuation of the discriminant via the formula $vD := n+j-1$.

**`Galois`**
when set to `true`, limits the extensions to only list normal extensions.

<a id="function-numberofextensions-rngpad-rngintelt"></a>
#### `NumberOfExtensions(R, n): RngPad, RngIntElt -> RngIntElt`

```magma
E     : RngIntElt                    Default: 0
F     : RngIntElt                    Default: 0
Galois: BoolElt                      Default: false
vD    : RngIntElt                    Default: -1
j     : RngIntElt                    Default: -1
```

Given a $p$-adic ring or field $R$ and some positive integer $n$, compute the number of extensions of $R$ of degree $n$. Similarly to the above function, the optional parameters can be used to impose restrictions on the fields returned. Note that $j$ and $vD$ must be unspecified (as $-1$) when $F\neq 1$ or when $E$ and $F$ are both not given.

Note that the count will not be the same as `AllExtensions`, as the latter need only be up to isomorphism.

<a id="function-oreconditions-rngpad-rngintelt-rngintelt"></a>
#### `OreConditions(R, n, j): RngPad, RngIntElt, RngIntElt -> BoolElt`

<a id="function-oreconditions-fldpad-rngintelt-rngintelt"></a>
#### `OreConditions(R, n, j): FldPad, RngIntElt, RngIntElt -> BoolElt`

Given a $p$-adic ring or field $R$ and positive integers $n$ and $j$, test if there exist totally ramified extensions of $R$ of degree $n$ with discriminant valuation $n+j-1$.

<a id="example-ex-ea2536"></a>
#### `Example: All Extensions of Degree 9 over Q3 (ex-ea2536)`

We follow Examples 9.1 and 9.2 from [[PR01](https://docs.magma-maths.org/references.md#cite-pauli-roblot)].

There are 54 (totally ramified) extensions of degree 9 and discriminant $3^{9+4-1}$ over ${{\mathbb{Q}}}_3$. There are six generating polynomials, each defining nine isomorphism classes. The possible (nontrivial) subfields of these have degree 3 and $j_0=1$, of which there are two defining polynomials each with three isomorphism classes. Each of these degree 3 fields then admits two extensions with $j_1=1$, which give six isomorphism classes. This gives a total of 27 degree 9 extensions that have a subfield of degree 3.

```magma
> R := pAdicRing(3,20);
> _<x> := PolynomialRing(R); // for printing
> NumberOfExtensions(R,9 : F:=1,j:=4);
54
> A9 := AllExtensions(R,9 : F:=1,j:=4);
> [DefiningPolynomial(a) : a in A9];
[ x^9 + 3*x^4 + 3, x^9 + 6*x^4 + 3,
  x^9 + 3*x^4 + 3*x^3 + 3, x^9 + 6*x^4 + 3*x^3 + 3,
  x^9 + 3*x^4 + 6*x^3 + 3, x^9 + 6*x^4 + 6*x^3 + 3 ]
> A3 := AllExtensions(R,3 : F:=1,j:=1);
> NumberOfExtensions(A3[1],3 : F:=1,j:=1);
6
> [DefiningPolynomial(a) : a in A3];
[ x^3 + 3*x + 3, x^3 + 6*x + 3 ]
> _<pi> := A3[1];
> _<y> := PolynomialRing(A3[1]);
> B3 := AllExtensions(A3[1],3 : F:=1,j:=1);
> [DefiningPolynomial(f) : f in B3];
[ y^3 + pi*y + pi, y^3 + 2*pi*y + pi ]
```

The other example concerns degree 10 extensions of ${{\mathbb{Q}}}_5$. Here there are 1818 total extensions, of which 1 is unramified and 2 have ramification degree 2, while 605 have ramification degree 5 and 1210 are totally ramified. With ramification degree 5, there are 145 defining polynomials over the unramified quadratic field, split into five $j$-groupings. As noted in [[PR01](https://docs.magma-maths.org/references.md#cite-pauli-roblot)], there is a further splitting in the $j=4$ grouping. Similarly, there are 145 defining polynomials over either of the two tamely ramified extensions of degree 2 over ${{\mathbb{Q}}}_5$. The resulting fields are in fact isomorphic in pairs, but the `AllExtensions` function still lists both fields in each pair. So it returns 438 fields (1+2+145+290) rather than the stated 293 isomorphism classes (1+2+145+145).

```magma
> R := pAdicRing(5,20);
> NumberOfExtensions(R,10);
1818
> [NumberOfExtensions(R,10 : E:=e) : e in Divisors(10)];
[ 1, 2, 605, 1210 ]
> U := UnramifiedExtension(R,2);
> [#AllExtensions(U,5 : E:=5,j:=j0) : j0 in [1..5]];
[ 24, 24, 24, 48, 25 ]
> // compare the above/below to (#K)/N in Pauli-Roblot
> [#AllExtensions(R,10 : E:=10,j:=j0): j0 in [1..10]];
[ 8, 8, 8, 16, 0, 40, 40, 80, 40, 50 ] // twice P-R
```

<a id="xpadic"></a>
### Exact $p$-Adic Rings

#### Introduction

The exact $p$-adic rings and fields use representations which contain a kind and a list of dependencies. These rings and their elements can then be approximated to as much precision as the objects they depend on allow, some to arbitrary precision depending on their construction. Approximations are calculated to some epoch $n$ which is equivalent to precision $2^n$. Such representations are often referred to as “lazy” as the work of computing to precision is delayed until it is necessary. The exact $p$-adic rings and fields use the inexact $p$-adic rings and fields described in the majority of this chapter for approximations.

For example, an element of an exact $p$-adic ring resulting from the addition of 2 elements will store that it is the sum of these two elements and approximations to this sum are computed by adding the corresponding approximations of the summands, when such approximations are required.

An advantage of this lazy representation is that a precision does not have be decided before computations are started. A disadvantage of this exact representation occurs when approximations are required to incredibly high precision, some precisions which may be considerably time and space expensive.

Exact $p$-adic rings have type `RngXPad`, exact $p$-adic fields `FldXPad`, their elements `RngXPadElt` and `FldXPadElt` respectively. There is also a dedicated polynomial ring type `RngUPolXPad` whose elements have type `RngUPolXPadElt`.

For further information see [[Dor21](https://docs.magma-maths.org/references.md#cite-doris-2021)].

<a id="function-isexactpadic-any"></a>
##### `IsExactpAdic(x): Any -> BoolElt`

Returns `true` if $x$ is an exact $p$-adic object, such as a ring, field, element, or polynomial.

#### Exact $p$-adic Rings and Fields

In this section we describe the construction and functionality of the exact $p$-adic rings and fields.

##### Construction of Exact $p$-adic Rings and Fields

<a id="function-padicfield-rngintelt-2"></a>
###### `pAdicField(p : parameters): RngIntElt -> FldXPad`

```magma
Exact : BoolElt                    Default: false
Global: BoolElt                    Default: true
```

Returns ${\mathbb{Q}}_p$ as an exact $p$-adic field if `Exact` is set to `true` otherwise returns an inexact $p$-adic field. If `Global` is set to `false` then a new object is constructed rather than reusing an existing object.

<a id="function-padicring-rngintelt-2"></a>
###### `pAdicRing(p : parameters): RngIntElt -> FldXPad`

```magma
Exact : BoolElt                    Default: false
Global: BoolElt                    Default: true
```

Returns ${\mathbb{Z}}_p$ as an exact $p$-adic integer ring if `Exact` is set to `true` otherwise returns an inexact $p$-adic field. If `Global` is set to `false` then a new object is constructed rather than reusing an identical existing object.

<a id="constructor-constructor-ext-fldxpad-rngupolelt-rngxpad"></a>
###### `ext<K | f>: FldXPad, RngUPolElt -> RngXPad`

<a id="constructor-constructor-ext-fldxpad-rngupolxpadelt-rngxpad"></a>
###### `ext<K | f>: FldXPad, RngUPolXPadElt -> RngXPad`

<a id="constructor-constructor-ext-fldxpad-rngxpadelt-rngxpad"></a>
###### `ext<K | f>: FldXPad, [RngXPadElt] -> RngXPad`

<a id="constructor-constructor-ext-fldxpad-rngintelt-rngxpad"></a>
###### `ext<K | d>: FldXPad, RngIntElt -> RngXPad`

<a id="constructor-constructor-ext-rngxpad-rngupolelt-rngxpad"></a>
###### `ext<K | f>: RngXPad, RngUPolElt -> RngXPad`

<a id="constructor-constructor-ext-rngxpad-rngupolxpadelt-rngxpad"></a>
###### `ext<K | f>: RngXPad, RngUPolXPadElt -> RngXPad`

<a id="constructor-constructor-ext-rngxpad-rngxpadelt-rngxpad"></a>
###### `ext<K | f>: RngXPad, [RngXPadElt] -> RngXPad`

<a id="constructor-constructor-ext-rngxpad-rngintelt-rngxpad"></a>
###### `ext<K | d>: RngXPad, RngIntElt -> RngXPad`

Construct the extension defined by the polynomial $f$, which must be inertial or Eisenstein, or an unramified extension of degree $d$.

<a id="example-ex-72b734"></a>
###### `Example: Constructing Exact p-adic Fields (ex-72b734)`

The construction of an exact $p$-adic field is shown as well as extensions, both unramified and ramified.

```magma
> Qp := pAdicField(11 : Exact);
> U := ext<Qp | 3>;
> U;
Unramified extension of degree 3 of 11-adic field (exact)
> R := ext<U | Polynomial([11, 11^2, 1])>;
> R;
Totally ramified extension of degree 2 of Unramified extension of degree 3 of
11-adic field (exact)
> ext<Qp | Polynomial([3, 5, 1])>;
Unramified extension of degree 2 of 11-adic field (exact)
> ext<Qp | Polynomial([11, 2*11^2, 1])>;
Totally ramified extension of degree 2 of 11-adic field (exact)
```

##### Related Structures

<a id="function-ringofintegers-fldxpad"></a>
###### `RingOfIntegers(L): FldXPad -> RngXPad`

<a id="function-ringofintegers-rngxpad"></a>
###### `RingOfIntegers(L): RngXPad -> RngXPad`

<a id="function-integerring-fldxpad"></a>
###### `IntegerRing(L): FldXPad -> RngXPad`

<a id="function-integers-fldxpad"></a>
###### `Integers(L): FldXPad -> RngXPad`

<a id="function-integerring-rngxpad"></a>
###### `IntegerRing(L): RngXPad -> RngXPad`

<a id="function-integers-rngxpad"></a>
###### `Integers(L): RngXPad -> RngXPad`

The ring of integers of the exact $p$-adic field $L$.

<a id="function-fieldoffractions-fldxpad"></a>
###### `FieldOfFractions(L): FldXPad -> FldXPad`

<a id="function-fieldoffractions-rngxpad"></a>
###### `FieldOfFractions(L): RngXPad -> FldXPad`

The field of fractions of the exact $p$-adic ring $L$.

<a id="function-basefield-fldxpad"></a>
###### `BaseField(F): FldXPad -> FldXPad`

<a id="function-coefficientfield-fldxpad"></a>
###### `CoefficientField(F): FldXPad -> FldXPad`

Returns the base field of the exact $p$-adic field $F$ when $F$ is an extension, or $F$ when $F$ is the prime field.

<a id="function-basering-rngxpad"></a>
###### `BaseRing(R): RngXPad -> RngXPad`

<a id="function-coefficientring-rngxpad"></a>
###### `CoefficientRing(R): RngXPad -> RngXPad`

Returns the base ring of the exact $p$-adic ring $R$ when $R$ is an extension, or $R$ when $R$ is the prime ring.

<a id="function-residueclassfield-fldxpad"></a>
###### `ResidueClassField(L): FldXPad -> FldFin, Map`

<a id="function-residueclassfield-rngxpad"></a>
###### `ResidueClassField(L): RngXPad -> FldFin, Map`

The residue class field $F$ of the exact $p$-adic ring or field $K$, as a finite field, and the map from $K$ to $F$.

<a id="function-padicquotientring-fldxpad-rngintelt"></a>
###### `pAdicQuotientRing(L, k): FldXPad, RngIntElt -> RngPadRes, Map`

<a id="function-padicquotientring-rngxpad-rngintelt"></a>
###### `pAdicQuotientRing(L, k): RngXPad, RngIntElt -> RngPadRes, Map`

<a id="constructor-constructor-quo-rngxpad-any-rngpadres-map"></a>
###### `quo<L | x>: RngXPad, Any -> RngPadRes, Map`

<a id="constructor-constructor-quo-fldxpad-any-rngpadres-map"></a>
###### `quo<L | x>: FldXPad, Any -> RngPadRes, Map`

The quotient of the exact $p$-adic ring or field $L$ by $L!x$, or by $\pi^k$ where $\pi$ is the uniformizing element of $L$.

<a id="function-infiniteprecisionapproximation-fldxpad"></a>
###### `InfinitePrecisionApproximation(K): FldXPad -> FldPad`

<a id="function-infiniteprecisionapproximation-rngxpad"></a>
###### `InfinitePrecisionApproximation(K): RngXPad -> RngPad`

The $p$-adic field of type `FldPad` or the $p$-adic ring of type `RngPad` with `Precision` `Infinity()` compatible with all finite–precision approximations of the exact $p$-adic field or ring $K$.

<a id="operation-op-eq-rngxpad-rngxpad"></a>
###### `R eq T: RngXPad, RngXPad -> BoolElt`

<a id="operation-op-eq-fldxpad-fldxpad"></a>
###### `R eq T: FldXPad, FldXPad -> BoolElt`

Return whether the exact $p$-adic rings or fields $R$ and $T$ are equal.

<a id="example-ex-34e873"></a>
###### `Example: Structures Related to Exact p-adic Rings (ex-34e873)`

```magma
> Qp := pAdicField(5 : Exact);
> Zp := Integers(Qp);
> FieldOfFractions(Zp) eq Qp;
true
> L := ext<ext<Zp | 5> | Polynomial([5, 5^3, 5^2, 1])>;
> L;
Totally ramified extension of degree 3 of Unramified extension of degree 5 of
5-adic ring (exact)
> BaseRing(L);
Unramified extension of degree 5 of 5-adic ring (exact)
> ResidueClassField(L);
Finite field of size 5^5
Mapping from: RngXPad: L to GF(5^5)
> InfinitePrecisionApproximation(L);
Totally ramified extension defined by a map over Unramified extension defined by
a map over 5-adic ring
> pAdicQuotientRing(L, 20);
Quotient of Totally ramified extension of Unramified extension of Quotient of
the 5-adic ring modulo the ideal generated by 5^7 modulo x^5 + 4*x + 3 modulo
x^3 + 25*x^2 + 125*x + 5 and $.1^20
Mapping from: RngXPad: L to ChangePrecision(TotallyRamifiedExtension(
UnramifiedExtension(pAdicQuotientRing(5, 7), Polynomial(pAdicQuotientRing(5, 7),
\\[3, 4, 0, 0, 0, 1])), Polynomial([UnramifiedExtension(pAdicQuotientRing(5, 7),
Polynomial(pAdicQuotientRing(5, 7), \\[3, 4, 0, 0, 0, 1])) | [5], [125], [25],
[1]])), 20)
```

##### Generating Elements

<a id="operation-operation-fldxpad-rngintelt-fldxpadelt"></a>
###### `R . i: FldXPad, RngIntElt -> FldXPadElt`

<a id="operation-operation-rngxpad-rngintelt-rngxpadelt"></a>
###### `R . i: RngXPad, RngIntElt -> RngXPadElt`

<a id="function-name-rngxpad-rngintelt"></a>
###### `Name(R, i): RngXPad, RngIntElt -> RngXPadElt`

<a id="function-name-fldxpad-rngintelt"></a>
###### `Name(R, i): FldXPad, RngIntElt -> FldXPadElt`

Given an exact $p$-adic ring or field $R$ and a positive integer $i$ return the $i$-th generator of $R$.

<a id="procedure-assignnames-rngxpad-seqenum-monstgelt-ref"></a>
###### `AssignNames(~R, S): RngXPad, SeqEnum[MonStgElt]`

<a id="procedure-assignnames-fldxpad-seqenum-monstgelt-ref"></a>
###### `AssignNames(~R, S): FldXPad, SeqEnum[MonStgElt]`

Given an exact $p$-adic ring or field $R$ assign the string in the sequence $S$ of length 1 to be the name used when printing elements of $R$. On construction of $R$, `R<x>` can be used to assign the string `"x"` as the name to be used when printing in which case the identifier `x` will be assigned the value of `R.1`.

<a id="function-generator-fldxpad"></a>
###### `Generator(R): FldXPad -> FldXPadElt`

<a id="function-generator-rngxpad"></a>
###### `Generator(R): RngXPad -> RngXPadElt`

Returns the generator of the exact $p$-adic ring or field $R$ over its base field. For extensions $R$, a root of its defining polynomial is returned, otherwise 1.

<a id="function-uniformizingelement-fldxpad"></a>
###### `UniformizingElement(R): FldXPad -> FldXPadElt`

<a id="function-uniformizingelement-rngxpad"></a>
###### `UniformizingElement(R): RngXPad -> RngXPadElt`

Returns an element of valuation 1 of the exact $p$-adic ring or field $R$.

<a id="function-residuegenerator-fldxpad"></a>
###### `ResidueGenerator(R): FldXPad -> FldXPadElt`

<a id="function-residuegenerator-rngxpad"></a>
###### `ResidueGenerator(R): RngXPad -> RngXPadElt`

Returns an element of valuation 0 whose residue class generates the residue class field of the exact $p$-adic ring or field $R$ over ${\mathbb{F}}_p$.

<a id="function-absolutegenerator-fldxpad"></a>
###### `AbsoluteGenerator(R): FldXPad -> FldXPadElt`

<a id="function-absolutegenerator-rngxpad"></a>
###### `AbsoluteGenerator(R): RngXPad -> RngXPadElt`

An element which generates the exact $p$-adic ring or field $R$ over its prime subfield. This will be either 1, a uniformizing element, a residue generator, or the sum of the two, depending on the inertia and ramification degrees.

<a id="example-ex-1abc7d"></a>
###### `Example: Generating Elements of Exact p-adic Rings (ex-1abc7d)`

```magma
> Zp := pAdicRing(7 : Exact);
> Zp.1;
1 + O(7^20)
> UniformizingElement(Zp);
7 + O(7^20)
> ResidueGenerator(Zp);
1 + O(7^20)
> L := ext<ext<Zp | Polynomial([7, 77, 7*17, 1])> | 4>;
> BL := BaseRing(L);
> L.1;
L.1 + O($.1^20)
> Generator(L);
L.1 + O($.1^20)
> UniformizingElement(L);
BL.1 + O(BL.1^20)
> ResidueGenerator(L);
L.1 + O($.1^20)
> AbsoluteGenerator(L);
L.1 + BL.1 + O(BL.1^20)
```

##### Invariants

<a id="function-prime-fldxpad"></a>
###### `Prime(L): FldXPad -> RngIntElt`

<a id="function-prime-rngxpad"></a>
###### `Prime(L): RngXPad -> RngIntElt`

The (rational) prime $p$ having valuation equal to the ramification degree of the exact $p$-adic ring or field $L$.

<a id="function-degree-fldxpad-fldxpad"></a>
###### `Degree(L, K): FldXPad, FldXPad -> RngIntElt`

<a id="function-degree-fldxpad"></a>
###### `Degree(L): FldXPad -> RngIntElt`

<a id="function-degree-rngxpad"></a>
###### `Degree(L): RngXPad -> RngIntElt`

<a id="function-degree-rngxpad-rngxpad"></a>
###### `Degree(L, K): RngXPad, RngXPad -> RngIntElt`

The degree of the extension $L$ over the exact $p$-adic ring or field $K$ if given or the base ring of $L$ otherwise.

<a id="function-inertiadegree-fldxpad-fldxpad"></a>
###### `InertiaDegree(L, K): FldXPad, FldXPad -> RngIntElt`

<a id="function-inertiadegree-fldxpad"></a>
###### `InertiaDegree(L): FldXPad -> RngIntElt`

<a id="function-inertiadegree-rngxpad-rngxpad"></a>
###### `InertiaDegree(L, K): RngXPad, RngXPad -> RngIntElt`

<a id="function-inertiadegree-rngxpad"></a>
###### `InertiaDegree(L): RngXPad -> RngIntElt`

The inertia degree of the extension $L$ over the exact $p$-adic ring or field $K$ if given or the base ring of $L$ otherwise.

<a id="function-ramificationdegree-fldxpad-fldxpad"></a>
###### `RamificationDegree(L, K): FldXPad, FldXPad -> RngIntElt`

<a id="function-ramificationdegree-fldxpad"></a>
###### `RamificationDegree(L): FldXPad -> RngIntElt`

<a id="function-ramificationindex-fldxpad"></a>
###### `RamificationIndex(L): FldXPad -> RngIntElt`

<a id="function-ramificationindex-fldxpad-fldxpad"></a>
###### `RamificationIndex(L, K): FldXPad, FldXPad -> RngIntElt`

<a id="function-ramificationdegree-rngxpad"></a>
###### `RamificationDegree(L): RngXPad -> RngIntElt`

<a id="function-ramificationdegree-rngxpad-rngxpad"></a>
###### `RamificationDegree(L, K): RngXPad, RngXPad -> RngIntElt`

<a id="function-ramificationindex-rngxpad"></a>
###### `RamificationIndex(L): RngXPad -> RngIntElt`

<a id="function-ramificationindex-rngxpad-rngxpad"></a>
###### `RamificationIndex(L, K): RngXPad, RngXPad -> RngIntElt`

The ramification degree of the extension $L$ over the exact $p$-adic ring or field $K$ if given or the base ring of $L$ otherwise.

<a id="function-definingpolynomial-rngxpad"></a>
###### `DefiningPolynomial(R): RngXPad -> RngUPolElt`

<a id="function-definingpolynomial-fldxpad"></a>
###### `DefiningPolynomial(R): FldXPad -> RngUPolElt`

```magma
Exact: BoolElt                    Default: true
```

Given an exact $p$-adic ring or field $R$ returns the defining polynomial of $R$ with type `RngUPolElt`, unless `Exact` is set to `true`, in which case the polynomial is returned with type `RngUPolXPadElt`.

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

<a id="function-absoluteinertiadegree-fldxpad"></a>
###### `AbsoluteInertiaDegree(L): FldXPad -> RngIntElt`

<a id="function-absoluteinertiaindex-fldxpad"></a>
###### `AbsoluteInertiaIndex(L): FldXPad -> RngIntElt`

<a id="function-absoluteramificationdegree-fldxpad"></a>
###### `AbsoluteRamificationDegree(L): FldXPad -> RngIntElt`

<a id="function-absoluteramificationindex-fldxpad"></a>
###### `AbsoluteRamificationIndex(L): FldXPad -> RngIntElt`

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

<a id="function-absoluteinertiadegree-rngxpad"></a>
###### `AbsoluteInertiaDegree(L): RngXPad -> RngIntElt`

<a id="function-absoluteinertiaindex-rngxpad"></a>
###### `AbsoluteInertiaIndex(L): RngXPad -> RngIntElt`

<a id="function-absoluteramificationdegree-rngxpad"></a>
###### `AbsoluteRamificationDegree(L): RngXPad -> RngIntElt`

<a id="function-absoluteramificationindex-rngxpad"></a>
###### `AbsoluteRamificationIndex(L): RngXPad -> RngIntElt`

The degree, inertia degree, or ramification degree of the exact $p$-adic ring or field $L$ over its prime subfield.

<a id="function-discriminantvaluation-fldxpad"></a>
###### `DiscriminantValuation(L): FldXPad -> RngIntElt`

<a id="function-discriminantvaluation-fldxpad-fldxpad"></a>
###### `DiscriminantValuation(L, K): FldXPad, FldXPad -> RngIntElt`

<a id="function-discriminantvaluation-rngxpad-rngxpad"></a>
###### `DiscriminantValuation(L, K): RngXPad, RngXPad -> RngIntElt`

<a id="function-discriminantvaluation-rngxpad"></a>
###### `DiscriminantValuation(L): RngXPad -> RngIntElt`

The valuation of the discriminant of the extension $L/K$ of exact $p$-adic rings or fields. This is computed as the height of the leftmost vertex of the ramification polygon (and so avoids actually computing the discriminant). If it is not specified $K$ defaults to the base ring of $L$.

<a id="function-ramificationpolygon-fldxpad"></a>
###### `RamificationPolygon(L): FldXPad -> NwtnPgon`

<a id="function-ramificationpolygon-fldxpad-fldxpad"></a>
###### `RamificationPolygon(L, K): FldXPad, FldXPad -> NwtnPgon`

<a id="function-ramificationpolygon-rngxpad-rngxpad"></a>
###### `RamificationPolygon(L, K): RngXPad, RngXPad -> NwtnPgon`

<a id="function-ramificationpolygon-rngxpad"></a>
###### `RamificationPolygon(L): RngXPad -> NwtnPgon`

<a id="function-ramificationpolygon-rngupolxpadelt-fldxpad"></a>
###### `RamificationPolygon(f): RngUPolXPadElt[FldXPad] -> NwtnPgon`

<a id="function-ramificationpolygon-rngupolxpadelt-rngxpad"></a>
###### `RamificationPolygon(f): RngUPolXPadElt[RngXPad] -> NwtnPgon`

Constructs the ramification polygon of the Eisenstein or inertial polynomial $f$ over an exact $p$-adic ring or field. The input can instead be an extension $L/K$, where $K$ defaults to the base ring of $L$ if it is not specified.

The locations and slopes of the vertices correspond to different subfields fixed by different ramification subgroups of the Galois group. For example a horizontal face corresponds to an unramified subfield, and a face of slope -1 corresponds to a tame subfield. This is represented as a Newton Polygon (type `NwtnPgon`).

<a id="example-ex-5789a2"></a>
###### `Example: Invariants of Exact p-adic Fields (ex-5789a2)`

```magma
> Qp := pAdicField(17 : Exact);
> Prime(Qp);
17
> Degree(Qp);
1
> L := ext<ext<Qp | 7> | Polynomial([3*17, 4*17^2, 2*17, 1])>;
> Prime(L);
17
> Degree(L);
3
> Degree(L, Qp);
21
> Degree(L, BaseField(L));
3
> InertiaDegree(L);
1
> RamificationDegree(L);
3
> DefiningPolynomial(L);
(1 + O(17^20))*$.1^3 + (2*17 + O(17^21))*$.1^2 + (4*17^2 + O(17^22))*$.1 + 3*17
    + O(17^21)
> Parent($1);
Univariate Polynomial Ring over Unramified extension of degree 7 of 17-adic
field (exact)
> DefiningPolynomial(CoefficientField(L));
(1 + O(17^20))*$.1^7 + O(17^2048)*$.1^6 + O(17^2048)*$.1^5 + O(17^2048)*$.1^4 +
    O(17^2048)*$.1^3 + O(17^2048)*$.1^2 + (12 + O(17^20))*$.1 + 14 + O(17^20)
> DefiningPolynomial(L : Exact);
(1 + O(17^20))*$.1^3 + (2*17 + O(17^21))*$.1^2 + (4*17^2 + O(17^22))*$.1 + 3*17
    + O(17^21)
> Parent($1);
Univariate polynomial ring (exact) over Unramified extension of degree 7 of
17-adic field (exact)
> AbsoluteDegree(L);
21
> DiscriminantValuation(L);
2
> DiscriminantValuation(L, Qp);
2
> RamificationPolygon(L);
Newton Polygon with vertices {(1, 2), (3, 0)} and defining points {(1, 2), (2,
1), (3, 0)}
```

#### Exact $p$-adic Elements

In this section we describe the construction and functionality related to elements of exact $p$-adic rings and fields.

<a id="function-getexactpadicsprintprecision"></a>
##### `GetExactpAdicsPrintPrecision() -> RngIntElt`

Returns the precision to which exact $p$-adic objects are printed by default.

<a id="procedure-setexactpadicsprintprecision-infty"></a>
##### `SetExactpAdicsPrintPrecision(k): Infty`

<a id="procedure-setexactpadicsprintprecision-rngintelt"></a>
##### `SetExactpAdicsPrintPrecision(k): RngIntElt`

Set the precision to which exact $p$-adic objects are printed by default to the integer $k$ or $\infty$.

<a id="operation-op-fldxpad-any"></a>
##### `K ! x: FldXPad, Any -> FldXPadElt`

<a id="operation-op-rngxpad-any"></a>
##### `R ! x: RngXPad, Any -> RngXPadElt`

<a id="constructor-constructor-elt-fldxpad-any-fldxpadelt"></a>
##### `elt<K | x>: FldXPad, Any -> FldXPadElt`

<a id="constructor-constructor-elt-rngxpad-any-rngxpadelt"></a>
##### `elt<R | x>: RngXPad, Any -> RngXPadElt`

Elements of an exact $p$-adic ring or field may be coerced from:

- Integers or rationals
- Any base field
- The residue class field
- Any compatible finite-precision $p$-adic field, ring, or quotient ring

In the latter two cases, the coerced element has its precision capped to the precision of $x$, so is not really “exact”. To select a full-precision lift, use `CoerceAndLift(K,x)`.

<a id="function-absoluteprecision-fldxpadelt"></a>
##### `AbsolutePrecision(x): FldXPadElt -> RngIntElt`

<a id="function-absoluteprecision-rngxpadelt"></a>
##### `AbsolutePrecision(x): RngXPadElt -> RngIntElt`

The precision of the exact $p$-adic element $x$ relative to valuation 0.

<a id="function-relativeprecision-fldxpadelt"></a>
##### `RelativePrecision(x): FldXPadElt -> RngIntElt`

<a id="function-relativeprecision-rngxpadelt"></a>
##### `RelativePrecision(x): RngXPadElt -> RngIntElt`

The precision of the exact $p$-adic element $x$ relative to its weak valuation. The relative precision is zero if and only if $x$ is weakly zero.

<a id="function-valuation-fldxpadelt"></a>
##### `Valuation(x): FldXPadElt -> RngIntElt`

<a id="function-valuation-rngxpadelt"></a>
##### `Valuation(x): RngXPadElt -> RngIntElt`

The valuation of the exact $p$-adic element $x$. Note that if $x$ is weakly zero, its epoch will be increased until it is no longer weakly zero, or until its weak valuation is infinite. If $x$ is actually zero, this could compute forever.

<a id="function-weakvaluation-rngxpadelt"></a>
##### `WeakValuation(x): RngXPadElt -> RngIntElt`

<a id="function-weakvaluation-fldxpadelt"></a>
##### `WeakValuation(x): FldXPadElt -> RngIntElt`

A lower bound on the valuation of the exact $p$-adic element $x$. It is equal to the true valuation unless $x$ is weakly zero.

<a id="function-shiftvaluation-fldxpadelt-rngintelt"></a>
##### `ShiftValuation(x, n): FldXPadElt, RngIntElt -> FldXPadElt`

<a id="function-shiftvaluation-rngxpadelt-rngintelt"></a>
##### `ShiftValuation(x, n): RngXPadElt, RngIntElt -> RngXPadElt`

Multiply the exact $p$-adic element $x$ by the $m$th power of the uniformizing element. This returns an element whose valuation is $m$ more than that of $x$.

<a id="function-valuationeq-fldxpadelt-rngintelt"></a>
##### `ValuationEq(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationeq-fldxpadelt-infty"></a>
##### `ValuationEq(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationeq-rngxpadelt-rngintelt"></a>
##### `ValuationEq(x, n): RngXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationeq-rngxpadelt-infty"></a>
##### `ValuationEq(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationne-fldxpadelt-rngintelt"></a>
##### `ValuationNe(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationne-fldxpadelt-infty"></a>
##### `ValuationNe(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationne-rngxpadelt-rngintelt"></a>
##### `ValuationNe(x, n): RngXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationne-rngxpadelt-infty"></a>
##### `ValuationNe(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationge-fldxpadelt-rngintelt"></a>
##### `ValuationGe(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationge-fldxpadelt-infty"></a>
##### `ValuationGe(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationge-rngxpadelt-rngintelt"></a>
##### `ValuationGe(x, n): RngXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationge-rngxpadelt-infty"></a>
##### `ValuationGe(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationgt-fldxpadelt-infty"></a>
##### `ValuationGt(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationgt-fldxpadelt-rngintelt"></a>
##### `ValuationGt(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationgt-rngxpadelt-rngintelt"></a>
##### `ValuationGt(x, n): RngXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationgt-rngxpadelt-infty"></a>
##### `ValuationGt(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationle-fldxpadelt-infty"></a>
##### `ValuationLe(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationle-fldxpadelt-rngintelt"></a>
##### `ValuationLe(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationle-rngxpadelt-rngintelt"></a>
##### `ValuationLe(x, n): RngXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationle-rngxpadelt-infty"></a>
##### `ValuationLe(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationlt-fldxpadelt-rngintelt"></a>
##### `ValuationLt(x, n): FldXPadElt, RngIntElt -> BoolElt`

<a id="function-valuationlt-fldxpadelt-infty"></a>
##### `ValuationLt(x, n): FldXPadElt, Infty -> BoolElt`

<a id="function-valuationlt-rngxpadelt-infty"></a>
##### `ValuationLt(x, n): RngXPadElt, Infty -> BoolElt`

<a id="function-valuationlt-rngxpadelt-rngintelt"></a>
##### `ValuationLt(x, n): RngXPadElt, RngIntElt -> BoolElt`

Compare the valuation of the exact $p$-adic element $x$ to $n$. These always terminate.

<a id="function-isunit-rngxpadelt"></a>
##### `IsUnit(x): RngXPadElt -> BoolElt`

<a id="function-isunit-fldxpadelt"></a>
##### `IsUnit(x): FldXPadElt -> BoolElt`

Return `true` if the exact $p$-adic element $x$ is a unit.

<a id="function-isintegral-rngxpadelt"></a>
##### `IsIntegral(x): RngXPadElt -> BoolElt`

<a id="function-isintegral-fldxpadelt"></a>
##### `IsIntegral(x): FldXPadElt -> BoolElt`

Returns `true` if the exact $p$-adic element $x$ is an integer.

<a id="function-isweaklyzero-stranyxpadelt"></a>
##### `IsWeaklyZero(x): StrAnyXPadElt -> BoolElt`

<a id="function-isweaklyequal-stranyxpadelt-stranyxpadelt"></a>
##### `IsWeaklyEqual(x, y): StrAnyXPadElt, StrAnyXPadElt -> BoolElt`

Returns `true` if the exact $p$-adic element $x$, respectively $x-y$, is zero up to its current precision. If $x$, respectively $x-y$, is zero then it is weakly zero, but not necessarily the other way around.

<a id="function-isdefinitelyzero-stranyxpadelt"></a>
##### `IsDefinitelyZero(x): StrAnyXPadElt -> BoolElt`

<a id="function-isdefinitelyequal-stranyxpadelt-stranyxpadelt"></a>
##### `IsDefinitelyEqual(x, y): StrAnyXPadElt, StrAnyXPadElt -> BoolElt`

Returns `true` if the exact $p$-adic element $x$ is definitely zero, respectively, $x$ and $y$ are identical or both definitely zero.

<a id="function-coerceandlift-stranyxpad-any"></a>
##### `CoerceAndLift(S, x): StrAnyXPad, Any -> StrAnyXPadElt`

Coerce $x$ into the exact $p$-adic structure $S$, and ensure its precision is unbounded. If $x$ is a finite-precision object, then ordinary coercion `S!x` will have capped precision whereas `CoerceAndLift(S,x)` will “lift” this to have unbounded precision

##### Arithmetic with Elements

<a id="operation-op-times-fldxpadelt-fldxpadelt"></a>
###### `x * y: FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="operation-op-times-rngxpadelt-rngxpadelt"></a>
###### `x * y: RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="operation-op-plus-fldxpadelt-fldxpadelt"></a>
###### `x + y: FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="operation-op-plus-rngxpadelt-rngxpadelt"></a>
###### `x + y: RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="operation-operation-fldxpadelt-fldxpadelt"></a>
###### `- y: FldXPadElt -> FldXPadElt`

<a id="operation-operation-rngxpadelt-rngxpadelt"></a>
###### `- y: RngXPadElt -> RngXPadElt`

<a id="operation-op-minus-rngxpadelt-rngxpadelt"></a>
###### `x - y: RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="operation-op-minus-fldxpadelt-fldxpadelt"></a>
###### `x - y: FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="operation-op-pow-fldxpadelt-rngintelt"></a>
###### `x ^ n: FldXPadElt, RngIntElt -> FldXPadElt`

<a id="operation-op-pow-rngxpadelt-rngintelt"></a>
###### `x ^ n: RngXPadElt, RngIntElt -> RngXPadElt`

<a id="operation-op-div-fldxpadelt-fldxpadelt"></a>
###### `x / y: FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="operation-op-div-rngxpadelt-rngxpadelt"></a>
###### `x / y: RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="operation-operation-div-rngxpadelt-rngxpadelt-rngxpadelt"></a>
###### `x div y: RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="function-quotrem-rngxpadelt-rngxpadelt"></a>
###### `Quotrem(x, y): RngXPadElt, RngXPadElt -> RngXPadElt, RngXPadElt`

<a id="function-gcd-fldxpadelt-fldxpadelt"></a>
###### `GCD(x, y): FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="function-gcd-fldxpadelt-fldxpadelt-2"></a>
###### `Gcd(x, y): FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="function-greatestcommondivisor-fldxpadelt-fldxpadelt"></a>
###### `GreatestCommonDivisor(x, y): FldXPadElt, FldXPadElt -> FldXPadElt`

<a id="function-gcd-rngxpadelt-rngxpadelt"></a>
###### `GCD(x, y): RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="function-gcd-rngxpadelt-rngxpadelt-2"></a>
###### `Gcd(x, y): RngXPadElt, RngXPadElt -> RngXPadElt`

<a id="function-greatestcommondivisor-rngxpadelt-rngxpadelt"></a>
###### `GreatestCommonDivisor(x, y): RngXPadElt, RngXPadElt -> RngXPadElt`

Given exact $p$-adic elements $x$ and $y$ return their greatest common divisor.

<a id="function-extendedgreatestcommondivisor-fldxpadelt-fldxpadelt"></a>
###### `ExtendedGreatestCommonDivisor(x, y): FldXPadElt, FldXPadElt -> FldXPadElt, FldXPadElt, FldXPadElt`

<a id="function-xgcd-fldxpadelt-fldxpadelt"></a>
###### `XGCD(x, y): FldXPadElt, FldXPadElt -> FldXPadElt, FldXPadElt, FldXPadElt`

<a id="function-xgcd-fldxpadelt-fldxpadelt-2"></a>
###### `Xgcd(x, y): FldXPadElt, FldXPadElt -> FldXPadElt, FldXPadElt, FldXPadElt`

<a id="function-extendedgreatestcommondivisor-rngxpadelt-rngxpadelt"></a>
###### `ExtendedGreatestCommonDivisor(x, y): RngXPadElt, RngXPadElt -> RngXPadElt, RngXPadElt, RngXPadElt`

<a id="function-xgcd-rngxpadelt-rngxpadelt"></a>
###### `XGCD(x, y): RngXPadElt, RngXPadElt -> RngXPadElt, RngXPadElt, RngXPadElt`

<a id="function-xgcd-rngxpadelt-rngxpadelt-2"></a>
###### `Xgcd(x, y): RngXPadElt, RngXPadElt -> RngXPadElt, RngXPadElt, RngXPadElt`

Given exact $p$-adic elements $x$ and $y$ return their greatest common divisor $g$ as well as $a$ and $b$ such that $g = a x + b y$.

<a id="example-ex-bdd87d"></a>
###### `Example: Arithmetic with Exact p-adic Elements (ex-bdd87d)`

```magma
> Zp := pAdicRing(19 :  Exact);
> x := Zp!3948701;
> y := Zp!748873*19;
> x;
3948701 + O(19^20)
> y;
14228587 + O(19^20)
> FieldOfFractions(Zp)!x;
3948701 + O(19^20)
> FieldOfFractions(Zp)!y;
748873*19 + O(19^21)
> AbsolutePrecision(x);
32
> RelativePrecision(x);
32
> Valuation(x);
0
> WeakValuation(x);
0
> ShiftValuation(x, 5);
9777374597399 + O(19^20)
> ValuationGe($1, 5);
true
> IsUnit(x);
true
> IsIntegral(x);
true
> Valuation(y);
1
> x + y;
18177288 + O(19^20)
> x*y;
56184435715487 + O(19^20)
> Valuation(y^5);
5
> x/y;
-14678086202175978502286566*19^-1 + O(19^19)
> Quotrem(x, y);
O(19^20) 3948701 + O(19^20)
> Quotrem(y, x);
15372121930607214329737477 + O(19^20) O(19^20)
> Gcd(x, y);
3948701 + O(19^20)
> Xgcd(19*x, y);
75025319 + O(19^20) 1 + O(19^20) O(19^20)
> IsWeaklyZero(Zp!0);
true
> IsDefinitelyZero(Zp!0);
false
> IsDefinitelyZero(FieldOfFractions(Zp)!0);
true
> IsDefinitelyEqual(x, x);
true
> CoerceAndLift(Zp, 0);
O(19^20)
> IsWeaklyZero($1);
true
> IsDefinitelyZero($2);
false
> CoerceAndLift(FieldOfFractions(Zp), 0);
0
> IsDefinitelyZero($1);
true
```

#### Polynomials over Exact $p$-adic Rings and Fields

While polynomial rings of type `RngUPol` and polynomials of type `RngUPolElt` can be constructed in the regular way over exact $p$-adic rings and fields there is also a specific type of polynomial rings which can be constructed over the exact $p$-adic rings and fields. These polynomial rings have type `RngUPolXPad` and their elements have type `RngUPolXPadElt`.

##### Exact Polynomial Rings

In this section we describe the construction and functionality for polynomial rings of type `RngUPolXPad`.

<a id="function-polynomialring-rng"></a>
###### `PolynomialRing(R : parameters): Rng -> RngUPol`

```magma
Global: BoolElt                    Default: true
Exact : BoolElt                    Default: false
```

A polynomial ring specifically to parent polynomials with exact $p$-adic coefficients exists to be able to implement new kinds of polynomials which are best implemented by giving approximations of the entire polynomial wholesale, instead of giving each coefficient individually. This ring is constructed when the `Exact` parameter is set to `true`, otherwise an ordinary polynomial ring over the exact $p$-adic ring or field $R$ is constructed.

<a id="operation-op-eq-rngupolxpad-rngupolxpad"></a>
###### `R eq T: RngUPolXPad, RngUPolXPad -> BoolElt`

Given polynomial rings $R$ and $T$ over exact $p$-adic rings or fields, return whether $R$ and $T$ are equal.

<a id="function-basering-rngupolxpad"></a>
###### `BaseRing(R): RngUPolXPad -> Rng`

<a id="function-coefficientring-rngupolxpad"></a>
###### `CoefficientRing(R): RngUPolXPad -> Rng`

Returns the coefficient ring of the polynomial ring $R$ over an exact $p$-adic ring or field.

<a id="operation-operation-rngupolxpad-rngintelt-rngxpadelt"></a>
###### `R . i: RngUPolXPad, RngIntElt -> RngXPadElt`

<a id="function-name-rngupolxpad-rngintelt"></a>
###### `Name(R, i): RngUPolXPad, RngIntElt -> RngUPolXPadElt`

<a id="function-generator-rngupolxpad"></a>
###### `Generator(R): RngUPolXPad -> RngUPolXPadElt`

Returns the polynomial variable of the polynomial ring $R$ over an exact $p$-adic ring of field.

<a id="procedure-assignnames-rngupolxpad-seqenum-monstgelt-ref"></a>
###### `AssignNames(~R, S): RngUPolXPad, SeqEnum[MonStgElt]`

Given a polynomial ring over an exact $p$-adic ring or field $R$ assign the string in the sequence $S$ of length 1 to be the name used for the variable of $R$ when printing elements of $R$. On construction of $R$, `R<x>` can be used to assign the string `"x"` as the name to be used when printing in which case the identifier `x` will be assigned the value of `R.1`.

<a id="example-ex-b44a56"></a>
###### `Example: Exact p-adic Polynomial Rings (ex-b44a56)`

```magma
> Zp := pAdicRing(7 : Exact);
> PolynomialRing(Zp);
Univariate Polynomial Ring over 7-adic ring (exact)
> PolynomialRing(Zp : Exact);
Univariate polynomial ring (exact) over 7-adic ring (exact)
```

##### Polynomials

In these next sections we describe the construction and functionality for polynomials of type `RngUPolXPadElt`.

<a id="operation-op-rngupolxpad-any"></a>
###### `R ! f: RngUPolXPad, Any -> RngUPolXPadElt`

Polynomials with exact $p$-adic coefficients can be constructed from:

- Other polynomials, either exact or ordinary, over any exact p-adic ring.
- Sequences of coefficients coercible to the base ring.
- Anything coercible to the base ring. If you are coercing from finite-precision rings, `CoerceAndLift(R,f)` may be appropriate.

<a id="function-basering-rngupolxpadelt"></a>
###### `BaseRing(f): RngUPolXPadElt -> Rng`

<a id="function-coefficientring-rngupolxpadelt"></a>
###### `CoefficientRing(f): RngUPolXPadElt -> Rng`

Returns the coefficient ring of the polynomial $f$ over an exact $p$-adic ring or field.

<a id="function-canchangering-rngupolxpadelt-rng"></a>
###### `CanChangeRing(f, R): RngUPolXPadElt, Rng -> BoolElt, RngUPolXPadElt`

<a id="function-changering-rngupolxpadelt-rng"></a>
###### `ChangeRing(f, R): RngUPolXPadElt, Rng -> RngUPolXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field and a ring $R$, return whether the coefficients of $f$ can be coerced into $R$ and the polynomial with those coefficients in $R$ if so.

<a id="function-degree-rngupolxpadelt"></a>
###### `Degree(f): RngUPolXPadElt -> RngIntElt`

Given a polynomial $f$ returns the true degree of $f$. That is, the corresponding leading coefficient is known to be non-zero.

<a id="function-weakdegree-rngupolxpadelt"></a>
###### `WeakDegree(f): RngUPolXPadElt -> RngIntElt`

Given a polynomial $f$ over an exact $p$-adic ring or field, returns an upper bound on the degree of $f$. That is, the corresponding leading coefficient may be weakly zero.

<a id="function-coefficient-rngupolxpadelt-rngintelt"></a>
###### `Coefficient(f, i): RngUPolXPadElt, RngIntElt -> RngElt`

<a id="function-coefficients-rngupolxpadelt"></a>
###### `Coefficients(f): RngUPolXPadElt -> SeqEnum`

Given a polynomial $f$ return the $i$th coefficient and all coefficients of $f$ respectively.

<a id="function-exactpolynomial-rngupolxpadelt"></a>
###### `ExactPolynomial(f): RngUPolXPadElt -> RngUPolXPadElt`

<a id="function-exactpolynomial-rngupolelt"></a>
###### `ExactPolynomial(f): RngUPolElt -> RngUPolXPadElt`

Given a polynomial $f$ of type `RngUPolElt` over an exact $p$-adic ring or field, convert $f$ into a polynomial of type `RngUPolXPadElt`.

<a id="function-evaluate-rngupolxpadelt-any"></a>
###### `Evaluate(f, x): RngUPolXPadElt, Any -> RngAnyXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field and an element $x$ coercible into the coefficient ring of $f$ return the value of $f$ when the variable is replaced by $x$.

<a id="function-derivative-rngupolxpadelt-rngintelt"></a>
###### `Derivative(f, m): RngUPolXPadElt, RngIntElt -> RngUPolXPadElt`

<a id="function-derivative-rngupolxpadelt"></a>
###### `Derivative(f): RngUPolXPadElt -> RngUPolXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field and an integer $m$, return the $m$th derivative of $f$ or the first derivative if $m$ is not specified.

<a id="function-discriminant-rngupolxpadelt"></a>
###### `Discriminant(f): RngUPolXPadElt -> RngAnyXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field, return the discriminant, the product of the differences between the roots of $f$.

<a id="function-resultant-rngupolxpadelt-rngupolxpadelt"></a>
###### `Resultant(f, g): RngUPolXPadElt, RngUPolXPadElt -> RngAnyXPadElt`

Given polynomials $f$ and $g$ over an exact $p$-adic ring or field, return their resultant.

<a id="function-isinertial-rngupolxpadelt"></a>
###### `IsInertial(f): RngUPolXPadElt -> BoolElt`

<a id="function-iseisenstein-rngupolxpadelt"></a>
###### `IsEisenstein(f): RngUPolXPadElt -> BoolElt`

Given a polynomial $f$ over an exact $p$-adic ring or field, return whether the polynomial is inertial or Eisenstein, respectively.

<a id="function-isweaklyzero-stranyxpadelt-2"></a>
###### `IsWeaklyZero(f): StrAnyXPadElt -> BoolElt`

<a id="function-isweaklyequal-stranyxpadelt-stranyxpadelt-2"></a>
###### `IsWeaklyEqual(f, g): StrAnyXPadElt, StrAnyXPadElt -> BoolElt`

Returns `true` if the exact $p$-adic polynomial $f$, respectively $f-g$, is zero up to its current precision. If $f$, respectively $f-g$, is zero then it is weakly zero, but not necessarily the other way around.

<a id="function-isdefinitelyzero-stranyxpadelt-2"></a>
###### `IsDefinitelyZero(f): StrAnyXPadElt -> BoolElt`

<a id="function-isdefinitelyequal-stranyxpadelt-stranyxpadelt-2"></a>
###### `IsDefinitelyEqual(f, g): StrAnyXPadElt, StrAnyXPadElt -> BoolElt`

Returns `true` if the exact $p$-adic polynomial $f$ is definitely zero, respectively, $f$ and $g$ are identical or both definitely zero.

<a id="function-coerceandlift-stranyxpad-any-2"></a>
###### `CoerceAndLift(S, x): StrAnyXPad, Any -> StrAnyXPadElt`

Coerce $x$ into the exact $p$-adic structure $S$, and ensure its precision is unbounded. If $x$ is a finite-precision object, then ordinary coercion `S!x` will have capped precision whereas `CoerceAndLift(S,x)` will “lift” this to have unbounded precision

##### Arithmetic

<a id="operation-op-times-rngupolxpadelt-rngupolxpadelt"></a>
###### `x * y: RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-operation-rngupolxpadelt-rngupolxpadelt"></a>
###### `- y: RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-op-plus-rngupolxpadelt-rngupolxpadelt"></a>
###### `x + y: RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-op-minus-rngupolxpadelt-rngupolxpadelt"></a>
###### `x - y: RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-op-div-rngupolxpadelt-rngelt"></a>
###### `x / c: RngUPolXPadElt, RngElt -> RngUPolXPadElt`

<a id="operation-op-pow-rngupolxpadelt-rngintelt"></a>
###### `x ^ n: RngUPolXPadElt, RngIntElt -> RngUPolXPadElt`

<a id="function-quotrem-rngupolxpadelt-rngupolxpadelt"></a>
###### `Quotrem(x, y): RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-operation-div-rngupolxpadelt-rngupolxpadelt-rngupolxpadelt"></a>
###### `x div y: RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="operation-operation-mod-rngupolxpadelt-rngupolxpadelt-rngupolxpadelt"></a>
###### `x mod y: RngUPolXPadElt, RngUPolXPadElt -> RngUPolXPadElt`

<a id="example-ex-88ff30"></a>
###### `Example: Arithmetic with Exact p-adic Polynomials (ex-88ff30)`

```magma
> Qp := pAdicField(11 : Exact);
> f := Polynomial(Qp, [3241, 245, 134, 1345, 125, 1542]);
> f;
(1542 + O(11^20))*$.1^5 + (125 + O(11^20))*$.1^4 + (1345 + O(11^20))*$.1^3 +
    (134 + O(11^20))*$.1^2 + (245 + O(11^20))*$.1 + 3241 + O(11^20)
> f := ExactPolynomial(f); f;
(1542 + O(11^20))*$.1^5 + (125 + O(11^20))*$.1^4 + (1345 + O(11^20))*$.1^3 +
    (134 + O(11^20))*$.1^2 + (245 + O(11^20))*$.1 + 3241 + O(11^20)
> BaseRing(f);
11-adic field (exact)
> CanChangeRing(f, Integers(Qp));
true (1542 + O(11^20))*$.1^5 + (125 + O(11^20))*$.1^4 + (1345 + O(11^20))*$.1^3
    + (134 + O(11^20))*$.1^2 + (245 + O(11^20))*$.1 + 3241 + O(11^20)
> Degree(f);
5
> WeakDegree(ExactPolynomial(f));
5
> Coefficient(f, 2);
134 + O(11^20)
> Evaluate(f, Qp.1);
6632 + O(11^20)
> Derivative(f, 2);
(30840 + O(11^20))*$.1^3 + (1500 + O(11^20))*$.1^2 + (8070 + O(11^20))*$.1 + 268
    + O(11^20)
> Discriminant(f);
-77083727534419762054 + O(11^20)
> Resultant(f, Derivative(f));
213641244987848541309 + O(11^20)
> IsInertial(f);
true
> IsEisenstein(f);
false
> IsWeaklyZero(PolynomialRing(Qp : Exact)!0);
true
> IsDefinitelyZero(PolynomialRing(Qp : Exact)!0);
true
> IsWeaklyZero(f-f);
true
> IsDefinitelyZero(f-f);
false
> IsDefinitelyEqual(f, f);
true
```

##### Factorization and Roots

The functionality in this section is related to taking roots and computing factorizations of polynomials. For some of these intrinsics there are restrictions on the input polynomial regarding multiple factors. Since no finite precision $p$-adic algorithm can provbably identify equal roots multiple factors are not checked for and some intrinsics may run forever on input having multiple factors.

<a id="function-newtonpolygon-rngupolxpadelt-rngxpad"></a>
###### `NewtonPolygon(f): RngUPolXPadElt[RngXPad] -> NwtnPgon`

<a id="function-newtonpolygon-rngupolxpadelt-fldxpad"></a>
###### `NewtonPolygon(f): RngUPolXPadElt[FldXPad] -> NwtnPgon`

Returns the Newton polygon of the polynomial $f$ over an exact $p$-adic ring or field.

<a id="function-xroots"></a>
###### `Roots(f, R): RngUPolElt, FldXPad -> SeqEnum`

<a id="function-roots-rngupolelt-rngxpad"></a>
###### `Roots(f, R): RngUPolElt, RngXPad -> SeqEnum`

<a id="function-roots-rngupolxpadelt-rngxpad"></a>
###### `Roots(f, R): RngUPolXPadElt, RngXPad -> SeqEnum`

<a id="function-roots-rngupolxpadelt-fldxpad"></a>
###### `Roots(f, R): RngUPolXPadElt, FldXPad -> SeqEnum`

<a id="function-roots-rngupolxpadelt-fldxpad-2"></a>
###### `Roots(f): RngUPolXPadElt[FldXPad] -> SeqEnum`

<a id="function-roots-rngupolxpadelt-rngxpad-2"></a>
###### `Roots(f): RngUPolXPadElt[RngXPad] -> SeqEnum`

```magma
Max: Infty                    Default: Infinity()
```

Given a polynomial $f$ over an exact $p$-adic ring or field, return the roots of $f$ in the exact $p$-adic field or ring $R$ or the base ring of $f$ if $R$ is not specified. The polynomial $f$ must have no repeated roots (without further assumptions on the structure of the polynomial, no finite-precision $p$-adic algorithm can provably identify a set of equal roots).

<a id="function-hasroot-rngupolxpadelt-rngxpad"></a>
###### `HasRoot(f): RngUPolXPadElt[RngXPad] -> BoolElt, RngXPadElt`

<a id="function-hasroot-rngupolxpadelt-fldxpad"></a>
###### `HasRoot(f): RngUPolXPadElt[FldXPad] -> BoolElt, FldXPadElt`

<a id="function-hasroot-rngupolelt-rngxpad"></a>
###### `HasRoot(f): RngUPolElt[RngXPad] -> BoolElt, RngXPadElt`

<a id="function-hasroot-rngupolelt-fldxpad"></a>
###### `HasRoot(f): RngUPolElt[FldXPad] -> BoolElt, FldXPadElt`

<a id="function-hasroot-rngupolelt-fldxpad-2"></a>
###### `HasRoot(f, R): RngUPolElt, FldXPad -> BoolElt, FldXPadElt`

<a id="function-hasroot-rngupolelt-rngxpad-2"></a>
###### `HasRoot(f, R): RngUPolElt, RngXPad -> BoolElt, RngXPadElt`

<a id="function-hasroot-rngupolxpadelt-fldxpad-2"></a>
###### `HasRoot(f, R): RngUPolXPadElt, FldXPad -> BoolElt, FldXPadElt`

<a id="function-hasroot-rngupolxpadelt-rngxpad-2"></a>
###### `HasRoot(f, R): RngUPolXPadElt, RngXPad -> BoolElt, RngXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field, return whether $f$ has a root in the exact $p$-adic ring or field $R$ or the base ring of $f$ if $R$ is not specified. If $f$ does have such a root then also return one root. The polynomial $f$ must have no repeated roots (see [`Roots`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xroots) above).

<a id="function-xfact"></a>
###### `Factorization(f, R): RngUPolXPadElt, FldXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorisation-rngupolxpadelt-fldxpad"></a>
###### `Factorisation(f, R): RngUPolXPadElt, FldXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorisation-rngupolxpadelt-rngxpad"></a>
###### `Factorisation(f, R): RngUPolXPadElt, RngXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorization-rngupolxpadelt-rngxpad"></a>
###### `Factorization(f, R): RngUPolXPadElt, RngXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorization-rngupolelt-rngxpad"></a>
###### `Factorization(f, R): RngUPolElt, RngXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorisation-rngupolelt-rngxpad"></a>
###### `Factorisation(f, R): RngUPolElt, RngXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorisation-rngupolelt-fldxpad"></a>
###### `Factorisation(f, R): RngUPolElt, FldXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorization-rngupolelt-fldxpad"></a>
###### `Factorization(f, R): RngUPolElt, FldXPad -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorization-rngupolxpadelt-rngxpad-2"></a>
###### `Factorization(f): RngUPolXPadElt[RngXPad] -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorization-rngupolxpadelt-fldxpad"></a>
###### `Factorization(f): RngUPolXPadElt[FldXPad] -> SeqEnum, FldXPadElt, SeqEnum`

<a id="function-factorisation-rngupolxpadelt-rngxpad-2"></a>
###### `Factorisation(f): RngUPolXPadElt[RngXPad] -> SeqEnum, RngXPadElt, SeqEnum`

<a id="function-factorisation-rngupolxpadelt-fldxpad-2"></a>
###### `Factorisation(f): RngUPolXPadElt[FldXPad] -> SeqEnum, FldXPadElt, SeqEnum`

```magma
Certificates : BoolElt                      Default: false
Extensions   : BoolElt                      Default: false
Max          : Infty                        Default: Infinity()
DegreeDivides: RngIntElt                    Default: 0
DegreeGe     : RngIntElt                    Default: 1
```

Given a polynomial $f$ over an exact $p$-adic ring or field, return the factorization of $f$ over $R$ if given or the coefficient ring of $f$ otherwise. The polynomial $f$ must have no repeated factors (for similar reasons to [`Roots`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xroots) above). A scaling factor is also returned, so that the product of the factors equals $f$ multiplied by the scaling factor.

If the parameter `Certificates` is set to `true`, a corresponding sequence of certificates for each factor is also returned. If the parameter `Extensions` is set to `true`, (which implies `Certificates`) then each certificate also includes the extension defined by the factor.

<a id="function-isirreducible-rngupolxpadelt-rngxpad"></a>
###### `IsIrreducible(f): RngUPolXPadElt[RngXPad] -> BoolElt, Rec`

<a id="function-isirreducible-rngupolxpadelt-fldxpad"></a>
###### `IsIrreducible(f): RngUPolXPadElt[FldXPad] -> BoolElt, Rec`

<a id="function-isirreducible-rngupolelt-rngxpad"></a>
###### `IsIrreducible(f): RngUPolElt[RngXPad] -> BoolElt, Rec`

<a id="function-isirreducible-rngupolelt-fldxpad"></a>
###### `IsIrreducible(f): RngUPolElt[FldXPad] -> BoolElt, Rec`

```magma
Extension  : BoolElt                    Default: false
Certificate: BoolElt                    Default: false
```

Given a polynomial $f$ over an exact $p$-adic ring or field, return whether $f$ is irreducible. It must have at least one non-repeated factor (for similar reasons to [`Roots`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xroots) above). If the parameters `Extension` or `Certificate` are given, the second return value is as in [`Factorization`](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/xpadic.md#function-xfact).

<a id="function-ishenselliftable-rngupolelt-fldxpadelt"></a>
###### `IsHenselLiftable(f, x): RngUPolElt, FldXPadElt -> BoolElt, FldXPadElt`

<a id="function-ishenselliftable-rngupolelt-rngxpadelt"></a>
###### `IsHenselLiftable(f, x): RngUPolElt, RngXPadElt -> BoolElt, RngXPadElt`

<a id="function-ishenselliftable-rngupolxpadelt-fldxpadelt"></a>
###### `IsHenselLiftable(f, x): RngUPolXPadElt, FldXPadElt -> BoolElt, FldXPadElt`

<a id="function-ishenselliftable-rngupolxpadelt-rngxpadelt"></a>
###### `IsHenselLiftable(f, x): RngUPolXPadElt, RngXPadElt -> BoolElt, RngXPadElt`

Given a polynomial $f$ over an exact $p$-adic ring or field and an element $x$ of an exact $p$-adic ring or field return whether $x$ is close enough to a root of $f$ to be Hensel lifted to that root. If so, returns the lifted root.

<a id="function-ramificationresidualpolynomial-rngupolelt-fldxpad-nwtnpgonface"></a>
###### `RamificationResidualPolynomial(f, face): RngUPolElt[FldXPad], NwtnPgonFace -> RngUPolElt`

<a id="function-ramificationresidualpolynomial-rngupolelt-rngxpad-nwtnpgonface"></a>
###### `RamificationResidualPolynomial(f, face): RngUPolElt[RngXPad], NwtnPgonFace -> RngUPolElt`

<a id="function-ramificationresidualpolynomial-rngupolxpadelt-fldxpad-nwtnpgonface"></a>
###### `RamificationResidualPolynomial(f, face): RngUPolXPadElt[FldXPad], NwtnPgonFace -> RngUPolElt`

<a id="function-ramificationresidualpolynomial-rngupolxpadelt-rngxpad-nwtnpgonface"></a>
###### `RamificationResidualPolynomial(f, face): RngUPolXPadElt[RngXPad], NwtnPgonFace -> RngUPolElt`

Given a polynomial $f$ over an exact $p$-adic ring or field, return the residual polynomial associated to the given $face$ of the ramifcation polygon of $f$.

<a id="function-ramificationresidualpolynomials-rngupolelt-fldxpad"></a>
###### `RamificationResidualPolynomials(f): RngUPolElt[FldXPad] -> SeqEnum, NwtnPgon`

<a id="function-ramificationresidualpolynomials-rngupolelt-rngxpad"></a>
###### `RamificationResidualPolynomials(f): RngUPolElt[RngXPad] -> SeqEnum, NwtnPgon`

<a id="function-ramificationresidualpolynomials-rngupolxpadelt-fldxpad"></a>
###### `RamificationResidualPolynomials(f): RngUPolXPadElt[FldXPad] -> SeqEnum, NwtnPgon`

<a id="function-ramificationresidualpolynomials-rngupolxpadelt-rngxpad"></a>
###### `RamificationResidualPolynomials(f): RngUPolXPadElt[RngXPad] -> SeqEnum, NwtnPgon`

Given an inertial or Eisenstein polynomial $f$ over an exact $p$-adic ring or field, return the residual polynomials assiociated to each face of the ramification polygon of $f$, and the ramification polygon itself.

<a id="example-ex-95a032"></a>
###### `Example: Factorization over Exact p-adic Fields (ex-95a032)`

```magma
> Qp := pAdicField(17 : Exact);
> P<x> := PolynomialRing(Qp : Exact);
> f := (x - 14)*(x - Qp.1)*(x - Qp.1 - 1);
> NewtonPolygon(f);
Newton Polygon with vertices {(0, 0), (3, 0)} and defining points {(0, 0), (3,
0)}
> HasRoot(f);
true 14 + O(17^20)
> Roots(f);
[ <14 + O(17^20), 1>, <2 + O(17^20), 1>, <1 + O(17^20), 1> ]
> Factorization(f);
[ <(1 + O(17^20))*x - 14 + O(17^20), 1>, <(1 + O(17^20))*x - 2 + O(17^20), 1>,
<(1 + O(17^20))*x - 1 + O(17^20), 1> ]
1 + O(17^20)
> IsIrreducible(f);
false
> IsHenselLiftable(f, Qp!14);
true 14 + O(17^20)
> IsHenselLiftable(f, Qp!10);
false
> RamificationResidualPolynomials(x^3 + 3*17*x^2 + 2*17^2*x + 5*17);
[
    $.1^2 + 3*$.1 + 3
]
Newton Polygon with vertices {(1, 2), (3, 0)} and defining points {(1, 2), (2,
    1), (3, 0)}
```

<a id="local-arbitrary"></a>
<a id="locala"></a>
## General $p$-Adic Extensions

- [Introduction](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/introduction.md)
- [Constructions](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md)
  - [`LocalField(L, f): FldPad, RngUPolElt → RngLocA`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#function-localfield-fldpad-rngupolelt)
  - [`LocalField(L, f): RngLocA, RngUPolElt → RngLocA`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#function-localfield-rngloca-rngupolelt)
  - [Example: One-Step Extension from a Two-Step Field](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#example-ex-827f9a)
  - [`sub< L | a₁, ..., aₙ >: RngLocA, RngLocAElt, ..., RngLocAElt → RngLocA`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#constructor-constructor-sub-rngloca-rnglocaelt-rnglocaelt-rngloca)
  - [`sub< L | S>: RngLocA, SeqEnum → RngLocA`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#constructor-constructor-sub-rngloca-seqenum-rngloca)
  - [Example: Subfield Generated by an Element](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/construction.md#example-ex-0823ac)
- [Operations with Fields](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md)
  - [`BaseRing(L): RngLocA → Rng`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-basering-rngloca)
  - [`CoefficientRing(L): RngLocA → Rng`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-coefficientring-rngloca)
  - [`DefiningPolynomial(L): RngLocA → RngUPolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-definingpolynomial-rngloca)
  - [`Degree(L): RngLocA → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-degree-rngloca)
  - [`Degree(L, R): RngLocA, Rng → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-degree-rngloca-rng)
  - [`InertiaDegree(L): RngLocA → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-inertiadegree-rngloca)
  - [`RamificationDegree(L): RngLocA → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-ramificationdegree-rngloca)
  - [`RamificationIndex(L): RngLocA → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-ramificationindex-rngloca)
  - [`Precision(L): RngLocA → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-precision-rngloca)
  - [`Prime(L): RngLocA → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-prime-rngloca)
  - [Example: Coefficient Ring and Defining Polynomial](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#example-ex-ef970a)
  - [`QuotientRepresentation(L): RngLocA → RngUPolRes`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-quotientrepresentation-rngloca)
  - [`RamifiedRepresentation(L): RngLocA → FldPad, Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-ramifiedrepresentation-rngloca)
  - [Example: Two-Step Representation of a Local Field](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#example-ex-a41b45)
  - [`AssignNames(~L, S): RngLocA, SeqEnum[MonStgElt]`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#procedure-assignnames-rngloca-seqenum-monstgelt-ref)
  - [`Name(L, i): RngLocA, RngIntElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-name-rngloca-rngintelt)
  - [`Discriminant(L): RngLocA → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-discriminant-rngloca)
  - [`ResidueClassField(L): RngLocA → Rng, Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-residueclassfield-rngloca)
  - [`RelativeField(L, m): RngLocA, Map → RngLocA, Map, Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-relativefield-rngloca-map)
  - [Predicates on Fields](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#predicates-on-fields)
    - [`IsRamified(L): RngLocA → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-isramified-rngloca)
    - [`IsTamelyRamified(L): RngLocA → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-istamelyramified-rngloca)
    - [`IsWildlyRamified(L): RngLocA → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-iswildlyramified-rngloca)
    - [`IsTotallyRamified(L): RngLocA → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-istotallyramified-rngloca)
    - [`IsUnramified(L): RngLocA → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/operations.md#function-isunramified-rngloca)
- [Maximal Order](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maximal-order.md)
  - [`IntegralBasis(L): RngLocA → SeqEnum`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maximal-order.md#function-integralbasis-rngloca)
  - [`IsIntegral(a): RngLocAElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maximal-order.md#function-isintegral-rnglocaelt)
  - [Example: Integral Basis of a Local Field](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maximal-order.md#example-ex-9bf4a2)
- [Homomorphisms](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maps.md)
  - [`hom< L -> R | a >: RngLocA, Rng, RngElt → Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maps.md#constructor-constructor-hom-rngloca-rng-rngelt-map)
  - [`hom< L -> R | cfm, a >: RngLocA, Rng, Map, RngElt → Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/maps.md#constructor-constructor-hom-rngloca-rng-map-rngelt-map)
- [Automorphisms and Galois Theory](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md)
  - [`FrobeniusAutomorphism(L): RngLocA → Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-frobeniusautomorphism-rngloca)
  - [`AutomorphismGroup(L): RngLocA → Grp, Map`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-automorphismgroup-rngloca)
  - [`DecompositionGroup(L): RngLocA → GrpPerm`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-decompositiongroup-rngloca)
  - [`InertiaGroup(L): RngLocA → GrpPerm`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-inertiagroup-rngloca)
  - [`RamificationGroup(L, i): RngLocA, RngIntElt → GrpPerm`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-ramificationgroup-rngloca-rngintelt)
  - [`FixedField(L, G): RngLocA, GrpPerm → RngLocA`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#function-fixedfield-rngloca-grpperm)
  - [Example: Automorphisms and Inertia Groups](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/galois.md#example-ex-180d7f)
- [Elements Operations](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md)
  - [`L ! r: RngLocA, Any → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-rngloca-any)
  - [`L . i: RngLocA, RngIntElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-operation-rngloca-rngintelt-rnglocaelt)
  - [`InertialElement(L): RngLocA → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-inertialelement-rngloca)
  - [`UniformizingElement(L): RngLocA → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-uniformizingelement-rngloca)
  - [Arithmetic](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#arithmetic)
    - [`a * b: RngLocAElt, RngLocAElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-times-rnglocaelt-rnglocaelt)
    - [`a + b: RngLocAElt, RngLocAElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-plus-rnglocaelt-rnglocaelt)
    - [`a - b: RngLocAElt, RngLocAElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-minus-rnglocaelt-rnglocaelt)
    - [`- a: RngLocAElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-operation-rnglocaelt-rnglocaelt)
    - [`a ^ n: RngLocAElt, RngIntElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-pow-rnglocaelt-rngintelt)
    - [`a / b: RngLocAElt, RngLocAElt → RngLocAElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-div-rnglocaelt-rnglocaelt)
  - [Predicates on Elements](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#predicates-on-elements)
    - [`a eq b: RngLocAElt, RngLocAElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#operation-op-eq-rnglocaelt-rnglocaelt)
    - [`IsOne(a): RngLocAElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-isone-rnglocaelt)
    - [`IsMinusOne(a): RngLocAElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-isminusone-rnglocaelt)
    - [`IsWeaklyZero(a): RngLocAElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-isweaklyzero-rnglocaelt)
    - [`IsZero(a): RngLocAElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-iszero-rnglocaelt)
  - [Other Operations on Elements](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#other-operations-on-elements)
    - [`Valuation(a): RngLocAElt → RngExtReElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-valuation-rnglocaelt)
    - [`RelativePrecision(a): RngLocAElt → RngExtReElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-relativeprecision-rnglocaelt)
    - [`Eltseq(a): RngLocAElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-eltseq-rnglocaelt)
    - [`RepresentationMatrix(a): RngLocAElt → AlgMatElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-representationmatrix-rnglocaelt)
    - [`Norm(a): RngLocAElt → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-norm-rnglocaelt)
    - [`Norm(a, F): RngLocAElt, Rng → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-norm-rnglocaelt-rng)
    - [`Trace(a): RngLocAElt → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-trace-rnglocaelt)
    - [`Trace(a, F): RngLocAElt, Rng → RngElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-trace-rnglocaelt-rng)
    - [`MinimalPolynomial(a): RngLocAElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-minimalpolynomial-rnglocaelt)
    - [`MinimalPolynomial(a, F): RngLocAElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#function-minimalpolynomial-rnglocaelt-2)
    - [Example: Uniformizing and Inertial Elements](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/elements.md#example-ex-0bf192)
- [Polynomial Factorization](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md)
  - [`Factorization(f): RngUPolElt[RngLocA] → SeqEnum, RngElt, Any`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md#function-factorization-rngupolelt-rngloca)
  - [`SuggestedPrecision(f): RngUPolElt[RngLocA] → RngIntElt`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md#function-suggestedprecision-rngupolelt-rngloca)
  - [`Roots(f): RngUPolElt[RngLocA] → SeqEnum`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md#function-roots-rngupolelt-rngloca)
  - [`Roots(f, R): RngUPolElt, RngLocA → SeqEnum`](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md#function-roots-rngupolelt-rngloca-2)
  - [Example: Factorization over a Local Field](https://docs.magma-maths.org/LocalFields/GeneralPAdicExtensions/poly_fact.md#example-ex-579903)

### Introduction

The local fields described in this chapter are extensions of any $p$-adic local field in Magma by any irreducible polynomial over that field. The polynomial defining the extension is not required to be inertial or eisenstein, in contrast to the (older) extensions of $p$-adic fields. This allows ramified and inertial extensions to be made in one step rather than forcing such an extension to be split into two – being a ramified extension and an unramified extension.

Only fields are implemented in this way – no construction of a ring of integers is provided (although `IntegralBasis` gives a basis for it as a module over the base ring).

These local fields have type `RngLocA` with elements of type `RngLocAElt`, while the local fields described in the previous chapter [$p$-Adic Rings and Their Extensions](https://docs.magma-maths.org/LocalFields/PAdicRingsAndTheirExtensions/index-padic-rings-and-their-extensions.md#rngloc) have type `FldPad`.

These fields (of type `RngLocA`) can be converted to the other representation (type `FldPad`) using `RamifiedRepresentation`, which returns an isomorphism between them. This can be used for calculations not supported for `RngLocA`.

### Constructions

The main construction is to extend a local field (of either type) by adjoining the root of a univariate polynomial. Another construction is of the subfield generated by given elements.

<a id="function-localfield-fldpad-rngupolelt"></a>
#### `LocalField(L, f): FldPad, RngUPolElt -> RngLocA`

<a id="function-localfield-rngloca-rngupolelt"></a>
#### `LocalField(L, f): RngLocA, RngUPolElt -> RngLocA`

Construct a local field $F$ as an extension of the local field $L$ by the polynomial $f$ over $L$.

<a id="example-ex-827f9a"></a>
#### `Example: One-Step Extension from a Two-Step Field (ex-827f9a)`

We can use the $2$ step local fields to help us find an irreducible polynomial over a $p$-adic field which can be used to extend that $p$-adic field in $1$ step.

```magma
> P<x> := PolynomialRing(Integers());
> Zp := pAdicRing(7, 50);
> U := UnramifiedExtension(Zp, x^2 + 6*x + 3);
> R := TotallyRamifiedExtension(U, x^3 + 7*x^2 + 7*x + 7);
> L<a> := LocalField(pAdicField(7, 50), MinimalPolynomial(R.1 + U.1, Zp));
> L;
Extension of 7-adic field mod 7^50 by x^6 + (32 + O(7^50))*x^5 + (390 +
    O(7^50))*x^4 + (2284 + O(7^50))*x^3 + (6588 + O(7^50))*x^2 + (8744 +
    O(7^50))*x + 5452 + O(7^50)
```

We can also use any irreducible polynomial we can find to define a $1$ step extension.

```magma
> LocalField(pAdicField(7, 50), x^6 - 49*x^2 + 686);
Extension of 7-adic field mod 7^50 by x^6 + O(7^50)*x^5 + O(7^50)*x^4 +
    O(7^50)*x^3 - (7^2 + O(7^52))*x^2 + O(7^50)*x + 2*7^3 + O(7^53)
```

<a id="constructor-constructor-sub-rngloca-rnglocaelt-rnglocaelt-rngloca"></a>
#### `sub< L | a₁, ..., aₙ >: RngLocA, RngLocAElt, ..., RngLocAElt -> RngLocA`

<a id="constructor-constructor-sub-rngloca-seqenum-rngloca"></a>
#### `sub< L | S>: RngLocA, SeqEnum -> RngLocA`

Construct the local field $F$ as a subfield of the local field $L$ containing the elements $a_i$ of $L$ or the elements of the sequence $S$.

<a id="example-ex-0823ac"></a>
#### `Example: Subfield Generated by an Element (ex-0823ac)`

```magma
> Qp := pAdicField(5, 20);
> P<x> := PolynomialRing(Qp);
> L<a> := LocalField(Qp, x^4 + 4*x^2 + 2);
> P<x> := PolynomialRing(L);
> LL<aa> := LocalField(L, x^4 + 4*L.1);
> r := (10236563738184*a^3 - 331496727861*a^2 + 10714284669258*a +
> 8590525712453*5)*aa^2
> -12574685904653*a^3 + 19786544763736*a^2 + 4956446023134*a + 37611818678747;
> S, m := sub< LL | r >;
> S;
Extension of Extension of 5-adic field mod 5^20 by x^4 + O(5^20)*x^3 + (4 +
    O(5^20))*x^2 + (4 + O(5^20))*x + 2 + O(5^20) by (O(5^20)*a^3 + O(5^20)*a^2 +
    O(5^20)*a + (1 + O(5^20)))*x^2 + (O(5^20)*a^3 + O(5^20)*a^2 + O(5^20)*a +
    O(5^20))*x + O(5^20)*a^3 + O(5^20)*a^2 + (4 + O(5^20))*a + O(5^20)
> m(S.1);
(O(5^20)*a^3 + O(5^20)*a^2 + O(5^20)*a + O(5^20))*aa^3 + (O(5^20)*a^3 +
    O(5^20)*a^2 + O(5^20)*a + (1 + O(5^20)))*aa^2 + (O(5^20)*a^3 + O(5^20)*a^2 +
    O(5^20)*a + O(5^20))*aa + O(5^20)*a^3 + O(5^20)*a^2 + O(5^20)*a + O(5^20)
```

### Operations with Fields

<a id="function-basering-rngloca"></a>
#### `BaseRing(L): RngLocA -> Rng`

<a id="function-coefficientring-rngloca"></a>
#### `CoefficientRing(L): RngLocA -> Rng`

Return the coefficient field of the local field $L$. This is the field which was extended to construct $L$.

<a id="function-definingpolynomial-rngloca"></a>
#### `DefiningPolynomial(L): RngLocA -> RngUPolElt`

Return the polynomial used to define the local field $L$ as an extension of its coefficient field.

<a id="function-degree-rngloca"></a>
#### `Degree(L): RngLocA -> RngIntElt`

Return the degree of the local field $L$, that is, the degree of its defining polynomial.

<a id="function-degree-rngloca-rng"></a>
#### `Degree(L, R): RngLocA, Rng -> RngIntElt`

Return the degree of $L$ as an extension of $R$ where $R$ is some coefficient ring of $L$.

<a id="function-inertiadegree-rngloca"></a>
#### `InertiaDegree(L): RngLocA -> RngIntElt`

<a id="function-ramificationdegree-rngloca"></a>
#### `RamificationDegree(L): RngLocA -> RngIntElt`

<a id="function-ramificationindex-rngloca"></a>
#### `RamificationIndex(L): RngLocA -> RngIntElt`

Return the degree of the inertial or totally ramified subfield of the local field $L$ as an extension of the coefficient field of $L$.

<a id="function-precision-rngloca"></a>
#### `Precision(L): RngLocA -> RngIntElt`

Return the precision of the local field $L$. This is the maximum number of digits which can occur in an element of $L$, the difference between the valuation of an element of $L$ and the valuation of the term of highest valuation occurring in that element.

<a id="function-prime-rngloca"></a>
#### `Prime(L): RngLocA -> RngElt`

Return the prime of the local field $L$. This is the same as the prime of the coefficient field of $L$.

<a id="example-ex-ef970a"></a>
#### `Example: Coefficient Ring and Defining Polynomial (ex-ef970a)`

Continuing from the first example we have :

```magma
> CoefficientRing(L);
7-adic field mod 7^50
> DefiningPolynomial(L);
$.1^6 + (32 + O(7^50))*$.1^5 + (390 + O(7^50))*$.1^4 + (2284 + O(7^50))*$.1^3 +
    (6588 + O(7^50))*$.1^2 + (8744 + O(7^50))*$.1 + 5452 + O(7^50)
> Precision(L);
150
> Prime(L);
7
> Degree(L); RamificationDegree(L); InertiaDegree(L);
6
3
2
```

<a id="function-quotientrepresentation-rngloca"></a>
#### `QuotientRepresentation(L): RngLocA -> RngUPolRes`

Return the polynomial quotient ring which is isomorphic to the local field $L$ and is used to represent $L$.

<a id="function-ramifiedrepresentation-rngloca"></a>
#### `RamifiedRepresentation(L): RngLocA -> FldPad, Map`

Return the local field isomorphic to the local field $L$ constructed as an unramified then a ramified extension and the map from $L$ into the isomorphic field.

<a id="example-ex-a41b45"></a>
#### `Example: Two-Step Representation of a Local Field (ex-a41b45)`

We create a $1$ step local field and compute its representation as a $2$ step local field.

```magma
> P<x> := PolynomialRing(Integers());
> L<a> := LocalField(pAdicField(7, 50), x^6 - 49*x^2 + 686);
> L;
Extension of 7-adic field mod 7^50 by x^6 + O(7^50)*x^5 + O(7^50)*x^4 +
    O(7^50)*x^3 - (7^2 + O(7^52))*x^2 + O(7^50)*x + 2*7^3 + O(7^53)
> QuotientRepresentation(L);
Univariate Quotient Polynomial Algebra in $.1 over 7-adic field mod 7^50
with modulus $.1^6 + O(7^50)*$.1^5 + O(7^50)*$.1^4 + O(7^50)*$.1^3 - (7^2 +
    O(7^52))*$.1^2 + O(7^50)*$.1 + 2*7^3 + O(7^53)
> RR, m := RamifiedRepresentation(L);
> RR;
Totally ramified extension defined by the polynomial x^2 +
    417092732355694537113348201703437033788663*$.1^2 +
    586194602218356762336379252895075698537137*$.1 -
    130094113224633998166887533755901214096597
 over Unramified extension defined by the polynomial x^3 + 6*x + 2
 over 7-adic field mod 7^50
> m(L.1);
RR.1 + O(RR.1^92)
> RR.1 @@ m;
O(7^48)*$.1^5 + O(7^48)*$.1^4 + O(7^49)*$.1^3 + O(7^49)*$.1^2 + $.1 + O(7^50)
> CoefficientRing(RR).1 @@ m;
O(7^34)*$.1^5 - (954564700580430506024960512238*7^-1 + O(7^35))*$.1^4 +
    O(7^36)*$.1^3 + (1031213687115590174398504554631*7^-1 + O(7^35))*$.1^2 +
    O(7^37)*$.1 + 131284877366067295106350173568*7 + O(7^36)
```

<a id="procedure-assignnames-rngloca-seqenum-monstgelt-ref"></a>
#### `AssignNames(~L, S): RngLocA, SeqEnum[MonStgElt]`

Assign the name in the sequence $S$ to the generator of the extension defining the local field $L$.

<a id="function-name-rngloca-rngintelt"></a>
#### `Name(L, i): RngLocA, RngIntElt -> RngLocAElt`

Return the generator of the local field $L$ which has assigned to it the name in the sequence $S$ which was input to `AssignNames`. The only valid input for $i$ is $1$.

<a id="function-discriminant-rngloca"></a>
#### `Discriminant(L): RngLocA -> RngElt`

Return the discriminant of the local field $L$.

<a id="function-residueclassfield-rngloca"></a>
#### `ResidueClassField(L): RngLocA -> Rng, Map`

Return the residue class field of the maximal order of the local field $L$ and the map between $L$ and its residue class field.

<a id="function-relativefield-rngloca-map"></a>
#### `RelativeField(L, m): RngLocA, Map -> RngLocA, Map, Map`

Return $L$ as an extension of the domain of the map $m$ which should be a map from a subfield of $L$ (having the same coefficient ring as $L$) into $L$.

#### Predicates on Fields

<a id="function-isramified-rngloca"></a>
##### `IsRamified(L): RngLocA -> BoolElt`

Return whether the local field $L$ has a non trivial ramified subfield, that is, the ramification degree of $L$ is greater than $1$.

<a id="function-istamelyramified-rngloca"></a>
##### `IsTamelyRamified(L): RngLocA -> BoolElt`

<a id="function-iswildlyramified-rngloca"></a>
##### `IsWildlyRamified(L): RngLocA -> BoolElt`

Return whether the local field $L$ is tamely or wildly ramified.

<a id="function-istotallyramified-rngloca"></a>
##### `IsTotallyRamified(L): RngLocA -> BoolElt`

Return whether the local field $L$ is a totally ramified extension, that is, $L$ has a trivial inertial subfield.

<a id="function-isunramified-rngloca"></a>
##### `IsUnramified(L): RngLocA -> BoolElt`

Return whether the local field $L$ is equal to its inertial subfield.

### Maximal Order

<a id="function-integralbasis-rngloca"></a>
#### `IntegralBasis(L): RngLocA -> SeqEnum`

Return a basis for the maximal order of the local field $L$.

<a id="function-isintegral-rnglocaelt"></a>
#### `IsIntegral(a): RngLocAElt -> BoolElt, SeqEnum`

Return whether the local field element $a$ lies in the maximal order of its parent $L$ and a sequence giving the coordinates of $a$ with respect to the integral basis of $L$ if so.

<a id="example-ex-9bf4a2"></a>
#### `Example: Integral Basis of a Local Field (ex-9bf4a2)`

We construct a local field and compute an integral basis for it.

```magma
> P<x> := PolynomialRing(Integers());
> L := LocalField(pAdicField(7, 50), x^6 - 49*x^2 + 686);
> IntegralBasis(L);
[ 1 + O(7^50), (7^-1 + O(7^49))*$.1^2 + O(7^49)*$.1 + O(7^49), (7^-2 +
    O(7^48))*$.1^4 + O(7^48)*$.1^3 + O(7^48)*$.1^2 + O(7^50)*$.1 + O(7^50), $.1
    + O(7^50), (7^-1 + O(7^49))*$.1^3 + O(7^49)*$.1^2 + O(7^49)*$.1 + O(7^99),
    (7^-2 + O(7^48))*$.1^5 + O(7^48)*$.1^4 + O(7^48)*$.1^3 + O(7^50)*$.1^2 +
    O(7^50)*$.1 + O(7^50) ]
```

### Homomorphisms

<a id="constructor-constructor-hom-rngloca-rng-rngelt-map"></a>
#### `hom< L -> R | a >: RngLocA, Rng, RngElt -> Map`

<a id="constructor-constructor-hom-rngloca-rng-map-rngelt-map"></a>
#### `hom< L -> R | cfm, a >: RngLocA, Rng, Map, RngElt -> Map`

Return the homomorphism from the local field $L$ into the ring $R$ whose image of the generator of $L$ is $a$ and whose action on the coefficient field of $L$ is given by $cfm$ if given.

### Automorphisms and Galois Theory

<a id="function-frobeniusautomorphism-rngloca"></a>
#### `FrobeniusAutomorphism(L): RngLocA -> Map`

Return the automorphism of the unramified extension $L$ which is the lift of the frobenius automorphism on the residue class field of $L$.

<a id="function-automorphismgroup-rngloca"></a>
#### `AutomorphismGroup(L): RngLocA -> Grp, Map`

Return the automorphism group of the local field $L$ and a map from the group to the parent of automorphisms of $L$.

<a id="function-decompositiongroup-rngloca"></a>
#### `DecompositionGroup(L): RngLocA -> GrpPerm`

<a id="function-inertiagroup-rngloca"></a>
#### `InertiaGroup(L): RngLocA -> GrpPerm`

<a id="function-ramificationgroup-rngloca-rngintelt"></a>
#### `RamificationGroup(L, i): RngLocA, RngIntElt -> GrpPerm`

Return the subgroup of the automorphism group of the local field $L$ whose elements are the automorphisms (represented as group elements) $\sigma$ such that $v(\sigma(z) - z) \ge i + 1$. The decomposition group is the $-1$th ramification group and the inertia group is the $0$th ramification group.

<a id="function-fixedfield-rngloca-grpperm"></a>
#### `FixedField(L, G): RngLocA, GrpPerm -> RngLocA`

Return the subfield of the local field $L$ which is fixed by the automorphisms (represented as group elements) in the subgroup $G$ of the automorphism group of $L$.

<a id="example-ex-180d7f"></a>
#### `Example: Automorphisms and Inertia Groups (ex-180d7f)`

The automorphism and inertia groups of a local field are computed and their fixed fields examined.

```magma
> P<x> := PolynomialRing(Integers());
> L := LocalField(pAdicField(7, 50), x^6 - 49*x^2 + 686);
> A, am := AutomorphismGroup(L);
> am(Random(A));
Mapping from: RngLocA: L to RngLocA: L
> $1(L.1);
-(279674609046925265141076018485*7^-2 + O(7^34))*$.1^5 + O(7^35)*$.1^4 +
    (1035905251748988129458881464123*7^-1 + O(7^35))*$.1^3 + O(7^36)*$.1^2 -
    (1009443907710864908501983735501 + O(7^36))*$.1 + O(7^37)
> FixedField(L, A);
Extension of 7-adic field mod 7^50 by (1 + O(7^33))*x + O(7^33)
> InertiaGroup(L);
Permutation group acting on a set of cardinality 6
    Id($)
    (1, 2)(3, 5)(4, 6)
> FixedField(L, InertiaGroup(L));
Extension of 7-adic field mod 7^50 by (1 + O(7^37))*x^3 - (2*7^2 + O(7^37))*x^2
    + (7^4 + O(7^37))*x - 4*7^6 + O(7^37)
```

### Elements Operations

<a id="operation-op-rngloca-any"></a>
#### `L ! r: RngLocA, Any -> RngLocAElt`

Return the element of the local field $L$ described by $r$ where $r$ may be anything which is coercible into the quotient representation of $L$.

<a id="operation-operation-rngloca-rngintelt-rnglocaelt"></a>
#### `L . i: RngLocA, RngIntElt -> RngLocAElt`

Return the generator of the local field $L$. The only valid input for $i$ is $1$.

<a id="function-inertialelement-rngloca"></a>
#### `InertialElement(L): RngLocA -> RngLocAElt`

Return a generator for the inertial subfield of the local field $L$.

<a id="function-uniformizingelement-rngloca"></a>
#### `UniformizingElement(L): RngLocA -> RngLocAElt`

Return an element of the local field $L$ of valuation $1$.

#### Arithmetic

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

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

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

<a id="operation-operation-rnglocaelt-rnglocaelt"></a>
##### `- a: RngLocAElt -> RngLocAElt`

<a id="operation-op-pow-rnglocaelt-rngintelt"></a>
##### `a ^ n: RngLocAElt, RngIntElt -> RngLocAElt`

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

#### Predicates on Elements

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

Return whether the local field elements $a$ and $b$ are considered equal.

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

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

Return whether the local field element $a$ is known to be $1$ or $-1$ to the precision of the field.

<a id="function-isweaklyzero-rnglocaelt"></a>
##### `IsWeaklyZero(a): RngLocAElt -> BoolElt`

Return whether the local field element $a$ is not known to be non zero.

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

Return whether the local field element $a$ is known to be zero.

#### Other Operations on Elements

<a id="function-valuation-rnglocaelt"></a>
##### `Valuation(a): RngLocAElt -> RngExtReElt`

The valuation of the element $a$ in a local field.

<a id="function-relativeprecision-rnglocaelt"></a>
##### `RelativePrecision(a): RngLocAElt -> RngExtReElt`

The relative precision of the element $a$ in a local field.

<a id="function-eltseq-rnglocaelt"></a>
##### `Eltseq(a): RngLocAElt -> SeqEnum`

Return the coefficients of powers of the generator of the parent of $a$ in $a$.

<a id="function-representationmatrix-rnglocaelt"></a>
##### `RepresentationMatrix(a): RngLocAElt -> AlgMatElt`

The representation matrix of the element $a$ of a local field.

<a id="function-norm-rnglocaelt"></a>
##### `Norm(a): RngLocAElt -> RngElt`

<a id="function-norm-rnglocaelt-rng"></a>
##### `Norm(a, F): RngLocAElt, Rng -> RngElt`

<a id="function-trace-rnglocaelt"></a>
##### `Trace(a): RngLocAElt -> RngElt`

<a id="function-trace-rnglocaelt-rng"></a>
##### `Trace(a, F): RngLocAElt, Rng -> RngElt`

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

<a id="function-minimalpolynomial-rnglocaelt-2"></a>
##### `MinimalPolynomial(a, F): RngLocAElt -> RngUPolElt`

Return the norm, trace, or minimal polynomial of $a$. If a coefficient field $F$ of the parent $L$ of $a$ is given then the norm, trace, or minimal polynomial will be that of $a$ as an element of $L$ represented as an extension of $F$.

<a id="example-ex-0bf192"></a>
##### `Example: Uniformizing and Inertial Elements (ex-0bf192)`

Continuing from the first example we have :

```magma
> UniformizingElement(L);
a^2 + (6 + O(7^50))*a + 3 + O(7^50)
> InertialElement(L);
a + O(7^50)
> Valuation(UniformizingElement(L));
1
> Valuation(InertialElement(L));
0
> Eltseq(UniformizingElement(L));
[ 3 + O(7^50), 6 + O(7^50), 1 + O(7^50) ]
```

### Polynomial Factorization

Polynomials over local fields can be factored and their roots computed.

<a id="function-factorization-rngupolelt-rngloca"></a>
#### `Factorization(f): RngUPolElt[RngLocA] -> SeqEnum, RngElt, Any`

```magma
Certificates: BoolElt                    Default: false
```

The factorization of the polynomial $f$ over a local field defined by an arbitrary polynomial. The factorization is returned as a sequence of tuples of prime polynomials and exponents along with a scalar factor. If the parameter `Certificates` is `true` then certificates proving the primality of each prime are also returned.

<a id="function-suggestedprecision-rngupolelt-rngloca"></a>
#### `SuggestedPrecision(f): RngUPolElt[RngLocA] -> RngIntElt`

For a polynomial $f$ over a general local field, return a precision at which the factorization of $f$ as given by `Factorization(f)` will be Hensel liftable to the correct factorization.

The precision returned is not guaranteed to be enough to obtain a factorization of the polynomial. It may be that a correct factorization cannot be found at that precision but may be possible with a little more precision.

<a id="function-roots-rngupolelt-rngloca"></a>
#### `Roots(f): RngUPolElt[RngLocA] -> SeqEnum`

<a id="function-roots-rngupolelt-rngloca-2"></a>
#### `Roots(f, R): RngUPolElt, RngLocA -> SeqEnum`

The roots of the polynomial $f$ over the general local field $R$ where $R$ is taken to be the coefficient ring of $f$ if it is not given.

<a id="example-ex-579903"></a>
#### `Example: Factorization over a Local Field (ex-579903)`

```magma
> Q3:=pAdicField(3,40);
> Q3X<x>:=PolynomialRing(Q3);
> L<a>:=LocalField(Q3,x^6-6*x^4+9*x^2-27);
> Factorization(Polynomial(L,x^6-6*x^4+9*x^2-27));
[
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (5*3^35 + O(3^38))*a^5 + O(3^38)*a^4 - (10*3^36 +
        O(3^39))*a^3 + O(3^39)*a^2 + (2701703435345984179 + O(3^40))*a +
        O(3^40), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 +
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 - (116512378274*3 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 +
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 - (349537134821 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + -(5*3^35 + O(3^38))*a^5 + O(3^38)*a^4 + (10*3^36 +
        O(3^39))*a^3 + O(3^39)*a^2 - (2701703435345984179 + O(3^40))*a +
        O(3^40), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 -
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 + (116512378274*3 +
        O(3^25))*a + O(3^26), 1>,
    <(O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + (1 +
        O(3^40)))*$.1 + (29642867960*3^-1 + O(3^23))*a^5 + O(3^24)*a^4 -
        (148214339800*3^-1 + O(3^24))*a^3 + O(3^25)*a^2 + (349537134821 +
        O(3^25))*a + O(3^26), 1>
]
O(3^38)*a^5 + O(3^38)*a^4 + O(3^39)*a^3 + O(3^39)*a^2 + O(3^40)*a + 1 + O(3^40)
```

<a id="series-power-laurent"></a>
<a id="rngser"></a>
## Power, Laurent, and Puiseux Series

- [Introduction](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md)
  - [Kinds of Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#kinds-of-series)
  - [Puiseux Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#puiseux-series)
  - [Representation of Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#representation-of-series)
  - [Precision](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#precision)
  - [Free and Fixed Precision](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#free-and-fixed-precision)
  - [Equality](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#equality)
  - [Polynomials over Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/introduction.md#polynomials-over-series-rings)
- [Creation Functions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md)
  - [Creation of Structures](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#creation-of-structures)
    - [`PowerSeriesRing(R): Rng → RngSerPow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-powerseriesring-rng)
    - [`PowerSeriesRing(R, p): Rng, RngIntElt → RngSerPow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-powerseriesring-rng-rngintelt)
    - [`LaurentSeriesRing(R): Rng → RngSerLaur`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-laurentseriesring-rng)
    - [`LaurentSeriesRing(R, p): Rng, RngIntElt → RngSerLaur`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-laurentseriesring-rng-rngintelt)
    - [`PuiseuxSeriesRing(R): Rng → RngSerPuis`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-puiseuxseriesring-rng)
    - [`PuiseuxSeriesRing(R, p): Rng, RngIntElt → RngSerPuis`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-puiseuxseriesring-rng-rngintelt)
    - [Example: Global and Non-Global Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#example-ex-f4cf13)
  - [Special Options](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#special-options)
    - [`AssertAttribute(S, "DefaultPrecision", n): RngSer, MonStgElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#procedure-assertattribute-rngser-monstgelt-rngintelt-defaultprecision)
    - [`HasAttribute(S, "DefaultPrecision"): RngSer, MonStgElt → BoolElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-hasattribute-rngser-monstgelt-defaultprecision)
    - [`AssignNames(~S, ["x"]): RngSer, [ MonStgElt ]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#procedure-assignnames-rngser-monstgelt-x-ref)
    - [`Name(S, 1): RngSer, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-name-rngser-rngintelt)
    - [`S . 1: RngSer, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#operation-operation-rngser-rngintelt-rngserelt)
    - [`Name(S, 1): RngSer, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-name-rngser-rngintelt-2)
    - [`S . 1: RngSer, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#operation-operation-rngser-rngintelt-rngserelt-2)
  - [Creation of Elements](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#creation-of-elements)
    - [`R . 1: RngSer, RngInt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#operation-operation-rngser-rngint-rngserelt)
    - [`UniformizingElement(R): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-uniformizingelement-rngser)
    - [`elt< R | v, [ a₁, ..., a_d], p >: RngIntElt, SeqEnum, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#constructor-constructor-elt-rngintelt-seqenum-rngintelt-rngserelt)
    - [`R ! s: RngSer, SeqEnum → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#operation-op-rngser-seqenum)
    - [`BigO(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-bigo-rngserelt)
    - [`O(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-o-rngserelt)
    - [`One(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-one-rngser)
    - [`One(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-one-rngser-2)
    - [`Identity(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-identity-rngser)
    - [`Identity(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-identity-rngser-2)
    - [`Zero(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-zero-rngser)
    - [`Zero(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-zero-rngser-2)
    - [`Representative(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-representative-rngser)
    - [`Representative(Q): RngSer → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/creation.md#function-representative-rngser-2)
- [Structure Operations](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md)
  - [Related Structures](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#related-structures)
    - [`Parent(R): RngSer → Pow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-parent-rngser)
    - [`Category(R): RngSer → Cat`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-category-rngser)
    - [`BaseRing(R): RngSer → Rng`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-basering-rngser)
    - [`CoefficientRing(R): RngSer → Rng`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-coefficientring-rngser)
    - [`IntegerRing(R): RngSer → RngSerPow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-integerring-rngser)
    - [`Integers(R): RngSer → RngSerPow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-integers-rngser)
    - [`RingOfIntegers(R): RngSer → RngSerPow`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-ringofintegers-rngser)
    - [`FieldOfFractions(R): RngSer → RngSerLaur`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-fieldoffractions-rngser)
    - [`ChangePrecision(R, r): RngSer, Any → RngSer`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-changeprecision-rngser-any)
    - [`ChangePrecision(~R, r): RngSer, Any → RngSer`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-changeprecision-rngser-any-ref)
    - [`ChangeRing(R, C): RngSer, Rng → RngSer, Map`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-changering-rngser-rng)
    - [`ResidueClassField(R): RngSer → Rng, Map`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-residueclassfield-rngser)
  - [Invariants](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#invariants)
    - [`Characteristic(R): RngSer → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-characteristic-rngser)
    - [`Precision(R): RngSer → ExtReElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-precision-rngser)
    - [`GetPrecision(R): RngSer → ExtReElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-getprecision-rngser)
  - [Ring Predicates and Booleans](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#ring-predicates-and-booleans)
    - [`IsCommutative(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-iscommutative-rngser)
    - [`IsUnitary(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isunitary-rngser)
    - [`IsFinite(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isfinite-rngser)
    - [`IsOrdered(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isordered-rngser)
    - [`IsField(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isfield-rngser)
    - [`IsEuclideanDomain(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-iseuclideandomain-rngser)
    - [`IsPID(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-ispid-rngser)
    - [`IsUFD(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isufd-rngser)
    - [`IsDivisionRing(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isdivisionring-rngser)
    - [`IsEuclideanRing(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-iseuclideanring-rngser)
    - [`IsPrincipalIdealRing(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isprincipalidealring-rngser)
    - [`IsDomain(Q): RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#function-isdomain-rngser)
    - [`R eq S: RngSer, RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#operation-op-eq-rngser-rngser)
    - [`R ne S: RngSer, RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md#operation-op-ne-rngser-rngser)
- [Basic Element Operations](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md)
  - [Parent and Category](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#parent-and-category)
    - [`Parent(r): RngSerElt → RngSer`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-parent-rngserelt)
    - [`Category(r): RngSerElt → Cat`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-category-rngserelt)
  - [Arithmetic Operators](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#arithmetic-operators)
    - [`+ b: RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-operation-rngserelt-rngserelt)
    - [`- b: RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-operation-rngserelt-rngserelt-2)
    - [`a + b: RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-plus-rngserelt-rngserelt)
    - [`a - b: RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-minus-rngserelt-rngserelt)
    - [`a * b: RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-times-rngserelt-rngserelt)
    - [`a ^ k: RngSerElt, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-pow-rngserelt-rngintelt)
    - [`a div b: RngSerPowElt, RngSerPowElt → RngSerPowElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-operation-div-rngserpowelt-rngserpowelt-rngserpowelt)
    - [`a / b: RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-div-rngserelt-rngserelt)
  - [Equality and Membership](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#equality-and-membership)
    - [`a eq b: RngSerElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-eq-rngserelt-rngserelt)
    - [`a ne b: RngSerElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-ne-rngserelt-rngserelt)
    - [`a in R: RngSerElt, RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-in-rngserelt-rngser)
    - [`a notin R: RngSerElt, RngSer → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#operation-op-notin-rngserelt-rngser)
  - [Predicates on Ring Elements](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#predicates-on-ring-elements)
    - [`IsZero(a): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-iszero-rngserelt)
    - [`IsOne(a): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isone-rngserelt)
    - [`IsMinusOne(a): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isminusone-rngserelt)
    - [`IsNilpotent(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isnilpotent-rngserelt)
    - [`IsIdempotent(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isidempotent-rngserelt)
    - [`IsUnit(a): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isunit-rngserelt)
    - [`IsZeroDivisor(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-iszerodivisor-rngserelt)
    - [`IsRegular(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isregular-rngserelt)
    - [`IsIrreducible(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isirreducible-rngserelt)
    - [`IsPrime(x): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isprime-rngserelt)
    - [`IsWeaklyZero(f): RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isweaklyzero-rngserelt)
    - [`IsWeaklyEqual(f, g): RngSerElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isweaklyequal-rngserelt-rngserelt)
    - [`IsIdentical(f, g): RngSerElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-isidentical-rngserelt-rngserelt)
  - [Precision](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#precision)
    - [`AbsolutePrecision(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-absoluteprecision-rngserelt)
    - [`RelativePrecision(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-relativeprecision-rngserelt)
    - [`ChangePrecision(f, r): RngSerElt, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-changeprecision-rngserelt-rngintelt)
    - [`ChangePrecision(f, r): RngSerElt, Infty → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-changeprecision-rngserelt-infty)
    - [`ChangePrecision(~f, r): RngSerElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#procedure-changeprecision-rngserelt-rngintelt-ref)
    - [`ChangePrecision(~f, r): RngSerElt, Infty`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#procedure-changeprecision-rngserelt-infty-ref)
  - [Coefficients and Degree](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#coefficients-and-degree)
    - [`Coefficients(f): RngSerElt → [ RngElt ], RngIntElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-coefficients-rngserelt)
    - [`ElementToSequence(f): RngSerElt → [ RngElt ], RngIntElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-elementtosequence-rngserelt)
    - [`Eltseq(f): RngSerElt → [ RngElt ], RngIntElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-eltseq-rngserelt)
    - [`Coefficient(f, i): RngSerElt, RngElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-coefficient-rngserelt-rngelt)
    - [`LeadingCoefficient(f): RngSerElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-leadingcoefficient-rngserelt)
    - [`LeadingTerm(f): RngSerElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-leadingterm-rngserelt)
    - [`Truncate(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-truncate-rngserelt)
    - [`ExponentDenominator(f): RngMSerElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-exponentdenominator-rngmserelt)
    - [`Degree(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-degree-rngserelt)
    - [`Valuation(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-valuation-rngserelt)
    - [`ExponentDenominator(f): RngSerElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-exponentdenominator-rngserelt)
  - [Evaluation and Derivative](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#evaluation-and-derivative)
    - [`Derivative(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-derivative-rngserelt)
    - [`Derivative(f, n): RngSerElt, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-derivative-rngserelt-rngintelt)
    - [`Integral(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-integral-rngserelt)
    - [`Evaluate(f, s): RngSerElt, RngElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-evaluate-rngserelt-rngelt)
    - [`Laplace(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-laplace-rngserelt)
  - [Square Root](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#square-root)
    - [`SquareRoot(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-squareroot-rngserelt)
    - [`Sqrt(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-sqrt-rngserelt)
  - [Composition and Reversion](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#composition-and-reversion)
    - [`Composition(f, g): RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-composition-rngserelt-rngserelt)
    - [`Reversion(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-reversion-rngserelt)
    - [`Reverse(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-reverse-rngserelt)
    - [`Convolution(f, g): RngSerElt, RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#function-convolution-rngserelt-rngserelt)
    - [Example: Composition and Reversion of Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md#example-ex-cad173)
- [Transcendental Functions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md)
  - [Exponential and Logarithmic Functions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#exponential-and-logarithmic-functions)
    - [`Exp(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-exp-rngserelt)
    - [`Log(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-log-rngserelt)
    - [Example: Bernoulli Numbers from Generating Functions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#example-ex-739f49)
  - [Trigonometric Functions and their Inverses](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#trigonometric-functions-and-their-inverses)
    - [`Sin(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-sin-rngserelt)
    - [`Cos(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-cos-rngserelt)
    - [`Sincos(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-sincos-rngserelt)
    - [`Tan(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-tan-rngserelt)
    - [`Arcsin(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-arcsin-rngserelt)
    - [`Arccos(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-arccos-rngserelt)
    - [`Arctan(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-arctan-rngserelt)
  - [Hyperbolic Functions and their Inverses](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#hyperbolic-functions-and-their-inverses)
    - [`Sinh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-sinh-rngserelt)
    - [`Cosh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-cosh-rngserelt)
    - [`Tanh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-tanh-rngserelt)
    - [`Argsinh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-argsinh-rngserelt)
    - [`Argcosh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-argcosh-rngserelt)
    - [`Argtanh(f): RngSerElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md#function-argtanh-rngserelt)
- [The Hypergeometric Series](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/hypergeometric.md)
  - [`HypergeometricSeries(a,b,c, z): RngElt, RngElt, RngElt, RngElt → RngElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/hypergeometric.md#function-hypergeometricseries-rngelt-rngelt-rngelt-rngelt)
- [Polynomials over Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md)
  - [`HenselLift(f, L): RngUPolElt[RngSer], SeqEnum[RngUPolElt] → [RngUPolElt]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#function-hensellift-rngupolelt-rngser-seqenum-rngupolelt)
  - [`HenselLift(f, L): RngUPolElt[RngSerExt], SeqEnum[RngUPolElt] → [RngUPolElt]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#function-hensellift-rngupolelt-rngserext-seqenum-rngupolelt)
  - [`Factorization(f): RngUPolElt[RngSerPow[FldFin]] → [ < RngUPolElt[RngSerPow], RngIntElt > ], RngSerPowElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#function-factorization-rngupolelt-rngserpow-fldfin)
  - [`Factorization(f): RngUPolElt[RngSerLaur[FldFin]] → [ < RngUPolElt[RngSerLaur], RngIntElt > ], RngSerLaurElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#function-factorization-rngupolelt-rngserlaur-fldfin)
  - [`Factorization(f): RngUPolElt[RngSerExt] → [ < RngUPolElt[RngSerExt], RngIntElt > ], RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#function-factorization-rngupolelt-rngserext)
  - [Example: Factorization over Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#example-ex-32baab)
- [Extensions of Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md)
  - [Constructions of Extensions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#constructions-of-extensions)
    - [`UnramifiedExtension(R, f): RngSerPow[FldFin], RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-unramifiedextension-rngserpow-fldfin-rngupolelt)
    - [`UnramifiedExtension(R, f): RngSerLaur[FldFin], RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-unramifiedextension-rngserlaur-fldfin-rngupolelt)
    - [`UnramifiedExtension(R, f): RngSerExt, RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-unramifiedextension-rngserext-rngupolelt)
    - [`TotallyRamifiedExtension(R, f): RngSerPow[FldFin], RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-totallyramifiedextension-rngserpow-fldfin-rngupolelt)
    - [`TotallyRamifiedExtension(R, f): RngSerLaur[FldFin], RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-totallyramifiedextension-rngserlaur-fldfin-rngupolelt)
    - [`TotallyRamifiedExtension(R, f): RngSerExt, RngUPolElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-totallyramifiedextension-rngserext-rngupolelt)
    - [`ChangePrecision(E, r): RngSerExt, RngIntElt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-changeprecision-rngserext-rngintelt)
    - [`ChangePrecision(~E, r): RngSerExt, RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#procedure-changeprecision-rngserext-rngintelt-ref)
    - [`FieldOfFractions(E): RngSerExt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-fieldoffractions-rngserext)
    - [Example: Two-Step Extension of a Series Ring](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#example-ex-0fa010)
  - [Operations on Extensions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operations-on-extensions)
    - [`Precision(E): RngSerExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-precision-rngserext)
    - [`GetPrecision(E): RngSerExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-getprecision-rngserext)
    - [`CoefficientRing(E): RngSerExt → Rng`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-coefficientring-rngserext)
    - [`BaseRing(E): RngSerExt → Rng`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-basering-rngserext)
    - [`DefiningPolynomial(E): RngSerExt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-definingpolynomial-rngserext)
    - [`InertiaDegree(E): RngSerExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-inertiadegree-rngserext)
    - [`RamificationIndex(E): RngSerExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-ramificationindex-rngserext)
    - [`RamificationDegree(E): RngSerExt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-ramificationdegree-rngserext)
    - [`ResidueClassField(E): RngSerExt → FldFin`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-residueclassfield-rngserext)
    - [`UniformizingElement(E): RngSerExt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-uniformizingelement-rngserext)
    - [`IntegerRing(E): RngSerExt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-integerring-rngserext)
    - [`Integers(E): RngSerExt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-integers-rngserext)
    - [`RingOfIntegers(E): RngSerExt → RngSerExt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-ringofintegers-rngserext)
    - [`E1 eq E2: RngSerExt, RngSerExt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-eq-rngserext-rngserext)
    - [`E . i: RngSerExt, RngIntElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-operation-rngserext-rngintelt-rngserextelt)
    - [`AssignNames(~E, S): RngSerExt, [ MonStgElt ]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#procedure-assignnames-rngserext-monstgelt-ref)
    - [Example: Operations on Series Ring Extensions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#example-ex-b88c0a)
  - [Elements of Extensions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#elements-of-extensions)
    - [`x * y: RngSerExtElt, RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-times-rngserextelt-rngserextelt)
    - [`x + y: RngSerExtElt, RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-plus-rngserextelt-rngserextelt)
    - [`x - y: RngSerExtElt, RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-minus-rngserextelt-rngserextelt)
    - [`- x: RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-operation-rngserextelt-rngserextelt)
    - [`x ^ n: RngSerExtElt, RngIntElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-pow-rngserextelt-rngintelt)
    - [`x div y: RngSerExtElt, RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-operation-div-rngserextelt-rngserextelt-rngserextelt)
    - [`x / y: RngSerExtElt, RngSerExtElt → RngSerExtElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-div-rngserextelt-rngserextelt)
    - [`x eq y: RngSerExtElt, RngSerExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#operation-op-eq-rngserextelt-rngserextelt)
    - [`IsZero(e): RngSerExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-iszero-rngserextelt)
    - [`IsOne(e): RngSerExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-isone-rngserextelt)
    - [`IsMinusOne(e): RngSerExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-isminusone-rngserextelt)
    - [`IsUnit(e): RngSerExtElt → BoolElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-isunit-rngserextelt)
    - [`Valuation(e): RngSerExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-valuation-rngserextelt)
    - [`RelativePrecision(e): RngSerExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-relativeprecision-rngserextelt)
    - [`AbsolutePrecision(e): RngSerExtElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-absoluteprecision-rngserextelt)
    - [`Coefficients(e): RngSerExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-coefficients-rngserextelt)
    - [`Eltseq(e): RngSerExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-eltseq-rngserextelt)
    - [`ElementToSequence(e): RngSerExtElt → [ RngElt ]`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-elementtosequence-rngserextelt)
    - [Example: Arithmetic in Series Ring Extensions](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#example-ex-77b403)
  - [Optimized Representation](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#optimized-representation)
    - [`OptimizedRepresentation(E): RngSerExt → RngSer, Map`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-optimizedrepresentation-rngserext)
    - [`OptimisedRepresentation(E): RngSerExt → RngSer, Map`](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#function-optimisedrepresentation-rngserext)
    - [Example: Optimized Representation of an Extension](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/extensions.md#example-ex-95694d)
- [Bibliography](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/bibliography.md)

### Introduction

This chapter describes the operations on formal power, Laurent, and Puiseux series available in Magma.

#### Kinds of Series

Internally Magma has only one kind of formal series, where general fractional exponents are allowed, but externally there are three kinds of series: power, Laurent, and Puiseux. Power series must have a non-negative integral valuation and integral exponents, Laurent series must have an integral valuation and integral exponents (possibly negative), while Puiseux series may have a general rational valuation and general rational exponents. The main reason for the three kinds is simply to supply error checking for operations illegal to a specific kind, so the user will not move into the next kind of exponents inadvertently. Apart from these error checks, there is no difference at all between the different kinds of series, so one can simply use Puiseux series always if the restrictions on exponents are not desired, and this will cause no loss of efficiency or functionality at all even if all exponents remain integral or integral and non-negative. In Magma, the set of all power series over a given base ring $R$ is called a power series ring (denoted by $R[[x]]$) and the category names are `RngSerPow` for the ring and `RngSerPowElt` for the elements. The set of all Laurent series over a given base ring $R$ is called a Laurent series ring (denoted by $R((x))$) and the category names are `RngSerLaur` for the ring and `RngSerLaurElt` for the elements. Finally, the set of all Puiseux series over a given base ring $R$ is called a Puiseux series ring (denoted by $R\langle \langle x\rangle \rangle$) and the category names are `RngSerPuis` for the ring and `RngSerPuisElt` for the elements. For the rest of this chapter, the term “series ring” refers to any of the above rings and the corresponding virtual category name is `RngSer`; the term “series” refers to any of the above series kinds and the corresponding virtual category name is `RngSerElt`.

#### Puiseux Series

Puiseux series in a variable $x$ are often mathematically defined to be Laurent series in another variable $y$ say, where $y=x^{1/d}$, for a fixed positive integer $d$; this $d$ is usually fixed for all the series under consideration. Magma is more general, in that although each series is internally represented in this way (i.e., its valuation, exponents, and precision are thought to be divided by a single denominator associated with it), different Puiseux series may have different exponent denominators and may be freely mixed (for example, in addition, where the exponent denominator of the result will be derived from that of the arguments). Thus there is no restriction whatsoever to a fixed exponent denominator for a given Puiseux series ring.

#### Representation of Series

Formal series are stored in truncated form, unless only finitely many terms are non-zero. If a series has precision $p$, that means that its coefficients are unknown from exponent $p$ onwards. This truncated form is similar to the floating point representation of real numbers except for one significant difference: because for series terms do not “carry” in arithmetic operations like they do in integer and real arithmetic, error propagation common in floating point methods does not occur. Consequently, given a result of any sequence of arithmetic operations with formal series, the coefficients of the known terms (the ones up to the given precision) will always be *exactly correct*, with no error (assuming the coefficient ring has exact arithmetic for its elements of course). Elements

$$
c_{v}x^{v}+c_{v+1}x^{v+1}+\ldots
$$

(with $v\in{\mathbb{Q}}$ and $r_v\neq 0$) of series ring over a commutative ring $R$ are stored in the form of approximations

$$
c_{v}x^{v}+c_{v+1}x^{v+1}+\ldots+O(x^p)
$$

to a certain *precision* $p\geq v$. The $O(x^p)$ notation is used to refer to terms of degree at least the precision $p$ in $x$. For Laurent series $v$ must be an integer and for power series $v$ must be a non-negative integer. Note that for Puiseux series the above element is actually internally stored in the form

$$
c_{w}x^{w/d}+c_{w+1}x^{(w+1)/d}+\ldots+O(x^{q/d})
$$

where $v=w/d$ and $p=q/d$ and $d$ (the exponent denominator) is minimal.

#### Precision

Associated with any series there are two types of precision: the *absolute precision* and the *relative precision*. For the element

$$
c_{v}x^{v}+c_{v+1}x^{v+1}+\cdots+O(x^p)
$$

(with $v\in{\mathbb{Q}}$ and $r_v\neq 0$), the absolute precision is $p$ and the relative precision is $p-v$. The absolute precision indicates the largest known term, and the relative precision indicates the size of the range over which terms are known. The two types of precision and the *valuation* of the series, which equals $v$ in the above, are therefore always related via $p=v+r$.

#### Free and Fixed Precision

For each type of series ring, there are two sub-kinds: a *free precision* ring (the usual case), where elements of the ring have arbitrary precision, and a *fixed precision* ring, where all elements of the ring have a fixed precision. In the latter case, for power series rings the fixed precision is absolute, while for Laurent and Puiseux series ring the fixed precision is relative. The free precision rings most closely resemble the mathematical objects $R[[x]]$ and $R((x))$; elements in these free rings and fields carry their own precision with them. Operations usually return results to a precision that is maximal given the input (and the nature of the operation). Operations which are given infinite precision series but which must return finite precision series (e.g., division) return series whose precision is the *default* precision for the series ring (this is different from the fixed precision of fixed precision rings); the default precision is $20$ by default but may be set to another value at creation by a parameter (see below). Elements of free structures that have finite series expansion (i.e., polynomials) can be created and stored exactly, with infinite (absolute and relative) precision. Also note that the relative precision will be $0$ for approximations to $0$. The structures with fixed precision, which we will sometimes refer to as *quotient* structures, behave differently. All elements in a *power* series ring of fixed precision have the same fixed *absolute* precision $p$, and the relative precision may be anything from $0$ to $p$. This means that the ring with fixed precision $p$ behaves like a quotient of a polynomial ring, $R[x]/x^p$. All elements in a *Laurent* or *Puiseux* series ring of fixed precision have the same fixed *relative* precision; the only exception to this rule is that $0$ in the ring is stored as zero with infinite absolute precision. The absolute precision of elements in a free Laurent or Puiseux series ring can be anything.

#### Equality

Since a given series ring will contain series truncated at arbitrary precision, care has to be taken as to the meaning of equality of two elements. Two series are considered equal iff they are identical (the equality operator `eq` follows this convention). But we call two series $A$ and $B$ in the same ring *weakly equal* if and only if their coefficients are the same whenever both are defined, that is, if and only if for every $n\leq p$ the coefficients $A_n$ and $B_n$ are equal, where $p$ is the minimum of the precisions of $A$ and $B$. Thus, for example, $A=3+x+O(x^2)$ and $B=3+x+17x^2+O(x^4)$ are the same, but $C=3+x+17x^2+x^3+O(x^4)$ is different from $B$. Note that $A$ and $C$ are equal under this definition, and hence weak equality is not transitive!

#### Polynomials over Series Rings

For a discussion of operations for polynomials over series rings see Chapter [Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/index-newton-polygons.md#newtonpgon) and Section [Polynomials over Series Rings](https://docs.magma-maths.org/LocalFields/PowerLaurentAndPuiseuxSeries/polynomials.md#rngser-poly).

### Creation Functions

#### Creation of Structures

<a id="function-powerseriesring-rng"></a>
##### `PowerSeriesRing(R): Rng -> RngSerPow`

<a id="function-powerseriesring-rng-rngintelt"></a>
##### `PowerSeriesRing(R, p): Rng, RngIntElt -> RngSerPow`

```magma
Global   : BoolElt                      Default: true
Precision: RngIntElt                    Default: 20
```

Given a commutative ring $R$, create the ring $R[[x]]$ of formal power series over $R$. If a second integer argument $p$ is given, the resulting ring is a fixed precision series ring with fixed precision $p$; otherwise the resulting ring is a free precision series ring and the optional argument `Precision` may be used to set the default precision for elements of the power series ring (it will be $20$ otherwise; see the section above on free and fixed precision). By default, a global series ring will be returned; if the parameter `Global` is set to `false`, a non-global series ring will be returned (to which a separate name for the indeterminate can be assigned). The angle bracket notation can be used to assign a name to the indeterminate: `S<x> := PowerSeriesRing(R)`.

<a id="function-laurentseriesring-rng"></a>
##### `LaurentSeriesRing(R): Rng -> RngSerLaur`

<a id="function-laurentseriesring-rng-rngintelt"></a>
##### `LaurentSeriesRing(R, p): Rng, RngIntElt -> RngSerLaur`

```magma
Global   : BoolElt                      Default: true
Precision: RngIntElt                    Default: 20
```

Given a commutative ring $R$, create the ring $R((x))$ of formal Laurent series over $R$. If a second integer argument $p$ is given, the resulting ring is a fixed precision series ring with fixed precision $p$; otherwise the resulting ring is a free precision series ring and the optional argument `Precision` may be used to set the default precision for elements of the power series ring (it will be $20$ otherwise; see the section above on free and fixed precision). By default, a global series ring will be returned; if the parameter `Global` is set to `false`, a non-global series ring will be returned (to which a separate name for the indeterminate can be assigned). The angle bracket notation can be used to assign a name to the indeterminate: `S<x> := LaurentSeriesRing(R)`.

<a id="function-puiseuxseriesring-rng"></a>
##### `PuiseuxSeriesRing(R): Rng -> RngSerPuis`

<a id="function-puiseuxseriesring-rng-rngintelt"></a>
##### `PuiseuxSeriesRing(R, p): Rng, RngIntElt -> RngSerPuis`

```magma
Global   : BoolElt                      Default: true
Precision: RngIntElt                    Default: 20
```

Given a commutative ring $R$, create the ring $R\langle \langle x\rangle \rangle$ of formal Puiseux series over $R$. If a second integer argument $p$ is given, the resulting ring is a fixed precision series ring with fixed precision $p$; otherwise the resulting ring is a free precision series ring and the optional argument `Precision` may be used to set the default precision for elements of the power series ring (it will be $20$ otherwise; see the section above on free and fixed precision). The optional argument `Precision` may be used to set the default precision for elements of the power series ring. By default, a global series ring will be returned; if the parameter `Global` is set to `false`, a non-global series ring will be returned (to which a separate name for the indeterminate can be assigned). The angle bracket notation can be used to assign a name to the indeterminate: `S<x> := PuiseuxSeriesRing(R)`.

<a id="example-ex-f4cf13"></a>
##### `Example: Global and Non-Global Series Rings (ex-f4cf13)`

We demonstrate the difference between global and non-global rings. We first create the global power series ring over ${\mathbb{Q}}$ twice.

```magma
> Q := RationalField();
> P<x> := PowerSeriesRing(Q);
> PP := PowerSeriesRing(Q);
> P;
Power series ring in x over Rational Field
> PP;
Power series ring in x over Rational Field
> PP.1;
x
```

$PP$ is identical to $P$. We now create non-global series rings (which are also different to the global series ring). Note that elements of all the rings are mathematically equal by automatic coercion.

```magma
> Pa<a> := PowerSeriesRing(Q: Global := false);
> Pb<b> := PowerSeriesRing(Q: Global := false);
> Pa;
Power series ring in a over Rational Field
> Pb;
Power series ring in b over Rational Field
> a;
a
> b;
b
> P;
Power series ring in x over Rational Field
> x;
x
> x eq a; // Automatic coercion
true
> x + a;
2*x
```

#### Special Options

<a id="procedure-assertattribute-rngser-monstgelt-rngintelt-defaultprecision"></a>
##### `AssertAttribute(S, "DefaultPrecision", n): RngSer, MonStgElt, RngIntElt`

Procedure to change the default precision on a free series ring series $S$; the default precision will be set to $n$, which must be a non-negative integer.

<a id="function-hasattribute-rngser-monstgelt-defaultprecision"></a>
##### `HasAttribute(S, "DefaultPrecision"): RngSer, MonStgElt -> BoolElt, RngIntElt`

Function that returns a Boolean indicating whether a default precision has been set on the free series ring $S$ (which will always be `true`), as well as its (non-negative) integer value (which is $20$ by default).

<a id="procedure-assignnames-rngser-monstgelt-x-ref"></a>
##### `AssignNames(~S, ["x"]): RngSer, [ MonStgElt ]`

Procedure to change the name of the ‘indeterminate’ transcendental element generating the series ring or field $S$; the name (used in printing elements of $S$) is changed to the string $x$. Note that no assignment to the identifier $x$ is made (so $x$ cannot be used for the specification of elements of $S$ without further assignment).

<a id="function-name-rngser-rngintelt"></a>
##### `Name(S, 1): RngSer, RngIntElt -> RngSerElt`

<a id="operation-operation-rngser-rngintelt-rngserelt"></a>
##### `S . 1: RngSer, RngIntElt -> RngSerElt`

<a id="function-name-rngser-rngintelt-2"></a>
##### `Name(S, 1): RngSer, RngIntElt -> RngSerElt`

<a id="operation-operation-rngser-rngintelt-rngserelt-2"></a>
##### `S . 1: RngSer, RngIntElt -> RngSerElt`

Return the element of the series ring or field with a name attached to it, that is, return the ‘indeterminate’ transcendental element generating $S$ over its coefficient ring.

#### Creation of Elements

The easiest way to create power and Laurent series in a given ring is to use the angle bracket construction to attach names to the indeterminate, and to use these names to express the series (see the examples). Below we list other options.

<a id="operation-operation-rngser-rngint-rngserelt"></a>
##### `R . 1: RngSer, RngInt -> RngSerElt`

<a id="function-uniformizingelement-rngser"></a>
##### `UniformizingElement(R): RngSer -> RngSerElt`

Return the generator (indeterminate) for the series ring $R$.

<a id="constructor-constructor-elt-rngintelt-seqenum-rngintelt-rngserelt"></a>
##### `elt< R | v, [ a₁, ..., a_d], p >: RngIntElt, SeqEnum, RngIntElt -> RngSerElt`

Given a series ring $R$, integers $v$ and $p$ (where $p > 0$ or $p = \infty$), and a sequence $a=[a_1, \ldots, a_d]$ of elements of $R$, create the element in $R$ with valuation $v$, known coefficients given by $a$ and relative precision $p$. That is, this function returns the series $a_1x^v+\cdots+a_dx^{v+d-1}+O(x^{v+p})$, or, if $p = {-1}$, the exact series $a_1x^v+\cdots+a_dx^{v+d-1}$. If $R$ is a power series ring, then $v$ must be non-negative. The integer $v$ or the integer $p$ or both may be omitted. If $v$ is omitted, it will be set to zero by default; if $p$ is omitted it will be taken to be $v+d$, where $d$ is the length of the sequence $a$.

<a id="operation-op-rngser-seqenum"></a>
##### `R ! s: RngSer, SeqEnum -> RngSerElt`

Coerce $s$ into the series ring $R$. Here $s$ is allowed to be a sequence of elements from (or coercible into) the coefficient ring of $R$, or just an element from (or coercible into) $R$. A sequence $[a_1, \ldots, a_d]$ is converted into the series $a_1+a_2x^1+\cdots+a_dx^{d-1}+O(x^d)$.

<a id="function-bigo-rngserelt"></a>
##### `BigO(f): RngSerElt -> RngIntElt`

<a id="function-o-rngserelt"></a>
##### `O(f): RngSerElt -> RngIntElt`

Create the series $O(x^v)$ where $x$ is the generator of the parent of $f$ and $v$ is the valuation of $f$. The most typical usage of this function is the expression $O(x^n)$ where $x$ is the generator of a series ring, but a general series $f$ is actually allowed.

<a id="function-one-rngser"></a>
##### `One(Q): RngSer -> RngSerElt`

<a id="function-one-rngser-2"></a>
##### `One(Q): RngSer -> RngSerElt`

<a id="function-identity-rngser"></a>
##### `Identity(Q): RngSer -> RngSerElt`

<a id="function-identity-rngser-2"></a>
##### `Identity(Q): RngSer -> RngSerElt`

<a id="function-zero-rngser"></a>
##### `Zero(Q): RngSer -> RngSerElt`

<a id="function-zero-rngser-2"></a>
##### `Zero(Q): RngSer -> RngSerElt`

<a id="function-representative-rngser"></a>
##### `Representative(Q): RngSer -> RngSerElt`

<a id="function-representative-rngser-2"></a>
##### `Representative(Q): RngSer -> RngSerElt`

### Structure Operations

#### Related Structures

<a id="function-parent-rngser"></a>
##### `Parent(R): RngSer -> Pow`

<a id="function-category-rngser"></a>
##### `Category(R): RngSer -> Cat`

<a id="function-basering-rngser"></a>
##### `BaseRing(R): RngSer -> Rng`

<a id="function-coefficientring-rngser"></a>
##### `CoefficientRing(R): RngSer -> Rng`

Return the coefficient ring of the series ring $R$.

<a id="function-integerring-rngser"></a>
##### `IntegerRing(R): RngSer -> RngSerPow`

<a id="function-integers-rngser"></a>
##### `Integers(R): RngSer -> RngSerPow`

<a id="function-ringofintegers-rngser"></a>
##### `RingOfIntegers(R): RngSer -> RngSerPow`

Return the power series ring which is the integer ring of the laurent series ring $R$.

<a id="function-fieldoffractions-rngser"></a>
##### `FieldOfFractions(R): RngSer -> RngSerLaur`

Return the laurent series ring which is the field of fractions of the series ring $R$.

<a id="function-changeprecision-rngser-any"></a>
##### `ChangePrecision(R, r): RngSer, Any -> RngSer`

<a id="function-changeprecision-rngser-any-ref"></a>
##### `ChangePrecision(~R, r): RngSer, Any -> RngSer`

Return a series ring identical to the series ring $R$ but having precision $r$.

<a id="function-changering-rngser-rng"></a>
##### `ChangeRing(R, C): RngSer, Rng -> RngSer, Map`

Return the series ring identical to the series ring $R$ but having coefficient ring $C$.

<a id="function-residueclassfield-rngser"></a>
##### `ResidueClassField(R): RngSer -> Rng, Map`

Return the residue class field of the series ring $R$ (which will be the same as the coefficient ring of $R$) and the map from $R$ into the residue class field.

#### Invariants

<a id="function-characteristic-rngser"></a>
##### `Characteristic(R): RngSer -> RngIntElt`

<a id="function-precision-rngser"></a>
##### `Precision(R): RngSer -> ExtReElt`

<a id="function-getprecision-rngser"></a>
##### `GetPrecision(R): RngSer -> ExtReElt`

Return the precision of the fixed precision series ring $R$. If $R$ is a fixed precision power series ring, then this is the fixed absolute precision for all elements of the ring. If $R$ is a fixed precision Laurent series ring, then this is the maximum relative precision for all elements of the ring.

#### Ring Predicates and Booleans

<a id="function-iscommutative-rngser"></a>
##### `IsCommutative(Q): RngSer -> BoolElt`

<a id="function-isunitary-rngser"></a>
##### `IsUnitary(Q): RngSer -> BoolElt`

<a id="function-isfinite-rngser"></a>
##### `IsFinite(Q): RngSer -> BoolElt`

<a id="function-isordered-rngser"></a>
##### `IsOrdered(Q): RngSer -> BoolElt`

<a id="function-isfield-rngser"></a>
##### `IsField(Q): RngSer -> BoolElt`

<a id="function-iseuclideandomain-rngser"></a>
##### `IsEuclideanDomain(Q): RngSer -> BoolElt`

<a id="function-ispid-rngser"></a>
##### `IsPID(Q): RngSer -> BoolElt`

<a id="function-isufd-rngser"></a>
##### `IsUFD(Q): RngSer -> BoolElt`

<a id="function-isdivisionring-rngser"></a>
##### `IsDivisionRing(Q): RngSer -> BoolElt`

<a id="function-iseuclideanring-rngser"></a>
##### `IsEuclideanRing(Q): RngSer -> BoolElt`

<a id="function-isprincipalidealring-rngser"></a>
##### `IsPrincipalIdealRing(Q): RngSer -> BoolElt`

<a id="function-isdomain-rngser"></a>
##### `IsDomain(Q): RngSer -> BoolElt`

<a id="operation-op-eq-rngser-rngser"></a>
##### `R eq S: RngSer, RngSer -> BoolElt`

<a id="operation-op-ne-rngser-rngser"></a>
##### `R ne S: RngSer, RngSer -> BoolElt`

### Basic Element Operations

#### Parent and Category

<a id="function-parent-rngserelt"></a>
##### `Parent(r): RngSerElt -> RngSer`

<a id="function-category-rngserelt"></a>
##### `Category(r): RngSerElt -> Cat`

#### Arithmetic Operators

<a id="operation-operation-rngserelt-rngserelt"></a>
##### `+ b: RngSerElt -> RngSerElt`

<a id="operation-operation-rngserelt-rngserelt-2"></a>
##### `- b: RngSerElt -> RngSerElt`

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

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

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

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

<a id="operation-operation-div-rngserpowelt-rngserpowelt-rngserpowelt"></a>
##### `a div b: RngSerPowElt, RngSerPowElt -> RngSerPowElt`

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

#### Equality and Membership

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

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

<a id="operation-op-in-rngserelt-rngser"></a>
##### `a in R: RngSerElt, RngSer -> BoolElt`

<a id="operation-op-notin-rngserelt-rngser"></a>
##### `a notin R: RngSerElt, RngSer -> BoolElt`

#### Predicates on Ring Elements

Note the definition of equality in the introduction to this Chapter. This not only affects the result of the application of `eq` and `ne`, but also that of `IsOne, IsZero` and `IsMinusOne`.

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

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

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

<a id="function-isnilpotent-rngserelt"></a>
##### `IsNilpotent(x): RngSerElt -> BoolElt`

<a id="function-isidempotent-rngserelt"></a>
##### `IsIdempotent(x): RngSerElt -> BoolElt`

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

<a id="function-iszerodivisor-rngserelt"></a>
##### `IsZeroDivisor(x): RngSerElt -> BoolElt`

<a id="function-isregular-rngserelt"></a>
##### `IsRegular(x): RngSerElt -> BoolElt`

<a id="function-isirreducible-rngserelt"></a>
##### `IsIrreducible(x): RngSerElt -> BoolElt`

<a id="function-isprime-rngserelt"></a>
##### `IsPrime(x): RngSerElt -> BoolElt`

<a id="function-isweaklyzero-rngserelt"></a>
##### `IsWeaklyZero(f): RngSerElt -> BoolElt`

Given a series $f$, return whether $f$ is weakly zero, which is whether $f$ is exactly zero or of the form $O(x^p)$ for some $p$.

<a id="function-isweaklyequal-rngserelt-rngserelt"></a>
##### `IsWeaklyEqual(f, g): RngSerElt, RngSerElt -> BoolElt`

Given series $f$ and $g$, return whether $f$ is weakly equal to $g$, which is whether ($f-g$) is weakly zero (see `IsWeaklyZero`).

<a id="function-isidentical-rngserelt-rngserelt"></a>
##### `IsIdentical(f, g): RngSerElt, RngSerElt -> BoolElt`

Given series $f$ and $g$, return whether $f$ is identical to $g$, which is whether $f$ and $g$ have exactly the same valuation, precision, and coefficients.

#### Precision

<a id="function-absoluteprecision-rngserelt"></a>
##### `AbsolutePrecision(f): RngSerElt -> RngIntElt`

Given a series $f$, this returns the absolute precision that is stored with $f$. If $f$ is a series in $x$, the absolute precision of $f$ is the exponent $p$ such that $x^p$ is the first term of $f$ of which the coefficient is not known, that is, it is the least $p$ such that $f\in O(x^p)$. If $f$ is known exactly (in a free ring), the absolute precision is infinite and an error occurs. Note that the absolute precision may be a non-integral rational number if $f$ is a Puiseux series.

<a id="function-relativeprecision-rngserelt"></a>
##### `RelativePrecision(f): RngSerElt -> RngIntElt`

Given a series $f$, this returns the relative precision that is stored with $f$. The relative precision counts the number of coefficients of $f$ that is known, starting at the first non-zero term. Hence the relative precision is the difference between the absolute precision and the valuation of $f$, and is therefore always non-negative; however, if $f$ is exact, the relative precision is infinite and the value $\infty$ is returned. Note that the relative precision may be a non-integral rational number if $f$ is a Puiseux series.

<a id="function-changeprecision-rngserelt-rngintelt"></a>
##### `ChangePrecision(f, r): RngSerElt, RngIntElt -> RngSerElt`

<a id="function-changeprecision-rngserelt-infty"></a>
##### `ChangePrecision(f, r): RngSerElt, Infty -> RngSerElt`

<a id="procedure-changeprecision-rngserelt-rngintelt-ref"></a>
##### `ChangePrecision(~f, r): RngSerElt, RngIntElt`

<a id="procedure-changeprecision-rngserelt-infty-ref"></a>
##### `ChangePrecision(~f, r): RngSerElt, Infty`

The (non puiseux) series $f$ with absolute precision $r$ (which can be positive infinity).

#### Coefficients and Degree

<a id="function-coefficients-rngserelt"></a>
##### `Coefficients(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt`

<a id="function-elementtosequence-rngserelt"></a>
##### `ElementToSequence(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt`

<a id="function-eltseq-rngserelt"></a>
##### `Eltseq(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt`

Let $f$ be a series with coefficients in a ring $R$ and with indeterminate $x$. This function returns the sequence $Q$ of coefficients of $f$, the unscaled valuation $v$, and the exponent denominator $d$ of $f$ ($v$ is the true valuation of $f$ multiplied by $d$). The $i$-th entry $Q[i]$ of $Q$ equals the coefficient of $x^{{v+i-1}\over{d}}$ in $f$. Thus the first entry of $Q$ is the ‘first’ (lowest order) non-zero coefficient of $f$, i.e., the coefficient of $x^w$ where $w$ is the true valuation of $f$.

<a id="function-coefficient-rngserelt-rngelt"></a>
##### `Coefficient(f, i): RngSerElt, RngElt -> RngElt`

Given a series $f$ with coefficients in a ring $R$, and a rational or integer $i$, return the coefficient of the $i$-th power of the indeterminate $x$ of $f$ as an element of $R$. If $f$ is a Puiseux series $i$ may be a (non-integral) rational; otherwise $i$ must be an integer (and also must be non-negative if $f$ is a power series). Also, $i$ must be less than $p$, the precision of $f$.

<a id="function-leadingcoefficient-rngserelt"></a>
##### `LeadingCoefficient(f): RngSerElt -> RngElt`

Given a series $f$ with coefficients in a ring $R$, return the leading coefficient of $f$ as an element of $R$, which is the first non-zero coefficient of $f$ (i.e., the coefficient $x^v$ in $f$, where $x$ is the indeterminate of $f$ and $v$ is the valuation of $f$).

<a id="function-leadingterm-rngserelt"></a>
##### `LeadingTerm(f): RngSerElt -> RngElt`

Given a series $f$ with coefficients in a ring $R$, return the leading term of $f$, which is the first non-zero term of $f$ (i.e., the term of $f$ whose monomial is $x^v$, where $x$ is the indeterminate of $f$ and $v$ is the valuation of $f$).

<a id="function-truncate-rngserelt"></a>
##### `Truncate(f): RngSerElt -> RngSerElt`

Given a series $f$, return the exact series obtained by truncating $f$ after the last known non-zero coefficient.

<a id="function-exponentdenominator-rngmserelt"></a>
##### `ExponentDenominator(f): RngMSerElt -> RngElt`

Given a series $f$, return the exponent denominator of $f$, i.e., the lowest common denominator of all the exponents of the non-zero terms of $f$ (always an integer). For power series and Laurent series, this will always be $1$ of course.

<a id="function-degree-rngserelt"></a>
##### `Degree(f): RngSerElt -> RngIntElt`

Given a series $f$, return the degree of the truncation of $f$, that is, the exponent of the last known non-zero term. Note that this may be a non-integral rational number if $f$ is a Puiseux series.

<a id="function-valuation-rngserelt"></a>
##### `Valuation(f): RngSerElt -> RngIntElt`

Given a series $f$, return the smallest integer $v$ (possibly negative for Laurent series) such that the coefficient of $x^v$ in $f$ is not known to be zero. For the exact $0$ element (in a free ring), the valuation is $\infty$. Note that the valuation may be a non-integral rational number if $f$ is a Puiseux series.

<a id="function-exponentdenominator-rngserelt"></a>
##### `ExponentDenominator(f): RngSerElt -> RngIntElt`

The exponent denominator of the series $f$. This is the lowest common denominator of the exponents of the non-zero terms of $f$.

#### Evaluation and Derivative

<a id="function-derivative-rngserelt"></a>
##### `Derivative(f): RngSerElt -> RngSerElt`

Given a series $f\in R$, return the derivative of $f$ with respect to its indeterminate, as an element of $R$. Note that the precision decreases by 1 (unless $f$ has infinite precision).

<a id="function-derivative-rngserelt-rngintelt"></a>
##### `Derivative(f, n): RngSerElt, RngIntElt -> RngSerElt`

Given a series $f\in R$ and an integer $n > 0$, return the $n$-th derivative of $f$ with respect to its indeterminate, as an element of $R$. Note that the precision decreases by $n$ (unless $f$ has infinite precision).

<a id="function-integral-rngserelt"></a>
##### `Integral(f): RngSerElt -> RngSerElt`

Given a series $f\in R$, return an anti-derivative $F$ of $f$ with respect to its indeterminate, which is an element of $R$ which has derivative $f$. The coefficient of $x^{-1}$ in $f$ must be zero. Note that the precision of $F$ will be exceeding that of $f$ by 1 (unless $f$ has infinite precision).

<a id="function-evaluate-rngserelt-rngelt"></a>
##### `Evaluate(f, s): RngSerElt, RngElt -> RngElt`

Given an element $f$ of a series ring over the coefficient ring $R$, and an element $s$ of the ring $S$, return the value of $f(s)$ when the indeterminate $x$ is evaluated at $s$. The result will be an element of the common overstructure over $R$ and $S$.

<a id="function-laplace-rngserelt"></a>
##### `Laplace(f): RngSerElt -> RngSerElt`

The Laplace transform of the series $f$; if $f$ has expansion $\sum_{i\geq 0} a_ix^i$, its Laplace transform has expansion $\sum_{i\geq 0} (i!a_i)x^i$. The valuation of $f$ must be integral and non-negative.

#### Square Root

<a id="function-squareroot-rngserelt"></a>
##### `SquareRoot(f): RngSerElt -> RngSerElt`

<a id="function-sqrt-rngserelt"></a>
##### `Sqrt(f): RngSerElt -> RngSerElt`

Return the square root of the series $f$, $f$ must have even valuation if it is a power or Laurent series.

#### Composition and Reversion

<a id="function-composition-rngserelt-rngserelt"></a>
##### `Composition(f, g): RngSerElt, RngSerElt -> RngSerElt`

Given elements $f$ and $g$ from the same series ring $P$, return their composition, defined by

$$
f\circ g = \sum_{i < p}f_i(g^i),
$$

where $f=\sum_{i < p} f_ix^i$.

<a id="function-reversion-rngserelt"></a>
##### `Reversion(f): RngSerElt -> RngSerElt`

<a id="function-reverse-rngserelt"></a>
##### `Reverse(f): RngSerElt -> RngSerElt`

Given a series $f$ (in $x$, say), this returns the inverse of $f$ under composition, that is, an element $g$ of the same power series ring such that its composition with $f$ equals $x$ to the best possible precision. If $f$ is a power or Laurent series, the valuation of $f$ must be 1. If $f$ is a Puiseux series, the valuation of $f$ must be positive (but need not equal 1), and if the valuation of $f$ is not 1, the leading coefficient of $f$ must be 1.

<a id="function-convolution-rngserelt-rngserelt"></a>
##### `Convolution(f, g): RngSerElt, RngSerElt -> RngSerElt`

Given elements $f$ and $g$ from the same series ring $P$, return their convolution $f\ast g$, defined by

$$
f\ast g = \sum_{i < \min(p,q)}f_ig_ix^i,
$$

where $f=\sum_{i < p} f_ix^i+O(x^p)$ and $g=\sum_{i < q}g_ix^i+O(x^q)$.

<a id="example-ex-cad173"></a>
##### `Example: Composition and Reversion of Series (ex-cad173)`

We demonstrate the functions `Composition` and `Reversion`. First we check that `Arcsin` is the reversion of `Sin`.

```magma
> S<x> := PowerSeriesRing(RationalField());
> f := Sin(x);
> g := Arcsin(x);
> f;
x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 -
    1/39916800*x^11 + 1/6227020800*x^13 - 1/1307674368000*x^15 +
    1/355687428096000*x^17 - 1/121645100408832000*x^19 + O(x^21)
> g;
x + 1/6*x^3 + 3/40*x^5 + 5/112*x^7 + 35/1152*x^9 + 63/2816*x^11 +
    231/13312*x^13 + 143/10240*x^15 + 6435/557056*x^17 +
    12155/1245184*x^19 + O(x^21)
> Composition(f, g);
x + O(x^21)
> Composition(g, f);
x + O(x^21)
> Reversion(f) - g;
O(x^21)
> Reversion(g) - f;
O(x^21)
```

Next we compute the reversion of a series whose valuation is not 1.

```magma
> S<x> := PuiseuxSeriesRing(RationalField());
> f := x^3 - x^5 + 2*x^8;
> r := Reversion(f);
> f;
x^3 - x^5 + 2*x^8
> r;
x^(1/3) + 1/3*x + 4/9*x^(5/3) - 2/3*x^2 + 65/81*x^(7/3) -
    22/9*x^(8/3) + 5/3*x^3 - 208/27*x^(10/3) + 5005/729*x^(11/3)
    - 70/3*x^4 + 206264/6561*x^(13/3) - 50830/729*x^(14/3) +
    134*x^5 - 498674/2187*x^(16/3) + 31389020/59049*x^(17/3) +
    O(x^6)
> Composition(r, f);
x + O(x^18)
> Composition(f, r);
x + O(x^(20/3))
```

Finally we compute the reversion of a proper Puiseux series.

```magma
> f := x^(2/5) - x^(2/3) + x^(3/2) + O(x^2);
> r := Reversion(f);
> r;
x^(5/2) + 5/2*x^(19/6) + 145/24*x^(23/6) + 715/48*x^(9/2) +
    389795/10368*x^(31/6) - 5/2*x^(21/4) + O(x^(11/2))
> Composition(f, r);
x + O(x^4)
> Composition(r, f);
x + O(x^(11/5))
```

### Transcendental Functions

In each of the functions below, the precision of the result will be approximately equal to the precision of the argument if that is finite; otherwise it will be approximately equal to the default precision of the parent of the argument. An error will result if the coefficient ring of the series is not a field. If the first argument has a non-zero constant term, an error will result unless the coefficient ring of the parent is a real or complex domain (so that the transcendental function can be evaluated in the constant term). See also the chapter on real and complex fields for elliptic and modular functions which are also defined for formal series.

#### Exponential and Logarithmic Functions

<a id="function-exp-rngserelt"></a>
##### `Exp(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field, return the exponential of $f$.

<a id="function-log-rngserelt"></a>
##### `Log(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the logarithm of $f$. The valuation of $f$ must be zero.

<a id="example-ex-739f49"></a>
##### `Example: Bernoulli Numbers from Generating Functions (ex-739f49)`

In this example we show how one can compute the Bernoulli number $B_{n}$ for given $n$ using generating functions. The function `BernoulliNumber` now actually uses this method (since V2.4). Using this method, the Bernoulli number $B_{10000}$ has been computed, taking about 14 hours on a 250MHz Sun Ultrasparc (the computation depends on the new asymptotically fast methods for series division).

The exponential generating function for the Bernoulli numbers is:

$$
E(x) = {x \over {e^x - 1}}.
$$

This means that the $n$-th Bernoulli number $B_n$ is $n!$ times the coefficient of $x^n$ in $E(x)$. The Bernoulli numbers $B_0, \ldots, B_n$ for any $n$ can thus be calculated by computing the above power series and scaling the coefficients.

In this example we will compute $B_{500}$. We first set the final coefficient index $n$ we desire to be 500. We then create the denominator $D = e^x - 1$ of the exponential generating function to precision $n + 2$ (we need $n+2$ since we lose precision when we divide by the denominator and the valuation changes). For each series we create, we print the sum of it and ${\rm O}(x^{20}$), which will only print the terms up to $x^{19}$.

```magma
> n := 500;
> S<x> := LaurentSeriesRing(RationalField(), n + 2);
> time D := Exp(x) - 1;
Time: 0.040
> D + O(x^20);
x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + 1/5040*x^7 +
    1/40320*x^8 + 1/362880*x^9 + 1/3628800*x^10 + 1/39916800*x^11 +
    1/479001600*x^12 + 1/6227020800*x^13 + 1/87178291200*x^14 +
    1/1307674368000*x^15 + 1/20922789888000*x^16 + 1/355687428096000*x^17 +
    1/6402373705728000*x^18 + 1/121645100408832000*x^19 + O(x^20)
```

We then form the quotient $E=x/D$ which gives the exponential generating function.

```magma
> time E := x / D;
Time: 5.330
> E + O(x^20);
1 - 1/2*x + 1/12*x^2 - 1/720*x^4 + 1/30240*x^6 - 1/1209600*x^8 +
    1/47900160*x^10 - 691/1307674368000*x^12 + 1/74724249600*x^14 -
    3617/10670622842880000*x^16 + 43867/5109094217170944000*x^18 + O(x^20)
```

We finally compute the Laplace transform of $E$ (which multiplies the coefficient of $x^i$ by $i!$) to yield the generating function of the Bernoulli numbers up to the $x^n$ term. Thus the coefficient of $x^{n}$ here is $B_{n}$.

```magma
> time B := Laplace(E);
Time: 0.289
> B + O(x^20);
1 - 1/2*x + 1/6*x^2 - 1/30*x^4 + 1/42*x^6 - 1/30*x^8 + 5/66*x^10 -
    691/2730*x^12 + 7/6*x^14 - 3617/510*x^16 + 43867/798*x^18 + O(x^20)
> Coefficient(B, n);
-16596380640568557229852123088077134206658664302806671892352650993155331641220\\
960084014956088135770921465025323942809207851857992860213463783252745409096420\\
932509953165466735675485979034817619983727209844291081908145597829674980159889\\
976244240633746601120703300698329029710482600069717866917229113749797632930033\\
559794717838407415772796504419464932337498642714226081743688706971990010734262\\
076881238322867559275748219588404488023034528296023051638858467185173202483888\\
794342720837413737644410765563213220043477396887812891242952336301344808165757\\
942109887803692579439427973561487863524556256869403384306433922049078300720480\\
361757680714198044230522015775475287075315668886299978958150756677417180004362\\
981454396613646612327019784141740499835461/8365830
> n;
500
```

#### Trigonometric Functions and their Inverses

<a id="function-sin-rngserelt"></a>
##### `Sin(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the sine of $f$. The valuation of $f$ must be zero.

<a id="function-cos-rngserelt"></a>
##### `Cos(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the cosine of $f$. The valuation of $f$ must be zero.

<a id="function-sincos-rngserelt"></a>
##### `Sincos(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return both the sine and cosine of $f$. The valuation of $f$ must be zero.

<a id="function-tan-rngserelt"></a>
##### `Tan(f): RngSerElt -> RngSerElt`

Return the tangent of the series $f$ defined over a field.

<a id="function-arcsin-rngserelt"></a>
##### `Arcsin(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the inverse sine of $f$.

<a id="function-arccos-rngserelt"></a>
##### `Arccos(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over the real or complex field, return the inverse cosine of $f$.

<a id="function-arctan-rngserelt"></a>
##### `Arctan(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the inverse tangent of $f$.

#### Hyperbolic Functions and their Inverses

<a id="function-sinh-rngserelt"></a>
##### `Sinh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field, return the hyperbolic sine of $f$.

<a id="function-cosh-rngserelt"></a>
##### `Cosh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field, return the hyperbolic cosine of $f$.

<a id="function-tanh-rngserelt"></a>
##### `Tanh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field, return the hyperbolic tangent of $f$.

<a id="function-argsinh-rngserelt"></a>
##### `Argsinh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the inverse hyperbolic sine of $f$.

<a id="function-argcosh-rngserelt"></a>
##### `Argcosh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over the real or complex field, return the inverse hyperbolic cosine of $f$.

<a id="function-argtanh-rngserelt"></a>
##### `Argtanh(f): RngSerElt -> RngSerElt`

Given a series $f$ defined over a field of characteristic zero, return the inverse hyperbolic tangent of $f$.

### The Hypergeometric Series

For more information on the Hypergeometric Series, see [[Hus87](https://docs.magma-maths.org/references.md#cite-husem87)], page 176.

<a id="function-hypergeometricseries-rngelt-rngelt-rngelt-rngelt"></a>
#### `HypergeometricSeries(a, b, c, z): RngElt, RngElt, RngElt, RngElt -> RngElt`

Return the hypergeometric series $F(a,b,c;z)$ defined by

$$
F(a,b,c;z) = \sum_{0\le n} {{(a)_n(b)_n}\over{n!(c)_n} z^n}
$$

where $(a)_n = a (a+1) \cdots (a+n-1)$.

<a id="polynomials"></a>
<a id="rngser-poly"></a>
### Polynomials over Series Rings

Factorization is available for polynomials over series rings defined over finite fields. We recommend constructing polynomials from sequences rather than by addition of terms, especially over fields, to avoid some precision loss. For example, $x^4 + t$ will not have full precision in the constant coefficient as there will be a $O$ term in the constant coefficient of $x^4$ which will reduce its precision as a field element. The equivalent polynomial `Polynomial([t, 0, 0, 0, 1])` will have more precision than that constructed as $x^4 + t$.

<a id="function-hensellift-rngupolelt-rngser-seqenum-rngupolelt"></a>
#### `HenselLift(f, L): RngUPolElt[RngSer], SeqEnum[RngUPolElt] -> [RngUPolElt]`

<a id="function-hensellift-rngupolelt-rngserext-seqenum-rngupolelt"></a>
#### `HenselLift(f, L): RngUPolElt[RngSerExt], SeqEnum[RngUPolElt] -> [RngUPolElt]`

Given a polynomial $f$ over a series ring over a finite field or an extension of a series ring and a factorization $L$ of $f$ to precision $1$ return a factorization of $f$ known to the full precision of the coefficient ring of $f$.

<a id="function-factorization-rngupolelt-rngserpow-fldfin"></a>
#### `Factorization(f): RngUPolElt[RngSerPow[FldFin]] -> [ < RngUPolElt[RngSerPow], RngIntElt > ], RngSerPowElt`

<a id="function-factorization-rngupolelt-rngserlaur-fldfin"></a>
#### `Factorization(f): RngUPolElt[RngSerLaur[FldFin]] -> [ < RngUPolElt[RngSerLaur], RngIntElt > ], RngSerLaurElt`

<a id="function-factorization-rngupolelt-rngserext"></a>
#### `Factorization(f): RngUPolElt[RngSerExt] -> [ < RngUPolElt[RngSerExt], RngIntElt > ], RngSerExtElt`

```magma
Certificates: BoolElt                    Default: false
Ideals      : BoolElt                    Default: false
Extensions  : BoolElt                    Default: false
```

The factorization of the polynomial $f$ over a power series ring, laurent series field over a finite field or an extension of either into irreducibles.

If `Certificates` is set to `true`, a two-element certificate for each factor, proving its irreducibility, is returned.

If `Ideals` is set to `true`, two generators of some ideal for each factor are returned within the certificates.

If `Extensions` is set to `true`, an extension for each factor is returned within the certificates.

<a id="example-ex-32baab"></a>
#### `Example: Factorization over Series Rings (ex-32baab)`

We illustrate factorizations over series rings and the extensions which can be gained through them.

```magma
> P<t> := PowerSeriesRing(GF(101));
> R<x> := PolynomialRing(P);
> Factorization(x^5 + t*x^4 - t^2*x^3 + (1 + t^20)*x^2 + t*x + t^6);
[
    <(1 + O(t^20))*x + t^5 + O(t^8), 1>,
    <(1 + O(t^20))*x + t + 100*t^4 + 100*t^5 + t^7 + O(t^8), 1>,
    <(1 + O(t^20))*x + 1 + 34*t^2 + 34*t^3 + 34*t^4 + 90*t^5 + 29*t^6 + 16*t^8 +
        32*t^9 + 6*t^10 + 66*t^11 + 41*t^12 + 93*t^13 + t^14 + 69*t^15 + 8*t^16
        + 61*t^17 + 86*t^18 + 19*t^19 + O(t^20), 1>,
    <(1 + O(t^20))*x^2 + (100 + 67*t^2 + 67*t^3 + 68*t^4 + 11*t^5 + 72*t^6 +
        100*t^7 + 85*t^8 + 69*t^9 + 94*t^10 + 31*t^11 + 59*t^12 + 16*t^13 +
        14*t^14 + 35*t^15 + 77*t^16 + 28*t^17 + 33*t^18 + 72*t^19 + O(t^20))*x +
        1 + 67*t^2 + 68*t^3 + 11*t^4 + 67*t^5 + 57*t^6 + 16*t^7 + 57*t^8 +
        21*t^9 + 68*t^10 + 68*t^11 + 61*t^12 + 98*t^13 + 4*t^14 + 21*t^15 +
        7*t^16 + 95*t^17 + 23*t^18 + 76*t^19 + O(t^20), 1>
]
1 + O(t^20)
> P<t> := PowerSeriesRing(GF(101), 50);
> R<x> := PolynomialRing(P);
> Factorization(x^5 + t*x^4 - t^2*x^3 + (1 + t^20)*x^2 + t*x + t^6 :
> Extensions);
[
    <x + t^5 + t^9 + 2*t^13 + t^16 + 5*t^17 + 6*t^20 + 14*t^21 + 26*t^24 +
        42*t^25 + 3*t^27 + 4*t^28 + 32*t^29 + 35*t^31 + 10*t^32 + 29*t^33 +
        46*t^35 + t^36 + 31*t^37 + O(t^38), 1>,
    <x + t + 100*t^4 + 100*t^5 + t^7 + 100*t^9 + t^10 + 4*t^11 + t^12 + 91*t^13
        + 86*t^14 + 98*t^15 + 15*t^16 + 7*t^17 + 83*t^18 + 10*t^19 + 23*t^20 +
        54*t^21 + 47*t^22 + 72*t^23 + 87*t^24 + 55*t^25 + 4*t^26 + 15*t^27 +
        90*t^28 + 82*t^29 + 97*t^30 + 15*t^31 + 23*t^32 + 86*t^33 + 57*t^34 +
        10*t^35 + 79*t^36 + 52*t^37 + O(t^38), 1>,
    <x + 1 + 34*t^2 + 34*t^3 + 34*t^4 + 90*t^5 + 29*t^6 + 16*t^8 + 32*t^9 +
        6*t^10 + 66*t^11 + 41*t^12 + 93*t^13 + t^14 + 69*t^15 + 8*t^16 + 61*t^17
        + 86*t^18 + 19*t^19 + 47*t^20 + 11*t^21 + 42*t^22 + 38*t^23 + 46*t^24 +
        90*t^25 + 14*t^26 + 7*t^27 + 89*t^28 + 85*t^29 + 70*t^30 + 24*t^31 +
        28*t^32 + 71*t^33 + 53*t^34 + 55*t^35 + 90*t^36 + 26*t^37 + 4*t^38 +
        56*t^39 + 44*t^40 + 8*t^41 + 25*t^42 + 94*t^43 + 14*t^44 + 92*t^45 +
        56*t^46 + 83*t^47 + 26*t^48 + 41*t^49 + O(t^50), 1>,
    <x^2 + (100 + 67*t^2 + 67*t^3 + 68*t^4 + 11*t^5 + 72*t^6 + 100*t^7 + 85*t^8
        + 69*t^9 + 94*t^10 + 31*t^11 + 59*t^12 + 16*t^13 + 14*t^14 + 35*t^15 +
        77*t^16 + 28*t^17 + 33*t^18 + 72*t^19 + 25*t^20 + 22*t^21 + 12*t^22 +
        92*t^23 + 43*t^24 + 15*t^25 + 83*t^26 + 76*t^27 + 19*t^28 + 3*t^29 +
        35*t^30 + 27*t^31 + 40*t^32 + 16*t^33 + 92*t^34 + 91*t^35 + 32*t^36 +
        93*t^37 + 84*t^38 + 98*t^39 + 85*t^40 + 54*t^41 + 25*t^42 + 88*t^43 +
        35*t^44 + 17*t^45 + t^46 + 39*t^47 + 89*t^48 + 67*t^49 + O(t^50))*x + 1
        + 67*t^2 + 68*t^3 + 11*t^4 + 67*t^5 + 57*t^6 + 16*t^7 + 57*t^8 + 21*t^9
        + 68*t^10 + 68*t^11 + 61*t^12 + 98*t^13 + 4*t^14 + 21*t^15 + 7*t^16 +
        95*t^17 + 23*t^18 + 76*t^19 + 62*t^20 + 59*t^21 + 66*t^22 + 35*t^23 +
        41*t^24 + 45*t^25 + 32*t^26 + 56*t^27 + 35*t^28 + 19*t^29 + 21*t^30 +
        59*t^31 + 50*t^32 + 72*t^33 + 58*t^34 + 75*t^35 + 59*t^36 + 76*t^37 +
        83*t^38 + 66*t^39 + 6*t^40 + 8*t^41 + 94*t^42 + 77*t^43 + 100*t^44 +
        30*t^45 + 72*t^46 + 26*t^47 + 54*t^48 + 21*t^49 + O(t^50), 1>
]
1 + O(t^50)
[
    rec<recformat<F: RngIntElt, Rho: RngUPolElt, E: RngIntElt, Pi: RngUPolElt,
    IdealGen1, IdealGen2: RngUPolElt, Extension> |
        F := 1,
        Rho := 1 + O($.1^50),
        E := 1,
        Pi := $.1 + O($.1^50),
        Extension := Power series ring in t over GF(101) with fixed absolute
            precision 50>,
    rec<recformat<F: RngIntElt, Rho: RngUPolElt, E: RngIntElt, Pi: RngUPolElt,
    IdealGen1, IdealGen2: RngUPolElt, Extension> |
        F := 1,
        Rho := 1 + O($.1^50),
        E := 1,
        Pi := $.1 + O($.1^50),
        Extension := Power series ring in t over GF(101) with fixed absolute
            precision 50>,
    rec<recformat<F: RngIntElt, Rho: RngUPolElt, E: RngIntElt, Pi: RngUPolElt,
    IdealGen1, IdealGen2: RngUPolElt, Extension> |
        F := 1,
        Rho := 1 + O($.1^50),
        E := 1,
        Pi := $.1 + O($.1^50),
        Extension := Power series ring in t over GF(101) with fixed absolute
            precision 50>,
    rec<recformat<F: RngIntElt, Rho: RngUPolElt, E: RngIntElt, Pi: RngUPolElt,
    IdealGen1, IdealGen2: RngUPolElt, Extension> |
        F := 2,
        Rho := (1 + O($.1^50))*$.1 + O($.1^50),
        E := 1,
        Pi := $.1 + O($.1^50),
        Extension := Extension of Power series ring in t over GF(101) with fixed
            absolute precision 50 by x^2 + (100 + O(t^50))*x + 1 + O(t^50)>
]
```

### Extensions of Series Rings

Extensions of series rings are either unramified or totally ramified. Only series rings defined over finite fields can be extended. We recommend constructing polynomials from sequences rather than by addition of terms, especially over fields, to avoid some precision loss. For example, $x^4 + t$ will not have full precision in the constant coefficient as there will be a $O$ term in the constant coefficient of $x^4$ which will reduce its precision as a field element. Extensions require full precision polynomials and some polynomials such as $x^4 + t$ may not have enough precision to be used to construct an extension whereas the equivalent `Polynomial([t, 0, 0, 0, 1])` will.

#### Constructions of Extensions

<a id="function-unramifiedextension-rngserpow-fldfin-rngupolelt"></a>
##### `UnramifiedExtension(R, f): RngSerPow[FldFin], RngUPolElt -> RngSerExt`

<a id="function-unramifiedextension-rngserlaur-fldfin-rngupolelt"></a>
##### `UnramifiedExtension(R, f): RngSerLaur[FldFin], RngUPolElt -> RngSerExt`

<a id="function-unramifiedextension-rngserext-rngupolelt"></a>
##### `UnramifiedExtension(R, f): RngSerExt, RngUPolElt -> RngSerExt`

Construct the unramified extension of $R$, a series ring or an extension thereof, defined by the inertial polynomial $f$, that is, adjoin a root of $f$ to $R$.

<a id="function-totallyramifiedextension-rngserpow-fldfin-rngupolelt"></a>
##### `TotallyRamifiedExtension(R, f): RngSerPow[FldFin], RngUPolElt -> RngSerExt`

<a id="function-totallyramifiedextension-rngserlaur-fldfin-rngupolelt"></a>
##### `TotallyRamifiedExtension(R, f): RngSerLaur[FldFin], RngUPolElt -> RngSerExt`

<a id="function-totallyramifiedextension-rngserext-rngupolelt"></a>
##### `TotallyRamifiedExtension(R, f): RngSerExt, RngUPolElt -> RngSerExt`

```magma
MaxPrecision: RngIntElt                    Default: 
```

Construct a totally ramified extension of $R$, a series ring or an extension thereof, defined by the eisenstein polynomial $f$, that is, adjoin a root of $f$ to $R$.

The parameter `MaxPrecision` defaults to the precision of $R$. It can be set to the maximum precision the coefficients of $f$ are known to, which must not be less than the precision of $R$. This allows the precision of the result to be increased to the degree of $f$ multiplied by this maximum precision.

The polynomial $f$ may be given over a series ring or an extension of a series ring having a higher precision than $R$. This allows the precision of the result to be increased up to the precision the polynomial is known to (or `MaxPrecision` if set) without losing any of the polynomial known past the precision of $R$.

The precision of a ramified extension cannot be increased unless the defining polynomial is known to more precision than the coefficient ring, indicated either by providing the polynomial to greater precision or by setting `MaxPrecision`. This should be taken into account when constructing ramified extensions, especially if polynomials are to be factored over the extension.

<a id="function-changeprecision-rngserext-rngintelt"></a>
##### `ChangePrecision(E, r): RngSerExt, RngIntElt -> RngSerExt`

<a id="procedure-changeprecision-rngserext-rngintelt-ref"></a>
##### `ChangePrecision(~E, r): RngSerExt, RngIntElt`

The extension of a series ring $E$ with precision $r$. It is not possible to increase the precision of a ramified extension unless the parameter `MaxPrecision` was set on construction of the extension and $r$ is less than or equal to this value multiplied by the ramification degree or the polynomial used in creating the extension was given to more precision than the coefficient ring of $E$.

<a id="function-fieldoffractions-rngserext"></a>
##### `FieldOfFractions(E): RngSerExt -> RngSerExt`

The field of fractions of the extension of a series ring $E$.

<a id="example-ex-0fa010"></a>
##### `Example: Two-Step Extension of a Series Ring (ex-0fa010)`

We show a simple creation of a two-step extension and change its precision.

```magma
> P<t> := PowerSeriesRing(GF(101), 50);
> PP<tt> := PowerSeriesRing(GF(101));
> R<x> := PolynomialRing(PP);
> U := UnramifiedExtension(P, x^2 + 2);
> T := TotallyRamifiedExtension(U, x^2 + tt*x + tt); T;
Extension of Extension of Power series ring in t over GF(101) with fixed
absolute precision 50 by x^2 + 2 + O(t^50) by x^2 + (t + O(t^50))*x + t +
    O(t^50)
> Precision($1);
100
> ChangePrecision($2, 200);
Extension of Extension of Power series ring in $.1 over GF(101) with fixed
absolute precision 100 by x^2 + 2 + O($.1^100) by x^2 + ($.1 + O($.1^100))*x +
    $.1 + O($.1^100)
> ChangePrecision($1, 1000);
Extension of Extension of Power series ring in $.1 over GF(101) with fixed
absolute precision 500 by x^2 + 2 + O($.1^500) by x^2 + ($.1 + O($.1^500))*x +
    $.1 + O($.1^500)
> ChangePrecision($1, 20);
Extension of Extension of Power series ring in $.1 over GF(101) with fixed
absolute precision 10 by x^2 + 2 + O($.1^10) by x^2 + ($.1 + O($.1^10))*x + $.1
    + O($.1^10)
```

Both $U$ and $T$ have a field of fractions.

```magma
> FieldOfFractions(U);
Extension of Laurent series field in $.1 over GF(101) with fixed relative
precision 50 by (1 + O($.1^50))*x^2 + O($.1^50)*x + 2 + O($.1^50)
> FieldOfFractions(T);
Extension of Extension of Laurent series field in $.1 over GF(101) with fixed
relative precision 50 by (1 + O($.1^50))*x^2 + O($.1^50)*x + 2 + O($.1^50) by (1
    + O($.1^50))*x^2 + ($.1 + O($.1^50))*x + $.1 + O($.1^50)
```

#### Operations on Extensions

<a id="function-precision-rngserext"></a>
##### `Precision(E): RngSerExt -> RngIntElt`

<a id="function-getprecision-rngserext"></a>
##### `GetPrecision(E): RngSerExt -> RngIntElt`

The maximum precision elements of the extension of a series ring $E$ may have.

<a id="function-coefficientring-rngserext"></a>
##### `CoefficientRing(E): RngSerExt -> Rng`

<a id="function-basering-rngserext"></a>
##### `BaseRing(E): RngSerExt -> Rng`

The ring the extension of a series ring $E$ was defined over.

<a id="function-definingpolynomial-rngserext"></a>
##### `DefiningPolynomial(E): RngSerExt -> RngUPolElt`

The polynomial used to define the extension $E$.

<a id="function-inertiadegree-rngserext"></a>
##### `InertiaDegree(E): RngSerExt -> RngIntElt`

The degree of the extension $E$ if $E$ is an unramified extension, $1$ otherwise.

<a id="function-ramificationindex-rngserext"></a>
##### `RamificationIndex(E): RngSerExt -> RngIntElt`

<a id="function-ramificationdegree-rngserext"></a>
##### `RamificationDegree(E): RngSerExt -> RngIntElt`

The degree of the extension $E$ if $E$ is a totally ramified extension, $1$ otherwise.

<a id="function-residueclassfield-rngserext"></a>
##### `ResidueClassField(E): RngSerExt -> FldFin`

The residue class field of the extension $E$, that is, $E / \pi E$.

<a id="function-uniformizingelement-rngserext"></a>
##### `UniformizingElement(E): RngSerExt -> RngSerExtElt`

A uniformizing element for the extension $E$, that is, an element of $E$ of valuation $1$.

<a id="function-integerring-rngserext"></a>
##### `IntegerRing(E): RngSerExt -> RngSerExt`

<a id="function-integers-rngserext"></a>
##### `Integers(E): RngSerExt -> RngSerExt`

<a id="function-ringofintegers-rngserext"></a>
##### `RingOfIntegers(E): RngSerExt -> RngSerExt`

The ring of integers of the extension $E$ of a series ring if $E$ is a field (extension of a laurent series ring).

<a id="operation-op-eq-rngserext-rngserext"></a>
##### `E1 eq E2: RngSerExt, RngSerExt -> BoolElt`

Whether extensions $E1$ and $E2$ are considered to be equal.

<a id="operation-operation-rngserext-rngintelt-rngserextelt"></a>
##### `E . i: RngSerExt, RngIntElt -> RngSerExtElt`

The primitive element of the extension $E$, that is, the root of the defining polynomial of $E$ adjoined to the coefficient ring of $E$ to construct $E$.

<a id="procedure-assignnames-rngserext-monstgelt-ref"></a>
##### `AssignNames(~E, S): RngSerExt, [ MonStgElt ]`

Assign the string in the sequence $S$ to be the name of the primitive element of $E$, that is, the root of the defining polynomial adjoined to the coefficient ring of $E$ to construct $E$.

<a id="example-ex-b88c0a"></a>
##### `Example: Operations on Series Ring Extensions (ex-b88c0a)`

A number of the operations above are applied to a two-step extension

```magma
> L<t> := LaurentSeriesRing(GF(53), 30);
> P<x> := PolynomialRing(L);
> U := UnramifiedExtension(L, x^3 + 3*x^2 + x + 4);
> P<y> := PolynomialRing(U);
> T := TotallyRamifiedExtension(U, Polynomial([t, 0, 0, 0, 1]));
> Precision(U);
30
> Precision(T);
120
> CoefficientRing(U);
Laurent series field in t over GF(53) with fixed relative precision 30
> CoefficientRing(T);
Extension of Laurent series field in t over GF(53) with fixed relative precision
30 by (1 + O(t^30))*x^3 + (3 + O(t^30))*x^2 + (1 + O(t^30))*x + 4 + O(t^30)
> DefiningPolynomial(U);
(1 + O(t^30))*x^3 + (3 + O(t^30))*x^2 + (1 + O(t^30))*x + 4 + O(t^30)
> DefiningPolynomial(T);
(1 + O(t^30))*y^4 + O(t^30)*y^3 + O(t^30)*y^2 + O(t^30)*y + t + O(t^30)
> InertiaDegree(U);
3
> InertiaDegree(T);
1
> RamificationDegree(U);
1
> RamificationDegree(T);
4
> ResidueClassField(U);
Finite field of size 53^3
Mapping from: RngSerExt: U to GF(53^3)
> ResidueClassField(T);
Finite field of size 53^3
Mapping from: RngSerExt: T to GF(53^3)
> UniformizingElement(U);
t + O(t^31)
> UniformizingElement(T);
(1 + O(t^30))*$.1 + O(t^30)
> Integers(T);
Extension of Extension of Power series ring in $.1 over GF(53) with fixed
absolute precision 30 by x^3 + (3 + O($.1^30))*x^2 + x + 4 + O($.1^30) by x^4 +
    $.1 + O($.1^30)
> U.1;
(1 + O(t^30))*$.1 + O(t^30)
> T.1;
(1 + O(t^30))*$.1 + O(t^30)
```

#### Elements of Extensions

<a id="operation-op-times-rngserextelt-rngserextelt"></a>
##### `x * y: RngSerExtElt, RngSerExtElt -> RngSerExtElt`

<a id="operation-op-plus-rngserextelt-rngserextelt"></a>
##### `x + y: RngSerExtElt, RngSerExtElt -> RngSerExtElt`

<a id="operation-op-minus-rngserextelt-rngserextelt"></a>
##### `x - y: RngSerExtElt, RngSerExtElt -> RngSerExtElt`

<a id="operation-operation-rngserextelt-rngserextelt"></a>
##### `- x: RngSerExtElt -> RngSerExtElt`

<a id="operation-op-pow-rngserextelt-rngintelt"></a>
##### `x ^ n: RngSerExtElt, RngIntElt -> RngSerExtElt`

<a id="operation-operation-div-rngserextelt-rngserextelt-rngserextelt"></a>
##### `x div y: RngSerExtElt, RngSerExtElt -> RngSerExtElt`

<a id="operation-op-div-rngserextelt-rngserextelt"></a>
##### `x / y: RngSerExtElt, RngSerExtElt -> RngSerExtElt`

<a id="operation-op-eq-rngserextelt-rngserextelt"></a>
##### `x eq y: RngSerExtElt, RngSerExtElt -> BoolElt`

<a id="function-iszero-rngserextelt"></a>
##### `IsZero(e): RngSerExtElt -> BoolElt`

<a id="function-isone-rngserextelt"></a>
##### `IsOne(e): RngSerExtElt -> BoolElt`

<a id="function-isminusone-rngserextelt"></a>
##### `IsMinusOne(e): RngSerExtElt -> BoolElt`

<a id="function-isunit-rngserextelt"></a>
##### `IsUnit(e): RngSerExtElt -> BoolElt`

<a id="function-valuation-rngserextelt"></a>
##### `Valuation(e): RngSerExtElt -> RngIntElt`

The valuation of the element $e$ of an extension of a series ring. This is the index of the largest power of $\pi$ which divides $e$.

<a id="function-relativeprecision-rngserextelt"></a>
##### `RelativePrecision(e): RngSerExtElt -> RngIntElt`

The relative precision of the element $e$ of an extension of a series ring. This is the number of digits of $e$ (in $\pi$) which are known.

<a id="function-absoluteprecision-rngserextelt"></a>
##### `AbsolutePrecision(e): RngSerExtElt -> RngIntElt`

The absolute precision of the element $e$ of an extension of a series ring. This is the same as the sum of the relative precision of $e$ and the valuation of $e$.

<a id="function-coefficients-rngserextelt"></a>
##### `Coefficients(e): RngSerExtElt -> [ RngElt ]`

<a id="function-eltseq-rngserextelt"></a>
##### `Eltseq(e): RngSerExtElt -> [ RngElt ]`

<a id="function-elementtosequence-rngserextelt"></a>
##### `ElementToSequence(e): RngSerExtElt -> [ RngElt ]`

Given an element $e$ of an extension of a series ring, return the coefficients of $e$ with respect to the powers of the uniformizing element of the extension.

<a id="example-ex-77b403"></a>
##### `Example: Arithmetic in Series Ring Extensions (ex-77b403)`

We show some simple arithmetic with some elements of some extensions.

```magma
> P<t> := PowerSeriesRing(GF(101), 50);
> R<x> := PolynomialRing(P);
> U<u> := UnramifiedExtension(P, x^2 + 2*x + 3);
> UF := FieldOfFractions(U);
> R<y> := PolynomialRing(U);
> T<tt> := TotallyRamifiedExtension(U, y^2 + t*y + t);
> TF<tf> := FieldOfFractions(T);
> UF<uf> := FieldOfFractions(U);
> u + t;
u + t + O(t^50)
> uf * t;
($.1 + O($.1^50))*uf + O($.1^51)
> tf eq tt;
false
> tf - tt;
O($.1^50)*tf + O($.1^50)
> IsZero($1);
false
> Valuation($2);
100
> Valuation(tt);
1
> Valuation(U!t);
1
> Valuation(T!t);
2
> RelativePrecision(u);
50
> AbsolutePrecision(u);
50
> AbsolutePrecision(uf);
50
> RelativePrecision(uf);
50
> RelativePrecision(u - uf);
0
> AbsolutePrecision(u - uf);
50
> u^7;
(13 + O(t^50))*u + 71 + O(t^50)
> Coefficients($1);
[
    71 + O(t^50),
    13 + O(t^50)
]
> tt^8;
(4*t^4 + 91*t^5 + 6*t^6 + 100*t^7 + O(t^50))*tt + t^4 + 95*t^5 + 5*t^6 + 100*t^7
    + O(t^50)
> Coefficients($1);
[ t^4 + 95*t^5 + 5*t^6 + 100*t^7 + O(t^50), 4*t^4 + 91*t^5 + 6*t^6 + 100*t^7 +
    O(t^50) ]
```

#### Optimized Representation

<a id="function-optimizedrepresentation-rngserext"></a>
##### `OptimizedRepresentation(E): RngSerExt -> RngSer, Map`

<a id="function-optimisedrepresentation-rngserext"></a>
##### `OptimisedRepresentation(E): RngSerExt -> RngSer, Map`

An optimized representation for the unramified extension $E$ of a series ring. The defining polynomial of $E$ must be coercible into the residue class field. The result is a series ring over the residue class field of $E$ and a map from $E$ to this series ring.

<a id="example-ex-95694d"></a>
##### `Example: Optimized Representation of an Extension (ex-95694d)`

We give a simple example of the use of `OptimizedRepresentation`.

```magma
> P<t> := PowerSeriesRing(GF(101), 50);
> R<x> := PolynomialRing(P);
> U<u> := UnramifiedExtension(P, x^2 + 2*x + 3);
> U;
Extension of Power series ring in t over GF(101) with fixed absolute precision
50 by x^2 + (2 + O(t^50))*x + 3 + O(t^50)
> OptimizedRepresentation(U);
Power series ring in $.1 over GF(101^2) with fixed absolute precision 50
Mapping from: RngSerExt: U to Power series ring in s over GF(101^2) with fixed
absolute precision 50 given by a rule
```

<a id="rnglaz-main"></a>
## Lazy Power Series Rings

- [Introduction](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/introduction.md)
- [Creation of Lazy Series Rings](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/creation.md)
  - [`LazyPowerSeriesRing(C, n): Rng, RngIntElt → RngPowLaz`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/creation.md#function-lazypowerseriesring-rng-rngintelt)
  - [`ChangeRing(L, C): RngPowLaz, Rng → RngPowLaz, Map`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/creation.md#function-changering-rngpowlaz-rng)
  - [Example: Creating Lazy Power Series Rings](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/creation.md#example-ex-085add)
- [Functions on Lazy Series Rings](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md)
  - [`R . i: RngPowLaz, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#operation-operation-rngpowlaz-rngintelt-rngpowlazelt)
  - [`AssignNames(~R, S): RngPowLaz, [MonStgElt]`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#procedure-assignnames-rngpowlaz-monstgelt-ref)
  - [`BaseRing(R): RngPowLaz → Rng`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#function-basering-rngpowlaz)
  - [`CoefficientRing(R): RngPowLaz → Rng`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#function-coefficientring-rngpowlaz)
  - [`Rank(R): RngPowLaz → RngIntElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#function-rank-rngpowlaz)
  - [`R1 eq R2: RngPowLaz, RngPowLaz → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#operation-op-eq-rngpowlaz-rngpowlaz)
  - [Example: Names and Properties of a Lazy Series Ring](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/ring_ops.md#example-ex-aee740)
- [Elements](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md)
  - [Creation of Finite Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#creation-of-finite-lazy-series)
    - [`R ! c: RngPowLaz, RngElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-rngpowlaz-rngelt)
    - [`R ! s: RngPowLaz, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-rngpowlaz-rngpowlazelt)
    - [`R ! S: RngPowLaz, [RngElt] → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-rngpowlaz-rngelt-2)
    - [`LazySeries(R, f): RngPowLaz, RngMPolElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-lazyseries-rngpowlaz-rngmpolelt)
    - [`LazySeries(R, f): RngPowLaz, FldFunRatElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-lazyseries-rngpowlaz-fldfunratelt)
    - [`LazySeries(R, f): RngPowLaz, RngUPolElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-lazyseries-rngpowlaz-rngupolelt)
    - [Example: Creating Finite Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-60e042)
    - [Creation of Lazy Series from Maps](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#creation-of-lazy-series-from-maps)
      - [`elt<R | m>: RngPowLaz, Map → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#constructor-constructor-elt-rngpowlaz-map-rngpowlazelt)
      - [Example: Univariate Lazy Series from a Map](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-6e6661)
      - [Example: Multivariate Lazy Series from a Map](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-53315d)
  - [Arithmetic with Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#arithmetic-with-lazy-series)
    - [`s + t: RngPowLazElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-plus-rngpowlazelt-rngpowlazelt)
    - [`- s: RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-operation-rngpowlazelt-rngpowlazelt)
    - [`s - t: RngPowLazElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-minus-rngpowlazelt-rngpowlazelt)
    - [`s * t: RngPowLazElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-times-rngpowlazelt-rngpowlazelt)
    - [`s + r: RngPowLazElt, RngElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-plus-rngpowlazelt-rngelt)
    - [`r + s: RngElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-plus-rngelt-rngpowlazelt)
    - [`c * s: RngElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-times-rngelt-rngpowlazelt)
    - [`s * c: RngPowLazElt, RngElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-times-rngpowlazelt-rngelt)
    - [`s * n: RngPowLazElt, [RngIntElt] → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-times-rngpowlazelt-rngintelt)
    - [`s ^ n: RngPowLazElt, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-pow-rngpowlazelt-rngintelt)
    - [Example: Arithmetic with Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-75ff3a)
  - [Finding Coefficients of Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#finding-coefficients-of-lazy-series)
    - [`Coefficient(s, i): RngPowLazElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-coefficient-rngpowlazelt-rngintelt)
    - [`Coefficient(s, T): RngPowLazElt, SeqEnum → RngElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-coefficient-rngpowlazelt-seqenum)
    - [`Coefficients(s, n): RngPowLazElt, RngIntElt → [RngElt]`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-rnglaz-coefficients)
    - [`Coefficients(s, l, n): RngPowLazElt, RngIntElt, RngIntElt → [RngElt]`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-coefficients-rngpowlazelt-rngintelt-rngintelt)
    - [`Valuation(s): RngPowLazElt → Any`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-valuation-rngpowlazelt)
    - [`PrintToPrecision(s, n): RngPowLazElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#procedure-rnglaz-printtoprecision)
    - [`PrintTermsOfDegree(s, l, n): RngPowLazElt, RngIntElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#procedure-printtermsofdegree-rngpowlazelt-rngintelt-rngintelt)
    - [`LeadingCoefficient(s): RngPowLazElt → RngElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-leadingcoefficient-rngpowlazelt)
    - [`LeadingTerm(s): RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-leadingterm-rngpowlazelt)
    - [Example: Coefficients by the Spiral Algorithm](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-eaeab7)
    - [`CoefficientsNonSpiral(s, n): RngPowLazElt, [RngIntElt] → SeqEnum`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-rnglaz-cns)
    - [`CoefficientsNonSpiral(s, n): RngPowLazElt, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-coefficientsnonspiral-rngpowlazelt-rngintelt)
    - [`Index(s, i, n): RngPowLazElt, [RngIntElt], [RngIntElt] → RngIntElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-index-rngpowlazelt-rngintelt-rngintelt)
    - [Example: Coefficients by the Non-Spiral Algorithm](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-31429a)
  - [Predicates on Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#predicates-on-lazy-series)
    - [`s eq t: RngPowLazElt, RngPowLazElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#operation-op-eq-rngpowlazelt-rngpowlazelt)
    - [`IsZero(s): RngPowLazElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-iszero-rngpowlazelt)
    - [`IsOne(s): RngPowLazElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-isone-rngpowlazelt)
    - [`IsMinusOne(s): RngPowLazElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-isminusone-rngpowlazelt)
    - [`IsUnit(s): RngPowLazElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-isunit-rngpowlazelt)
    - [`IsWeaklyZero(s, n): RngPowLazElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-isweaklyzero-rngpowlazelt-rngintelt)
    - [`IsWeaklyEqual(s, t, n): RngPowLazElt, RngPowLazElt, RngIntElt → BoolElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-isweaklyequal-rngpowlazelt-rngpowlazelt-rngintelt)
  - [Other Functions on Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#other-functions-on-lazy-series)
    - [`Derivative(s): RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-derivative-rngpowlazelt)
    - [`Derivative(s, v): RngPowLazElt, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-derivative-rngpowlazelt-rngintelt)
    - [`Derivative(s, v, n): RngPowLazElt, RngIntElt, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-derivative-rngpowlazelt-rngintelt-rngintelt)
    - [`Integral(s): RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-integral-rngpowlazelt)
    - [`Integral(s, v): RngPowLazElt, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-integral-rngpowlazelt-rngintelt)
    - [`Evaluate(s, t): RngPowLazElt, RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-evaluate-rngpowlazelt-rngpowlazelt)
    - [`Evaluate(s, T): RngPowLazElt, [RngPowLazElt] → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-evaluate-rngpowlazelt-rngpowlazelt-2)
    - [Example: Evaluating a Lazy Series](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#example-ex-f9b608)
    - [`SquareRoot(s): RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-squareroot-rngpowlazelt)
    - [`Sqrt(s): RngPowLazElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-sqrt-rngpowlazelt)
    - [`IsSquare(s): RngPowLazElt → BoolElt, RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-issquare-rngpowlazelt)
    - [`PolynomialCoefficient(s, i): RngPowLazElt, RngIntElt → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-polynomialcoefficient-rngpowlazelt-rngintelt)
    - [`PolynomialCoefficient(s, i): RngPowLazElt, [RngIntElt] → RngPowLazElt`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-polynomialcoefficient-rngpowlazelt-rngintelt-2)

### Introduction

The lazy series rings `RngLaz` and their elements `RngLazElt` allow the creation of infinite precision series by providing series for which all coefficients can be calculated by some given formula. Only finitely many coefficients of such a series can be known at any one time but all infinitely many of the coefficients are knowable. Any coefficient of a lazy series can be generated and once a coefficient is computed it will be stored in the series for quick retrieval.

The simplest implementation of this idea is creating a series by providing a map. This map is a formula for computing coefficients of a series. Given the exponents of the variables of a term it will give you the coefficient of that term. Series with finitely many non–zero terms can be created in special ways and several usual arithmetic operations can be applied to lazy series. Such constructions yield lazy series with more complicated formulas for their coefficients.

Consider the series $\sum_{i = 0}^n i*x^i$. A formula for the coefficients is given by $i \mapsto i$. This series can be created as a lazy series as follows:

```
> L<x> := LazyPowerSeriesRing(Integers(), 1);
> m := map<Integers() -> Integers() | i :-> i>;
> s := elt<L | m>;
> s;
Lazy power series
```

Currently $s$ does not know what any of its coefficients are yet it is possible to calculate any coefficient of $s$.

```
> Coefficient(s, 0);
0
> Coefficient(s, 100);
100
> Coefficient(s, 100000000000000000000000);
100000000000000000000000
```

### Creation of Lazy Series Rings

Both univariate and multivariate lazy series rings can be created.

<a id="function-lazypowerseriesring-rng-rngintelt"></a>
#### `LazyPowerSeriesRing(C, n): Rng, RngIntElt -> RngPowLaz`

The lazy power series ring with coefficient ring $C$ and $n$ variables. Any ring is valid input for $C$ and $n$ can be any positive integer.

<a id="function-changering-rngpowlaz-rng"></a>
#### `ChangeRing(L, C): RngPowLaz, Rng -> RngPowLaz, Map`

Given a lazy series ring $L$ defined over a ring $R$ and some ring $C$, return the lazy series ring with coefficient ring $C$ but the same number of variables as $L$. A map from $L$ to the new lazy series ring is also returned which takes a series $s$ in $L$ to a series whose coefficients are those of $s$ coerced into $C$.

<a id="example-ex-085add"></a>
#### `Example: Creating Lazy Power Series Rings (ex-085add)`

Here we illustrate the creation and printing of lazy power series rings.

```magma
> L := LazyPowerSeriesRing(Rationals(), 5);
> L;
Lazy power series ring in 5 variables over Rational Field
> ChangeRing(L, MaximalOrder(CyclotomicField(7)));
Lazy power series ring in 5 variables over Maximal Equation Order with defining
polynomial x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 over Z
```

### Functions on Lazy Series Rings

Lazy series rings have variables, names for their variables, and a coefficient ring.

<a id="operation-operation-rngpowlaz-rngintelt-rngpowlazelt"></a>
#### `R . i: RngPowLaz, RngIntElt -> RngPowLazElt`

The $i$th variable of the lazy power series ring $R$, where $i$ is between $1$ and the rank of $R$.

<a id="procedure-assignnames-rngpowlaz-monstgelt-ref"></a>
#### `AssignNames(~R, S): RngPowLaz, [MonStgElt]`

Given a lazy series ring $R$ with $n$ indeterminates and a sequence $S$ of $n$ strings, assign the elements of $S$ to the names of the variables of $R$.

<a id="function-basering-rngpowlaz"></a>
#### `BaseRing(R): RngPowLaz -> Rng`

<a id="function-coefficientring-rngpowlaz"></a>
#### `CoefficientRing(R): RngPowLaz -> Rng`

The coefficient ring of the lazy power series ring $R$. The coefficients of all the series in $R$ will lie in this ring.

<a id="function-rank-rngpowlaz"></a>
#### `Rank(R): RngPowLaz -> RngIntElt`

The number of variables associated with the lazy power series ring $R$.

<a id="operation-op-eq-rngpowlaz-rngpowlaz"></a>
#### `R1 eq R2: RngPowLaz, RngPowLaz -> BoolElt`

Return `true` if the lazy series rings $R1$ and $R2$ are the same ring, that is, they have the same coefficient ring and rank.

<a id="example-ex-aee740"></a>
#### `Example: Names and Properties of a Lazy Series Ring (ex-aee740)`

The functions on lazy power series rings are illustrated here.

```magma
> L := LazyPowerSeriesRing(FiniteField(73), 7);
> L.4;
Lazy power series
> AssignNames(~L, ["a", "b", "c", "d", "fifth", "sixth", "seventh"]);
> L.4;
Lazy power series
```

The names for the variables of $L$ are not used in default series printing. However they are used when printing an element to a given precision using [`PrintToPrecision`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#procedure-rnglaz-printtoprecision).

```magma
> CoefficientRing(L);
Finite field of size 73
> Rank(L);
7
> L eq LazyPowerSeriesRing(CoefficientRing(L), Rank(L));
true
```

### Elements

Lazy series may be created in a number of ways. Arithmetic for ring elements is available as well as a few predicates. Coefficients of the monomials in the series can be calculated.

#### Creation of Finite Lazy Series

<a id="operation-op-rngpowlaz-rngelt"></a>
##### `R ! c: RngPowLaz, RngElt -> RngPowLazElt`

Return the series in the lazy series ring $R$ with constant term $c$ and every other coefficient $0$ where $c$ is any ring element coercible into the coefficient ring of $R$.

<a id="operation-op-rngpowlaz-rngpowlazelt"></a>
##### `R ! s: RngPowLaz, RngPowLazElt -> RngPowLazElt`

Return the lazy series in the lazy series ring $R$ whose coefficients are those of the lazy series $s$ coerced into the coefficient ring of $R$.

<a id="operation-op-rngpowlaz-rngelt-2"></a>
##### `R ! S: RngPowLaz, [RngElt] -> RngPowLazElt`

Return the series in the lazy series ring $R$ whose coefficients are the elements of $S$ where $S$ is a sequence of elements each coercible into the coefficient ring of $R$. The coefficients are taken to be given in the order which [`Coefficients`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-rnglaz-coefficients) will return them and [`PrintToPrecision`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#procedure-rnglaz-printtoprecision) will print the terms of the series. Any coefficient not given is assumed to be zero so that all coefficients are calculable. The resulting series can only have finitely many non zero terms and all such non zero coefficients must be given in $S$.

<a id="function-lazyseries-rngpowlaz-rngmpolelt"></a>
##### `LazySeries(R, f): RngPowLaz, RngMPolElt -> RngPowLazElt`

<a id="function-lazyseries-rngpowlaz-fldfunratelt"></a>
##### `LazySeries(R, f): RngPowLaz, FldFunRatElt -> RngPowLazElt`

<a id="function-lazyseries-rngpowlaz-rngupolelt"></a>
##### `LazySeries(R, f): RngPowLaz, RngUPolElt -> RngPowLazElt`

Create the lazy series in the lazy series ring $R$ with finitely many non zero terms which are the terms of the polynomial $f$. The number of variables of the parent ring of $f$ must be the same as the number of variables of $R$. The coefficients of $f$ must be coercible into the coefficient ring of $R$.

It is also possible for $f$ to be a rational function, $p/q$. The series created from $f$ will be `LazySeries(R, p)*LazySeries(R, q)^\{-1\}`.

<a id="example-ex-60e042"></a>
##### `Example: Creating Finite Lazy Series (ex-60e042)`

Creation of series using the above functions is shown here.

```magma
> L := LazyPowerSeriesRing(AlgebraicClosure(), 3);
> LR := LazyPowerSeriesRing(Rationals(), 3);
> s := L!1;
> s;
Lazy power series
> LR!s;
Lazy power series
> P<x, y, z> := RationalFunctionField(Rationals(), 3);
> LazySeries(L, (x + y + 8*z)^7/(1 + 5*x*y*z + x^8)^3);
Lazy power series
```

##### Creation of Lazy Series from Maps

Creating a lazy series from a map simulates the existence of lazy series as series for which coefficients are not known on creation of the series but calculated by some rule given when creating the series.

This rule can be coded in a map where the input to the map is the exponents of the variables in a term and the output is the coefficient of the term described by the input. So for a lazy series ring with variables $x$, $y$, and $z$, a general term of a series will look like $c_{ijk}*x_i^r*y_j^s*z_k^t$. The coefficient of this term, $c_{ijk}$, in a series defined by a map $m$ is the result of $m(\langle i, j, k\rangle)$.

<a id="constructor-constructor-elt-rngpowlaz-map-rngpowlazelt"></a>
###### `elt<R | m>: RngPowLaz, Map -> RngPowLazElt`

Creates a series in the lazy series ring $R$ from the map $m$. The map $m$ must take as input either an integer (when $R$ is univariate only) or a tuple of integers (of length the number of variables of $R$) and return an element of the coefficient ring of $R$. This element will be taken as the coefficient of the term of the series whose variables have the exponents given in the input tuple, as described above.

<a id="example-ex-6e6661"></a>
###### `Example: Univariate Lazy Series from a Map (ex-6e6661)`

We first illustrate the univariate case.

```magma
> L<x> := LazyPowerSeriesRing(MaximalOrder(QuadraticField(5)), 1);
> Z := Integers();
> m := map<Z -> CoefficientRing(L) | t :-> 2*t>;
> s := elt<L | m>;
> PrintToPrecision(s, 10);
2*x + 4*x^2 + 6*x^3 + 8*x^4 + 10*x^5 + 12*x^6 + 14*x^7 + 16*x^8 + 18*x^9 +
    20*x^10
> Coefficient(s, 34);
68
> m(34);
68
> Coefficient(s, 2^30 + 10);
2147483668
> m(2^30 + 10);
2147483668
```

<a id="example-ex-53315d"></a>
###### `Example: Multivariate Lazy Series from a Map (ex-53315d)`

And now for the multivariate case.

```magma
> L<x, y, z> := LazyPowerSeriesRing(AlgebraicClosure(), 3);
> Z := Integers();
> m := map<car<Z, Z, Z> -> CoefficientRing(L) | t :-> t[1]*t[2]*t[3]>;
> s := elt<L | m>;
> PrintToPrecision(s, 5);
x*y*z + 2*x^2*y*z + 2*x*y^2*z + 2*x*y*z^2 + 3*x^3*y*z + 4*x^2*y^2*z +
    4*x^2*y*z^2 + 3*x*y^3*z + 4*x*y^2*z^2 + 3*x*y*z^3
> Coefficient(s, [1, 1, 1]);
1
> m(<1, 1, 1>);
1
> Coefficient(s, [3, 1, 2]);
6
> m(<3, 1, 2>);
6
```

#### Arithmetic with Lazy Series

All the usual arithmetic operations are possible for lazy series.

<a id="operation-op-plus-rngpowlazelt-rngpowlazelt"></a>
##### `s + t: RngPowLazElt, RngPowLazElt -> RngPowLazElt`

The sum of the two lazy series $s$ and $t$.

<a id="operation-operation-rngpowlazelt-rngpowlazelt"></a>
##### `- s: RngPowLazElt -> RngPowLazElt`

The negation of the lazy series $s$.

<a id="operation-op-minus-rngpowlazelt-rngpowlazelt"></a>
##### `s - t: RngPowLazElt, RngPowLazElt -> RngPowLazElt`

The difference between lazy series $s$ and $t$.

<a id="operation-op-times-rngpowlazelt-rngpowlazelt"></a>
##### `s * t: RngPowLazElt, RngPowLazElt -> RngPowLazElt`

The product of the lazy series $s$ and $t$.

<a id="operation-op-plus-rngpowlazelt-rngelt"></a>
##### `s + r: RngPowLazElt, RngElt -> RngPowLazElt`

<a id="operation-op-plus-rngelt-rngpowlazelt"></a>
##### `r + s: RngElt, RngPowLazElt -> RngPowLazElt`

The sum of the lazy series $s$ and the element $r$ of the coefficient ring of the parent ring of $s$.

<a id="operation-op-times-rngelt-rngpowlazelt"></a>
##### `c * s: RngElt, RngPowLazElt -> RngPowLazElt`

<a id="operation-op-times-rngpowlazelt-rngelt"></a>
##### `s * c: RngPowLazElt, RngElt -> RngPowLazElt`

The product of the lazy series $s$ and the element $c$ of the coefficient ring of the parent ring of $s$.

<a id="operation-op-times-rngpowlazelt-rngintelt"></a>
##### `s * n: RngPowLazElt, [RngIntElt] -> RngPowLazElt`

The product of the lazy series $s$ and the monomial $x^n$, where $x^n$ is $x_1^{n_1} \times \ldots \times x_r^{n_r}$ where $r$ is the number of variables of the parent ring of $s$, $n$ is the sequence $[n_1,\ldots,n_r]$ and $x = x_1,\ldots, x_r$ are the series variables of the parent ring of $s$.

<a id="operation-op-pow-rngpowlazelt-rngintelt"></a>
##### `s ^ n: RngPowLazElt, RngIntElt -> RngPowLazElt`

Given a lazy series $s$ and an integer $n$, return the $n$th power of $s$. It is allowed for $n$ to be negative and inverses will be taken where possible.

<a id="example-ex-75ff3a"></a>
##### `Example: Arithmetic with Lazy Series (ex-75ff3a)`

Here we demonstrate the above arithmetic operations.

```magma
> L<a, b, c, d> := LazyPowerSeriesRing(Rationals(), 4);
> (a + 4*b + (-c)*[8, 9, 2^30 + 10, 2] - d*b + 5)^-8;
Lazy power series
```

#### Finding Coefficients of Lazy Series

In theory, all the coefficients of most series can be calculated. In practice it is not possible to compute infinitely many. Some problems arise however when a series has been created using multiplication, inversion, evaluation, or by taking square roots. For such series the $j$th coefficient for all $j < i$ must be known for the $i$th coefficient to be calculated. In such cases the exponents specified for each variable in the monomial whose coefficient is required must be small integers ($< 2^{30}$).

The default ordering of coefficients is by total degree of the corresponding monomials. This is the same order on multivariate polynomials by default. When drawn on paper or imagined in $3$ or more dimensions this looks like a spiral if the coordinates representing the monomial exponents are joined. This is the same ordering which is used to compute the valuation of a series.

Once computed, coefficients are stored with the series so any subsequent call to these functions will be faster in non–trivial cases than the first call. It is possible to interrupt any of these functions and return to the prompt.

<a id="function-coefficient-rngpowlazelt-rngintelt"></a>
##### `Coefficient(s, i): RngPowLazElt, RngIntElt -> RngElt`

Returns the coefficient in the univariate lazy series $s$ of $x^i$ where $x$ is the series variable of the parent of $s$ and $i$ is a non negative integer.

<a id="function-coefficient-rngpowlazelt-seqenum"></a>
##### `Coefficient(s, T): RngPowLazElt, SeqEnum -> RngElt`

Returns the coefficient in the multivariate lazy series $s$ of the monomial $x_1^{T_1}*\ldots *x_r^{T_r}$ where $T$ is the sequence $[T_1, \ldots, T_r]$, $x_1, \ldots, x_r$ are the variables of the parent ring of $s$ and $r$ is the rank of the parent of $s$.

<a id="function-rnglaz-coefficients"></a>
##### `Coefficients(s, n): RngPowLazElt, RngIntElt -> [RngElt]`

<a id="function-coefficients-rngpowlazelt-rngintelt-rngintelt"></a>
##### `Coefficients(s, l, n): RngPowLazElt, RngIntElt, RngIntElt -> [RngElt]`

The coefficients of the lazy series $s$ whose monomials have total degree at least $l$ ($0$ if not given) and at most $n$ where the monomials are ordered using the default “spiral” degree order. The bounds $l$ and $n$ must be non negative integers.

<a id="function-valuation-rngpowlazelt"></a>
##### `Valuation(s): RngPowLazElt -> Any`

The valuation of the lazy series $s$. This is the exponent of the monomial with the first non–zero coefficient as returned by `Coefficients` above. The return value will be either `Infty`, an integer (univariate case) or a sequence (multivariate case).

<a id="procedure-rnglaz-printtoprecision"></a>
##### `PrintToPrecision(s, n): RngPowLazElt, RngIntElt`

Print the sum of all terms of the lazy series $s$ whose degree is no more than $n$ where $n$ is a non negative integer. The series is printed using the “spiral” ordering.

<a id="procedure-printtermsofdegree-rngpowlazelt-rngintelt-rngintelt"></a>
##### `PrintTermsOfDegree(s, l, n): RngPowLazElt, RngIntElt, RngIntElt`

Print the sum of the terms of the lazy series $s$ whose degree is at least $l$ and at most $n$. The terms are printed using the spiral ordering. The bounds $l$ and $n$ must be non negative integers.

<a id="function-leadingcoefficient-rngpowlazelt"></a>
##### `LeadingCoefficient(s): RngPowLazElt -> RngElt`

The coefficient in the lazy series $s$ whose monomial exponent is the valuation of $s$. That is, the first non–zero coefficient of $s$ where the ordering which determines “first” is the “spiral” ordering used by `Coefficients` and `Valuation`.

<a id="function-leadingterm-rngpowlazelt"></a>
##### `LeadingTerm(s): RngPowLazElt -> RngPowLazElt`

The term in the lazy series $s$ whose monomial exponent is the valuation of $s$. That is, the first non–zero term of $s$ where the ordering which determines “first” is the “spiral” ordering used by `Coefficients` and `Valuation`.

<a id="example-ex-eaeab7"></a>
##### `Example: Coefficients by the Spiral Algorithm (ex-eaeab7)`

In this example we look at some coefficients of an infinite series.

```magma
> L<a, b, c, d> := LazyPowerSeriesRing(Rationals(), 4);
> s := (1 + 2*a + 3*b + 4*d)^-5;
```

Find the coefficient of $a*b*c*d$.

```magma
> Coefficient(s, [1, 1, 1, 1]);
0
```

Find the coefficients of all monomials with total degree at most $6$.

```magma
> time Coefficients(s, 6);
[ 1, -10, -15, 0, -20, 60, 180, 0, 240, 135, 0, 360, 0, 0, 240, -280, -1260, 0,
-1680, -1890, 0, -5040, 0, 0, -3360, -945, 0, -3780, 0, 0, -5040, 0, 0, 0,
-2240, 1120, 6720, 0, 8960, 15120, 0, 40320, 0, 0, 26880, 15120, 0, 60480, 0, 0,
80640, 0, 0, 0, 35840, 5670, 0, 30240, 0, 0, 60480, 0, 0, 0, 53760, 0, 0, 0, 0,
17920, -4032, -30240, 0, -40320, -90720, 0, -241920, 0, 0, -161280, -136080, 0,
-544320, 0, 0, -725760, 0, 0, 0, -322560, -102060, 0, -544320, 0, 0, -1088640,
0, 0, 0, -967680, 0, 0, 0, 0, -322560, -30618, 0, -204120, 0, 0, -544320, 0, 0,
0, -725760, 0, 0, 0, 0, -483840, 0, 0, 0, 0, 0, -129024, 13440, 120960, 0,
161280, 453600, 0, 1209600, 0, 0, 806400, 907200, 0, 3628800, 0, 0, 4838400, 0,
0, 0, 2150400, 1020600, 0, 5443200, 0, 0, 10886400, 0, 0, 0, 9676800, 0, 0, 0,
0, 3225600, 612360, 0, 4082400, 0, 0, 10886400, 0, 0, 0, 14515200, 0, 0, 0, 0,
9676800, 0, 0, 0, 0, 0, 2580480, 153090, 0, 1224720, 0, 0, 4082400, 0, 0, 0,
7257600, 0, 0, 0, 0, 7257600, 0, 0, 0, 0, 0, 3870720, 0, 0, 0, 0, 0, 0, 860160 ]
Time: 0.140
> #$1;
210
```

`PrintToPrecision` will display the monomials to which these coefficients correspond.

```magma
> time PrintToPrecision(s, 6);
1 - 10*a - 15*b - 20*d + 60*a^2 + 180*a*b + 240*a*d + 135*b^2 + 360*b*d +
    240*d^2 - 280*a^3 - 1260*a^2*b - 1680*a^2*d - 1890*a*b^2 - 5040*a*b*d -
    3360*a*d^2 - 945*b^3 - 3780*b^2*d - 5040*b*d^2 - 2240*d^3 + 1120*a^4 +
    6720*a^3*b + 8960*a^3*d + 15120*a^2*b^2 + 40320*a^2*b*d + 26880*a^2*d^2 +
    15120*a*b^3 + 60480*a*b^2*d + 80640*a*b*d^2 + 35840*a*d^3 + 5670*b^4 +
    30240*b^3*d + 60480*b^2*d^2 + 53760*b*d^3 + 17920*d^4 - 4032*a^5 -
    30240*a^4*b - 40320*a^4*d - 90720*a^3*b^2 - 241920*a^3*b*d - 161280*a^3*d^2
    - 136080*a^2*b^3 - 544320*a^2*b^2*d - 725760*a^2*b*d^2 - 322560*a^2*d^3 -
    102060*a*b^4 - 544320*a*b^3*d - 1088640*a*b^2*d^2 - 967680*a*b*d^3 -
    322560*a*d^4 - 30618*b^5 - 204120*b^4*d - 544320*b^3*d^2 - 725760*b^2*d^3 -
    483840*b*d^4 - 129024*d^5 + 13440*a^6 + 120960*a^5*b + 161280*a^5*d +
    453600*a^4*b^2 + 1209600*a^4*b*d + 806400*a^4*d^2 + 907200*a^3*b^3 +
    3628800*a^3*b^2*d + 4838400*a^3*b*d^2 + 2150400*a^3*d^3 + 1020600*a^2*b^4 +
    5443200*a^2*b^3*d + 10886400*a^2*b^2*d^2 + 9676800*a^2*b*d^3 +
    3225600*a^2*d^4 + 612360*a*b^5 + 4082400*a*b^4*d + 10886400*a*b^3*d^2 +
    14515200*a*b^2*d^3 + 9676800*a*b*d^4 + 2580480*a*d^5 + 153090*b^6 +
    1224720*b^5*d + 4082400*b^4*d^2 + 7257600*b^3*d^3 + 7257600*b^2*d^4 +
    3870720*b*d^5 + 860160*d^6
Time: 0.010
```

The valuation of $s$ can be obtained as follows. The valuation of zero is a special case.

```magma
> Valuation(s);
[ 0, 0, 0, 0 ]
> Valuation(s*0);
Infinity
```

<a id="function-rnglaz-cns"></a>
##### `CoefficientsNonSpiral(s, n): RngPowLazElt, [RngIntElt] -> SeqEnum`

<a id="function-coefficientsnonspiral-rngpowlazelt-rngintelt"></a>
##### `CoefficientsNonSpiral(s, n): RngPowLazElt, RngIntElt -> SeqEnum`

Returns the coefficients of the monomials in the lazy series $s$ whose exponents are given by $[i_1,...,i_r]$ where each $i_j \le n_j$. The argument $n$ may either be a non negative integer (univariate case) or a sequence of non negative integers of length $r$ where $r$ is the rank of the parent ring of $s$. The index of the $[i_1,...,i_r]$-th coefficient in the return sequence is given by

$$
\sum_{j=1}^{r} i_j * (  \prod_{k=j+1}^{r} (n_k + 1)  ).
$$

<a id="function-index-rngpowlazelt-rngintelt-rngintelt"></a>
##### `Index(s, i, n): RngPowLazElt, [RngIntElt], [RngIntElt] -> RngIntElt`

Return the index in the return value of [`CoefficientsNonSpiral`](https://docs.magma-maths.org/LocalFields/LazyPowerSeriesRings/elements.md#function-rnglaz-cns)`(s, n)` of the monomial in the lazy series $s$ whose exponents are given by the (trivial in the univariate case) sequence $i$.

<a id="example-ex-31429a"></a>
##### `Example: Coefficients by the Non-Spiral Algorithm (ex-31429a)`

We find the coefficients of the series used in the last example using the alternative algorithm.

```magma
> L<a, b, c, d> := LazyPowerSeriesRing(Rationals(), 4);
> s := (1 + 2*a + 3*b + 4*d)^-5;
> time CoefficientsNonSpiral(s, [3, 3, 3, 2]);
[ 1, -20, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, -15, 360, -5040, 0, 0, 0, 0, 0, 0, 0,
0, 0, 135, -3780, 60480, 0, 0, 0, 0, 0, 0, 0, 0, 0, -945, 30240, -544320, 0, 0,
0, 0, 0, 0, 0, 0, 0, -10, 240, -3360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, -5040,
80640, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1890, 60480, -1088640, 0, 0, 0, 0, 0, 0, 0,
0, 0, 15120, -544320, 10886400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, -1680, 26880, 0,
0, 0, 0, 0, 0, 0, 0, 0, -1260, 40320, -725760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15120,
-544320, 10886400, 0, 0, 0, 0, 0, 0, 0, 0, 0, -136080, 5443200, -119750400, 0,
0, 0, 0, 0, 0, 0, 0, 0, -280, 8960, -161280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6720,
-241920, 4838400, 0, 0, 0, 0, 0, 0, 0, 0, 0, -90720, 3628800, -79833600, 0, 0,
0, 0, 0, 0, 0, 0, 0, 907200, -39916800, 958003200, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
Time: 0.370
> #$1;
192
```

It appears that the “spiral” algorithm may be faster since it computed more coefficients in less time. This may be because of the operations (inversion) involved in calculating $s$ and that `CoefficientsNonSpiral` computed coefficients of larger degree monomials than `Coefficients`. In calculating these coefficients for larger degrees, coefficients which were not asked for may have been calculated. `Coefficients` will only need to calculate the coefficients which have been asked for — all intermediate calculations would have been asked for.

#### Predicates on Lazy Series

<a id="operation-op-eq-rngpowlazelt-rngpowlazelt"></a>
##### `s eq t: RngPowLazElt, RngPowLazElt -> BoolElt`

Return `true` if the lazy series $s$ and $t$ are exactly the same series.

<a id="function-iszero-rngpowlazelt"></a>
##### `IsZero(s): RngPowLazElt -> BoolElt`

Return `true` if the lazy series $s$ was created as the zero series.

<a id="function-isone-rngpowlazelt"></a>
##### `IsOne(s): RngPowLazElt -> BoolElt`

Return `true` if the lazy series $s$ was created as the one series.

<a id="function-isminusone-rngpowlazelt"></a>
##### `IsMinusOne(s): RngPowLazElt -> BoolElt`

Return `true` if the lazy series $s$ was created as the minus one series.

<a id="function-isunit-rngpowlazelt"></a>
##### `IsUnit(s): RngPowLazElt -> BoolElt`

Return `true` if the lazy series $s$ is a unit.

<a id="function-isweaklyzero-rngpowlazelt-rngintelt"></a>
##### `IsWeaklyZero(s, n): RngPowLazElt, RngIntElt -> BoolElt`

Return `true` if all the terms of the lazy series $s$ with degree at most $n$ are zero. Calling this function without the second argument returns `IsZero(s)`.

<a id="function-isweaklyequal-rngpowlazelt-rngpowlazelt-rngintelt"></a>
##### `IsWeaklyEqual(s, t, n): RngPowLazElt, RngPowLazElt, RngIntElt -> BoolElt`

Return `true` if the terms of the lazy series $s$ and $t$ with degree at most $n$ are the same. Calling this function without the third argument returns `s eq t`.

#### Other Functions on Lazy Series

<a id="function-derivative-rngpowlazelt"></a>
##### `Derivative(s): RngPowLazElt -> RngPowLazElt`

<a id="function-derivative-rngpowlazelt-rngintelt"></a>
##### `Derivative(s, v): RngPowLazElt, RngIntElt -> RngPowLazElt`

<a id="function-derivative-rngpowlazelt-rngintelt-rngintelt"></a>
##### `Derivative(s, v, n): RngPowLazElt, RngIntElt, RngIntElt -> RngPowLazElt`

Return the ($n$th) derivative of the lazy series $s$ with respect to the $v$th variable of the parent ring of $s$. If $v$ is not given, the parent ring of $s$ must be univariate and the derivative with respect to the unique variable is returned. It is only allowed to give values of $v$ from $1$ to the rank of the parent of $s$ and for $n$ to be a positive integer.

<a id="function-integral-rngpowlazelt"></a>
##### `Integral(s): RngPowLazElt -> RngPowLazElt`

<a id="function-integral-rngpowlazelt-rngintelt"></a>
##### `Integral(s, v): RngPowLazElt, RngIntElt -> RngPowLazElt`

Return the integral of the lazy series $s$ with respect to the $v$th variable of the parent ring of $s$. If $v$ is not given, the parent ring of $s$ must be univariate and the integral with respect to the unique variable is returned. It is only allowed to give values of $v$ from $1$ to the rank of the parent of $s$.

<a id="function-evaluate-rngpowlazelt-rngpowlazelt"></a>
##### `Evaluate(s, t): RngPowLazElt, RngPowLazElt -> RngPowLazElt`

<a id="function-evaluate-rngpowlazelt-rngpowlazelt-2"></a>
##### `Evaluate(s, T): RngPowLazElt, [RngPowLazElt] -> RngPowLazElt`

Return the lazy series $s$ evaluated at the lazy series $t$ or the sequence $T$ of lazy series. The series $t$ or the series in $T$ must have zero constant term so that every coefficient of the result can be finitely calculated.

<a id="example-ex-f9b608"></a>
##### `Example: Evaluating a Lazy Series (ex-f9b608)`

Some usage of `Evaluate` is shown below.

```magma
> R := LazyPowerSeriesRing(Rationals(), 2);
> AssignNames(~R, ["x","y"]);
> m := map<car<Integers(), Integers()> -> Rationals() | t :-> 1>;
> s := elt<R | m>;
> PrintToPrecision(s, 3);
1 + x + y + x^2 + x*y + y^2 + x^3 + x^2*y + x*y^2 + y^3
> R1 := LazyPowerSeriesRing(Rationals(), 1);
> AssignNames(~R1, ["z"]);
> m1 := map<car<Integers()> -> Rationals() | t :-> t[1]>;
> s1 := elt<R1 | m1>;
> PrintToPrecision(s1, 3);
z + 2*z^2 + 3*z^3
> e := Evaluate(s, [s1,s1]);
> PrintToPrecision(e, 10);
1 + 2*z + 7*z^2 + 22*z^3 + 67*z^4 + 200*z^5 + 588*z^6 + 1708*z^7 + 4913*z^8 +
    14018*z^9 + 39725*z^10
> Parent(e);
Lazy power series ring in 1 variable over Rational Field
> f := Evaluate(s1, s - 1);
> PrintToPrecision(f, 10);
x + y + 3*x^2 + 5*x*y + 3*y^2 + 8*x^3 + 18*x^2*y + 18*x*y^2 + 8*y^3 + 20*x^4 +
    56*x^3*y + 75*x^2*y^2 + 56*x*y^3 + 20*y^4 + 48*x^5 + 160*x^4*y + 264*x^3*y^2
    + 264*x^2*y^3 + 160*x*y^4 + 48*y^5 + 112*x^6 + 432*x^5*y + 840*x^4*y^2 +
    1032*x^3*y^3 + 840*x^2*y^4 + 432*x*y^5 + 112*y^6 + 256*x^7 + 1120*x^6*y +
    2496*x^5*y^2 + 3600*x^4*y^3 + 3600*x^3*y^4 + 2496*x^2*y^5 + 1120*x*y^6 +
    256*y^7 + 576*x^8 + 2816*x^7*y + 7056*x^6*y^2 + 11616*x^5*y^3 +
    13620*x^4*y^4 + 11616*x^3*y^5 + 7056*x^2*y^6 + 2816*x*y^7 + 576*y^8 +
    1280*x^9 + 6912*x^8*y + 19200*x^7*y^2 + 35392*x^6*y^3 + 47280*x^5*y^4 +
    47280*x^4*y^5 + 35392*x^3*y^6 + 19200*x^2*y^7 + 6912*x*y^8 + 1280*y^9 +
    2816*x^10 + 16640*x^9*y + 50688*x^8*y^2 + 103168*x^7*y^3 + 154000*x^6*y^4 +
    175344*x^5*y^5 + 154000*x^4*y^6 + 103168*x^3*y^7 + 50688*x^2*y^8 +
    16640*x*y^9 + 2816*y^10
> f := Evaluate(s1 + 1, s - 1);
> PrintToPrecision(f, 10);
1 + x + y + 3*x^2 + 5*x*y + 3*y^2 + 8*x^3 + 18*x^2*y + 18*x*y^2 + 8*y^3 + 20*x^4
    + 56*x^3*y + 75*x^2*y^2 + 56*x*y^3 + 20*y^4 + 48*x^5 + 160*x^4*y +
    264*x^3*y^2 + 264*x^2*y^3 + 160*x*y^4 + 48*y^5 + 112*x^6 + 432*x^5*y +
    840*x^4*y^2 + 1032*x^3*y^3 + 840*x^2*y^4 + 432*x*y^5 + 112*y^6 + 256*x^7 +
    1120*x^6*y + 2496*x^5*y^2 + 3600*x^4*y^3 + 3600*x^3*y^4 + 2496*x^2*y^5 +
    1120*x*y^6 + 256*y^7 + 576*x^8 + 2816*x^7*y + 7056*x^6*y^2 + 11616*x^5*y^3 +
    13620*x^4*y^4 + 11616*x^3*y^5 + 7056*x^2*y^6 + 2816*x*y^7 + 576*y^8 +
    1280*x^9 + 6912*x^8*y + 19200*x^7*y^2 + 35392*x^6*y^3 + 47280*x^5*y^4 +
    47280*x^4*y^5 + 35392*x^3*y^6 + 19200*x^2*y^7 + 6912*x*y^8 + 1280*y^9 +
    2816*x^10 + 16640*x^9*y + 50688*x^8*y^2 + 103168*x^7*y^3 + 154000*x^6*y^4 +
    175344*x^5*y^5 + 154000*x^4*y^6 + 103168*x^3*y^7 + 50688*x^2*y^8 +
    16640*x*y^9 + 2816*y^10
```

<a id="function-squareroot-rngpowlazelt"></a>
##### `SquareRoot(s): RngPowLazElt -> RngPowLazElt`

<a id="function-sqrt-rngpowlazelt"></a>
##### `Sqrt(s): RngPowLazElt -> RngPowLazElt`

The square root of the lazy series $s$.

<a id="function-issquare-rngpowlazelt"></a>
##### `IsSquare(s): RngPowLazElt -> BoolElt, RngPowLazElt`

Return `true` if the lazy series $s$ is a square and the square root if so.

<a id="function-polynomialcoefficient-rngpowlazelt-rngintelt"></a>
##### `PolynomialCoefficient(s, i): RngPowLazElt, RngIntElt -> RngPowLazElt`

<a id="function-polynomialcoefficient-rngpowlazelt-rngintelt-2"></a>
##### `PolynomialCoefficient(s, i): RngPowLazElt, [RngIntElt] -> RngPowLazElt`

Given a series $s$ in a lazy series ring whose coefficient ring is a polynomial ring (either univariate or multivariate), consider the polynomial which would be formed if this series was written as a polynomial with series as the coefficients. For $i$ a non negative integer and the coefficient ring of the series ring a univariate polynomial ring this function returns the series which is the $i$th coefficient of the polynomial resulting from the rewriting of the series.

When the coefficient ring of the parent of $s$ is a multivariate polynomial ring $i$ should be a sequence of non negative integers of length the rank of the coefficient ring. The series returned will be the series which is the coefficient of $x_1^{i_1}*\ldots*x_r^{i_r}$ in the rewritten series where $r$ is the rank of the coefficient ring and $x_j$ are the indeterminates of the coefficient ring.

<a id="rngpowalg"></a>
## Algebraic Power Series Rings

- [Introduction](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/introduction.md)
- [Basics](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/basics.md)
  - [Data Structures](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/basics.md#data-structures)
  - [Verbose Output](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/basics.md#verbose-output)
- [Constructors](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md)
  - [`PolyToSeries(s): RngMPolElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-polytoseries-rngmpolelt)
  - [`AlgebraicPowerSeries(dp, ip, L, e): RngUPolElt, RngMPolElt, Lat, RngIntElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-aps)
  - [`AlgebraicPowerSeries(dp, ip, e): RngUPolElt, RngMPolElt, RngIntElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-algebraicpowerseries-rngupolelt-rngmpolelt-rngintelt)
  - [`AlgebraicPowerSeries(dp, ip): RngUPolElt, RngMPolElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-algebraicpowerseries-rngupolelt-rngmpolelt)
  - [`EvaluationPowerSeries(s, nu, v): Tup, SeqEnum, SeqEnum → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-eval)
  - [`ImplicitFunction(dp): RngUPolElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-imp)
  - [Rational Puiseux Expansions](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#rational-puiseux-expansions)
    - [`RationalPuiseux(p): RngUPolElt → Tup, SeqEnum, RngIntElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-pui)
    - [Example: Constructors for Algebraic Power Series](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#example-ex-da4682)
- [Accessors and Expansion](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md)
  - [`Domain(s): RngPowAlgElt → RngMPol`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-domain-rngpowalgelt)
  - [`ExponentLattice(s): RngPowAlgElt → Tup`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-exponentlattice-rngpowalgelt)
  - [`DefiningPolynomial(s): RngPowAlgElt → RngUPolElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-rpa-defp)
  - [`Order(s): RngPowAlgElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-order-rngpowalgelt)
  - [`Expand(s,ord): RngPowAlgElt, RngIntElt → BoolElt, RngMPolElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-rpa-exp)
  - [Example: Accessing an Algebraic Power Series](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#example-ex-4231eb)
- [Arithmetic](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md)
  - [`AlgComb(c,ss): RngMPolElt, SeqEnum → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md#function-algcomb-rngmpolelt-seqenum)
  - [`s + t: RngPowAlgElt, RngPowAlgElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md#operation-op-plus-rngpowalgelt-rngpowalgelt)
  - [`s - t: RngPowAlgElt, RngPowAlgElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md#operation-op-minus-rngpowalgelt-rngpowalgelt)
  - [`s * t: RngPowAlgElt, RngPowAlgElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md#operation-op-times-rngpowalgelt-rngpowalgelt)
  - [Example: Substituting Series into Polynomials](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/arith.md#example-ex-46bd4b)
- [Predicates](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md)
  - [`IsZero(s): RngPowAlgElt → BoolElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#function-rpa-zer)
  - [`s eq t: RngPowAlgElt, RngPowAlgElt → BoolElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#operation-op-eq-rngpowalgelt-rngpowalgelt)
  - [`IsPolynomial(s): RngPowAlgElt → BoolElt, RngMPolElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#function-rpa-isp)
  - [Example: Testing Whether a Series Is Polynomial](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#example-ex-e6b227)
- [Modifiers](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md)
  - [`ScaleGenerators(s,ls): RngPowAlgElt, SeqEnum → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md#function-scalegenerators-rngpowalgelt-seqenum)
  - [`ChangeRing(s,R): RngPowAlgElt, RngMPol → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md#function-changering-rngpowalgelt-rngmpol)
  - [`SimplifyRep(s): RngPowAlgElt → RngPowAlgElt`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md#function-rpa-simp)
  - [Example: Scaling the Generators of a Series](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md#example-ex-e60c95)
- [Bibliography](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/bibliography.md)

### Introduction

Algebraic Power Series are a lazy representation of multivariate power series with fractional exponents, which are roots of univariate polynomials with coefficients in multivariate polynomial rings. The functionality allows the “lazy” computation of the power series expansion to any finite degree, this being well-determined by the defining algebraic equation.

The package was designed with the computation of formal resolutions of singularities of surfaces in mind but should provide a useful general tool for users. As well as allowing definition directly from a polynomial equation, the user can compose algebraic power series and recursively define series which are roots of polynomials whose coefficients are polynomial functions in other algebraic power series. There are also functions for basic arithmetic operations and tests for exact equality and the like.

The defined series must be expandable in fractional (positive) powers of the base variables. This is true for all roots of a *quasi-ordinary* polynomial possibly after a finite extension of the base field.

The package was designed and implemented by Tobias Beck at the RICAM institute in Linz, Austria. Some low-level adaptations for added efficiency and integration were carried out by the Magma group. The algorithms are described in [[Bec07](https://docs.magma-maths.org/references.md#cite-tb2007), Sec. 4].

### Basics

In Magma, algebraic power series are represented in a hybrid lazy-exact way. Eventually every power series is given by a defining polynomial and a sufficiently large initial segment. Intermediate operations are represented in a lazy way. This makes it possible to compute both quickly and to high precision if necessary.

Note, however, that decision procedures may be very time intensive. In the sequel we have indicated in each function whether it is fast or whether it has to be used with care.

<a id="data"></a>
<a id="sec-data"></a>
#### Data Structures

Algebraic power series are of type `RngPowAlgElt`.

There are two types of algebraic series: `Atomic` and `Substitution` which we sometimes refer to briefly as type A or type B. There is no difference in the functionality available but they are structurally different. The user can determine the type of a series, if (s)he desires, from the attribute `type` which is $0$ for type A and $1$ for type B.

`Atomic` series are the basic type that are given directly as the root of a univariate polynomial $p(z)$ with given initial expansion. $p(z)$ comes from a polynomial $f(z)$ with coefficients in a multivariate polynomial ring. Either $p = f$ or $p$ is determined from $f$ by evaluating the coefficients of $f$ at a given array, $subs$, of algebraic power series. This allows the construction of algebraic power series as roots of polynomials over finitely-generated fields of already-constructed series. Most of the constructors return a series of this type.

`Substitution` series allow the composition of algebraic power series. The principal defining data is an algebraic power series $s$ in $n$ variables and an array of $n$ algebraic series that are substituted into this. In fact, the substitution is not necessarily direct, but through $n$ given elements in the dual lattice of the exponent lattice of $s$ as explained in the constructor [`EvaluationPowerSeries`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-eval).

Both types of series have an associated exponent lattice specified by two components: $\Gamma$, a sublattice of a standard integral lattice, and $e$, a positive integer. The expansion of the series will in general have fractional exponents and $e$ is the LCM of the denominators of these ($e$ may be $1$). The finite expansions that are returned are always integral-exponent multivariate polynomials. The *actual* mathematical expansion is derived from this return value by dividing all exponents by $e$. With this scaling up of fractional exponents by $e$ to get integral exponents, all exponent vectors for monomials occurring in the expansion (up to any degree) will lie in the lattice $\Gamma$. So the actual exponent lattice for the series is $(1/e)\Gamma$.

The user doesn’t have to worry too much about the lattice $\Gamma$. It is automatically computed by most of the constructors for algebraic power series and the default of the standard integral lattice can always be used (assuming $e$ is correct!). It’s utility is that, in computing the exponent lattice for composite constructions on series, factors of $e$ may be cancelled out from the resulting lattice. So an algebraic construction involving series with non-integral exponents may produce a result with only integral exponents. Such lattice computations are carried out automatically.

**Important note:** To speed up some of the basic internal polynomial operations, it is assumed that the domain of an algebraic power series is a multivariate polynomial ring with a *degree* ordering (`glex` or `grevlex`). Attempts to create series using polynomial rings with a non-degree ordering will result in a user error.

<a id="verb"></a>
<a id="sec-rpa-verb"></a>
#### Verbose Output

A verbose flag `AlgSeries` exists which can take values `true`, `false`, $0$, or $1$. Setting to `true` (or $1$) will output information on the progress of some of the potentially more time-consuming intrinsics.

### Constructors

Using constructors one can construct power series starting from polynomial data or using other power series recursively.

<a id="function-polytoseries-rngmpolelt"></a>
#### `PolyToSeries(s): RngMPolElt -> RngPowAlgElt`

Given a multivariate polynomial $s$, returns the series representation of $s$.

<a id="function-rpa-aps"></a>
#### `AlgebraicPowerSeries(dp, ip, L, e): RngUPolElt, RngMPolElt, Lat, RngIntElt -> RngPowAlgElt`

<a id="function-algebraicpowerseries-rngupolelt-rngmpolelt-rngintelt"></a>
#### `AlgebraicPowerSeries(dp, ip, e): RngUPolElt, RngMPolElt, RngIntElt -> RngPowAlgElt`

<a id="function-algebraicpowerseries-rngupolelt-rngmpolelt"></a>
#### `AlgebraicPowerSeries(dp, ip): RngUPolElt, RngMPolElt -> RngPowAlgElt`

```magma
subs: SeqEnum                    Default: []
```

Define a power series root of a polynomial $p$ using an initial expansion $ip$ and its exponent lattice $1/\hbox{\tt e}~\hbox{\tt L}$. The defining polynomial $p$ is either $dp$ when $subs$ is empty or obtained by substituting the elements of $subs$ into the variables of $dp$. The initial expansion has to be sufficiently long in order to uniquely identify a root, see [[Bec07](https://docs.magma-maths.org/references.md#cite-tb2007), Cond. 4.3]. In this initial finite expansion and in subsequent ones, the variables occurring actually represent $e$-th roots, *ie* $x_1x_2^2$ is really $x_1^{1/e}x_2^{2/e}$. All exponents of monomials occurring in these expansions and the coefficients of $p$ should lie in $L$ (although this is not checked in many places), monomials of $p$ giving true values rather than $e$-th roots.

There are simpler constructors where $L$ is omitted (when it is assumed to be the standard integral lattice) or $e$ is (when it is taken as 1).

As noted earlier, no strong checks are performed at construction time on the correctness of $L$ or $e$ or whether $ip$ is indeed the initial expansion of a unique root in this “raw data” constructor. Incorrect initial data will only be revealed when failure occurs in further expansion of the series. The preferred methods of series creation are [`ImplicitFunction`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-imp), [`EvaluationPowerSeries`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-eval), and [`RationalPuiseux`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-pui) because in these cases the sanity checks are more easily verified.

<a id="function-rpa-eval"></a>
#### `EvaluationPowerSeries(s, nu, v): Tup, SeqEnum, SeqEnum -> RngPowAlgElt`

Given a series $s$, a sequence $nu$ of vectors in the dual of its exponent lattice of $s$ and a sequence $v$ (of the same length) of power series in some other common domain (with compatible coefficient field). Returns the series obtained by substituting ${\underline x}^{\mu} \mapsto \prod_i \hbox{\tt v[i]}^{\langle \hbox{\tt nu[i]}, \mu \rangle}$. This requires that $nu$ and $v$ fulfill a certain condition on the orders to guarantee convergence of the resulting series, see [[Bec07](https://docs.magma-maths.org/references.md#cite-tb2007), Cond. 4.6].

<a id="function-rpa-imp"></a>
#### `ImplicitFunction(dp): RngUPolElt -> RngPowAlgElt`

```magma
subs: SeqEnum                    Default: []
```

The unique series with zero constant term defined by a polynomial $p \in k[x_1,..,x_n][z]$ or $k[[x_1,\dots,x_n]][z]$, fulfilling the conditions of the implicit function theorem, *i.e.*, $p(0,\dots,0)=0$ and $\partial p / \partial z(0,\dots,0) \neq 0$. The polynomial $p$ is equal to $dp$ possibly substituted with the series in $subs$ as in [`AlgebraicPowerSeries`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-aps). $dp$ should have coefficients in a multivariate polynomial ring.

#### Rational Puiseux Expansions

Let $p \in k[[x_1,\dots,x_n]][z]$ be a quasi-ordinary polynomial over a field $k$ of characteristic zero. This means that $p$ is non-zero, squarefree, and monic (i.e., its leading coefficient in $z$ is a unit in the power series ring) and if $d \in k[[x_1,\dots,x_n]]$ denotes its discriminant then $d = x_1^{e_1} \cdots x_n^{e_n} u(x_1,\dots,x_n)$ where $u$ is a unit in the power series ring.

In this case the Theorem of Jung-Abhyankar states that $p$ has $\deg(p)$ distinct Puiseux series roots, i.e., power series roots with fractionary exponents and coefficients in the algebraic closure of $k$.

These roots are computed by a generalization of the so called Newton-Puiseux algorithm. Also Duval’s extension for computing rational parametrization has been implemented.

<a id="function-rpa-pui"></a>
##### `RationalPuiseux(p): RngUPolElt -> Tup, SeqEnum, RngIntElt`

```magma
Gamma       : Lattice                      Default: StandardLattice
subs        : SeqEnum                      Default: []
Duval       : BoolElt                      Default: false
OnlySingular: BoolElt                      Default: false
ExtName     : MonStgElt                    Default: "gamma"
ExtCount    : RngIntElt                    Default: 0
```

We first specify the behavior of this function in the case that no special value of $subs$ has been given. This function assumes that $p$ is a univariate polynomial over a multivariate polynomial ring $S = k[x_1, ..., x_r]$ and that $p$ is quasi-ordinary. In this case it will compute a set of rational parametrizations of $p$. Note that for reasons of efficiency the user has to make sure that $p$ is actually quasi-ordinary! (Otherwise, further processing of the output may result in runtime errors.)

The first return value will be the exponent lattice of the input polynomial in the usual format $<\Gamma_0, e_0>$. If the parameter `Gamma` has been specified, then $\Gamma_0 = \hbox{\tt Gamma}$ and $e_0 = 1$. In this case `Gamma` has to be an integral ‘r’-dimensional lattice of full rank containing all the exponents of $p$. Otherwise $\Gamma_0$ will be set to the $r$-dimensional standard lattice and again $e_0=1$.

As a second value a complete list of rational parametrizations in the format $<\lambda, s, N, E>$ is returned. Here $\lambda$ is a sequence of $r$ field elements and $s$ is a fractionary algebraic power series of type `RngPowAlgElt`. Let $p_1$ denote the image of $p$ under the transformation $x^{\mu_i} \mapsto \lambda_i x^{\mu_i}$ where $(\mu_i)_i$ is the basis of the exponent lattice $e_0^{-1} \Gamma_0$ then $s$ is a solution of $p_1$, i.e., we have $p_1(s) = 0$. Note that if neither `Gamma` nor `subs` have been supplied this just means that $x_i$ is substituted by $\lambda_i x_i$. Finally $N$ is the index of $e_0^{-1} \Gamma_0$ in the exponent lattice of $s$ and $E$ is the degree of the extension of the coefficient field needed for defining $s$.

The behavior described above corresponds to the Newton-Puiseux algorithm with Duval’s trick. The field extensions that are used for expressing the series fulfill a certain minimality condition. If `Duval` is set to `false` then the function returns a complete set of representatives (up to conjugacy) of Puiseux series roots of the original polynomial $p$, in other words, the $\lambda$-vectors will always be vectors of ones.

If `OnlySingular` is set to `true` then only those parametrizations that correspond to singular branches are returned.

If the ground field has to be extended, the algebraic elements will be assigned the name $\hbox{\tt ExtName}\_i$ where $i$ starts from `ExtCount`. The last return value is the value of `ExtCount` plus the number of field extensions that have been introduced during the computation.

Finally, if the parameter `subs` is passed, then it has to be a sequence of $r$ power series in a common domain and internally the variables in $p$ will be substituted by the corresponding series. Again the resulting polynomial has to be quasi-ordinary. In this case $\Gamma_0$ and $e_0$ are determined by building the sum of the exponent lattices of all series in `subs`. The parameter `Gamma` then has no effect.

For further details on the algorithm and other references see [[Bec07](https://docs.magma-maths.org/references.md#cite-tb2007), Sec. 4.3]

<a id="example-ex-da4682"></a>
##### `Example: Constructors for Algebraic Power Series (ex-da4682)`

We illustrate the constructors by examples. For displaying results we already use the command [`Expand`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-rpa-exp) that will be explained later.

```magma
> Q := Rationals(); Qs<s> := FunctionField(Q);
> Qxy<x,y> := PolynomialRing(Q, 2, "glex");
> Qxyz<z> := PolynomialRing(Qxy);
> Qst<t> := PolynomialRing(Qs, 1, "glex");
> Qstu<u> := PolynomialRing(Qst);
```

One can consider polynomials as series.

```magma
> s0 := PolyToSeries(1 - 3*x + x^2*y + y^20);
> Expand(s0, 10);
true x^2*y - 3*x + 1
```

One can define series by the implicit function theorem at the origin.

```magma
> s1 := ImplicitFunction(z*(1 - x - y) - x - y);
> Expand(s1, 4);
true x^3 + 3*x^2*y + 3*x*y^2 + y^3 + x^2 + 2*x*y + y^2 + x + y
```

One can define a power series if an initial expansion is known. Note that the following power series has exponent lattice ${\mathbb{Z}}({{1}\over{5}},-{{2}\over{5}}) + {\mathbb{Z}}({{2}\over{5}},{{1}\over{5}})$ but its “expansions” are polynomials supported on ${\mathbb{Z}}(1,-2) +  {\mathbb{Z}}(2,1)$.

```magma
> defpol := (1+5*y+10*y^3+10*y^2+5*y^4+y^5)*z^5+(-20*y^3*x-
>   30*y^2*x-5*y^4*x-5*x-20*y*x)*z^4+(10*x^2+30*y^2*x^2+10*y^3*x^2+
>   30*x^2*y)*z^3+(-20*y*x^3-10*x^3-10*y^2*x^3)*z^2+
>   (5*y*x^4+5*x^4)*z-x^5-x^2*y;
> Gamma := Lattice(RMatrixSpace(Integers(), 2, 2) ! [1,-2, 2,1]);
> init := x^2*y;
> s2 := AlgebraicPowerSeries(defpol, init, Gamma, 5);
> Expand(s2, 20);
true
-x^2*y^16 + x^5*y^10 + x^2*y^11 - x^5*y^5 - x^2*y^6 + x^5 + x^2*y
```

We can “substitute” series into each other.

```magma
> X := AlgebraicPowerSeries(u^3-t+s*t^2, t, StandardLattice(1), 3);
> Y := PolyToSeries(t);
> duals := [RSpace(Integers(), 2) | [1, 3], [2, 1]];
> s3 := EvaluationPowerSeries(s2, duals, [X, Y]);
> Expand(s3, 13);
true (-1/9*s^2 - 1/3*s - 1)*t^10 + (-1/3*s + 1)*t^7 + t^4
```

We can compute all the Puiseux series roots of a quasi-ordinary polynomial up to conjugacy over ${\mathbb{Q}}$.

```magma
> qopol := z^6 + 3*x*y^2*z^4 + x*y*z^3 + 3*x^2*y^4*z^2 + x^3*y^6;
> _, prms := RationalPuiseux(qopol : Duval := false); prms;
[*
    <[ 1, 1 ], Algebraic power series -x*y, 3, 1>,
    <[ 1, 1 ], Algebraic power series gamma_0*x*y, 3, 2>,
    <[ 1, 1 ], Algebraic power series -x^2*y^5, 3, 1>,
    <[ 1, 1 ], Algebraic power series gamma_1*x^2*y^5, 3, 2>
*]
> Domain(prms[2][2]); ExponentLattice(prms[2][2]);
Polynomial ring of rank 2 over Number Field with defining
polynomial $.1^2 - $.1 + 1 over the Rational Field
Graded Lexicographical Order
Variables: x, y
<
    Lattice of rank 2 and degree 2
    Basis:
    ( 1  1)
    ( 1 -2),

    3
>
> Expand(prms[2][2], 15);
true x^3*y^9 + (gamma_0 - 1)*x^2*y^5 + gamma_0*x*y
```

We find that the sum over all field extensions $1+2+1+2 = 6$ is equal to the degree of the defining polynomial `qopol`. The third parametrization involves a field extension of ${\mathbb{Q}}$ by `gamma_0` s.t. $\hbox{\tt gamma\_0}^2 - \hbox{\tt gamma\_0} + 1 = 0$ and an extension of the exponent lattice to ${\mathbb{Z}}({{1}\over{3}},{{1}\over{3}}) + {\mathbb{Z}}({{1}\over{3}},-{{2}\over{3}})$. It turns out that the field extension is not necessary if we are only interested in parametrizations.

```magma
> _, prms := RationalPuiseux(qopol : Duval := true); prms;
[*
    <[ -1, -1 ], Algebraic power series -x*y, 3, 1>,
    <[ -1, 1 ], Algebraic power series -x^2*y^5, 3, 1>
*]
```

No field extensions have been introduced, but this required the application of automorphisms ${\mathbb{Q}}[[x, y]]\to {\mathbb{Q}}[[x, y]]$ in advance (more precisely $x \mapsto -x, y \mapsto -y$ resp. $x \mapsto -x, y \mapsto y$). This time we can sum up the overall extension degrees (*i.e.*, for fields and lattices) $3 \cdot 1 + 3 \cdot 1 = 6$ to the degree of `qopol`.

### Accessors and Expansion

The following functions provide an interface to conveniently extract information from a power series defined as above.

<a id="function-domain-rngpowalgelt"></a>
#### `Domain(s): RngPowAlgElt -> RngMPol`

Return the multivariate polynomial ring that is used for approximating the series $s$ by its truncations.

<a id="function-exponentlattice-rngpowalgelt"></a>
#### `ExponentLattice(s): RngPowAlgElt -> Tup`

Return the exponent lattice $(1/e)\Gamma$ of the series as tuple $(\Gamma, e)$ where $\Gamma$ is an integral lattice and $e$ is an integer.

<a id="function-rpa-defp"></a>
#### `DefiningPolynomial(s): RngPowAlgElt -> RngUPolElt`

Return a defining polynomial of the series which is a squarefree univariate polynomial over the multivariate polynomial domain `Domain(s)`. In the case of series defined with substitutions, the computation may be expensive and can involve recursive resultant computations.

<a id="function-order-rngpowalgelt"></a>
#### `Order(s): RngPowAlgElt -> RngIntElt`

```magma
TestZero: BoolElt                    Default: false
```

Given a series $s$, return the integral order (total degree of smallest non-zero term occurring) of its expansion as returned by `Expand`, *i.e.*, its fractionary order times the exponent denominator. If $s$ is zero, this function will **not terminate**. Set `TestZero` to `true` to get a return value $-1$ in this case, but note that this involves the computationally complex call [`IsZero`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#function-rpa-zer).

<a id="function-rpa-exp"></a>
#### `Expand(s, ord): RngPowAlgElt, RngIntElt -> BoolElt, RngMPolElt`

Given the power series $\beta$ which is represented by $s$, let $\alpha$ be the result of substituting variables $x_i \mapsto x_i^e$ where $e$ is taken from the output of `ExponentLattice(s)` (*i.e.*, $\alpha$ is $\beta$ without exponent denominators). Returns `true` and the truncation of $\alpha$ modulo terms of order greater or equal `ord`. A return of `false` indicates that the representation is inconsistent (which should only happen when [`RationalPuiseux`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-pui) is called with non quasi-ordinary input or [`AlgebraicPowerSeries`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-aps) is used inconsistently).

<a id="example-ex-4231eb"></a>
#### `Example: Accessing an Algebraic Power Series (ex-4231eb)`

We can study the series `s3`.

```magma
> Domain(s3);
Polynomial ring of rank 1 over Univariate rational function
field over Rational Field
Graded Lexicographical Order
Variables: t
> ExponentLattice(s3);
<
    Standard Lattice of rank 1 and degree 1,

    3
>
> DefiningPolynomial(s3);
(s^45*t^45 - ... - 15*s^30*t^2 - s^30)*u^15 + ... +
(5*s^37*t^41 - ... + 120*s^31*t^19 - 30*s^30*t^18)*u^3 -
s^35*t^40 + ... - 5*s^31*t^21 + s^30*t^20
> Order(s3);
4
```

These commands reveal the following about `s3`: It is a power series in ${\mathbb{Q}}(s)[[t^{1/3} ]]$, because it is approximated in ${\mathbb{Q}}(s)[t]$ and has exponent lattice ${{1}\over{3}}{\mathbb{Z}}$. A defining polynomial in ${\mathbb{Q}}(s)[t][u]$ was also computed. (Recall that `s3` has been defined recursively.) The order is ${{4}\over{3}}$ which we know already from a previous expansion.

### Arithmetic

There are functions to perform basic arithmetic operations (addition, subtraction etc.) on power series.

<a id="function-algcomb-rngmpolelt-seqenum"></a>
#### `AlgComb(c, ss): RngMPolElt, SeqEnum -> RngPowAlgElt`

Given a polynomial $c$ in $r$ variables and a sequence $ss$ of $r$ power series (in a common domain with compatible coefficient field) return the series obtained by substituting the elements of $ss$ for the variables of $c$. This allows the construction of completely arbitrary algebraic combinations.

<a id="operation-op-plus-rngpowalgelt-rngpowalgelt"></a>
#### `s + t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt`

<a id="operation-op-minus-rngpowalgelt-rngpowalgelt"></a>
#### `s - t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt`

<a id="operation-op-times-rngpowalgelt-rngpowalgelt"></a>
#### `s * t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt`

Add, subtract, or multiply two power series.

<a id="example-ex-46bd4b"></a>
#### `Example: Substituting Series into Polynomials (ex-46bd4b)`

One can easily substitute power series into polynomials.

```magma
> // construct the series s0^2+s1^2
> h0 := AlgComb(x^2 + y^2, [s0,s1]);
> Expand(h0, 3);
true 10*x^2 + 2*x*y + y^2 - 6*x + 1
```

This includes of course the ring operations.

```magma
> h1 := Add(s1, PolyToSeries(One(Qxy)));
> Expand(h1, 4);
true
x^3 + 3*x^2*y + 3*x*y^2 + y^3 + x^2 + 2*x*y + y^2 + x + y + 1
> h2 := Mult(h1, PolyToSeries(1 - x - y));
> Expand(h2, 4);
true 1
> h3 := Add(h2, PolyToSeries(-One(Qxy)));
> Expand(h3, 4);
true 0
```

### Predicates

The following functions provide decision algorithms for algebraic power series. They may involve **recursive resultant computations**, hence, have a high complexity and should be used with care.

<a id="function-rpa-zer"></a>
#### `IsZero(s): RngPowAlgElt -> BoolElt`

Decides if the series is zero.

<a id="operation-op-eq-rngpowalgelt-rngpowalgelt"></a>
#### `s eq t: RngPowAlgElt, RngPowAlgElt -> BoolElt`

Decides if two series are equal.

<a id="function-rpa-isp"></a>
#### `IsPolynomial(s): RngPowAlgElt -> BoolElt, RngMPolElt`

Decides whether the series is actually a polynomial (with integral exponents) in the multivariate polynomial domain as returned by `Domain(s)`. In the positive case also returns that polynomial. This function relies on [`SimplifyRep`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/mods.md#function-rpa-simp).

<a id="example-ex-e6b227"></a>
#### `Example: Testing Whether a Series Is Polynomial (ex-e6b227)`

The previous computations suggest that `h2` is $1$, in particular it is polynomial (in contrast to `h1`). In this case `h3` would be zero.

```magma
> IsPolynomial(h1);
false
> IsPolynomial(h2);
true 1
> IsEqual(h2, PolyToSeries(One(Qxy)));
true
> IsZero(h3);
true
```

### Modifiers

The following functions modify the representation of the power series or apply a simple automorphism.

<a id="function-scalegenerators-rngpowalgelt-seqenum"></a>
#### `ScaleGenerators(s, ls): RngPowAlgElt, SeqEnum -> RngPowAlgElt`

Let $\{\gamma_i\}_i$ be the basis (determined from the representation chosen by Magma) of the exponent lattice of the series $s$, and let $\sigma: {\underline x}^{\gamma_i} \mapsto ls[i] {\underline x}^{\gamma_i}$. Return the series $\sigma(s)$.

<a id="function-changering-rngpowalgelt-rngmpol"></a>
#### `ChangeRing(s, R): RngPowAlgElt, RngMPol -> RngPowAlgElt`

If $R$ is a multivariate polynomial domain compatible with the approximation domain `Domain(s)`, return the same power series with new approximation domain $R$. This is sort of a “coercion between power series rings”.

<a id="function-rpa-simp"></a>
#### `SimplifyRep(s): RngPowAlgElt -> RngPowAlgElt`

```magma
Factorizing: BoolElt                    Default: true
```

“Simplifies” the internal representation of a series. The result will be a series of atomic type without recursive (substitution) dependencies on other power series. The defining polynomial of the simplified series will be irreducible and therefore a minimal polynomial over `Domain(s)` (unless `Factorizing` is `false` when it will only be guaranteed to be squarefree). After the simplification, [`DefiningPolynomial`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/accessors.md#function-rpa-defp) returns this polynomial, which can be useful (*e.g.*, for [`IsPolynomial`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/preds.md#function-rpa-isp)). However, experience shows that the resulting representation is in general neither simple nor more efficient for subsequent computations.

There is a **dangerous pitfall:**

Assume we have a series represented by a tree with nodes of type A and B. Assume further that the leaves have been constructed by [`RationalPuiseux`](https://docs.magma-maths.org/LocalFields/AlgebraicPowerSeriesRings/cons.md#function-rpa-pui) with parameter `Gamma` set to some value. Then the intention was probably to work over the subring of a polynomial ring with restricted support. If now `SimplifyRep`, with `Factorizing` as `true`, is called, then a minimal polynomial over the whole polynomial ground ring is computed which is maybe not what one wants.

<a id="example-ex-e60c95"></a>
#### `Example: Scaling the Generators of a Series (ex-e60c95)`

We can modify `s2` by mapping generators (of Laurent polynomials) $x^{1/5}y^{-2/5} \mapsto 3 x^{1/5}y^{-2/5}$ and $x^{2/5}y^{1/5} \mapsto 4 x^{2/5}y^{1/5}$.

```magma
> Expand(ScaleGenerators(s2, [3,4]), 15);
true
64/81*x^2*y^11 - 64/3*x^5*y^5 - 16/9*x^2*y^6 + 48*x^5 + 4*x^2*y
```

One can naturally view `h1` as a series in ${\mathbb{Q}}(i)[[u,v]]$.

```magma
> Qi<i> := NumberField(R.1^2 + 1) where R is PolynomialRing(Q);
> Qiuv<u,v> := PolynomialRing(Qi, 2, "glex");
> h4 := ChangeRing(s1, Qiuv);
> Expand(h4, 4); Domain(h4);
true u^3 + 3*u^2*v + 3*u*v^2 + v^3 + u^2 + 2*u*v + v^2 + u + v
Polynomial ring of rank 2 over Qi
Graded Lexicographical Order
Variables: u, v
```

We have seen that the power series `h3` is zero, but its representation does not show this immediately. We can “explicitize” its representation.

```magma
> SimplifyRep(h3 : Factorizing := true);
Algebraic power series
0
> DefiningPolynomial($1);
z
```

<a id="valuation"></a>
<a id="rngval"></a>
## Valuation Rings

- [Introduction](https://docs.magma-maths.org/LocalFields/ValuationRings/introduction.md)
- [Creation Functions](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md)
  - [Creation of Structures](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#creation-of-structures)
    - [`ValuationRing(Q, p): FldRat, RngIntElt → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#function-valuationring-fldrat-rngintelt)
    - [`ValuationRing(F, f): FldFunRat, RngUPolElt → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#function-valuationring-fldfunrat-rngupolelt)
    - [`ValuationRing(F): FldFunRat → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#function-valuationring-fldfunrat)
    - [`ValuationRing(K, p): FldNum, RngOrdIdl → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#function-valuationring-fldnum-rngordidl)
    - [`ValuationRing(K, p): FldFun, RngFunOrdIdl → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#function-valuationring-fldfun-rngfunordidl)
  - [Creation of Elements](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#creation-of-elements)
    - [`V ! r: RngVal, FldFunElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#operation-op-rngval-fldfunelt)
    - [`V ! r: RngVal, FldRatElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/creation.md#operation-op-rngval-fldratelt)
- [Structure Operations](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md)
  - [Related Structures](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#related-structures)
    - [`Category(V): RngVal → Cat`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-category-rngval)
    - [`Parent(V): RngVal → Pow`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-parent-rngval)
    - [`PrimeRing(V): RngVal → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-primering-rngval)
    - [`Center(V): RngVal → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-center-rngval)
    - [`FieldOfFractions(V): RngVal → Rng`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-fieldoffractions-rngval)
  - [Numerical Invariants](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#numerical-invariants)
    - [`Characteristic(V): RngVal → RngIntElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/structure.md#function-characteristic-rngval)
- [Element Operations](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md)
  - [Arithmetic Operations](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#arithmetic-operations)
    - [`+ v: RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-rngvalelt-rngvalelt)
    - [`- v: RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-rngvalelt-rngvalelt-2)
    - [`v + w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-plus-rngvalelt-rngvalelt)
    - [`v - w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-minus-rngvalelt-rngvalelt)
    - [`v * w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-times-rngvalelt-rngvalelt)
    - [`v ^ k: RngValElt, RngIntElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-pow-rngvalelt-rngintelt)
    - [`v / w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-div-rngvalelt-rngvalelt)
    - [`v +:= w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-rngvalelt-rngvalelt-rngvalelt)
    - [`v -:= w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-rngvalelt-rngvalelt-rngvalelt-2)
    - [`v *:= w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-rngvalelt-rngvalelt-rngvalelt-3)
    - [`v div w: RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-operation-div-rngvalelt-rngvalelt-rngvalelt)
  - [Equality and Membership](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#equality-and-membership)
    - [`v eq w: RngValElt, RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-eq-rngvalelt-rngvalelt)
    - [`v ne w: RngValElt, RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-ne-rngvalelt-rngvalelt)
    - [`v in V: RngValElt, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-in-rngvalelt-rng)
    - [`v notin V: RngValElt, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#operation-op-notin-rngvalelt-rng)
  - [Parent and Category](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#parent-and-category)
    - [`Parent(v): RngValElt → RngVal`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-parent-rngvalelt)
    - [`Category(v): RngValElt → Cat`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-category-rngvalelt)
  - [Predicates on Ring Elements](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#predicates-on-ring-elements)
    - [`IsZero(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-iszero-rngvalelt)
    - [`IsOne(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isone-rngvalelt)
    - [`IsMinusOne(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isminusone-rngvalelt)
    - [`IsNilpotent(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isnilpotent-rngvalelt)
    - [`IsIdempotent(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isidempotent-rngvalelt)
    - [`IsUnit(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isunit-rngvalelt)
    - [`IsZeroDivisor(n): RngValElt → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-iszerodivisor-rngvalelt)
    - [`IsRegular(n): RngVal → BoolElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-isregular-rngval)
  - [Other Element Functions](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#other-element-functions)
    - [`EuclideanNorm(v): RngValElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-euclideannorm-rngvalelt)
    - [`Valuation(v): RngValElt → RngIntElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-valuation-rngvalelt)
    - [`Quotrem(v, w): RngValElt, RngValElt → RngValElt, RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-quotrem-rngvalelt-rngvalelt)
    - [`GreatestCommonDivisor(v, w): RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-greatestcommondivisor-rngvalelt-rngvalelt)
    - [`Gcd(v, w): RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-gcd-rngvalelt-rngvalelt)
    - [`GCD(v, w): RngValElt, RngValElt → RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-gcd-rngvalelt-rngvalelt-2)
    - [`ExtendedGreatestCommonDivisor(v, w): RngValElt, RngValElt → RngValElt, RngValElt, RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-extendedgreatestcommondivisor-rngvalelt-rngvalelt)
    - [`Xgcd(v, w): RngValElt, RngValElt → RngValElt, RngValElt, RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-xgcd-rngvalelt-rngvalelt)
    - [`XGCD(v, w): RngValElt, RngValElt → RngValElt, RngValElt, RngValElt`](https://docs.magma-maths.org/LocalFields/ValuationRings/element.md#function-xgcd-rngvalelt-rngvalelt-2)

### Introduction

Magma currently supports basic operations in valuation rings obtained either from the rational field ${\mathbb{Q}}$ (and a finite prime $p$), or from a field of rational functions over a field (and an irreducible polynomial, or the infinite prime).

### Creation Functions

#### Creation of Structures

<a id="function-valuationring-fldrat-rngintelt"></a>
##### `ValuationRing(Q, p): FldRat, RngIntElt -> RngVal`

Given the rational field $Q$ and a rational prime number $p$, create the valuation ring $R$ corresponding to the discrete non-Archimedean valuation $v_p$, consisting of rational numbers $r$ such that $v_p(r)\geq 0$, that is, $r={x\over y}\in\Q$ such that $p\nmid y$.

<a id="function-valuationring-fldfunrat-rngupolelt"></a>
##### `ValuationRing(F, f): FldFunRat, RngUPolElt -> RngVal`

Given the rational function field $F$ as a field of fractions of the univariate polynomial ring $K[x]$ over a field $K$, as well as a monic irreducible polynomial $f\in K[x]$, create the valuation ring $R$ corresponding to the discrete non-Archimedean valuation $v_f$. Thus $R$ consists of rational functions ${g\over h}\in F$ with $v_f(g/h)\geq 0$, that is, with $f\nmid h$.

<a id="function-valuationring-fldfunrat"></a>
##### `ValuationRing(F): FldFunRat -> RngVal`

Given the rational function field $F$ as a field of fractions of the univariate polynomial ring $K[x]$ over a field $K$, create the valuation ring $R$ corresponding to $v_{\infty}$, consisting of ${g\over h}\in F$ such that $\deg(h)\geq\deg(g)$.

<a id="function-valuationring-fldnum-rngordidl"></a>
##### `ValuationRing(K, p): FldNum, RngOrdIdl -> RngVal`

<a id="function-valuationring-fldfun-rngfunordidl"></a>
##### `ValuationRing(K, p): FldFun, RngFunOrdIdl -> RngVal`

Given an algebraic number field or function field $K$ and a prime ideal $p$ contained in $K$, construct the valuation ring $R$ corresponding to the valuation given by the prime ideal $p$.

#### Creation of Elements

<a id="operation-op-rngval-fldfunelt"></a>
##### `V ! r: RngVal, FldFunElt -> RngValElt`

<a id="operation-op-rngval-fldratelt"></a>
##### `V ! r: RngVal, FldRatElt -> RngValElt`

Given a valuation ring $V$ and an element of the field of fractions $F$ of $V$ (from which $V$ was created), coerce the element $r$ into $V$. This is only possible for elements $r\in F$ for which the valuation on $V$ is non-negative, an error occurs if this is not the case.

### Structure Operations

#### Related Structures

<a id="function-category-rngval"></a>
##### `Category(V): RngVal -> Cat`

<a id="function-parent-rngval"></a>
##### `Parent(V): RngVal -> Pow`

<a id="function-primering-rngval"></a>
##### `PrimeRing(V): RngVal -> RngVal`

<a id="function-center-rngval"></a>
##### `Center(V): RngVal -> RngVal`

<a id="function-fieldoffractions-rngval"></a>
##### `FieldOfFractions(V): RngVal -> Rng`

Return field of fractions of the valuation ring $V$, which is the rational field or the function field from which $V$ was created.

#### Numerical Invariants

<a id="function-characteristic-rngval"></a>
##### `Characteristic(V): RngVal -> RngIntElt`

### Element Operations

#### Arithmetic Operations

<a id="operation-operation-rngvalelt-rngvalelt"></a>
##### `+ v: RngValElt -> RngValElt`

<a id="operation-operation-rngvalelt-rngvalelt-2"></a>
##### `- v: RngValElt -> RngValElt`

<a id="operation-op-plus-rngvalelt-rngvalelt"></a>
##### `v + w: RngValElt, RngValElt -> RngValElt`

<a id="operation-op-minus-rngvalelt-rngvalelt"></a>
##### `v - w: RngValElt, RngValElt -> RngValElt`

<a id="operation-op-times-rngvalelt-rngvalelt"></a>
##### `v * w: RngValElt, RngValElt -> RngValElt`

<a id="operation-op-pow-rngvalelt-rngintelt"></a>
##### `v ^ k: RngValElt, RngIntElt -> RngValElt`

<a id="operation-op-div-rngvalelt-rngvalelt"></a>
##### `v / w: RngValElt, RngValElt -> RngValElt`

<a id="operation-operation-rngvalelt-rngvalelt-rngvalelt"></a>
##### `v +:= w: RngValElt, RngValElt -> RngValElt`

<a id="operation-operation-rngvalelt-rngvalelt-rngvalelt-2"></a>
##### `v -:= w: RngValElt, RngValElt -> RngValElt`

<a id="operation-operation-rngvalelt-rngvalelt-rngvalelt-3"></a>
##### `v *:= w: RngValElt, RngValElt -> RngValElt`

<a id="operation-operation-div-rngvalelt-rngvalelt-rngvalelt"></a>
##### `v div w: RngValElt, RngValElt -> RngValElt`

The quotient $q$ of the division with remainder $v=qw+r$ of the valuation ring elements $v$ and $w$, where the remainder will have valuation less than that of $w$; if the valuation of $v$ is greater than or equal than that of $w$, this simply returns the quotient $v/w$, if the valuation of $w$ exceeds that of $v$ it returns $0$.

#### Equality and Membership

<a id="operation-op-eq-rngvalelt-rngvalelt"></a>
##### `v eq w: RngValElt, RngValElt -> BoolElt`

<a id="operation-op-ne-rngvalelt-rngvalelt"></a>
##### `v ne w: RngValElt, RngValElt -> BoolElt`

<a id="operation-op-in-rngvalelt-rng"></a>
##### `v in V: RngValElt, Rng -> BoolElt`

<a id="operation-op-notin-rngvalelt-rng"></a>
##### `v notin V: RngValElt, Rng -> BoolElt`

#### Parent and Category

<a id="function-parent-rngvalelt"></a>
##### `Parent(v): RngValElt -> RngVal`

<a id="function-category-rngvalelt"></a>
##### `Category(v): RngValElt -> Cat`

#### Predicates on Ring Elements

<a id="function-iszero-rngvalelt"></a>
##### `IsZero(n): RngValElt -> BoolElt`

<a id="function-isone-rngvalelt"></a>
##### `IsOne(n): RngValElt -> BoolElt`

<a id="function-isminusone-rngvalelt"></a>
##### `IsMinusOne(n): RngValElt -> BoolElt`

<a id="function-isnilpotent-rngvalelt"></a>
##### `IsNilpotent(n): RngValElt -> BoolElt`

<a id="function-isidempotent-rngvalelt"></a>
##### `IsIdempotent(n): RngValElt -> BoolElt`

<a id="function-isunit-rngvalelt"></a>
##### `IsUnit(n): RngValElt -> BoolElt`

<a id="function-iszerodivisor-rngvalelt"></a>
##### `IsZeroDivisor(n): RngValElt -> BoolElt`

<a id="function-isregular-rngval"></a>
##### `IsRegular(n): RngVal -> BoolElt`

#### Other Element Functions

<a id="function-euclideannorm-rngvalelt"></a>
##### `EuclideanNorm(v): RngValElt -> RngIntElt`

<a id="function-valuation-rngvalelt"></a>
##### `Valuation(v): RngValElt -> RngIntElt`

Given an element $v$ of a valuation ring $V$, return the valuation (associated with $V$) of $v$.

<a id="function-quotrem-rngvalelt-rngvalelt"></a>
##### `Quotrem(v, w): RngValElt, RngValElt -> RngValElt, RngValElt`

Given two elements $v, w$ of a valuation ring $V$ with associated valuation $\phi$, return a quotient and remainder $q$ and $r$ in $V$ such that $v=qw+r$ and $0\leq\phi(r)<\phi(w)$. If $\phi(v)<\phi(w)$ this simply returns $q=0$ and $r=v$, and if $\phi(v)\geq\phi(w)$ then it returns $q=v/w$ and $r=0$.

<a id="function-greatestcommondivisor-rngvalelt-rngvalelt"></a>
##### `GreatestCommonDivisor(v, w): RngValElt, RngValElt -> RngValElt`

<a id="function-gcd-rngvalelt-rngvalelt"></a>
##### `Gcd(v, w): RngValElt, RngValElt -> RngValElt`

<a id="function-gcd-rngvalelt-rngvalelt-2"></a>
##### `GCD(v, w): RngValElt, RngValElt -> RngValElt`

This function returns a greatest common divisor of two elements $v, w$ in a valuation ring $V$. This will return $u^m$, where $m=\min(\phi(v), \phi(w))$ is the minimum of the valuations of $v$ and $w$ and $u$ is the uniformizing element of $V$ (with valuation $\phi(u)=1$).

<a id="function-extendedgreatestcommondivisor-rngvalelt-rngvalelt"></a>
##### `ExtendedGreatestCommonDivisor(v, w): RngValElt, RngValElt -> RngValElt, RngValElt, RngValElt`

<a id="function-xgcd-rngvalelt-rngvalelt"></a>
##### `Xgcd(v, w): RngValElt, RngValElt -> RngValElt, RngValElt, RngValElt`

<a id="function-xgcd-rngvalelt-rngvalelt-2"></a>
##### `XGCD(v, w): RngValElt, RngValElt -> RngValElt, RngValElt, RngValElt`

This function returns a greatest common divisor $z\in V$ of two elements $v, w$ in a valuation ring $V$ as well as multipliers $x, y\in V$ such that $xv+yw=z$. The principal return value will be $z=u^m$, where $m=\min(\phi(v), \phi(w))$ is the minimum of the valuations of $v$ and $w$ and $u$ is the uniformizing element of $V$ (with valuation $\phi(u)=1$).

<a id="galois-ring"></a>
<a id="rnggal"></a>
## Galois Rings

- [Introduction](https://docs.magma-maths.org/LocalFields/GaloisRings/introduction.md)
- [Creation Functions](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md)
  - [Creation of Structures](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#creation-of-structures)
    - [`GaloisRing(q, d): RngIntElt, RngIntElt → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-galoisring-rngintelt-rngintelt)
    - [`GR(q, d): RngIntElt, RngIntElt → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-gr-rngintelt-rngintelt)
    - [`GaloisRing(p, a, d): RngIntElt, RngIntElt, RngIntElt → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-galoisring-rngintelt-rngintelt-rngintelt)
    - [`GR(p, a, d): RngIntElt, RngIntElt, RngIntElt → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-gr-rngintelt-rngintelt-rngintelt)
    - [`GaloisRing(q, D): RngIntElt, RngUPol → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-galoisring-rngintelt-rngupol)
    - [`GR(q, D): RngIntElt, RngUPol → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-gr-rngintelt-rngupol)
    - [`GaloisRing(p, a, D): RngIntElt, RngIntElt, RngUPol → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-galoisring-rngintelt-rngintelt-rngupol)
    - [`GR(p, a, D): RngIntElt, RngIntElt, RngUPol → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-gr-rngintelt-rngintelt-rngupol)
  - [Names](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#names)
    - [`AssignNames(~R, [f]): RngGal, [ MonStgElt ]`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#procedure-assignnames-rnggal-monstgelt-ref)
    - [`Name(R, 1): RngGal, RngIntElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-name-rnggal-rngintelt)
  - [Creation of Elements](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#creation-of-elements)
    - [`R . 1: RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#operation-operation-rnggal-rnggalelt)
    - [`Generator(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-generator-rnggal)
    - [`R ! a: RngGal, RngElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#operation-op-rnggal-rngelt)
    - [`One(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-one-rnggal)
    - [`Identity(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-identity-rnggal)
    - [`Zero(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-zero-rnggal)
    - [`Representative(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-representative-rnggal)
    - [`Random(R): RngGal → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-random-rnggal)
  - [Sequence Conversions](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#sequence-conversions)
    - [`ElementToSequence(a): RngGalElt → [ RngIntResElt ]`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-elementtosequence-rnggalelt)
    - [`Eltseq(a): RngGalElt → [ RngIntResElt ]`](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#function-eltseq-rnggalelt)
    - [Example: Defining a Galois Ring](https://docs.magma-maths.org/LocalFields/GaloisRings/creation.md#example-ex-5d69d7)
- [Structure Operations](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md)
  - [Related Structures](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#related-structures)
    - [`Category(R): RngGal → Cat`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-category-rnggal)
    - [`Parent(R): RngGal → PowerStructure`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-parent-rnggal)
    - [`Centre(R): RngGal → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-centre-rnggal)
    - [`PrimeRing(R): RngGal → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-primering-rnggal)
    - [`PrimeField(R): RngGal → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-primefield-rnggal)
    - [`FieldOfFractions(R): RngGal → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-fieldoffractions-rnggal)
  - [Numerical Invariants](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#numerical-invariants)
    - [`Characteristic(R): RngGal → RngIntElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-characteristic-rnggal)
    - [`# R: RngGal → RngIntElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#operation-operation-rnggal-rngintelt)
    - [`Degree(R): RngGal → RngIntElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-degree-rnggal)
    - [`ResidueField(R): RngGal → FldFin`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-residuefield-rnggal)
  - [Ring Predicates and Booleans](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#ring-predicates-and-booleans)
    - [`IsCommutative(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-iscommutative-rnggal)
    - [`IsUnitary(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isunitary-rnggal)
    - [`IsFinite(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isfinite-rnggal)
    - [`IsOrdered(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isordered-rnggal)
    - [`IsField(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isfield-rnggal)
    - [`IsEuclideanDomain(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-iseuclideandomain-rnggal)
    - [`IsPID(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-ispid-rnggal)
    - [`IsUFD(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isufd-rnggal)
    - [`IsDivisionRing(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isdivisionring-rnggal)
    - [`IsEuclideanRing(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-iseuclideanring-rnggal)
    - [`IsPrincipalIdealRing(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isprincipalidealring-rnggal)
    - [`IsDomain(R): RngGal → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#function-isdomain-rnggal)
    - [`R eq G: RngGal, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#operation-op-eq-rnggal-rng)
    - [`R ne G: RngGal, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation.md#operation-op-ne-rnggal-rng)
- [Element Operations](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md)
  - [Arithmetic Operators](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#arithmetic-operators)
    - [`+ a: RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-rnggalelt-rnggalelt)
    - [`- a: RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-rnggalelt-rnggalelt-2)
    - [`a + b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-plus-rnggalelt-rnggalelt)
    - [`a - b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-minus-rnggalelt-rnggalelt)
    - [`a * b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-times-rnggalelt-rnggalelt)
    - [`a ^ k: RngGalElt, RngIntElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-pow-rnggalelt-rngintelt)
    - [`a +:= b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-rnggalelt-rnggalelt-rnggalelt)
    - [`a -:= b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-rnggalelt-rnggalelt-rnggalelt-2)
    - [`a *:= b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-rnggalelt-rnggalelt-rnggalelt-3)
  - [Euclidean Operations](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#euclidean-operations)
    - [`a div b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-div-rnggalelt-rnggalelt-rnggalelt)
    - [`a mod b: RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-operation-mod-rnggalelt-rnggalelt-rnggalelt)
    - [`Quotrem(a, b): RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-quotrem-rnggalelt-rnggalelt)
    - [`GCD(a, b): RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-gcd-rnggalelt-rnggalelt)
    - [`LCM(a, b): RngGalElt, RngGalElt → RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-lcm-rnggalelt-rnggalelt)
    - [`XGCD(a, b): RngGalElt, RngGalElt → RngGalElt, RngGalElt, RngGalElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-xgcd-rnggalelt-rnggalelt)
  - [Equality and Membership](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#equality-and-membership)
    - [`a eq b: RngGalElt, RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-eq-rnggalelt-rnggalelt)
    - [`a ne b: RngGalElt, RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-ne-rnggalelt-rnggalelt)
    - [`a in R: RngGalElt, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-in-rnggalelt-rng)
    - [`a notin R: RngGalElt, Rng → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#operation-op-notin-rnggalelt-rng)
  - [Parent and Category](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#parent-and-category)
    - [`Parent(a): RngGalElt → RngGal`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-parent-rnggalelt)
    - [`Category(a): RngGalElt → Cat`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-category-rnggalelt)
  - [Predicates on Ring Elements](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#predicates-on-ring-elements)
    - [`IsZero(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-iszero-rnggalelt)
    - [`IsOne(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-isone-rnggalelt)
    - [`IsMinusOne(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-isminusone-rnggalelt)
    - [`IsNilpotent(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-isnilpotent-rnggalelt)
    - [`IsIdempotent(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-isidempotent-rnggalelt)
    - [`IsUnit(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-isunit-rnggalelt)
    - [`IsZeroDivisor(a): RngGalElt → BoolElt`](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#function-iszerodivisor-rnggalelt)
    - [Example: Groebner Bases over Galois Rings](https://docs.magma-maths.org/LocalFields/GaloisRings/operation-element.md#example-ex-6cf97d)

### Introduction

Magma provides facilities for computing with Galois rings. The features are currently very basic, but advanced features will be available in the near future, including support for the creation of subrings and appropriate embeddings, allowing lattices of compatible embeddings, just as for finite fields. A Galois ring $R$ in Magma is considered as a finite algebraic extension of ${\mathbb{Z}}_{p^a}$ (where $p$ is prime) by a monic polynomial $D\in{\mathbb{Z}}[x]$ which is irreducible modulo $p$. Thus $R$ is presented as the polynomial quotient ring ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$ and is usually written as $\operatorname{GR}({p^a}, { d})$, where $d$ is the degree of $D$. The cardinality of $R$ is easily seen to be $p^{ad}$. $R$ has a unique maximal ideal generated by $p$, and the quotient ring $R/\langle p\rangle$ is a finite field isomorphic to ${\mathbb{Z}}_p[x]/\langle D\rangle$, where $D$ is here considered as a polynomial in ${\mathbb{Z}}_p[x]$ (the coefficients are reduced modulo $p$). This finite field is called the *residue field* of $R$. In the following, we will also call the integer residue ring ${\mathbb{Z}}_{p^a}$ the *base ring* of $R$, because this is the subring of $R$ generated by 1 and we can think of $R$ as an extension of ${\mathbb{Z}}_{p^a}$. For a non-zero element $x$ of $R$, the valuation of $x$ is defined to be the largest power of $p$ which divides the coefficients of $x$, where $x$ is considered as a polynomial in ${\mathbb{Z}}_p[x]/\langle D\rangle$. $x$ is a unit if and only if the valuation of $x$ is zero. Because of the valuation defined on them, Galois rings are Euclidean rings, so they may be used in Magma in any place where general Euclidean rings are valid. This includes many matrix and module functions, and the computation of Gröbner bases. Linear codes over Galois rings will be supported in the near future.

### Creation Functions

#### Creation of Structures

<a id="function-galoisring-rngintelt-rngintelt"></a>
##### `GaloisRing(q, d): RngIntElt, RngIntElt -> RngGal`

<a id="function-gr-rngintelt-rngintelt"></a>
##### `GR(q, d): RngIntElt, RngIntElt -> RngGal`

Given integers $q$, $d\ge 1$, where $q = p^a$ for prime $p$ and $a\ge 1$, create the default Galois ring $\operatorname{GR}({p^a}, { d})$. The defining polynomial used to construct the ring will be that used for ${\bf F}_{p^d}$, lifted to ${\mathbb{Z}}_{p^a}$. If $p$ is very large, it is advised to use the next function instead, because Magma must first factor $q$ completely. The angle bracket notation can be used to assign names to the generator; e.g.: `R<w> := GaloisRing(2, 3)`.

<a id="function-galoisring-rngintelt-rngintelt-rngintelt"></a>
##### `GaloisRing(p, a, d): RngIntElt, RngIntElt, RngIntElt -> RngGal`

<a id="function-gr-rngintelt-rngintelt-rngintelt"></a>
##### `GR(p, a, d): RngIntElt, RngIntElt, RngIntElt -> RngGal`

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

Given a prime $p$ and integers $a, d\ge 1$, create the default Galois ring $\operatorname{GR}({p^a}, { d})$. The defining polynomial used to construct the ring will be that used for ${\bf F}_{p^d}$, lifted to ${\mathbb{Z}}_{p^a}$. By default $p$ is checked to be a strong pseudoprime for 20 random bases $b$ with $1 < b < p$; if the parameter `Check` is `false`, then no check is done on $p$ at all (this is useful when $p$ is very large and one does not wish to perform an expensive primality test on $p$).

<a id="function-galoisring-rngintelt-rngupol"></a>
##### `GaloisRing(q, D): RngIntElt, RngUPol -> RngGal`

<a id="function-gr-rngintelt-rngupol"></a>
##### `GR(q, D): RngIntElt, RngUPol -> RngGal`

Given an integer $q$, where $q = p^a$ for prime $p$ and $a\ge 1$, and a monic polynomial $D$ over ${\mathbb{Z}}$ such that $D$ is irreducible mod $p$, create the Galois ring $R = \operatorname{GR}({p^a}, { D})$. The coefficients of $D$ are reduced modulo $p^a$, and $R$ is constructed to behave like the polynomial quotient ring ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$. If $p$ is very large, it is advised to use the next function instead, because Magma must first factor $q$ completely.

<a id="function-galoisring-rngintelt-rngintelt-rngupol"></a>
##### `GaloisRing(p, a, D): RngIntElt, RngIntElt, RngUPol -> RngGal`

<a id="function-gr-rngintelt-rngintelt-rngupol"></a>
##### `GR(p, a, D): RngIntElt, RngIntElt, RngUPol -> RngGal`

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

Given a prime $p$, an integer $a\ge 1$, and a monic polynomial $D$ over ${\mathbb{Z}}$ such that $D$ is irreducible mod $p$, create the Galois ring $R = \operatorname{GR}({p^a}, { D})$. The coefficients of $D$ are reduced modulo $p^a$, and $R$ is constructed to behave like the polynomial quotient ring ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$. The parameter `Check` is as above.

#### Names

<a id="procedure-assignnames-rnggal-monstgelt-ref"></a>
##### `AssignNames(~R, [f]): RngGal, [ MonStgElt ]`

Procedure to change the name of the generating element in the Galois ring $R$ to the contents of the string $f$. When $R$ is created, the name will be `R.1`. This procedure only changes the name used in printing the elements of $R$. It does *not* assign to an identifier called $f$ the value of the generator in $R$; to do this, use an assignment statement, or use angle brackets when creating the ring. Note that since this is a procedure that modifies $R$, it is necessary to have a reference `~R` to $R$ in the call to this function.

<a id="function-name-rnggal-rngintelt"></a>
##### `Name(R, 1): RngGal, RngIntElt -> RngGalElt`

Given a Galois ring $R$, return the element which has the name attached to it, that is, return the element `R.1` of $R$.

#### Creation of Elements

<a id="operation-operation-rnggal-rnggalelt"></a>
##### `R . 1: RngGal -> RngGalElt`

<a id="function-generator-rnggal"></a>
##### `Generator(R): RngGal -> RngGalElt`

The generator for $R$ as an algebra over its base ring ${\mathbb{Z}}_{p^a}$. Thus, if $R$ is viewed as ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$, then `R.1` corresponds to $x$ in this presentation.

<a id="operation-op-rnggal-rngelt"></a>
##### `R ! a: RngGal, RngElt -> RngGalElt`

Given a Galois ring $R$ create the element specified by $a$; here $a$ is allowed to be an element coercible into $R$, which means that $a$ may be

**(i)**
An element of $R$;

**(ii)**
An integer, to be identified with $a$ modulo the characteristic $p^a$ of $R$;

**(iii)**
An element of the base ring ${\mathbb{Z}}_{p^a}$ of $R$, to be identified with the corresponding element of $R$.

**(iv)**
A sequence of elements of the base ring ${\mathbb{Z}}_{p^a}$ of $R$. In this case the element $a_0+a_1w+\cdots+a_{n-1}w^{n-1}$ is created, where $a=[a_0, \ldots a_{n-1}]$ and $w$ is the generator `R.1` of $R$ over ${\mathbb{Z}}_{p^a}$.

<a id="function-one-rnggal"></a>
##### `One(R): RngGal -> RngGalElt`

<a id="function-identity-rnggal"></a>
##### `Identity(R): RngGal -> RngGalElt`

<a id="function-zero-rnggal"></a>
##### `Zero(R): RngGal -> RngGalElt`

<a id="function-representative-rnggal"></a>
##### `Representative(R): RngGal -> RngGalElt`

These generic functions create $1$, $1$, $0$, and $0$ respectively, in any Galois ring.

<a id="function-random-rnggal"></a>
##### `Random(R): RngGal -> RngGalElt`

Create a pseudo-random element of Galois ring $R$.

#### Sequence Conversions

<a id="function-elementtosequence-rnggalelt"></a>
##### `ElementToSequence(a): RngGalElt -> [ RngIntResElt ]`

<a id="function-eltseq-rnggalelt"></a>
##### `Eltseq(a): RngGalElt -> [ RngIntResElt ]`

Given an element $a$ of the Galois ring $R$, return the sequence of coefficients $[a_0, \ldots, a_{n-1}]$ in the base ring ${\mathbb{Z}}_{p^a}$ of $R$ (where $R$ is ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$), such that $a=a_0+a_1w+\cdots+a_{n-1}w^{d-1}$, with $w$ the generator of $R$, and $d$ the degree of $D$.

<a id="example-ex-5d69d7"></a>
##### `Example: Defining a Galois Ring (ex-5d69d7)`

We can define the Galois ring $\operatorname{GR}({2^3}, { 2})$ using the default function:

```magma
> R<w> := GaloisRing(2^3, 2);
> R;
GaloisRing(2, 3, 2)
```

We note that $R$ has characteristic 8 and that $w^2 + w + 1 = 0$ in $R$.

```magma
> R!8;
0
> R!9;
1
> w;
w
> 4*w;
4*w
> 4*w + 4*w;
0
> w^2;
7*w + 7
> w^2 + w + 1;
0
```

We can list all the elements of $R$ by simply looping over $R$:

```magma
> [x: x in R];
[ 0, 1, 2, 3, 4, 5, 6, 7, w, w + 1, w + 2, w + 3, w + 4, w + 5, w + 6,
    w + 7, 2*w, 2*w + 1, 2*w + 2, 2*w + 3, 2*w + 4, 2*w + 5, 2*w + 6, 2*w
    + 7, 3*w, 3*w + 1, 3*w + 2, 3*w + 3, 3*w + 4, 3*w + 5, 3*w + 6,
    3*w + 7, 4*w, 4*w + 1, 4*w + 2, 4*w + 3, 4*w + 4, 4*w + 5, 4*w +
    6, 4*w + 7, 5*w, 5*w + 1, 5*w + 2, 5*w + 3, 5*w + 4, 5*w + 5, 5*w
    + 6, 5*w + 7, 6*w, 6*w + 1, 6*w + 2, 6*w + 3, 6*w + 4, 6*w + 5,
    6*w + 6, 6*w + 7, 7*w, 7*w + 1, 7*w + 2, 7*w + 3, 7*w + 4, 7*w +
    5, 7*w + 6, 7*w + 7 ]
```

We see that the elements of $R$ can be considered as polynomials of degree at most 1, with coefficients in the range $\{ 0 \ldots 7\}$. We can easily create elements of $R$ also using the `!` operator, and use the `Eltseq` function to recover the corresponding sequence of coefficients.

```magma
> R ! [1, 2];
2*w + 1
> Eltseq(2*w + 1);
[ 1, 2 ]
> Eltseq(w);
[ 0, 1 ]
```

### Structure Operations

#### Related Structures

<a id="function-category-rnggal"></a>
##### `Category(R): RngGal -> Cat`

<a id="function-parent-rnggal"></a>
##### `Parent(R): RngGal -> PowerStructure`

<a id="function-centre-rnggal"></a>
##### `Centre(R): RngGal -> RngGal`

<a id="function-primering-rnggal"></a>
##### `PrimeRing(R): RngGal -> RngGal`

<a id="function-primefield-rnggal"></a>
##### `PrimeField(R): RngGal -> RngGal`

<a id="function-fieldoffractions-rnggal"></a>
##### `FieldOfFractions(R): RngGal -> RngGal`

#### Numerical Invariants

<a id="function-characteristic-rnggal"></a>
##### `Characteristic(R): RngGal -> RngIntElt`

The characteristic of $R$, which is $p^a$ where $R$ is considered as ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$.

<a id="operation-operation-rnggal-rngintelt"></a>
##### `# R: RngGal -> RngIntElt`

The cardinality of $R$, which is $p^{ad}$ where $R$ is considered as ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$ and $d$ is the degree of $D$.

<a id="function-degree-rnggal"></a>
##### `Degree(R): RngGal -> RngIntElt`

The degree of $R$, which is the degree of $D$, where $R$ is considered as ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$.

<a id="function-residuefield-rnggal"></a>
##### `ResidueField(R): RngGal -> FldFin`

The residue field of $R$, which is the finite field ${\mathbb{Z}}_p[x]/\langle D\rangle$, where $R$ is considered as ${\mathbb{Z}}_{p^a}[x]/\langle D\rangle$.

#### Ring Predicates and Booleans

The following functions are described for rings in general in Section [Predicates and Boolean Operations](https://docs.magma-maths.org/BasicRings/IntroductionToRings/generic.md#rngintro-predb).

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

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

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

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

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

<a id="function-iseuclideandomain-rnggal"></a>
##### `IsEuclideanDomain(R): RngGal -> BoolElt`

<a id="function-ispid-rnggal"></a>
##### `IsPID(R): RngGal -> BoolElt`

<a id="function-isufd-rnggal"></a>
##### `IsUFD(R): RngGal -> BoolElt`

<a id="function-isdivisionring-rnggal"></a>
##### `IsDivisionRing(R): RngGal -> BoolElt`

<a id="function-iseuclideanring-rnggal"></a>
##### `IsEuclideanRing(R): RngGal -> BoolElt`

<a id="function-isprincipalidealring-rnggal"></a>
##### `IsPrincipalIdealRing(R): RngGal -> BoolElt`

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

<a id="operation-op-eq-rnggal-rng"></a>
##### `R eq G: RngGal, Rng -> BoolElt`

<a id="operation-op-ne-rnggal-rng"></a>
##### `R ne G: RngGal, Rng -> BoolElt`

### Element Operations

See also Section [Generic Element Functions](https://docs.magma-maths.org/BasicRings/IntroductionToRings/element.md#rngintro-elt-funcs).

#### Arithmetic Operators

<a id="operation-operation-rnggalelt-rnggalelt"></a>
##### `+ a: RngGalElt -> RngGalElt`

<a id="operation-operation-rnggalelt-rnggalelt-2"></a>
##### `- a: RngGalElt -> RngGalElt`

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

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

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

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

<a id="operation-operation-rnggalelt-rnggalelt-rnggalelt"></a>
##### `a +:= b: RngGalElt, RngGalElt -> RngGalElt`

<a id="operation-operation-rnggalelt-rnggalelt-rnggalelt-2"></a>
##### `a -:= b: RngGalElt, RngGalElt -> RngGalElt`

<a id="operation-operation-rnggalelt-rnggalelt-rnggalelt-3"></a>
##### `a *:= b: RngGalElt, RngGalElt -> RngGalElt`

#### Euclidean Operations

<a id="operation-operation-div-rnggalelt-rnggalelt-rnggalelt"></a>
##### `a div b: RngGalElt, RngGalElt -> RngGalElt`

<a id="operation-operation-mod-rnggalelt-rnggalelt-rnggalelt"></a>
##### `a mod b: RngGalElt, RngGalElt -> RngGalElt`

<a id="function-quotrem-rnggalelt-rnggalelt"></a>
##### `Quotrem(a, b): RngGalElt, RngGalElt -> RngGalElt`

<a id="function-gcd-rnggalelt-rnggalelt"></a>
##### `GCD(a, b): RngGalElt, RngGalElt -> RngGalElt`

<a id="function-lcm-rnggalelt-rnggalelt"></a>
##### `LCM(a, b): RngGalElt, RngGalElt -> RngGalElt`

<a id="function-xgcd-rnggalelt-rnggalelt"></a>
##### `XGCD(a, b): RngGalElt, RngGalElt -> RngGalElt, RngGalElt, RngGalElt`

#### Equality and Membership

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

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

<a id="operation-op-in-rnggalelt-rng"></a>
##### `a in R: RngGalElt, Rng -> BoolElt`

<a id="operation-op-notin-rnggalelt-rng"></a>
##### `a notin R: RngGalElt, Rng -> BoolElt`

#### Parent and Category

<a id="function-parent-rnggalelt"></a>
##### `Parent(a): RngGalElt -> RngGal`

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

#### Predicates on Ring Elements

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

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

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

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

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

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

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

<a id="example-ex-6cf97d"></a>
##### `Example: Groebner Bases over Galois Rings (ex-6cf97d)`

This simple example shows how one can compute Gröbner bases over Galois rings. We create an ideal in 3 variables over a Galois ring and compute its Gröbner basis.

```magma
> R<w> := GaloisRing(3, 3, 2);
> #R;
729
> P<x,y,z> := PolynomialRing(R, 3);
> I := ideal<P | [x^2 - w*y, 3*y^3 - 3*w*x*z, 9*z^5 - 9*w]>;
> GroebnerBasis(I);
[
    x^2 + 26*w*y,
    3*x*y^3 + (6*w + 6)*y*z,
    3*x*z + (15*w + 3)*y^3,
    9*x + (9*w + 9)*y^3*z^4,
    3*y^6 + (21*w + 15)*y*z^2,
    9*z^5 + 18*w
]
```

Notice that the leading coefficients include 3 and 9, which are not units in the ring. See Chapter [Gröbner Bases](https://docs.magma-maths.org/CommutativeAlgebra/GrobnerBases/index-grobner-bases.md#chapgb) for much more information on such Gröbner bases.

<a id="newton-polygon"></a>
<a id="newtonpgon"></a>
## Newton Polygons

- [Introduction](https://docs.magma-maths.org/LocalFields/NewtonPolygons/introduction.md)
- [Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md)
  - [Creation of Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#creation-of-newton-polygons)
    - [`NewtonPolygon(f): RngMPolElt → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngmpolelt)
    - [`NewtonPolygon(f): RngUPolElt → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngupolelt)
    - [`NewtonPolygon(f, p): RngUPolElt, RngOrdIdl → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngupolelt-rngordidl)
    - [`NewtonPolygon(f, p): RngUPolElt, RngFunOrdIdl → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngupolelt-rngfunordidl)
    - [`NewtonPolygon(f, p): RngUPolElt, RngIntElt → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngupolelt-rngintelt)
    - [`NewtonPolygon(f, p): RngUPolElt, PlcFunElt → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-rngupolelt-plcfunelt)
    - [`NewtonPolygon(C): Crv → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-crv)
    - [`NewtonPolygon(V): SeqEnum → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-seqenum)
    - [`NewtonPolygon(V): SetEnum → NwtnPgon`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-newtonpolygon-setenum)
    - [`DefiningPoints(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-definingpoints-nwtnpgon)
    - [Example: Creating Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#example-ex-4f67e3)
  - [Vertices and Faces of Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#vertices-and-faces-of-polygons)
    - [`Faces(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-faces-nwtnpgon)
    - [`InnerFaces(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-innerfaces-nwtnpgon)
    - [`LowerFaces(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-lowerfaces-nwtnpgon)
    - [`OuterFaces(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-outerfaces-nwtnpgon)
    - [`AllFaces(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-allfaces-nwtnpgon)
    - [Example: Faces of a Newton Polygon](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#example-ex-a15e3f)
    - [`Vertices(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-vertices-nwtnpgon)
    - [`InnerVertices(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-innervertices-nwtnpgon)
    - [`LowerVertices(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-lowervertices-nwtnpgon)
    - [`OuterVertices(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-outervertices-nwtnpgon)
    - [`AllVertices(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-allvertices-nwtnpgon)
    - [Example: Vertices of a Newton Polygon](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#example-ex-534640)
    - [`EndVertices(F): NwtnPgonFace → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-endvertices-nwtnpgonface)
    - [`FacesContaining(N,p): NwtnPgon, Tup → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-facescontaining-nwtnpgon-tup)
    - [Example: End Vertices and Containing Faces](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#example-ex-8ed2f7)
    - [`GradientVector(F): NwtnPgonFace → Tup`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-gradientvector-nwtnpgonface)
    - [`GradientVectors(N): NwtnPgon → [ Tup ]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-gradientvectors-nwtnpgon)
    - [`Weight(F): NwtnPgonFace → RngIntElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-weight-nwtnpgonface)
    - [`Slopes(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-slopes-nwtnpgon)
    - [`InnerSlopes(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-innerslopes-nwtnpgon)
    - [`LowerSlopes(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-lowerslopes-nwtnpgon)
    - [`AllSlopes(N): NwtnPgon → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-allslopes-nwtnpgon)
    - [Example: Gradient Vector and Weight of a Face](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#example-ex-260949)
  - [Tests for Points and Faces](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#tests-for-points-and-faces)
    - [`IsFace(N, F): NwtnPgon, Tup → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-isface-nwtnpgon-tup)
    - [`IsVertex(N, p): NwtnPgon, Tup → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-isvertex-nwtnpgon-tup)
    - [`IsInterior(N,p): NwtnPgon, Tup → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-isinterior-nwtnpgon-tup)
    - [`IsBoundary(N, p): NwtnPgon, Tup → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-isboundary-nwtnpgon-tup)
    - [`IsPoint(N,p): NwtnPgon, Tup → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#function-ispoint-nwtnpgon-tup)
- [Polynomials Associated with Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md)
  - [`HasPolynomial(N): NwtnPgon → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-haspolynomial-nwtnpgon)
  - [`Polynomial(N): NwtnPgon → RngElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-polynomial-nwtnpgon)
  - [`ParentRing(N): NwtnPgon → Rng`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-parentring-nwtnpgon)
  - [`IsNewtonPolygonOf(N, f): NwtnPgon, RngElt → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-isnewtonpolygonof-nwtnpgon-rngelt)
  - [`FaceFunction(F): NwtnPgonFace → RngElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-facefunction-nwtnpgonface)
  - [`IsDegenerate(F): NwtnPgonFace → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-isdegenerate-nwtnpgonface)
  - [`IsDegenerate(N): NwtnPgon → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-isdegenerate-nwtnpgon)
  - [`IsNondegenerate(F): NwtnPgonFace → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-isnondegenerate-nwtnpgonface)
  - [`IsNondegenerate(N): NwtnPgon → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton-polynomials.md#function-isnondegenerate-nwtnpgon)
- [Finding Valuations of Roots of Polynomials from Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/val.md)
  - [`ValuationsOfRoots(f): RngUPolElt → [ < RngIntElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/val.md#function-valuationsofroots-rngupolelt)
  - [`ValuationsOfRoots(f, p): RngUPolElt, RngIntElt → [ < RngIntElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/val.md#function-valuationsofroots-rngupolelt-rngintelt)
  - [`ValuationsOfRoots(f, p): RngUPolElt, RngOrdIdl → [ < RngIntElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/val.md#function-valuationsofroots-rngupolelt-rngordidl)
  - [`ValuationsOfRoots(f, p): RngUPolElt, PlcFunElt → [ < RngIntElt, RngIntElt > ]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/val.md#function-valuationsofroots-rngupolelt-plcfunelt)
- [Using Newton Polygons to Find Roots of Polynomials over Series Rings](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md)
  - [`SetVerbose("Newton", v): MonStgElt, RngIntElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#procedure-setverbose-monstgelt-rngintelt-newton)
  - [Operations not associated with Duval’s Algorithm](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#operations-not-associated-with-duval-s-algorithm)
    - [`PuiseuxExpansion(f, n): RngUPolElt, RngIntElt → SeqEnum[RngSerPuisElt]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-newton-puiseuxexpansion)
    - [`ExpandToPrecision(f, c, n): RngUPolElt, RngSerElt, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-expandtoprecision-rngupolelt-rngserelt-rngintelt)
    - [`ImplicitFunction(f, d, n): RngUPolElt, RngIntElt, RngIntElt → RngSerElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-implicitfunction-rngupolelt-rngintelt-rngintelt)
    - [Example: Puiseux Expansions to Higher Precision](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#example-ex-d1b398)
    - [`IsPartialRoot(f, c): RngUPolElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-ispartialroot-rngupolelt-rngserelt)
    - [`IsUniquePartialRoot(f, c): RngUPolElt, RngSerElt → BoolElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-isuniquepartialroot-rngupolelt-rngserelt)
    - [Example: Checking That a Partial Root Can Be Expanded](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#example-ex-5113cd)
    - [`PuiseuxExponents(p): RngSerElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-puiseuxexponents-rngserelt)
    - [`PuiseuxExponentsCommon(p, q): RngSerElt, RngSerElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-puiseuxexponentscommon-rngserelt-rngserelt)
    - [Example: Exponents of Puiseux Expansions](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#example-ex-cc0585)
  - [Operations associated with Duval’s algorithm](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#operations-associated-with-duval-s-algorithm)
    - [`DuvalPuiseuxExpansion(f, n): RngUPolElt, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-duvalpuiseuxexpansion-rngupolelt-rngintelt)
    - [`ParametrizationToPuiseux(T): Tup → SeqEnum`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-parametrizationtopuiseux-tup)
    - [`PuiseuxToParametrization(S): RngSerElt → Tup`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-puiseuxtoparametrization-rngserelt)
    - [Example: Duval's Algorithm for Puiseux Expansions](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#example-ex-2dca42)
  - [Roots of Polynomials](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#roots-of-polynomials)
    - [`Roots(f): RngUPolElt → [<RngSerElt, RngIntElt>]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-roots-rngupolelt)
    - [`Roots(f, n): RngUPolElt, RngIntElt → [<RngSerElt, RngIntElt>]`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-roots-rngupolelt-rngintelt)
    - [`HasRoot(f): RngUPolElt → BoolElt, RngSerElt`](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#function-hasroot-rngupolelt)
    - [Example: Roots of Polynomials over Puiseux Series](https://docs.magma-maths.org/LocalFields/NewtonPolygons/poly-ops.md#example-ex-0c4847)
- [Bibliography](https://docs.magma-maths.org/LocalFields/NewtonPolygons/bibliography.md)

### Introduction

This chapter introduces functions which allow the construction and simple study of Newton polygons. It allows data from a number of different contexts to be used to construct the polygons. It also covers different interpretations of Newton polygons, and translation among these interpretations. Recall that a Newton polygon is the intersection of finitely many rational half spaces in the rational plane. An advantage of this definition is that it emphasizes that Newton polygons are often thought of as being noncompact. However, they are not implemented here in this way. Instead polygons are interpreted as the convex hull of finitely many points of the plane (possibly including some points at $+\infty$ along the axes).

Any Newton polygon is contained in some virtual cartesian product of the rational field with itself (virtual since this plane is not a structure that is intended to be accessible to the user or which is characteristic of the polygon). The first and second coordinate functions of this plane are referred to as the $x$ and $y$ coordinates respectively. Points of the plane will always be written $\left< a,b \right>$ while faces of polygons will be written $\left< a,b,c \right>$. Geometrically, a face $\left< a,b,c \right>$ is a one-dimensional boundary intersection of $N$ with the line $ax+by=c$.

The *standard Newton polygon* of a polynomial $f=f(u,v)$ is, by definition, the convex hull of the points $\left< a,b \right>$, so-called *Newton points*, ranging over monomials $u^av^b$ having nonzero coefficient in $f$ together with the points $+\infty$ on the two axes. The infinite points, however, are not listed among the vertices of the polygon; they are simply a convenient way of hiding all Newton points other than those on the ‘lower lefthand’ faces of the hull of those points. A similar definition applies to polynomials $f(y)$ whose coefficients lie in some field of fractional power series, or *Puiseux field*, $k\left<\!\left< x \right>\!\right>$. Newton Polygons can also be created for polynomials over local rings (and fields). The defining points are computed as $\langle i, v(a_i) \rangle$ where $a_i$ is the coefficient of the $i$-th power of the generator and $v$ denotes the valuation function on the ring. Infinite points arise only as the valuation of zero coefficients.

The main intended application of Newton polygons is to the Newton–Puiseux analysis of singular points of plane curves, or put another way, the factorization of polynomials defined over Puiseux fields.

The examples below should be thought of as running consecutively in a single Magma session.

```
> R<x,y> := PolynomialRing(Rationals(),2);
> f := x^5 + x^2*y + x^2*y^3 + y^4 + x^3*y^5 + y^2*x^7;
> N := NewtonPolygon(f);
> N;
Newton Polygon of x^7*y^2 + x^5 + x^3*y^5 + x^2*y^3 + x^2*y + y^4 over
Rational Field
> Faces(N);
[ <3, 2, 8>, <1, 3, 5> ]
> Vertices(N);
[ <0, 4>, <2, 1>, <5, 0> ]
```

This is the standard Newton polygon associated with the polynomial $f$. Only those vertices and faces of the convex hull of points which correspond to the monomials appearing in $f$ which ‘face’ the origin are considered to be vertices and faces of the polygon. As already mentioned, one interpretation of this is to think of the points $+\infty$ on each axis as being included among the defining points of $N$, and then $N$ is the convex hull of its defining points.

To consider $N$ as the compact convex hull of only the monomials of $f$ simply use alternative vertex and face functions.

```
> AllVertices(N);
[ <0, 4>, <2, 1>, <5, 0>, <7, 2>, <3, 5> ]
> AllFaces(N);
[ <3, 2, 8>, <1, 3, 5>, <-1, 1, -5>, <-3, -4, -29>, <1, -3, -12> ]
```

However, where there is a choice of interpretation, Magma always interprets $N$ in the way it was defined. So for example, the functions which test for faces and vertices compare a given value with the sequence returned by the functions `Faces(N)` or `Vertices(N)`, which are fixed the first time they are calculated, rather than with any other collections of faces or vertices.

```
> IsFace(N,<3/4,3/6,2>);
true <3, 2, 8>
> IsFace(N,<-3,-4,-29>);
false
```

Notice that faces are reduced to normal integral form and that the correct form is returned as the second return value of the test function.

When a polygon is created using a polynomial, the restriction of the polynomial to faces is important characteristic data.

```
> FaceFunction(Faces(N)[1]);
x^2*y + y^4
```

The face function is simply the sum of those monomial terms of $f$ (they keep their coefficients) whose corresponding Newton point lies on the given face.

### Newton Polygons

All polygons are determined by a finite collection of points in the rational plane. For Magma, these points are the most basic attribute of any Newton polygon. They are always determined and recorded on creation of a polygon. Throughout this chapter, for a Newton polygon $N$, these points are denoted by $P_N$. As seen in the introduction, the main class of polygons is that comprising polygons in the first quadrant of the plane and including the points $+\infty$ on the two axes. But there are other useful types, especially when calculating factorizations of univariate polynomials over series rings. The data distinguishing the different flavours of Newton polygon is the collection of lines and points that are considered to be faces and vertices.

<a id="newton-creation"></a>
<a id="newton-pgon-creation"></a>
#### Creation of Newton Polygons

These are the functions available for constructing Newton polygons and retrieving the points which describe them.

<a id="function-newtonpolygon-rngmpolelt"></a>
##### `NewtonPolygon(f): RngMPolElt -> NwtnPgon`

```magma
Faces: MonStgElt                    Default: "Inner"
```

The standard Newton polygon of a polynomial $f$ in two variables. This is the hull of the Newton points of the polynomial together with the points $+\infty$ on each axis. The horizontal and vertical ‘end’ faces are not listed among the faces of the polygon; the points at infinity are not listed among the vertices of the polygon.

The parameter `Faces` can have the value `"Inner"`, `"Lower"`, or `"All"`. This determines which faces are returned by the intrinsic `Faces`.

<a id="function-newtonpolygon-rngupolelt"></a>
##### `NewtonPolygon(f): RngUPolElt -> NwtnPgon`

```magma
SwapAxes: BoolElt                      Default: false
Faces   : MonStgElt                    Default: 
```

The standard Newton polygon of a polynomial in one variable defined over a series ring or a local ring or field. A value of `true` for `SwapAxes` is only valid if the polynomial is over a series ring. If `SwapAxes` is set to `true` then the exponents of the series variable will be plotted on the horizontal axis and the exponents of the polynomial on the vertical axis.

For a polynomial over a series ring, the hull includes the points $+\infty$ on each axis. For a polynomial over a local ring, the infinite points are not included.

The parameter `Faces` can have the value `"All"`, `"Inner"`, or `"Lower"`. This determines which faces are returned by the intrinsic `Faces`. The default for series rings is `"Inner"` and for local rings is `"Lower"`.

<a id="function-newtonpolygon-rngupolelt-rngordidl"></a>
##### `NewtonPolygon(f, p): RngUPolElt, RngOrdIdl -> NwtnPgon`

<a id="function-newtonpolygon-rngupolelt-rngfunordidl"></a>
##### `NewtonPolygon(f, p): RngUPolElt, RngFunOrdIdl -> NwtnPgon`

<a id="function-newtonpolygon-rngupolelt-rngintelt"></a>
##### `NewtonPolygon(f, p): RngUPolElt, RngIntElt -> NwtnPgon`

```magma
Faces: MonStgElt                    Default: "Inner"
```

The newton polygon of $f$ where $p$ is a prime used for valuations of the coefficients of $f$. The polynomial $f$ may be over the integers or rationals or a number field or algebraic function field or an order thereof. The prime $p$ may be an integer or a prime ideal. The newton polygon will have points $(i, v_i)$ where $i$ is the exponent of a term of $f$ and $v_i$ is the valuation of the coefficient of the $i$th term. The points at $+\infty$ on each axis are included.

The parameter `Faces` can have the value `"Inner"`, `"Lower"`, or `"All"`. This determines which faces are returned by the intrinsic `Faces`.

<a id="function-newtonpolygon-rngupolelt-plcfunelt"></a>
##### `NewtonPolygon(f, p): RngUPolElt, PlcFunElt -> NwtnPgon`

```magma
Faces: MonStgElt                    Default: "Inner"
```

The newton polygon of the polynomial $f$ where the place $p$ of an algebraic function field is the prime used for determining the valuations of the coefficients of $f$. The points at $+\infty$ on each axis are included.

The parameter `Faces` can have the value `"Inner"`, `"Lower"`, or `"All"`. This determines which faces are returned by the intrinsic `Faces`.

<a id="function-newtonpolygon-crv"></a>
##### `NewtonPolygon(C): Crv -> NwtnPgon`

The standard Newton polygon of the defining polynomial of the curve $C$.

<a id="function-newtonpolygon-seqenum"></a>
##### `NewtonPolygon(V): SeqEnum -> NwtnPgon`

<a id="function-newtonpolygon-setenum"></a>
##### `NewtonPolygon(V): SetEnum -> NwtnPgon`

```magma
Faces: MonStgElt                    Default: "All"
```

The Newton polygon that is the compact convex hull of the set or sequence $V$ of points of the form $\left< a,b \right>$ where $a$, $b$ are integers or rational numbers.

The parameter `Faces` can have the value `"All"`, `"Lower"`, or `"Inner"`. This determines which faces are returned by the intrinsic `Faces`.

<a id="function-definingpoints-nwtnpgon"></a>
##### `DefiningPoints(N): NwtnPgon -> SeqEnum`

The points of the rational plane used in the initial creation of $N$. Applying this function to two polygons allows their defining points to be compared. No explicit function is provided for testing whether defining points of two polygons are equal.

<a id="example-ex-4f67e3"></a>
##### `Example: Creating Newton Polygons (ex-4f67e3)`

Some ways of creating Newton Polygons from polynomials are shown below.

```magma
> P<y> := PuiseuxSeriesRing(Rationals());
> R<x> := PolynomialRing(P);
> f := 3*x^4 + (5*y^3 + 4*y^(1/4))*x^3 + (7*y^2 + 1/2*y^(1/3))*x^2 + 6*x + y^(
> 4/5);
> N := NewtonPolygon(f);
> N;
Newton Polygon of 3*x^4 + (4*y^(1/4) + 5*y^3)*x^3 + (1/2*y^(1/3) + 7*y^2)*x^2 +
6*x + y^(4/5) over Puiseux series field in y over Rational Field
> P<x> := PolynomialRing(Integers());
> L := ext<ext<pAdicRing(5, 100) | 3> | x^2 + 5>;
> R<x> := PolynomialRing(L);
> f := 3*x^4 + 75*x^3 + 78*x^2 + 10*x + 750;
> NR := NewtonPolygon(f);
> NR;
Newton Polygon of 3*x^4 + 75*x^3 + 78*x^2 + 10*x + 750 over L
```

Newton Polygons can also be created by specifying the defining points that the polygon must enclose.

```magma
> N2 := NewtonPolygon({<2, 0>, <0, 3>, <4, 1>});
> N2;
Newton Polygon with defining points {(0, 3), (2, 0), (4, 1)}
> N6 := NewtonPolygon({<1, 4>, <1, 6>, <2, 4>, <3, 1>, <6, 1>, <5, 2>, <4, 5>,
> <4, 7>, <6, 6>, <7, 7>, <2, 7>, <5, 9>, <8, 4>, <8, 6>, <8, 8>, <7, 9>});
> N6;
Newton Polygon with defining points {(1, 4), (1, 6), (2, 4), (2, 7), (3, 1), (4,
5), (4, 7), (5, 2), (5, 9), (6, 1), (6, 6), (7, 7), (7, 9), (8, 4), (8, 6), (8,
8)}
```

These polygons will be referred to in later examples.

#### Vertices and Faces of Polygons

Both the vertices $\left< a,b \right>$ and faces $\left< a,b,c \right>$ (representing $ax + by = c$) of a given polygon $N$ are computed as needed. As seen above, these will be a particular choice of possible faces and vertices determined by the data used to create the polygon. They can be recovered using the `Faces()` and `Vertices()` intrinsics. A different choice of faces and vertices, those faces and vertices of the compact convex hull of the defining points say, can be made using the other intrinsics below.

Recall that $P_N$ denotes the set of points used in the definition of the Newton polygon $N$ whether they arise as the powers of monomials appearing in a polynomial or have been given explicitly as a sequence of pairs.

<a id="function-faces-nwtnpgon"></a>
##### `Faces(N): NwtnPgon -> SeqEnum`

The sequence of faces $\left< a, b, c \right>$ (representing $ax + by = c$) of $N$ listed anticlockwise. How this is interpreted in terms of the points used to create $N$ depends on the creation function used (see Section [Creation of Newton Polygons](https://docs.magma-maths.org/LocalFields/NewtonPolygons/newton.md#newton-pgon-creation)). The faces are listed anticlockwise starting with the face with its left endpoint being the lowest of the leftmost points.

<a id="function-innerfaces-nwtnpgon"></a>
##### `InnerFaces(N): NwtnPgon -> SeqEnum`

Those faces of the compact convex hull of $P_N$ starting at the lowest of the leftmost points which have strictly negative gradient.

<a id="function-lowerfaces-nwtnpgon"></a>
##### `LowerFaces(N): NwtnPgon -> SeqEnum`

Those faces of the compact convex hull of $P_N$ which bound it below in the $y$ direction.

<a id="function-outerfaces-nwtnpgon"></a>
##### `OuterFaces(N): NwtnPgon -> SeqEnum`

The union of lower faces which aren’t inner faces and the faces which bound the compact convex hull of $P_N$ above in the $y$-direction (ignoring infinite points).

<a id="function-allfaces-nwtnpgon"></a>
##### `AllFaces(N): NwtnPgon -> SeqEnum`

The faces of the compact convex hull of $P_N$.

<a id="example-ex-a15e3f"></a>
##### `Example: Faces of a Newton Polygon (ex-a15e3f)`

Using some of the polygons defined before the different types of faces are illustrated.

```magma
> Faces(N);
[ <4, 5, 4> ]
> InnerFaces(N);
[ <4, 5, 4> ]
> OuterFaces(N);
[ <0, 1, 0>, <-1, -4, -4>, <-11, -60, -48> ]
> AllFaces(N);
[ <4, 5, 4>, <0, 1, 0>, <-1, -4, -4>, <-11, -60, -48> ]
> Faces(NR);
[ <4, 1, 6>, <2, 1, 4>, <0, 1, 0> ]
> InnerFaces(NR);
[ <4, 1, 6>, <2, 1, 4> ]
> LowerFaces(NR);
[ <4, 1, 6>, <2, 1, 4>, <0, 1, 0> ]
```

For the polynomial over the Puiseux Field it is no coincidence that `InnerFaces` and `Faces` return the same sequences. Similarly, for the polynomial over the local ring `Faces` is defined to be `LowerFaces`. For both, this is the category of faces that gives the most information for the purposes that the polygon is used. It can also be noted that combining `InnerFaces` and `OuterFaces` will give `AllFaces` with no repetitions (though repetitions will occur if the polygon has only one face and this face is an inner face).

<a id="function-vertices-nwtnpgon"></a>
##### `Vertices(N): NwtnPgon -> SeqEnum`

The sequence of vertices of $N$. The vertices will be listed anticlockwise from the lowest of the leftmost points.

<a id="function-innervertices-nwtnpgon"></a>
##### `InnerVertices(N): NwtnPgon -> SeqEnum`

The sequence of vertices which arise as endpoints of inner faces.

<a id="function-lowervertices-nwtnpgon"></a>
##### `LowerVertices(N): NwtnPgon -> SeqEnum`

The sequence of vertices which arise as endpoints of lower faces.

<a id="function-outervertices-nwtnpgon"></a>
##### `OuterVertices(N): NwtnPgon -> SeqEnum`

The sequence of vertices which arise as endpoints of outer faces.

<a id="function-allvertices-nwtnpgon"></a>
##### `AllVertices(N): NwtnPgon -> SeqEnum`

The sequence of vertices of the compact convex hull of $P_N$.

<a id="example-ex-534640"></a>
##### `Example: Vertices of a Newton Polygon (ex-534640)`

This example illustrates the types of vertices that can be calculated. Note that the printing of these polygons, created from their defining points, changes as more information is calculated. This would occur in the same manner if faces were being calculated instead of vertices.

```magma
> InnerVertices(N2);
[ <0, 3>, <2, 0> ]
> N2;
Newton Polygon with vertices {(0, 3), (2, 0)} and defining points {(0, 3), (2,
0), (4, 1)}
> InnerVertices(N6);
[ <1, 4>, <3, 1> ]
> N6;
Newton Polygon with vertices {(1, 4), (3, 1)} and defining points {(1, 4), (1,
6), (2, 4), (2, 7), (3, 1), (4, 5), (4, 7), (5, 2), (5, 9), (6, 1), (6, 6), (7,
7), (7, 9), (8, 4), (8, 6), (8, 8)}
> Vertices(N2);
[ <0, 3>, <2, 0>, <4, 1> ]
> Vertices(N6);
[ <1, 4>, <3, 1>, <6, 1>, <8, 4>, <8, 8>, <7, 9>, <5, 9>, <2, 7>, <1, 6> ]
> AllVertices(N2);
[ <0, 3>, <2, 0>, <4, 1> ]
> N2;
Newton Polygon with vertices {(0, 3), (2, 0), (4, 1)} and defining points {(0,
3), (2, 0), (4, 1)}
> AllVertices(N6);
[ <1, 4>, <3, 1>, <6, 1>, <8, 4>, <8, 8>, <7, 9>, <5, 9>, <2, 7>, <1, 6> ]
> N6;
Newton Polygon with vertices {(1, 4), (3, 1), (6, 1), (8, 4), (8, 8), (7, 9),
(5, 9), (2, 7), (1, 6)} and defining points {(1, 4), (1, 6), (2, 4), (2, 7), (3,
1), (4, 5), (4, 7), (5, 2), (5, 9), (6, 1), (6, 6), (7, 7), (7, 9), (8, 4), (8,
6), (8, 8)}
```

Here `Vertices` has been defined to be `AllVertices`. All the known vertices of the polygon are printed when the polygon is printed. There is some overlap between the inner and outer vertices as is shown below. Every vertex is either an inner vertex or an outer vertex with some being both. Not all defining points are vertices.

```magma
> OuterVertices(N6);
[ <3, 1>, <6, 1>, <8, 4>, <8, 8>, <7, 9>, <5, 9>, <2, 7>, <1, 6>, <1, 4> ]
> OuterVertices(N2);
[ <2, 0>, <4, 1>, <0, 3> ]
```

<a id="function-endvertices-nwtnpgonface"></a>
##### `EndVertices(F): NwtnPgonFace -> SeqEnum`

A sequence containing the two end vertices of the face $F = \left< a,b,c \right>$.

<a id="function-facescontaining-nwtnpgon-tup"></a>
##### `FacesContaining(N, p): NwtnPgon, Tup -> SeqEnum`

Those faces of the polygon $N$ returned by `Faces` on which the point $p = \langle a, b \rangle$ lies.

<a id="example-ex-8ed2f7"></a>
##### `Example: End Vertices and Containing Faces (ex-8ed2f7)`

Using some of the example polygons that have been created above, we illustrate the simple use of `EndVertices` and `FacesContaining`.

```magma
> AN := AllFaces(N);
> AN;
[ <4, 5, 4>, <0, 1, 0>, <-1, -4, -4>, <-11, -60, -48> ]
> A6 := AllFaces(N6);
> A6;
[ <3, 2, 11>, <0, 1, 1>, <-3, 2, -16>, <-1, 0, -8>, <-1, -1, -16>, <0, -1, -9>,
<2, -3, -17>, <1, -1, -5>, <1, 0, 1> ]
> AllVertices(N);
[ <0, 4/5>, <1, 0>, <4, 0>, <3, 1/4> ]
> AllVertices(N6);
[ <1, 4>, <3, 1>, <6, 1>, <8, 4>, <8, 8>, <7, 9>, <5, 9>, <2, 7>, <1, 6> ]
> EndVertices(AN[1]);
[ <0, 4/5>, <1, 0> ]
> EndVertices(AN[4]);
[ <0, 4/5>, <3, 1/4> ]
> EndVertices(A6[1]);
[ <1, 4>, <3, 1> ]
> EndVertices(A6[5]);
[ <7, 9>, <8, 8> ]
> EndVertices(A6[9]);
[ <1, 4>, <1, 6> ]
> FacesContaining(N, <1, 0>);
[ <4, 5, 4> ]
> FacesContaining(N6, <1, 0>);
[]
> FacesContaining(N6, <4, 1>);
[ <0, 1, 1> ]
> FacesContaining(N, <4, 1>);
[]
> FacesContaining(N6, <3, 1>);
[ <3, 2, 11>, <0, 1, 1> ]
```

<a id="function-gradientvector-nwtnpgonface"></a>
##### `GradientVector(F): NwtnPgonFace -> Tup`

The $a$ and $b$ values of the line describing the face $F$ of the form $a*x + b*y = c$ where $a, b$ and $c$ are integers.

<a id="function-gradientvectors-nwtnpgon"></a>
##### `GradientVectors(N): NwtnPgon -> [ Tup ]`

A sequence containing the gradient vectors of the faces of the newton polygon $N$.

<a id="function-weight-nwtnpgonface"></a>
##### `Weight(F): NwtnPgonFace -> RngIntElt`

The $c$ value of the line describing the face $F$ of the form $a*x + b*y = c$ where $a, b$ and $c$ are integers.

<a id="function-slopes-nwtnpgon"></a>
##### `Slopes(N): NwtnPgon -> SeqEnum`

The slopes of the faces of the newton polygon $N$.

<a id="function-innerslopes-nwtnpgon"></a>
##### `InnerSlopes(N): NwtnPgon -> SeqEnum`

<a id="function-lowerslopes-nwtnpgon"></a>
##### `LowerSlopes(N): NwtnPgon -> SeqEnum`

<a id="function-allslopes-nwtnpgon"></a>
##### `AllSlopes(N): NwtnPgon -> SeqEnum`

The slopes of the polygon $N$ corresponding of `InnerFaces`, `LowerFaces`, and `AllFaces` respectively.

<a id="example-ex-260949"></a>
##### `Example: Gradient Vector and Weight of a Face (ex-260949)`

In this example `GradientVector` and `Weight` can be seen to be access functions on the components of a face of a polygon.

```magma
> A := AllFaces(N);
> A;
[ <4, 5, 4>, <0, 1, 0>, <-1, -4, -4>, <-11, -60, -48> ]
> f := A[3];
> GradientVector(f);
<-1, -4>
> Weight(f);
-4
```

The gradient of the face can now be easily computed as shown.

```magma
> a := GradientVector(f)[1];
> b := GradientVector(f)[2];
> -a/b;
-1/4
```

#### Tests for Points and Faces

Once more, recall that $P_N$ denotes the finite set of points in the plane used to define the Newton polygon $N$. Whether or not a point is considered to lie in a polygon depends on what are considered to be its faces. Magma always uses the list of faces returned by `Faces(N)` when testing points. Of course, this is not always the case in applications. One must to perform other tests explicitly when there is doubt.

<a id="function-isface-nwtnpgon-tup"></a>
##### `IsFace(N, F): NwtnPgon, Tup -> BoolElt`

Return `true` if and only if the tuple $F = \langle a, b, c \rangle$ describes a line coinciding with a face of the polygon $N$ as returned by `Faces`.

<a id="function-isvertex-nwtnpgon-tup"></a>
##### `IsVertex(N, p): NwtnPgon, Tup -> BoolElt`

Return `true` if and only if the point $p = \left< a,b \right>$ of the rational plane (given as a tuple) is a vertex of the polygon $N$ as returned by `Vertices`.

<a id="function-isinterior-nwtnpgon-tup"></a>
##### `IsInterior(N, p): NwtnPgon, Tup -> BoolElt`

Return `true` if and only if the point $p = \left< a,b \right>$ given as a tuple lies strictly in the interior of the polygon $N$.

<a id="function-isboundary-nwtnpgon-tup"></a>
##### `IsBoundary(N, p): NwtnPgon, Tup -> BoolElt`

Return `true` if and only if the point $p = \left< a,b \right>$ given as a tuple lies on the boundary of the polygon $N$, that is, the point is contained in a face of $N$.

<a id="function-ispoint-nwtnpgon-tup"></a>
##### `IsPoint(N, p): NwtnPgon, Tup -> BoolElt`

Return `true` if and only if the point $p = \left< a,b \right>$ (given as a tuple) lies on the polygon $N$.

### Polynomials Associated with Newton Polygons

The polynomial used to define a polygon can be recovered, but more usefully so can those restrictions of that polynomial to parts of the polygon, the so-called face functions in particular.

Note that most of these functions will return an error if $N$ was not defined in terms of a polynomial.

<a id="function-haspolynomial-nwtnpgon"></a>
#### `HasPolynomial(N): NwtnPgon -> BoolElt`

Return `true` if and only if the polygon $N$ was defined as the Newton polygon of some polynomial.

<a id="function-polynomial-nwtnpgon"></a>
#### `Polynomial(N): NwtnPgon -> RngElt`

The polynomial used to define the polygon $N$.

<a id="function-parentring-nwtnpgon"></a>
#### `ParentRing(N): NwtnPgon -> Rng`

The parent ring of the polynomial of the polygon $N$.

<a id="function-isnewtonpolygonof-nwtnpgon-rngelt"></a>
#### `IsNewtonPolygonOf(N, f): NwtnPgon, RngElt -> BoolElt`

Return whether the newton polygon $N$ is defined by the polynomial $f$.

<a id="function-facefunction-nwtnpgonface"></a>
#### `FaceFunction(F): NwtnPgonFace -> RngElt`

If the polygon $N$ is defined by a polynomial in two variables $f$ this returns those monomial terms of $f$ whose corresponding Newton points lie on the face $F$. On the other hand, if $N$ is determined by a univariate polynomial over a series ring, this returns the univariate polynomial supported on the face $F$.

<a id="function-isdegenerate-nwtnpgonface"></a>
#### `IsDegenerate(F): NwtnPgonFace -> BoolElt`

Return `true` if the face function along $F$ is not squarefree.

<a id="function-isdegenerate-nwtnpgon"></a>
#### `IsDegenerate(N): NwtnPgon -> BoolElt`

Return `true` if a face function on some face of $N$ is degenerate.

<a id="function-isnondegenerate-nwtnpgonface"></a>
#### `IsNondegenerate(F): NwtnPgonFace -> BoolElt`

Return `false` if the face function along $F$ is not squarefree.

<a id="function-isnondegenerate-nwtnpgon"></a>
#### `IsNondegenerate(N): NwtnPgon -> BoolElt`

Return `false` if a face function on some face of $N$ is degenerate.

### Finding Valuations of Roots of Polynomials from Newton Polygons

Newton polygons can be used to find the valuations of roots of the polynomial from which the polygon was created at the prime used in the creation (given implicitly or explicitly). The following functions use Newton polygons to calculate the valuations of the roots of the polynomial paired with the number of roots with that valuation.

<a id="function-valuationsofroots-rngupolelt"></a>
#### `ValuationsOfRoots(f): RngUPolElt -> [ < RngIntElt, RngIntElt > ]`

The valuations of the roots of $f$, where $f$ is a polynomial over a local ring or a series ring.

<a id="function-valuationsofroots-rngupolelt-rngintelt"></a>
#### `ValuationsOfRoots(f, p): RngUPolElt, RngIntElt -> [ < RngIntElt, RngIntElt > ]`

<a id="function-valuationsofroots-rngupolelt-rngordidl"></a>
#### `ValuationsOfRoots(f, p): RngUPolElt, RngOrdIdl -> [ < RngIntElt, RngIntElt > ]`

<a id="function-valuationsofroots-rngupolelt-plcfunelt"></a>
#### `ValuationsOfRoots(f, p): RngUPolElt, PlcFunElt -> [ < RngIntElt, RngIntElt > ]`

The valuations of the roots of $f$ with respect to $p$ where $p$ may be either a prime integer, a prime ideal of a number field or a place of a function field.

### Using Newton Polygons to Find Roots of Polynomials over Series Rings

The operations described in this section are relevant for polynomials over series rings. There are two main algorithms involved.

<a id="procedure-setverbose-monstgelt-rngintelt-newton"></a>
#### `SetVerbose("Newton", v): MonStgElt, RngIntElt`

Set the verbose printing to level $v$ for `PuiseuxExpansion`, `ExpandToPrecision`, `DuvalPuiseuxExpansion`, `Roots`, and `ImplicitFunction`. A level of $1$ will mean that any partial solutions that could not be expanded to the precision requested will be printed before an error is returned except for `Roots`. The polynomials used in forming extensions will also be printed before the extension is computed. In `Roots`, the algorithm used to compute the expansions will be printed. When Walker’s algorithm is being used the current value of the denominator will be printed. For `ImplicitFunction` a warning about a potentially bad value of $d$ will be printed if the value of $d$ given is not divisible by the exponent denominator of some coefficient of $f$. A level of $2$ will print the last polynomials calculated during the newton polygon part of `PuiseuxExpansion` and `DuvalPuiseuxExpansion` and some evaluated polynomials during `ImplicitFunction`.

<a id="operations-not-associated-with-duval-s-algorithm"></a>
#### Operations not associated with Duval’s Algorithm

<a id="function-newton-puiseuxexpansion"></a>
##### `PuiseuxExpansion(f, n): RngUPolElt, RngIntElt -> SeqEnum[RngSerPuisElt]`

```magma
PreciseRoot   : BoolElt                    Default: false
TestSquarefree: BoolElt                    Default: true
NoExtensions  : BoolElt                    Default: false
LowerFaces    : BoolElt                    Default: true
OneRoot       : BoolElt                    Default: false
Newton        : Verbose                    Default: 2
```

This function implements the algorithm described in [[Wal78](https://docs.magma-maths.org/references.md#cite-wa78)].

Return a sequence of partial expansions of the roots of the polynomial $f$ over a series ring as puiseux series. The roots are returned with relative precision at least $n/d$ where $d$ is the least common multiple of exponent denominator for the series expansion and the exponent denominators of the coefficients of the $f$. An input of $n = 0$ will return the expansions calculated by the newton polygon part of the algorithm and these will be to the precision of what is known. The coefficient ring of the series ring containing the coefficients of $f$ must always be a field and unless extensions are not required it must be able to be extended.

If the coefficient ring of the series ring is a finite field whose characteristic is less than or equal to the degree of the polynomial then the denominators computed in the newton polygon part of the algorithm may not be bounded and the function will return an error. However, it is possible for some polynomials that the denominators will be bounded. This is stated by [[Gri95](https://docs.magma-maths.org/references.md#cite-gr95)], pg 269 – 272.

Care needs to be taken with polynomials whose coefficients have low precision. The algorithm must extract from $f$ the squarefree part and in doing so lose even more precision. The result is that the algorithm may not have enough precision to calculate the expansions correctly. A solution is to set `TestSquarefree` to `false` if the polynomial is known to have no multiple roots. However this will not solve all precision problems and the answer is only as good as the precision allows it to be.

If `PreciseRoot` is set to `true` then the partial expansions to be returned are checked and if any are exact roots of $f$ they are returned with full precision. If `NoExtensions` is set to `true` then expansions are found within the puiseux series ring only. By default, the coefficient ring of the series ring is extended to find all the partial expansions. If `LowerFaces` is set to `false` then expansions with negative valuations will not be found. If `OneRoot` is set to true then representatives of conjugate roots only will be found instead of each of the roots individually.

Note that it may useful to define the polynomial over an algebraically closed field (via [`AlgebraicClosure`](https://docs.magma-maths.org/GlobalFields/AlgebraicallyClosedFields/structure.md#function-fldac-algebraicclosure)), so that all roots may be found.

<a id="function-expandtoprecision-rngupolelt-rngserelt-rngintelt"></a>
##### `ExpandToPrecision(f, c, n): RngUPolElt, RngSerElt, RngIntElt -> RngSerElt`

```magma
PreciseRoot   : BoolElt                    Default: false
TestSquarefree: BoolElt                    Default: true
Newton        : Verbose                    Default: 2
```

Given a polynomial $f$ over a Puiseux series ring and a partial root $c$ of that polynomial (found by `PuiseuxExpansion` for example) continue to expand that root until it has relative precision $n/d$ where $d$ is the least common multiple of the exponent denominator of $c$ and the exponent denominators of the coefficients of $f$. If $c$ is given to greater precision (or length greater than $n$ if its precision is infinite), the relative precision of $c$ is reduced to $n/d$. An error results if $c$ is not a partial expansion to precision $n/d$. If `PreciseRoot` is true then the partial expansion to be returned is checked and if it is an exact root of $f$ it is returned with full precision. All input is checked for being an exact root regardless. If `TestSquarefree` is `false` the polynomial will not be made squarefree. This may avoid some loss of precision but may result in some unique partial roots not being recognized as unique partial roots and as such they cannot be expanded.

An error may result if $c$ is a partial root of $f$ but the exponent denominator of the full expansion is greater than that of $c$. Therefore for $c$ to be expanded it must have the same denominator as the expansion it is part of. This will rarely be an issue for those partial expansions resulting from `PusieuxExpansion` which did not encounter problems with precision in the newton polygon part since the algorithm for this will find at least as much of the expansion as necessary to compute the exponent denominator.

<a id="function-implicitfunction-rngupolelt-rngintelt-rngintelt"></a>
##### `ImplicitFunction(f, d, n): RngUPolElt, RngIntElt, RngIntElt -> RngSerElt`

```magma
Newton: Verbose                    Default: 2
```

Return a root of the polynomial $f$ over a series ring. The input $d$ is the denominator (or a multiple of) the exponent denominator of the root. The root is given to absolute precision $n/d$. The evaluation of $f$ at zero (polynomial) evaluated at zero (series) must be zero but that of its derivative must be nonzero.

<a id="example-ex-d1b398"></a>
##### `Example: Puiseux Expansions to Higher Precision (ex-d1b398)`

This example illustrates the joint use of `PuiseuxExpansion` and `ExpandToPrecision` which can be used together to gain and improve partial roots of a polynomial. The use of `ExpandToPrecision` following `PuiseuxExpansion` avoids the recalculation of information already known.

```magma
> P<x> := PuiseuxSeriesRing(Rationals());
> R<y> := PolynomialRing(P);
> f := y^3 + 2*x^-1*y^2 + 1*x^-2*y + 2*x;
> c := PuiseuxExpansion(f, 0);
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> Q<q> := PolynomialRing(A);
> c;
[
    -2*a^3 + O(a^4),
    -a^-1 + n*a + O(a^2),
    -a^-1 - n*a + O(a^2)
]
> [ExpandToPrecision(f, c[i], 10) : i in [1 .. #c]];
[
    -2*a^3 - 8*a^7 - 56*a^11 + O(a^13),
    -a^-1 + n*a + a^3 + 5/4*n*a^5 + 4*a^7 + O(a^9),
    -a^-1 - n*a + a^3 - 5/4*n*a^5 + 4*a^7 + O(a^9)
]
```

The same results could have been gained using `PuiseuxExpansion` with the required precision in the first place.

```magma
> c := PuiseuxExpansion(f, 10);
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> c;
[
    -2*a^3 - 8*a^7 - 56*a^11 + O(a^13),
    -a^-1 + n*a + a^3 + 5/4*n*a^5 + 4*a^7 + O(a^9),
    -a^-1 - n*a + a^3 - 5/4*n*a^5 + 4*a^7 + O(a^9)
]
```

However, asking for more precision requires time so that if it is not necessary the extra calculation can be avoided and if more precision happens to be required then it can be gained without recalculation. `ExpandToPrecision` is also called on only one root so that if only one expansion is required using `PusieuxExpansion` and then `ExpandToPrecision` will not calculate any unnecessary information.

```magma
> time c := PuiseuxExpansion(f, 100);
Time: 2.810
> time c := PuiseuxExpansion(f, 10);
Time: 0.060
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> time ExpandToPrecision(f, c[1], 100);
-2*a^3 - 8*a^7 - 56*a^11 - 480*a^15 - 4576*a^19 - 46592*a^23 -
    496128*a^27 - 5457408*a^31 - 61529600*a^35 - 707266560*a^39 -
    8257566720*a^43 - 97654702080*a^47 - 1167349284864*a^51 -
    14082308833280*a^55 - 171221451538432*a^59 -
    2096081963188224*a^63 - 25814314231136256*a^67 -
    319605795242639360*a^71 - 3975750610806374400*a^75 -
    49666299938073477120*a^79 - 622818862289639178240*a^83 -
    7837247078959687925760*a^87 - 98931046460491133091840*a^91 -
    1252424949872174982758400*a^95 - 15897106567806080658702336*a^99
    + O(a^103)
Time: 0.410
```

<a id="function-ispartialroot-rngupolelt-rngserelt"></a>
##### `IsPartialRoot(f, c): RngUPolElt, RngSerElt -> BoolElt`

Return `true` if the series $c$ can be expanded to at least one root of the polynomial $f$.

<a id="function-isuniquepartialroot-rngupolelt-rngserelt"></a>
##### `IsUniquePartialRoot(f, c): RngUPolElt, RngSerElt -> BoolElt`

```magma
TestSquarefree: BoolElt                    Default: true
```

Return `true` if the series $c$ can be expanded to exactly one distinct root of the polynomial $f$. By default $f$ will have multiple factors removed to allow partial expansions of multiple roots to be recognized as being unique. If `TestSquarefree` is set to `false` then $f$ will be taken as given which may avoid errors due to lost precision but may not pick partial expansions of multiple roots as being unique and as such is best used when $f$ is squarefree or the expansion is known to be of a single root.

<a id="example-ex-5113cd"></a>
##### `Example: Checking That a Partial Root Can Be Expanded (ex-5113cd)`

The above $2$ functions can be used to reduce the occurrence of errors from `ExpandToPrecision` by checking that the input can be expanded. Errors resulting from a lack of precision which means that the expansion cannot be calculated to the requested precision are the only errors that cannot be removed. Only unique partial roots can be expanded. If a partial root is not unique then calling `PuiseuxExpansion` will provide several further partial expansions of the partial root that will themselves be unique and so can be used to calculate several expansions of the original.

```magma
> P<x> := PuiseuxSeriesRing(Rationals());
> R<y> := PolynomialRing(P);
> f := (y^2 - x^3)^2 - y*x^6;
> IsPartialRoot(f, x^(3/2));
true
> ExpandToPrecision(f, x^(3/2), 10);

>> ExpandToPrecision(f, x^(3/2), 10);
                    ^
Runtime error in 'ExpandToPrecision': Element is not a unique partial
root of the polynomial
> IsUniquePartialRoot(f, x^(3/2));
false
> c := PuiseuxExpansion(f, 0);
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> Q<q> := PolynomialRing(A);
> c;
[
    a^(3/2) + 1/2*a^(9/4) + O(a^(5/2)),
    a^(3/2) - 1/2*a^(9/4) + O(a^(5/2)),
    -a^(3/2) + 1/2*n*a^(9/4) + O(a^(5/2)),
    -a^(3/2) - 1/2*n*a^(9/4) + O(a^(5/2))
]
> IsUniquePartialRoot(f, x^(3/2) + 1/2*x^(9/4));
true
> ExpandToPrecision(f, x^(3/2) + 1/2*x^(9/4), 10);
x^(3/2) + 1/2*x^(9/4) - 1/64*x^(15/4) + O(x^4)
> ExpandToPrecision(f, x^(3/2) + x^2, 30);

>> ExpandToPrecision(f, x^(3/2) + x^2, 30);
                    ^
Runtime error in 'ExpandToPrecision': Element is not a partial root of
the polynomial
> IsPartialRoot(f, x^(3/2) + x^2);
false
```

So if `IsPartialRoot` returns `false` then no expansion can be made. If `IsUniquePartialRoot` returns `false` (but `IsPartialRoot` returns `true`) then several expansions can be made after calling `PuiseuxExpansion`.

<a id="function-puiseuxexponents-rngserelt"></a>
##### `PuiseuxExponents(p): RngSerElt -> SeqEnum`

Given a series expansion return the sequence of exponents $[a/b]$ of the non zero terms of the series $p$ up to and including the first one where $b$ is the global denominator for the series.

<a id="function-puiseuxexponentscommon-rngserelt-rngserelt"></a>
##### `PuiseuxExponentsCommon(p, q): RngSerElt, RngSerElt -> SeqEnum`

Given two series return the sequence of exponents $[a/b]$ of the non zero initial terms of the series $p$ and $q$ which are equal up to but not including the first unequal terms.

<a id="example-ex-cc0585"></a>
##### `Example: Exponents of Puiseux Expansions (ex-cc0585)`

This example illustrates how `PuiseuxExponents` and `PuiseuxExponentsCommon` can be used on output from `PusieuxExpansion`. (Similar can be done with related functions and general series).

```magma
> P<x> := PuiseuxSeriesRing(FiniteField(5, 3));
> R<y> := PolynomialRing(P);
> f := (1+x)*y^4 - x^(-1/3)*y^2 + y + x^(1/2);
> time c := PuiseuxExpansion(f, 5);
Time: 0.030
> c;
[
    4*x^(1/2) + x^(2/3) + 3*x^(5/6) + x^(7/6) + O(x^(4/3)),
    x^(1/3) + x^(1/2) + 4*x^(2/3) + 2*x^(5/6) + O(x^(7/6)),
    4*x^(-1/6) + 2*x^(1/3) + O(x^(2/3)),
    x^(-1/6) + 2*x^(1/3) + O(x^(2/3))
]
> PuiseuxExponents(c[1]);
[ 1/2, 2/3, 5/6 ]
> PuiseuxExponents(c[3]);
[ -1/6 ]
> P<x> := PuiseuxSeriesRing(FiniteField(5, 3));
> R<y> := PolynomialRing(P);
> f := ((y^2 - x^3)^2 - y*x^6)^2 - y*x^15;
> c := PuiseuxExpansion(f, 0);
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> Q<q> := PolynomialRing(A);
> c;
[
    4*a^(3/2) + 4*a^(9/4) + 4*a^3 + O(a^(13/4)),
    4*a^(3/2) + 4*a^(9/4) + a^3 + O(a^(13/4)),
    4*a^(3/2) + a^(9/4) + 4*a^3 + O(a^(13/4)),
    4*a^(3/2) + a^(9/4) + a^3 + O(a^(13/4)),
    a^(3/2) + 3*a^(9/4) + 4*a^3 + O(a^(13/4)),
    a^(3/2) + 3*a^(9/4) + a^3 + O(a^(13/4)),
    a^(3/2) + 2*a^(9/4) + 4*a^3 + O(a^(13/4)),
    a^(3/2) + 2*a^(9/4) + a^3 + O(a^(13/4))
]
> PuiseuxExponentsCommon(c[1], c[1]);
[ 3/2, 9/4, 3 ]
> PuiseuxExponentsCommon(c[1], c[2]);
[ 3/2, 9/4 ]
> PuiseuxExponentsCommon(c[1], c[3]);
[ 3/2 ]
> PuiseuxExponentsCommon(c[1], c[8]);
[]
```

<a id="operations-associated-with-duval-s-algorithm"></a>
#### Operations associated with Duval’s algorithm

The following functions have a similar use to those given above but implement a different algorithm, namely that of [[Duv89](https://docs.magma-maths.org/references.md#cite-duv89)] which is faster and can handle larger degree polynomials. However, it can only be used with polynomials which are essentially over a laurent series ring and the coefficient ring of that laurent series ring has either characteristic zero or characteristic greater than the degrees of the squarefree factors of the polynomial.

<a id="function-duvalpuiseuxexpansion-rngupolelt-rngintelt"></a>
##### `DuvalPuiseuxExpansion(f, n): RngUPolElt, RngIntElt -> SeqEnum`

```magma
Version       : MonStgElt                    Default: "Rational"
TestSquarefree: BoolElt                      Default: true
NoExtensions  : BoolElt                      Default: false
LowerFaces    : BoolElt                      Default: true
OneRoot       : BoolElt                      Default: false
Newton        : Verbose                      Default: 2
```

A sequence of parametrizations of puiseux expansions of roots of $f$, as puiseux series, where $f$ is a polynomial over a series ring. The expansions will have at least $n$ non zero terms (unless the expansion is finite and has less than $n$ non zero terms), with more than $n$ occurring only if $n$ is less than the number of terms returned by the newton polygon part of the algorithm. The coefficients of $f$ must have exponent denominator $1$.

This algorithm is faster than that given by Walker and implemented in `PuiseuxExpansion`, since it doesn’t calculate non zero terms explicitly and doesn’t make all necessary extensions during the algorithm leaving some to be made when the series is computed from the parametrizations.

If $f$ has coefficients with finite precision then the expansions can only be computed to as many non zero terms as can be known for that expansion. After this limit has been reached, an error results since the next non zero term is not known. If $f$ has roots with finite puiseux expansions then if $n$ is greater than the number of non zero terms in the expansion the expansion is returned with infinite precision.

If `Version` is set to `"Classical"` then the (slower) classical branch of the algorithm will be run which makes all extensions necessary for the computation of the expansions. It is still faster than `PusieuxExpansion` since it does not iterate through and calculate zero terms but will encounter the same problems that `PuiseuxExpansion` does with field extensions over the rationals. The classical version will return as many parametrizations as there are expansions and some of these parametrizations will give the same set of expansions.

If `NoExtensions` is set to `true` then only the expansions which lie in the puiseux series ring corresponding to the coefficient ring of $f$ are calculated. Otherwise, all the expansions of roots of $f$ are calculated regardless of where they lie. `LowerFaces` and `OneRoot` work as for `PuiseuxExpansion`.

This algorithm works with the squarefree part of $f$ only. If any coefficient of $f$ has low precision then this step may make it impossible for any information about the expansions to be gained due to a loss of further precision. A way around this is to set `TestSquarefree` to `false` if the polynomial is known to be squarefree. This may result in some information being returned but such information is only as good as the precision it was allowed.

<a id="function-parametrizationtopuiseux-tup"></a>
##### `ParametrizationToPuiseux(T): Tup -> SeqEnum`

The series that satisfy the parametrization `T`. These are found by evaluating `T[2]` at $t$ where `T[1]` $= \lambda t^e$.

<a id="function-puiseuxtoparametrization-rngserelt"></a>
##### `PuiseuxToParametrization(S): RngSerElt -> Tup`

A parametrization of the series $S$. It is the simplest one which takes the denominator out of $S$ and makes it the exponent of the first entry in the parametrization.

<a id="example-ex-2dca42"></a>
##### `Example: Duval's Algorithm for Puiseux Expansions (ex-2dca42)`

This example illustrates the use of `DuvalPuiseuxExpansion` and `ParametrizationToPuiseux` to gain the information given by `PuiseuxExpansion` and also compares the performance of the two algorithms. It also highlights some of the anomalies that may be encountered due to precision concerns.

```magma
> P<x> := PuiseuxSeriesRing(Rationals());
> R<y> := PolynomialRing(P);
> f := (y^2 - x^3)^2 - y*x^6;
> time D := DuvalPuiseuxExpansion(f, 0);
Time: 0.000
> D;
[
    <16*x^4, 64*x^6 + 256*x^9 + O(x^10)>
]
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.060
> A<a> := Parent(P[1]);
> N<n> := CoefficientRing(A);
> P;
[
    a^(3/2) + 1/2*a^(9/4) + O(a^(5/2)),
    a^(3/2) - 1/2*a^(9/4) + O(a^(5/2)),
    -a^(3/2) + 1/2*n*a^(9/4) + O(a^(5/2)),
    -a^(3/2) - 1/2*n*a^(9/4) + O(a^(5/2))
]
> time c := PuiseuxExpansion(f, 0);
Time: 0.050
```

Here it can be seen that the newton polygon part of the algorithm is substantially faster using Duval’s method, though the converting of the parametrization to a series is not as fast. Asking for more terms shows this more substantially.

```magma
> time D := DuvalPuiseuxExpansion(f, 10);
Time: 0.020
> D;
[
    <16*x^4, 64*x^6 + 256*x^9 - 512*x^15 + 2048*x^18 - 4608*x^21 + 56320*x^27 -
        294912*x^30 + 792064*x^33 - 12082176*x^39 + 68157440*x^42 + O(x^43)>
]
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.129
> time c := PuiseuxExpansion(f, 10);
Time: 0.100
> A<a> := Parent(c[1]);
> N<n> := CoefficientRing(A);
> c;
[
    a^(3/2) + 1/2*a^(9/4) - 1/64*a^(15/4) + O(a^4),
    a^(3/2) - 1/2*a^(9/4) + 1/64*a^(15/4) + O(a^4),
    -a^(3/2) + 1/2*n*a^(9/4) + 1/64*n*a^(15/4) + O(a^4),
    -a^(3/2) - 1/2*n*a^(9/4) - 1/64*n*a^(15/4) + O(a^4)
]
> A<a> := Parent(P[1]);
> N<n> := CoefficientRing(A);
> P;
[
    a^(3/2) + 1/2*a^(9/4) - 1/64*a^(15/4) + 1/128*a^(9/2) - 9/4096*a^(21/4) +
        55/131072*a^(27/4) - 9/32768*a^(15/2) + 1547/16777216*a^(33/4) -
        11799/536870912*a^(39/4) + 65/4194304*a^(21/2) + O(a^(43/4)),
    a^(3/2) - 1/2*a^(9/4) + 1/64*a^(15/4) + 1/128*a^(9/2) + 9/4096*a^(21/4) -
        55/131072*a^(27/4) - 9/32768*a^(15/2) - 1547/16777216*a^(33/4) +
        11799/536870912*a^(39/4) + 65/4194304*a^(21/2) + O(a^(43/4)),
    -a^(3/2) + 1/2*n*a^(9/4) + 1/64*n*a^(15/4) - 1/128*a^(9/2) -
        9/4096*n*a^(21/4) - 55/131072*n*a^(27/4) + 9/32768*a^(15/2) +
        1547/16777216*n*a^(33/4) + 11799/536870912*n*a^(39/4) -
        65/4194304*a^(21/2) + O(a^(43/4)),
    -a^(3/2) - 1/2*n*a^(9/4) - 1/64*n*a^(15/4) - 1/128*a^(9/2) +
        9/4096*n*a^(21/4) + 55/131072*n*a^(27/4) + 9/32768*a^(15/2) -
        1547/16777216*n*a^(33/4) - 11799/536870912*n*a^(39/4) -
        65/4194304*a^(21/2) + O(a^(43/4))
]
```

It can be seen that the computation of the information is a lot faster using Duval’s method. It is only the cosmetic of converting this information into series that could make this algorithm seem slow. But also note that there is much greater information given by Duval’s algorithm. The equivalent information is given below.

```magma
> time D := DuvalPuiseuxExpansion(f, 3);
Time: 0.009
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.049
> A<a> := Parent(P[1]);
> N<n> := CoefficientRing(A);
> P;
[
    a^(3/2) + 1/2*a^(9/4) - 1/64*a^(15/4) + O(a^4),
    a^(3/2) - 1/2*a^(9/4) + 1/64*a^(15/4) + O(a^4),
    -a^(3/2) + 1/2*n*a^(9/4) + 1/64*n*a^(15/4) + O(a^4),
    -a^(3/2) - 1/2*n*a^(9/4) - 1/64*n*a^(15/4) + O(a^4)
]
```

One thing that may be taken for granted from `PuiseuxExpansion` is that all the expansions lie in the same puiseux series ring. However, for `DuvalPuiseuxExpansion` this may not be the case. It will always be true that each of the parametrizations will lie in the same puiseux series ring but series resulting from different parametrizations may not. This occurs since some extensions are left to the stage of calculating the series from the parametrization to be made and for different parametrizations these extensions may be different.

```magma
> f := (-x^3 + x^4) - 2*x^2*y - x*y^2 + 2*x*y^4 + y^5;
> time D := DuvalPuiseuxExpansion(f, 0);
Time: 0.010
> D;
[
    <x^2, -x^2 - x^3 + O(x^4)>,
    <x^3, x + O(x^2)>
]
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.000
> P;
[
    -x - x^(3/2) + O(x^2),
    -x + x^(3/2) + O(x^2)
]
> Parent(P[1]);
Puiseux series field in x over Rational Field
> time P := ParametrizationToPuiseux(D[2]);
Time: 0.030
> A<a> := Parent(P[1]);
> N<n> := CoefficientRing(A);
> P;
[
    a^(1/3) + O(a^(2/3)),
    n*a^(1/3) + O(a^(2/3)),
    (-n - 1)*a^(1/3) + O(a^(2/3))
]
> Parent(P[1]);
Puiseux series field in a over N
> N;
Number Field with defining polynomial $.1^2 + $.1 + 1 over the Rational Field
```

`DuvalPuiseuxExpansion` reacts differently to `PuiseuxExpansion` when given input which has finite expansions either due to finite precision or exact roots. These differences are shown below and are due to the fact that `DuvalPuiseuxExpansion` always looks for the next non zero term in an expansion whereas `PuiseuxExpansion` will calculate zero terms.

```magma
> f := y - x^3 - x^7 - x^76 + O(x^200);
> D := DuvalPuiseuxExpansion(f, 0);
> D;
[
    <x, x^3 + O(x^4)>
]
> D := DuvalPuiseuxExpansion(f, 3);
> D;
[
    <x, x^3 + x^7 + x^76 + O(x^77)>
]
> D := DuvalPuiseuxExpansion(f, 4);

>> D := DuvalPuiseuxExpansion(f, 4);
                            ^
Runtime error in 'DuvalPuiseuxExpansion': Insufficient precision to calculate to
requested precision
> c := PuiseuxExpansion(f, 197);
> c;
[
    x^3 + x^7 + x^76 + O(x^200)
]
> c := PuiseuxExpansion(f, 200);

>> c := PuiseuxExpansion(f, 200);
                        ^
Runtime error in 'PuiseuxExpansion': Insufficient precision to calculate to
requested precision

> f := y - x^3 - x^7 - x^76;
> D := DuvalPuiseuxExpansion(f, 0);
> D;
[
    <x, x^3 + O(x^4)>
]
> D := DuvalPuiseuxExpansion(f, 3);
> D;
[
    <x, x^3 + x^7 + x^76 + O(x^77)>
]
> D := DuvalPuiseuxExpansion(f, 4);
> D;
[
    <x, x^3 + x^7 + x^76>
]
> c := PuiseuxExpansion(f, 10);
> c;
[
    x^3 + x^7 + O(x^13)
]
> c := PuiseuxExpansion(f, 100);
> c;
[
    x^3 + x^7 + x^76 + O(x^103)
]
> c := PuiseuxExpansion(f, 200);
> c;
[
    x^3 + x^7 + x^76 + O(x^203)
]
> c := PuiseuxExpansion(f, 200 : PreciseRoot := true);
> c;
[
    x^3 + x^7 + x^76
]
```

The two methods can be combined. Given a series there is no way that Duval’s REGULAR algorithm can be used to further the precision of an expansion. But `ExpandToPrecision` can be used to gain the extra precision. Using the REGULAR algorithm would be preferable since it is faster but this is not possible for the type of input that is available. This is explored in the case of our first example.

```magma
> f := (y^2 - x^3)^2 - y*x^6;
> time D := DuvalPuiseuxExpansion(f, 0);
Time: 0.009
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.050
> A<a> := Parent(P[1]);
> N<n> := CoefficientRing(A);
> P;
[
    a^(3/2) + 1/2*a^(9/4) + O(a^(5/2)),
    a^(3/2) - 1/2*a^(9/4) + O(a^(5/2)),
    -a^(3/2) + 1/2*n*a^(9/4) + O(a^(5/2)),
    -a^(3/2) - 1/2*n*a^(9/4) + O(a^(5/2))
]
> time ExpandToPrecision(f, P[1], 20);
a^(3/2) + 1/2*a^(9/4) - 1/64*a^(15/4) + 1/128*a^(9/2) - 9/4096*a^(21/4) +
    O(a^(13/2))
Time: 0.070
> time D := DuvalPuiseuxExpansion(f, 5);
Time: 0.010
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.059
```

It can be seen that using `ExpandToPrecision` is slower even than rerunning Duval’s algorithm from the beginning. Even more so when it is remembered that running Duval’s algorithm with the extra precision will give parametrizations of all the expansions of the roots of $f$ and not just one expansion. This seems to still be the case when larger examples are considered so that if more terms of an expansion are required it is probably best to start from the beginning asking for these extra terms.

```magma
> time p1 := ExpandToPrecision(f, P[1], 50);
Time: 0.439
> A<a> := Parent(p1);
> N<n> := CoefficientRing(A);
> p1;
a^(3/2) + 1/2*a^(9/4) - 1/64*a^(15/4) + 1/128*a^(9/2) - 9/4096*a^(21/4) +
    55/131072*a^(27/4) - 9/32768*a^(15/2) + 1547/16777216*a^(33/4) -
    11799/536870912*a^(39/4) + 65/4194304*a^(21/2) - 189805/34359738368*a^(45/4)
    + 1584999/1099511627776*a^(51/4) - 2261/2147483648*a^(27/2) + O(a^14)
> time D := DuvalPuiseuxExpansion(f, 13);
Time: 0.009
> time P := ParametrizationToPuiseux(D[1]);
Time: 0.200
```

#### Roots of Polynomials

This section describes two similar functions that can be used for finding roots of polynomials over series rings in a similar way to finding roots of polynomials over any other ring for which roots can be computed in Magma.

<a id="function-roots-rngupolelt"></a>
##### `Roots(f): RngUPolElt -> [<RngSerElt, RngIntElt>]`

<a id="function-roots-rngupolelt-rngintelt"></a>
##### `Roots(f, n): RngUPolElt, RngIntElt -> [<RngSerElt, RngIntElt>]`

```magma
Newton: Verbose                    Default: 2
```

Find the roots of the polynomial $f$ which lie in the coefficient ring of $f$. The first form of this function can be used on any polynomial over any ring for which Magma can compute roots. Since precision is an issue in series rings and some roots may have infinite expansions, the second version of this function which is specific to series rings allows a lower bound for the precision to which these roots will be known to be specified. The first computes the roots to at least the default precision of the ring if that ring has infinite precision otherwise it computes them to at least the precision of the ring. The first version will be enough when all the coefficients of the polynomial have infinite precision. The second version may be required when a precision other than that assumed by the first is sought which may be due to the impossibility of computing the roots to such a high precision as the default. The precision is relative to the least common multiple of the exponent denominators of the coefficients of $f$ and the exponent denominator of the root. Roots which are known to be different but are identical to the precision specified will be returned as two distinct roots.

Duval’s algorithm as implemented in `DuvalPuiseuxExpansion` will usually be used. Walker’s algorithm as implemented in `PuiseuxExpansion` will be used if the polynomial has coefficients involving fractional powers or the characteristic of the coefficient ring of the series ring is less than the degree of a squarefree factor.

If Walker’s algorithm is used and the characteristic of the field is less than the degree of the polynomial then the computation may not finish (see remarks under `PuiseuxExpansion`) and control will return to the user when interrupted.

If verbose printing of partial output that doesn’t have enough precision is required the functions `PuiseuxExpansion` and `DuvalPuiseuxExpansion` should be used with the appropriate precision. `Roots` also requires that there is enough precision in the roots so that the multiplicities can be calculated correctly and the parts of the roots that are returned are distinct. Therefore an error will be given if there is not enough precision to calculate the part of the root that results from the newton polygon part of the algorithm and the root is not known to be a single root since the multiplicity may not be able to be calculated correctly. Information at such a low precision can be gained correctly by using the `PuiseuxExpansion` functions and determining the multiplicities manually.

<a id="function-hasroot-rngupolelt"></a>
##### `HasRoot(f): RngUPolElt -> BoolElt, RngSerElt`

Return `true` if the polynomial $f$ has a root in its coefficient ring and that root can be found to the fixed or default precision of the ring as applicable. A root is also returned in this case. If $f$ is irreducible over its coefficient ring then return `false`.

<a id="example-ex-0c4847"></a>
##### `Example: Roots of Polynomials over Puiseux Series (ex-0c4847)`

Below are some examples of the use of the `Roots` function.

```magma
> SetVerbose("Newton", 1);
> P<x> := PuiseuxSeriesRing(Rationals());
> R<y> := PolynomialRing(P);
> f := y^3 + 2*x^-1*y^2 + 1*x^-2*y + 2*x;
> Roots(f);
DUVAL :
[
    <-2*x^3 - 8*x^7 - 56*x^11 - 480*x^15 - 4576*x^19 + O(x^23), 1>
]
> f := f^2;
> Roots(f);
DUVAL :
[
   <-2*x^3 - 8*x^7 - 56*x^11 - 480*x^15 - 4576*x^19 + O(x^23), 2>
]
> f := y^3 + 2*x^-1*y^2 + 1*x^-2*y + 2*x;
> f +:= O(x^20)*(y^3 + y^2 + y + 1);
> f;
(1 + O(x^20))*y^3 + (2*x^-1 + O(x^20))*y^2 + (x^-2 + O(x^20))*y + 2*x + O(x^20)
> Roots(f);
DUVAL :

>> Roots(f);
        ^
Runtime error in 'Roots': Roots not calculable to default precision
> Roots(f, 10);
DUVAL :
[
   <-2*x^3 - 8*x^7 - 56*x^11 + O(x^13), 1>
]
> f := f^2;
> f;
(1 + O(x^20))*y^6 + (4*x^-1 + O(x^19))*y^5 + (6*x^-2 + O(x^18))*y^4 + (4*x^-3 +
   4*x + O(x^18))*y^3 + (x^-4 + 8 + O(x^18))*y^2 + (4*x^-1 + O(x^18))*y + 4*x^2
   + O(x^21)
> Roots(f, 10);
DUVAL :
[
   <-2*x^3 - 8*x^7 - 56*x^11 + O(x^13), 2>
]
> f := (y - x^(1/4))*(y - x^(1/3));
> Roots(f);
WALKER :
[
    <x^(1/3) + O(x^2), 1>,
    <x^(1/4) + O(x^(23/12)), 1>
]
```

<a id="p-adic-pow-ser"></a>
<a id="rngslope"></a>
## Series Rings over $p$-Adic Rings

- [Introduction](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md)
  - [Background](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#background)
  - [Basic Operations](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#basic-operations)
    - [Creation Intrinsics](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#creation-intrinsics)
      - [`SnuRing(F, nu): FldPad, FldRatElt → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-fldpad-fldratelt)
      - [`SpRing(F, nu): FldPad, FldRatElt → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-fldpad-fldratelt)
      - [`SuRing(F, nu): FldPad, FldRatElt → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-fldpad-fldratelt)
      - [`SnuRing(F): FldPad → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-fldpad)
      - [`SpRing(F): FldPad → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-fldpad)
      - [`SuRing(F): FldPad → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-fldpad)
      - [`SnuRing(p, e): RngIntElt, RngIntElt → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-rngintelt-rngintelt)
      - [`SnuRing(p): RngIntElt → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-rngintelt)
      - [`SpRing(p, e): RngIntElt, RngIntElt → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-rngintelt-rngintelt)
      - [`SpRing(p): RngIntElt → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-rngintelt)
      - [`SuRing(p, e): RngIntElt, RngIntElt → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-rngintelt-rngintelt)
      - [`SuRing(p): RngIntElt → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-rngintelt)
      - [`SnuRing(S, nu): RngSerPow, FldRatElt → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-rngserpow-fldratelt)
      - [`SpRing(S, nu): RngSerPow, FldRatElt → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-rngserpow-fldratelt)
      - [`SuRing(S, nu): RngSerLaur, FldRatElt → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-rngserlaur-fldratelt)
      - [`SnuRing(S): SpRng → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-sprng)
      - [`SpRing(S): SnuRng → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-spring-snurng)
      - [`SnuRing(S): SuRng → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-snuring-surng)
      - [`SuRing(S): SnuRng → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-suring-snurng)
    - [Access Functions](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#access-functions)
      - [`R eq S: SnuRng, SnuRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-eq-snurng-snurng)
      - [`R ne S: SnuRng, SnuRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-ne-snurng-snurng)
      - [`R eq S: SpRng, SpRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-eq-sprng-sprng)
      - [`R ne S: SpRng, SpRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-ne-sprng-sprng)
      - [`R eq S: SuRng, SuRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-eq-surng-surng)
      - [`R ne S: SuRng, SuRng → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#operation-op-ne-surng-surng)
      - [`Slope(S): SnuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-slope-snurng)
      - [`Slope(S): SpRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-slope-sprng)
      - [`Slope(S): SuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-slope-surng)
      - [`Precision(S): SnuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-precision-snurng)
      - [`Precision(S): SpRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-precision-sprng)
      - [`Precision(S): SuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-precision-surng)
      - [`CoefficientRing(S): SnuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-coefficientring-snurng)
      - [`CoefficientRing(S): SpRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-coefficientring-sprng)
      - [`CoefficientRing(S): SuRng → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-coefficientring-surng)
  - [Element Operations](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#element-operations)
    - [`Parent(f): SnuElement → SnuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-parent-snuelement)
    - [`Parent(f): SpElement → SpRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-parent-spelement)
    - [`Parent(f): SuElement → SuRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-parent-suelement)
    - [`IsWeaklyZero(f): SnuElement → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-isweaklyzero-snuelement)
    - [`IsWeaklyZero(f): SpElement → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-isweaklyzero-spelement)
    - [`IsWeaklyZero(f): SuElement → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-isweaklyzero-suelement)
    - [Valuation and Degree](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#valuation-and-degree)
      - [`GaussValuation(f): SnuElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-gaussvaluation-snuelement)
      - [`GaussValuation(f): SpElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-gaussvaluation-spelement)
      - [`GaussValuation(f): SuElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-gaussvaluation-suelement)
      - [`WeierstrassDegree(f): SnuElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassdegree-snuelement)
      - [`WeierstrassDegree(f): SpElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassdegree-spelement)
      - [`WeierstrassDegree(f): SuElement → FldRatElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassdegree-suelement)
      - [`IsDistinguished(f): SnuElement → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-isdistinguished-snuelement)
      - [`LeadingTerm(f): SnuElement → RngSerPowElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-leadingterm-snuelement)
      - [`LeadingTerm(f): SpElement → RngSerPowElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-leadingterm-spelement)
      - [`LeadingTerm(f): SuElement → RngSerLaurElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-leadingterm-suelement)
      - [`WeierstrassTerm(f): SnuElement → RngSerPowElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassterm-snuelement)
      - [`WeierstrassTerm(f): SpElement → RngSerPowElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassterm-spelement)
      - [`WeierstrassTerm(f): SuElement → RngSerLaurElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrassterm-suelement)
      - [`O(x): SnuElement → SnuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-o-snuelement)
      - [`O(x): SpElement → SpElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-o-spelement)
      - [`O(x): SuElement → SuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-o-suelement)
      - [Example: Basic Operations in a Slope Ring](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#example-ex-c0e1cb)
  - [Euclidean Algorithm](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#euclidean-algorithm)
    - [Intrinsics](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#intrinsics)
      - [`WeierstrassPreparation(f): SnuElement → SnuElement, SnuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-weierstrasspreparation-snuelement)
      - [`Quotrem(A, B): SnuElement, SnuElement → SnuElement, SnuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-quotrem-snuelement-snuelement)
      - [`Quotrem(A, B): SpElement, SpElement → SpElement, SpElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-quotrem-spelement-spelement)
      - [`Quotrem(A, B): SuElement, SuElement → SuElement, SuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-quotrem-suelement-suelement)
      - [`ExtendedGcd(A, B): SnuElement, SnuElement → SnuElement, SnuElement, SnuElement, SnuElement, SnuElement, SnuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-extendedgcd-snuelement-snuelement)
      - [`ExtendedGcd(A, B): SpElement, SpElement → SpElement, SpElement, SpElement, SpElement, SpElement, SpElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-extendedgcd-spelement-spelement)
      - [`ExtendedGcd(A, B): SuElement, SuElement → SuElement, SuElement, SuElement, SuElement, SuElement, SuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-extendedgcd-suelement-suelement)
      - [`CanonicalElement(S, v): SuRng, FldRatElt → SuElement`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#function-canonicalelement-surng-fldratelt)
      - [Example: Euclidean Operations on Series](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/introduction.md#example-ex-db44fa)
- [Matrices and Modules](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md)
  - [Matrices](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#matrices)
    - [`SpMatrixSpace(S, r, c): SpRng, RngIntElt, RngIntElt → SpMatRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spmatrixspace-sprng-rngintelt-rngintelt)
    - [`SuMatrixSpace(S, r, c): SuRng, RngIntElt, RngIntElt → SuMatRng`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-sumatrixspace-surng-rngintelt-rngintelt)
    - [`IdentityMatrix(S, n): SpRng, RngIntElt → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-identitymatrix-sprng-rngintelt)
    - [`IdentityMatrix(S): SpMatRng → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-identitymatrix-spmatrng)
    - [`ZeroMatrix(S): SpMatRng → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-spmatrng)
    - [`ZeroMatrix(S, n): SpRng, RngIntElt → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-sprng-rngintelt)
    - [`ZeroMatrix(S, r, c): SpRng, RngIntElt, RngIntElt → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-sprng-rngintelt-rngintelt)
    - [`IdentityMatrix(S, n): SuRng, RngIntElt → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-identitymatrix-surng-rngintelt)
    - [`IdentityMatrix(S): SuMatRng → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-identitymatrix-sumatrng)
    - [`ZeroMatrix(S): SuMatRng → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-sumatrng)
    - [`ZeroMatrix(S, n): SuRng, RngIntElt → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-surng-rngintelt)
    - [`ZeroMatrix(S, r, c): SuRng, RngIntElt, RngIntElt → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zeromatrix-surng-rngintelt-rngintelt)
    - [`SpMatrix(A): SeqEnum → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spmatrix-seqenum)
    - [`SpMatrix(r, c, A): RngIntElt, RngIntElt, SeqEnum → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spmatrix-rngintelt-rngintelt-seqenum)
    - [`SpMatrix(v): SeqEnum → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spmatrix-seqenum-2)
    - [`SpMatrix(A): SeqEnum → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spmatrix-seqenum-3)
    - [`SuMatrix(r, c, A): RngIntElt, RngIntElt, SeqEnum → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-sumatrix-rngintelt-rngintelt-seqenum)
    - [`SuMatrix(v): SeqEnum → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-sumatrix-seqenum)
    - [`GaussValuations(M): SpMat → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-gaussvaluations-spmat)
    - [`GaussValuations(M): SuMat → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-gaussvaluations-sumat)
    - [`WeierstrassDegrees(M): SpMat → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassdegrees-spmat)
    - [`WeierstrassDegrees(M): SuMat → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassdegrees-sumat)
    - [`LeadingTerms(M): SpMat → Mtrx`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-leadingterms-spmat)
    - [`LeadingTerms(M): SuMat → Mtrx`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-leadingterms-sumat)
    - [`WeierstrassTerms(M): SpMat → Mtrx`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassterms-spmat)
    - [`WeierstrassTerms(M): SuMat → Mtrx`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassterms-sumat)
    - [`IsWeaklyZero(M): SpMat → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isweaklyzero-spmat)
    - [`IsWeaklyZero(M): SuMat → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isweaklyzero-sumat)
    - [`EchelonForm(M): SpMat → SpMat, SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-echelonform-spmat)
    - [`EchelonForm(M): SuMat → SuMat, SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-echelonform-sumat)
    - [`HermiteForm(M): SpMat → SpMat, SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-hermiteform-spmat)
    - [`HermiteForm(M): SuMat → SuMat, SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-hermiteform-sumat)
    - [`SmithForm(M): SpMat → SpMat, SpMat, SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-smithform-spmat)
    - [`SmithForm(M): SuMat → SuMat, SuMat, SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-smithform-sumat)
    - [`Kernel(M): SpMat → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-kernel-spmat)
    - [`Kernel(M): SuMat → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-kernel-sumat)
    - [`Image(M): SpMat → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-image-spmat)
    - [`Image(M): SuMat → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-image-sumat)
    - [Example: Matrices over Sp Rings](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#example-ex-8c19ad)
    - [Example: Matrices over Su Rings](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#example-ex-970ed4)
  - [Modules](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#modules)
    - [`SpSpace(R, n): SpRng, RngIntElt → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spspace-sprng-rngintelt)
    - [`SuSpace(R, n): SuRng, RngIntElt → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-suspace-surng-rngintelt)
    - [`SpSpace(M): SpMat → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spspace-spmat)
    - [`SuSpace(M): SuMat → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-suspace-sumat)
    - [`SpSpace(v): SeqEnum → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spspace-seqenum)
    - [`SuSpace(v): SeqEnum → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-suspace-seqenum)
    - [`Ambient(S): SpSpc → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-ambient-spspc)
    - [`Ambient(S): SuSpc → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-ambient-suspc)
    - [`Parent(v): SpVec → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-parent-spvec)
    - [`Parent(v): SuVec → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-parent-suvec)
    - [`ZeroVector(S): SpSpc → SpVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zerovector-spspc)
    - [`ZeroVector(S): SuSpc → SuVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-zerovector-suspc)
    - [`SpVector(e): SeqEnum → SpVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-spvector-seqenum)
    - [`SuVector(e): SeqEnum → SuVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-suvector-seqenum)
    - [`Basis(S): SpSpc → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-basis-spspc)
    - [`Basis(S): SuSpc → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-basis-suspc)
    - [`BasisMatrix(S): SpSpc → SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-basismatrix-spspc)
    - [`BasisMatrix(S): SuSpc → SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-basismatrix-suspc)
    - [`Dimension(S): SpSpc → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-dimension-spspc)
    - [`Dimension(S): SuSpc → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-dimension-suspc)
    - [`Degree(S): SpSpc → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-degree-spspc)
    - [`Degree(S): SuSpc → RngIntElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-degree-suspc)
    - [`LeadingTerms(v): SpVec → ModTupRngElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-leadingterms-spvec)
    - [`LeadingTerms(v): SuVec → ModTupRngElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-leadingterms-suvec)
    - [`WeierstrassTerms(v): SpVec → ModTupRngElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassterms-spvec)
    - [`WeierstrassTerms(v): SuVec → ModTupRngElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassterms-suvec)
    - [`GaussValuations(v): SpVec → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-gaussvaluations-spvec)
    - [`GaussValuations(v): SuVec → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-gaussvaluations-suvec)
    - [`WeierstrassDegrees(v): SpVec → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassdegrees-spvec)
    - [`WeierstrassDegrees(v): SuVec → SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-weierstrassdegrees-suvec)
    - [`IsWeaklyZero(v): SpVec → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isweaklyzero-spvec)
    - [`IsWeaklyZero(v): SuVec → BoolElt`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isweaklyzero-suvec)
    - [`M1 + M2: SpSpc, SpSpc → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-plus-spspc-spspc)
    - [`M1 + M2: SuSpc, SuSpc → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-plus-suspc-suspc)
    - [`DirectSum(M1, M2): SpSpc, SpSpc → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-directsum-spspc-spspc)
    - [`DirectSum(M1, M2): SuSpc, SuSpc → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-directsum-suspc-suspc)
    - [`M1 meet M2: SpSpc, SpSpc → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-meet-spspc-spspc)
    - [`M1 meet M2: SuSpc, SuSpc → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-meet-suspc-suspc)
    - [`S * M: SpSpc, SpMat → SpSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-times-spspc-spmat)
    - [`S * M: SuSpc, SuMat → SuSpc`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-times-suspc-sumat)
    - [`IsConsistent(M, v): SpMat, SpVec → BoolElt, SpVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-spmat-spvec)
    - [`IsConsistent(M, v): SuMat, SuVec → BoolElt, SuVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-sumat-suvec)
    - [`IsConsistent(M, e): SpMat, SeqEnum → BoolElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-spmat-seqenum)
    - [`IsConsistent(M, e): SuMat, SeqEnum → BoolElt, SeqEnum`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-sumat-seqenum)
    - [`IsConsistent(M, W): SpMat, SpMat → BoolElt, SpMat, SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-spmat-spmat)
    - [`IsConsistent(M, W): SuMat, SpMat → BoolElt, SuMat, SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-isconsistent-sumat-spmat)
    - [`v in M: SpVec, SpMat → BoolElt, SpVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-in-spvec-spmat)
    - [`v in M: SuVec, SpMat → BoolElt, SuVec`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#operation-op-in-suvec-spmat)
    - [`IsSubspace(A, B): SpSpc, SpSpc → BoolElt, SpMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-issubspace-spspc-spspc)
    - [`IsSubspace(A, B): SuSpc, SuSpc → BoolElt, SuMat`](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#function-issubspace-suspc-suspc)
    - [Example: Modules over Sp Rings](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#example-ex-3f4950)
    - [Example: Module with a Nontrivial Kernel](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#example-ex-76e436)
    - [Example: Modules over Su Rings](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/matrices-modules.md#example-ex-9b9567)
- [Bibliography](https://docs.magma-maths.org/LocalFields/SeriesRingsOverPAdicRings/bibliography.md)

### Introduction

Thanks to Xavier Caruso and David Lubicz, Magma now contains an implementation of linear algebra over ${\bf Z}_p[[u]]$ and related rings [[CL12](https://docs.magma-maths.org/references.md#cite-cl2012)]. This is a first step in various calculations with $p$-adic Hodge theory, to be able to compute with modules over suitable approximations in these rings.

The package deliberately builds a wrapper level through user-defined types in Magma. While one could alternatively just do everything in terms of power (and Laurent) series rings over the $p$-adics directly, this extra layer is hoped to make it easier to use the functionality in a coherent way. Some of the common functions applicable to power series, matrices, and modules have been copied over, but not all of them. The underlying attributes can be accessed directly in the cases where there is no equivalent on the types described here. Most notably, vectors and matrices that are user-defined types do not seem yet to be accessible via $v[i]$ or $M[i,j]$.

The package has seen limited testing, with not every possibility of precision bounds (in both the $p$-adic and power series aspects) being considered in all cases, nor has much work been done for base rings that are extensions of ${\bf Z}_p$.

#### Background

Let $R$ be a discrete valuation ring with residue field of characteristic $p$, and let $\nu$ be real. Recall that $f(u)=\sum_i a_iu^i$ where $a_i\in{\rm Frac}(R)$ converges for $|u|<1/p^\nu$ if and only if $\inf_i v_R(i)+i\nu$ is bounded.

When $\nu$ is rational, this infinimum is attained. It is called the Gauss valuation, denoted by $v_\nu(f)$, and the Weierstrass degree $d_\nu(f)$ is the minimal $i$ that realises this (by convention, the Weierstrass degree of the zero element is $-\infty$). An element is *distinguished* if its Gauss valuation is 0. We have that $v_\nu(fg)=v_\nu(f)+v_\nu(g)$ and $v_\nu(f+g)\ge\min\bigl(v_\nu(f),v_\nu(g)\bigr)$, while $d_\nu(fg)=d_\nu(f)d_\nu(g)$.

As it is not particularly clear how to represent elements of a convergent series ring in finite form, so we instead work with the “slope” ring of elements of nonnegative Gauss valuation for which $v_\nu(f)\ge 0$, namely

$$
S^\nu(R)=\biggl\{\sum_{i=0}^\infty a_i u^i|
v_R(a_i)+i\cdot\nu\ge 0,a_i\in{\rm Frac}(R)\biggr\}.
$$

For instance, when $\nu=0$, this ring is just the power series ring over $R$.

There are two related rings of interest. The first extends the coefficients to allow them to have negative valuation in ${\rm Frac}(R)$, namely $S_p^\nu(R)=S^\nu[1/\pi]$ where $\pi$ uniformises $R$. The second is a type of Laurent extension, namely writing $\nu=a/b$ in lowest terms, we have $S_u^\nu(R)=S^\nu[\pi^a/u^b]$.

For instance, the polynomial $u^2/p$ is in $S^{1/2}({\bf Q}_p)$ and $S^\nu({\bf Q}_p)$ for all $\nu$, and inverting it gives us $p/u^2\in S^{1/2}_u({\bf Q}_p)$. Note that as a power series $u^2/p$ clearly has infinite radius of convergence, even though it is in not in the slope ring $S^0({\bf Q}_p)$.

Another example, $p+u$ has Gauss valuation $\min(1,\nu)$, and thus the Weierstrass degree is $0$ for $\nu\ge 1$ but degree $1$ for $\nu<1$.

Both of these “completion” rings are Euclidean, which allows us to construct a module theory over them. While internally Magma has generic code for handling modules over Euclidean rings, with these user-defined types the component parts are all taken from boilerplate package-level implementations.

#### Basic Operations

Here are the basic creations and operations for $S^\nu$ rings and elements. All of these have a direct analogue for $S_p^\nu$ and $S_u^\nu$ rings.

##### Creation Intrinsics

<a id="function-snuring-fldpad-fldratelt"></a>
###### `SnuRing(F, nu): FldPad, FldRatElt -> SnuRng`

<a id="function-spring-fldpad-fldratelt"></a>
###### `SpRing(F, nu): FldPad, FldRatElt -> SpRng`

<a id="function-suring-fldpad-fldratelt"></a>
###### `SuRing(F, nu): FldPad, FldRatElt -> SuRng`

```magma
Precision: RngIntElt                    Default: Infinity()
```

Given a p-adic field (or ring) $F$ and a slope $\nu$ (which can be rational or integral), create the slope ring (or the $S_p^\nu$ or $S_u^\nu$ ring). The precision refers to that of the power series ring.

<a id="function-snuring-fldpad"></a>
###### `SnuRing(F): FldPad -> SnuRng`

<a id="function-spring-fldpad"></a>
###### `SpRing(F): FldPad -> SpRng`

<a id="function-suring-fldpad"></a>
###### `SuRing(F): FldPad -> SuRng`

<a id="function-snuring-rngintelt-rngintelt"></a>
###### `SnuRing(p, e): RngIntElt, RngIntElt -> SnuRng`

<a id="function-snuring-rngintelt"></a>
###### `SnuRing(p): RngIntElt -> SnuRng`

<a id="function-spring-rngintelt-rngintelt"></a>
###### `SpRing(p, e): RngIntElt, RngIntElt -> SpRng`

<a id="function-spring-rngintelt"></a>
###### `SpRing(p): RngIntElt -> SpRng`

<a id="function-suring-rngintelt-rngintelt"></a>
###### `SuRing(p, e): RngIntElt, RngIntElt -> SuRng`

<a id="function-suring-rngintelt"></a>
###### `SuRing(p): RngIntElt -> SuRng`

```magma
nu       : FldRatElt                    Default: 0
Precision: RngIntElt                    Default: Infinity()
```

The first three are the same as above, but with $\nu$ as a parameter. The others create the slope ring over ${\bf Q}_p$, with $e$ being the precision of the $p$-adic ring in this case.

<a id="function-snuring-rngserpow-fldratelt"></a>
###### `SnuRing(S, nu): RngSerPow, FldRatElt -> SnuRng`

<a id="function-spring-rngserpow-fldratelt"></a>
###### `SpRing(S, nu): RngSerPow, FldRatElt -> SpRng`

<a id="function-suring-rngserlaur-fldratelt"></a>
###### `SuRing(S, nu): RngSerLaur, FldRatElt -> SuRng`

Given a power-series ring over a $p$-adic ring or field and a rational number (or integer), create the slope ring. For the $S^\nu_u$ ring, one gives a Laurent series ring.

<a id="function-snuring-sprng"></a>
###### `SnuRing(S): SpRng -> SnuRng`

<a id="function-spring-snurng"></a>
###### `SpRing(S): SnuRng -> SpRng`

<a id="function-snuring-surng"></a>
###### `SnuRing(S): SuRng -> SnuRng`

<a id="function-suring-snurng"></a>
###### `SuRing(S): SnuRng -> SuRng`

Given an $S^\nu_p$-ring, create the associated $S^\nu$-ring, and vice-versa. Similarly with an $S^\nu_u$-ring.

##### Access Functions

<a id="operation-op-eq-snurng-snurng"></a>
###### `R eq S: SnuRng, SnuRng -> BoolElt`

<a id="operation-op-ne-snurng-snurng"></a>
###### `R ne S: SnuRng, SnuRng -> BoolElt`

<a id="operation-op-eq-sprng-sprng"></a>
###### `R eq S: SpRng, SpRng -> BoolElt`

<a id="operation-op-ne-sprng-sprng"></a>
###### `R ne S: SpRng, SpRng -> BoolElt`

<a id="operation-op-eq-surng-surng"></a>
###### `R eq S: SuRng, SuRng -> BoolElt`

<a id="operation-op-ne-surng-surng"></a>
###### `R ne S: SuRng, SuRng -> BoolElt`

Two slope rings are equal if their underlying $p$-adic power series rings are the same (including precisions), and the slopes $\nu$ are the same.

<a id="function-slope-snurng"></a>
###### `Slope(S): SnuRng -> RngIntElt`

<a id="function-slope-sprng"></a>
###### `Slope(S): SpRng -> RngIntElt`

<a id="function-slope-surng"></a>
###### `Slope(S): SuRng -> RngIntElt`

The slope of the $S^\nu$ ring.

<a id="function-precision-snurng"></a>
###### `Precision(S): SnuRng -> RngIntElt`

<a id="function-precision-sprng"></a>
###### `Precision(S): SpRng -> RngIntElt`

<a id="function-precision-surng"></a>
###### `Precision(S): SuRng -> RngIntElt`

The precision of the underlying power-series ring.

<a id="function-coefficientring-snurng"></a>
###### `CoefficientRing(S): SnuRng -> RngIntElt`

<a id="function-coefficientring-sprng"></a>
###### `CoefficientRing(S): SpRng -> RngIntElt`

<a id="function-coefficientring-surng"></a>
###### `CoefficientRing(S): SuRng -> RngIntElt`

The underlying $p$-adic ring of the $S^\nu$ ring.

#### Element Operations

The full range of addition, subtraction, multiplication, division (where applicable) and powering are available, similarly with equality.

<a id="function-parent-snuelement"></a>
##### `Parent(f): SnuElement -> SnuRng`

<a id="function-parent-spelement"></a>
##### `Parent(f): SpElement -> SpRng`

<a id="function-parent-suelement"></a>
##### `Parent(f): SuElement -> SuRng`

Return the $S^\nu$ ring to which the element belongs.

<a id="function-isweaklyzero-snuelement"></a>
##### `IsWeaklyZero(f): SnuElement -> BoolElt`

<a id="function-isweaklyzero-spelement"></a>
##### `IsWeaklyZero(f): SpElement -> BoolElt`

<a id="function-isweaklyzero-suelement"></a>
##### `IsWeaklyZero(f): SuElement -> BoolElt`

This is the proper way to test equality with elements of $S^\nu$. It checks whether every (known) coefficient is zero to within the $p$-adic precision.

##### Valuation and Degree

<a id="function-gaussvaluation-snuelement"></a>
###### `GaussValuation(f): SnuElement -> FldRatElt`

<a id="function-gaussvaluation-spelement"></a>
###### `GaussValuation(f): SpElement -> FldRatElt`

<a id="function-gaussvaluation-suelement"></a>
###### `GaussValuation(f): SuElement -> FldRatElt`

<a id="function-weierstrassdegree-snuelement"></a>
###### `WeierstrassDegree(f): SnuElement -> FldRatElt`

<a id="function-weierstrassdegree-spelement"></a>
###### `WeierstrassDegree(f): SpElement -> FldRatElt`

<a id="function-weierstrassdegree-suelement"></a>
###### `WeierstrassDegree(f): SuElement -> FldRatElt`

The Gauss valuation and Weierstrass degree respectively return these values.

<a id="function-isdistinguished-snuelement"></a>
###### `IsDistinguished(f): SnuElement -> BoolElt`

The `IsDistinguished` intrinsic returns whether the Gauss valuation is zero (this intrinsic is only for $S^\nu$ elements).

<a id="function-leadingterm-snuelement"></a>
###### `LeadingTerm(f): SnuElement -> RngSerPowElt`

<a id="function-leadingterm-spelement"></a>
###### `LeadingTerm(f): SpElement -> RngSerPowElt`

<a id="function-leadingterm-suelement"></a>
###### `LeadingTerm(f): SuElement -> RngSerLaurElt`

Gives the first non(weakly)zero term in the $S^\nu_p$-element, as a power series (or Laurent series). Useful in particular when examining vectors or matrices of such.

<a id="function-weierstrassterm-snuelement"></a>
###### `WeierstrassTerm(f): SnuElement -> RngSerPowElt`

<a id="function-weierstrassterm-spelement"></a>
###### `WeierstrassTerm(f): SpElement -> RngSerPowElt`

<a id="function-weierstrassterm-suelement"></a>
###### `WeierstrassTerm(f): SuElement -> RngSerLaurElt`

Gives the term corresponding to the Weierstrass degree of the $S^\nu_p$-element, as a power series (or Laurent series). Useful in particular when examining vectors or matrices of such.

<a id="function-o-snuelement"></a>
###### `O(x): SnuElement -> SnuElement`

<a id="function-o-spelement"></a>
###### `O(x): SpElement -> SpElement`

<a id="function-o-suelement"></a>
###### `O(x): SuElement -> SuElement`

Gives the big-Oh value of the argument.

<a id="example-ex-c0e1cb"></a>
###### `Example: Basic Operations in a Slope Ring (ex-c0e1cb)`

Here are some basic operations with a ring of slope 1.

```magma
> S<u> := SnuRing (pAdicField (5, 15), 1); // slope 1 over 5-adics
> assert Slope(S) eq 1;
> f := 5*u + u^2 + 2*u^3 + u^5 + O(u^10);
> g := u^4/25 + u^6 + u^8 + O(u^10);
> GaussValuation (f); // both have Gauss valuation 2
2
> GaussValuation (g); // both have Gauss valuation 2
2
> q := g/f; q; // g has degree 4, so this division works
(5^-3 + O(5^12))*u^3 + (-5^-4 + O(5^11))*u^4 +
  (616*5^-5 + O(5^10))*u^5 + (-606*5^-6 + O(5^9))*u^6 +
  (9946*5^-7 + O(5^8))*u^7 + (-3761*5^-8 + O(5^7))*u^8 + O(u^9)
> LeadingTerm (q); // returned as a power series ring element
(5^-3 + O(5^12))*$.1^3
```

All the same functionality copies over to the $S^\nu_p$ rings, the main difference is that one can invert $p$ directly there. There is automatic coercion from $S^\nu$ to $S^\nu_p$ rings in some cases, even when the slopes are not equal. The criterion is whether the result in the $S^\nu_p$ ring is valid.

```magma
> Sp<uu> := SpRing (pAdicField (5, 15), 1/2); // slope 1/2 over 5-adics
> assert Slope(Sp) eq 1/2;
> ff := 1/5 + uu + 5*uu^2 + O(uu^10);
> GaussValuation (ff);
-1
> gg := uu + 5^2*uu^2 + uu^3 - uu^6 + uu^9 + O(uu^10);
> h := S ! (ff * S!gg); // coerced back to the Snu-ring
> assert IsDistinguished (h);
> LeadingTerm (ff) * LeadingTerm (gg) eq LeadingTerm (h);
true
```

Similarly with $S^\nu_u$ rings, where Laurent series are now also allowed.

```magma
> Su<z> := SuRing (pAdicField (7, 25), 2/3); // slope 2/3 over 7-adics
> F := 7/z + 3*7 + z^2/7 + 7^2*z^3 + O(z^10);
> GaussValuation (F);
1/3
> WeierstrassTerm (F);
(7 + O(7^26))*$.1^-1
> SR<t> := SnuRing (Su);
> t*z/7; // automatic coercion into Su
(7^-1 + O(7^24))*z^2 + O(z^20)
```

#### Euclidean Algorithm

Given $A,B\in S^\nu$ with $v_\nu(A)\ge v_\nu(B)$ (so in particular $B$ is nonzero) the quotient-remainder algorithm returns $Q,R$ such that $A=BQ+R$ with $R$ a polynomial of degree less that $d_\nu(B)$. In general the precision loss in this operation becomes more acute with larger $\nu$. This precision loss percolates throughout all computations. Note that the result in general depends on $\nu$.

The Weierstrass preparation theorem takes a distinguished element $f\in S^\nu$ and writes $f=UP$ where $U$ is invertible in $S^\nu(R)$ and $P$ is a polynomial of degree $d_\nu(f)$. The units of $S^\nu$ are precisely those elements with Gauss valuation and Weierstrass degree both 0.

The ring $S^\nu$ is not itself Euclidean, as we can only properly quotient elements as $A/B$ when $v_\nu(B)\ge v_\nu(A)$, and this property need not be preserved in the Euclidean steps. For instance with $\nu=1$, starting with $A=pu^2+p^4$ and $B=p^2u$ we get $Q=u/p$ and $R=p^4$, but then $v_\nu(R)=4>3=v_\nu(B)$, so that we cannot divide $B$ by $R$.

However, the ability to scale by arbitrary powers of the uniformiser implies that the ring $S_p^\nu$ is Euclidean with respect to the Weierstrass degree, and similarly the ring $S_u^\nu$ is a discrete valuation ring (hence Euclidean) for the valuation $v_\nu$.

The extended gcd in $S^\nu$ or $S^\nu_p$ takes $A,B$ with $v(A)\ge v(B)$ and returns $(G,H,w,x,y,z)$ has $Aw+Bx=G$ where $v(B)=v(G)$ and $Ay+Bz=H$ with $v(H)>v(A)$ with $wz-xy=1$ (consecutive Euclidean steps). The gcd is $G$ in the case where $H$ is the zero polynomial (this will always be true over $S^\nu_p$).

Since $S^\nu_u$ is a discrete valuation ring, the quotient-remainder $A=qB+r$ always has $r=0$ when $v(B)<v(A)$, and else $q=0$. The *canonical* element of valuation $v$ in $S^\nu_u$ is $u^y p^z$ where $0\le y<{\rm denom}(\nu)$ is as small as possible and $y\nu+z=v$. The gcd of two elements $A$ and $B$ can always be taken to be a canonical element of valuation equal to the smaller of the valuations of $A$ and $B$.

##### Intrinsics

<a id="function-weierstrasspreparation-snuelement"></a>
###### `WeierstrassPreparation(f): SnuElement -> SnuElement, SnuElement`

Given a distinguished element $f$ of $S^\nu$ (one of Gauss valuation 0), write $f=UP$ where $U$ is invertible in $S^\nu$ and $P$ is a polynomial (whose degree equals the Weierstrass degree of $f$).

<a id="function-quotrem-snuelement-snuelement"></a>
###### `Quotrem(A, B): SnuElement, SnuElement -> SnuElement, SnuElement`

Given $S^\nu$ elements $A$ and $B$ with $v(A)\ge v(B)$, determine $Q,R$ with $A=BQ+R$ where $B$ is a polynomial whose degree is less than the Weierstrass degree of $B$.

<a id="function-quotrem-spelement-spelement"></a>
###### `Quotrem(A, B): SpElement, SpElement -> SpElement, SpElement`

Given $A$ and (nonzero) $B$ which are $S_p^\nu$ elements, determine $Q,R$ with $A=BQ+R$ where $B$ is a polynomial whose degree is less than the Weierstrass degree of $B$.

<a id="function-quotrem-suelement-suelement"></a>
###### `Quotrem(A, B): SuElement, SuElement -> SuElement, SuElement`

Given $A$ and (nonzero) $B$ which are $S_u^\nu$ elements, determine $Q,R$ with $A=BQ+R$. Here when $v(A)\ge v(B)$ we have $Q=A/B$ and $R=0$, and when $v(A)<v(B)$ we have $Q=0$ and $R=A$.

<a id="function-extendedgcd-snuelement-snuelement"></a>
###### `ExtendedGcd(A, B): SnuElement, SnuElement -> SnuElement, SnuElement, SnuElement, SnuElement, SnuElement, SnuElement`

Given $S^\nu$ elements $A$ and $B$ with $v(A)\ge v(B)$, try to compute the gcd. This returns a 6-tuple $(G,H,w,x,y,z)$ with $Aw+Bx=G$, $Cw+Dy=H$, and $wz-xy=1$. When $H=0$ then $G$ is the gcd. Alternatively, $v(H)$ will be some element with $v(H)>v(A)$, which precludes the Euclidean algorithm from progressing.

<a id="function-extendedgcd-spelement-spelement"></a>
###### `ExtendedGcd(A, B): SpElement, SpElement -> SpElement, SpElement, SpElement, SpElement, SpElement, SpElement`

Given $S_p^\nu$ elements $A$ and $B$ compute the extended gcd. This returns a 6-tuple $(G,H,w,x,y,z)$ with $Aw+Bx=G$, $Cw+Dy=H=0$, and $wz-xy=1$, where $G$ is the gcd.

<a id="function-extendedgcd-suelement-suelement"></a>
###### `ExtendedGcd(A, B): SuElement, SuElement -> SuElement, SuElement, SuElement, SuElement, SuElement, SuElement`

Given $S_u^\nu$ elements $A$ and $B$ compute the extended gcd. Since $S_u^\nu$ is a DVR, the gcd can be taken to be the `CanonicalElement` of the smaller valuation of $A$ and $B$.

<a id="function-canonicalelement-surng-fldratelt"></a>
###### `CanonicalElement(S, v): SuRng, FldRatElt -> SuElement`

The *canonical* element of valuation $v$ in $S^\nu_u$ is $u^y p^z$ where $0\le y<{\rm denom}(\nu)$ is as small as possible and $y\nu+z=v$.

<a id="example-ex-db44fa"></a>
###### `Example: Euclidean Operations on Series (ex-db44fa)`

Here are some basic examples of Euclidean operations.

```magma
> S<u> := SnuRing (pAdicField (5, 15), 1); // slope 1 over 5-adics
> f := 5*u + u^2 + 2*u^3 + u^5 + O(u^10);
> g := u^4/25 + u^6 + u^8 + O(u^10);
> q := g/f;
> assert IsDistinguished (q);
> U, P := WeierstrassPreparation (q); // loses a lot of precision
> U;
1 + O(5^15) + (-5^-1 + O(5^14))*u + (616*5^-2 + O(5^13))*u^2 +
 (-606*5^-3 + O(5^12))*u^3 + (9946*5^-4 + O(5^11))*u^4 +
 (-3761*5^-5 + O(5^10))*u^5 + O(u^6)
> P;
(5^-3 + O(5^12))*u^3 + O(u^6)
> q, r := Quotrem (g, f); assert r eq 0; assert q eq g/f;
> q; // same as above, though is O(u^10) not O(u^9)
(5^-3 + O(5^12))*u^3 + (-5^-4 + O(5^11))*u^4 +
  (616*5^-5 + O(5^10))*u^5 + (-606*5^-6 + O(5^9))*u^6 +
  (9946*5^-7 + O(5^8))*u^7 + (-3761*5^-8 + O(5^7))*u^8 +
  (-172699*5^-9 + O(5^6))*u^9 + O(u^10)
> q, r := Quotrem (f, g); // this is valid, as the valuations are equal
> q, r; assert f eq g*q + r;
(5^2 + O(5^17))*u + (-5^4 + O(5^17))*u^3 + (24*5^4 + O(5^17))*u^5 +
  (-23*5^6 + O(5^17))*u^7 + (551*5^6 + O(5^17))*u^9 + O(u^10)
(5 + O(5^16))*u + (1 + O(5^15))*u^2 + (2 + O(5^15))*u^3 + O(u^10)
> G, H, A, B := ExtendedGcd (f, g); assert H eq 0;
> G;
(-5 + O(5^16))*u + (-1 + O(5^15))*u^2 + (-2 + O(5^15))*u^3 + O(u^10)
> assert A*f + B*g eq G;
```

```magma
> f1 := 5*u^2 + 5^4;     // example from the text
> g1 := 5^2*u;           // where ExtendedGcd fails
> G, H := ExtendedGcd (f1, g1); assert H ne 0;
> H;
-5^4 + O(5^24) + O(u^20)
> GaussValuation (H); GaussValuation (g1);
4 3
```

The above will also work in $S^\nu_p$. As noted above, the corresponding commands for $S^\nu_u$ rings are particularly simplified.

```magma
> Su<z> := SuRing (S);
> F := Su!f; assert GaussValuation(F) eq 2;
> G := Su!g; assert GaussValuation(G) eq 2;
> Q, R := Quotrem (F, G); assert R eq 0;
> g, _, A, B, C, D := ExtendedGcd (F, G);
> g; assert g eq CanonicalElement (Su, 2);
5^2 + O(5^17) + O(z^20)
> assert A*F + B*G eq g;
> assert C*F + D*G eq 0;
> assert A*D - B*C eq 1;
```

### Matrices and Modules

Since $S_p^\nu$ and $S_u^\nu$ are Euclidean, we can work with canonical forms and modules over these rings. We consider $S_p^\nu$ first.

#### Matrices

The row-echelon form of a matrix over $S_p^\nu$ has pivot entries which are polynomials of the form

$$
u^d+\sum_{j=0}^{d-1} b_ju^j\qquad{\rm where}\qquad v(b_j)+\nu j >\nu d
$$

for $j$ in the sum, so that the Weierstrass degree is $d$ and the Gauss valuation is $d\nu$.

The Hermite form additionally assures that the other entries in the columns with pivots are polynomials of smaller degree, via taking Quotrem. This can be made unique via suitable choices, and so provides a way of testing equality of modules.

The Smith form is computed by creating a matrix of pivots corresponding to a Hermite on the matrix and then a Hermite on the transpose. One also demands recursive divisibility of the resulting diagonal terms.

Over $S_u^\nu$ the picture is the same, except that pivot entries of the echelon form are all `CanonicalElement`s, with similar changes thereon. E.g., the Hermite form will have elements of smaller valuation above the pivots.

<a id="function-spmatrixspace-sprng-rngintelt-rngintelt"></a>
##### `SpMatrixSpace(S, r, c): SpRng, RngIntElt, RngIntElt -> SpMatRng`

<a id="function-sumatrixspace-surng-rngintelt-rngintelt"></a>
##### `SuMatrixSpace(S, r, c): SuRng, RngIntElt, RngIntElt -> SuMatRng`

Given an $S_p^\nu$ of $S^\nu_u$ ring and a (nonnegative) number of rows and columns, construct the matrix space.

<a id="function-identitymatrix-sprng-rngintelt"></a>
##### `IdentityMatrix(S, n): SpRng, RngIntElt -> SpMat`

<a id="function-identitymatrix-spmatrng"></a>
##### `IdentityMatrix(S): SpMatRng -> SpMat`

<a id="function-zeromatrix-spmatrng"></a>
##### `ZeroMatrix(S): SpMatRng -> SpMat`

<a id="function-zeromatrix-sprng-rngintelt"></a>
##### `ZeroMatrix(S, n): SpRng, RngIntElt -> SpMat`

<a id="function-zeromatrix-sprng-rngintelt-rngintelt"></a>
##### `ZeroMatrix(S, r, c): SpRng, RngIntElt, RngIntElt -> SpMat`

<a id="function-identitymatrix-surng-rngintelt"></a>
##### `IdentityMatrix(S, n): SuRng, RngIntElt -> SuMat`

<a id="function-identitymatrix-sumatrng"></a>
##### `IdentityMatrix(S): SuMatRng -> SuMat`

<a id="function-zeromatrix-sumatrng"></a>
##### `ZeroMatrix(S): SuMatRng -> SuMat`

<a id="function-zeromatrix-surng-rngintelt"></a>
##### `ZeroMatrix(S, n): SuRng, RngIntElt -> SuMat`

<a id="function-zeromatrix-surng-rngintelt-rngintelt"></a>
##### `ZeroMatrix(S, r, c): SuRng, RngIntElt, RngIntElt -> SuMat`

Different ways of obtaining the zero matrix or identity matrix (if applicable) of a matrix ring.

<a id="function-spmatrix-seqenum"></a>
##### `SpMatrix(A): SeqEnum -> SpMat`

<a id="function-spmatrix-rngintelt-rngintelt-seqenum"></a>
##### `SpMatrix(r, c, A): RngIntElt, RngIntElt, SeqEnum -> SpMat`

<a id="function-spmatrix-seqenum-2"></a>
##### `SpMatrix(v): SeqEnum -> SpMat`

<a id="function-spmatrix-seqenum-3"></a>
##### `SpMatrix(A): SeqEnum -> SpMat`

<a id="function-sumatrix-rngintelt-rngintelt-seqenum"></a>
##### `SuMatrix(r, c, A): RngIntElt, RngIntElt, SeqEnum -> SuMat`

<a id="function-sumatrix-seqenum"></a>
##### `SuMatrix(v): SeqEnum -> SuMat`

Various ways of obtaining an `SpMat` or `SuMat`. The first takes a sequence of sequences of `SpElement`s or `SuElement`s, the second takes a row and column count and a sequence of `SpElement`s or `SuElement`s, and the third takes a sequence of `SpVec`s or `SuVec`s.

<a id="function-gaussvaluations-spmat"></a>
##### `GaussValuations(M): SpMat -> SeqEnum`

<a id="function-gaussvaluations-sumat"></a>
##### `GaussValuations(M): SuMat -> SeqEnum`

Returns a sequence of sequences of the Gauss valuations of the elements of a matrix. Since these can be `ExtendedReals`, the valuations themselves are put in an array rather than a matrix.

<a id="function-weierstrassdegrees-spmat"></a>
##### `WeierstrassDegrees(M): SpMat -> SeqEnum`

<a id="function-weierstrassdegrees-sumat"></a>
##### `WeierstrassDegrees(M): SuMat -> SeqEnum`

Returns a sequence of sequences of the Weierstrass degrees of the elements of a matrix. Since these can be `ExtendedReals`, the valuations themselves are put in an array rather than a matrix.

<a id="function-leadingterms-spmat"></a>
##### `LeadingTerms(M): SpMat -> Mtrx`

<a id="function-leadingterms-sumat"></a>
##### `LeadingTerms(M): SuMat -> Mtrx`

Returns a matrix (defined over the underlying power or Laurent series ring) which has the leading term of each element.

<a id="function-weierstrassterms-spmat"></a>
##### `WeierstrassTerms(M): SpMat -> Mtrx`

<a id="function-weierstrassterms-sumat"></a>
##### `WeierstrassTerms(M): SuMat -> Mtrx`

Returns a matrix (defined over the underlying power or Laurent series ring) which has the Weierstrass term of each element.

<a id="function-isweaklyzero-spmat"></a>
##### `IsWeaklyZero(M): SpMat -> BoolElt`

<a id="function-isweaklyzero-sumat"></a>
##### `IsWeaklyZero(M): SuMat -> BoolElt`

Returns whether every element in the matrix is nearly zero.

<a id="function-echelonform-spmat"></a>
##### `EchelonForm(M): SpMat -> SpMat, SpMat`

<a id="function-echelonform-sumat"></a>
##### `EchelonForm(M): SuMat -> SuMat, SuMat`

```magma
Transform: BoolElt                    Default: false
```

Returns the (row) echelon form $E$, and (if desired) the transform $T$ such that $E=TM$.

<a id="function-hermiteform-spmat"></a>
##### `HermiteForm(M): SpMat -> SpMat, SpMat`

<a id="function-hermiteform-sumat"></a>
##### `HermiteForm(M): SuMat -> SuMat, SuMat`

```magma
Transform: BoolElt                    Default: false
```

Returns the Hermite form $H$, and (if desired) the transform $T$ such that $H=TM$.

<a id="function-smithform-spmat"></a>
##### `SmithForm(M): SpMat -> SpMat, SpMat, SpMat`

<a id="function-smithform-sumat"></a>
##### `SmithForm(M): SuMat -> SuMat, SuMat, SuMat`

Returns the Smith form $S$, and (if desired) the transforms $P,Q$ such that $S=PMQ$.

<a id="function-kernel-spmat"></a>
##### `Kernel(M): SpMat -> SpSpc`

<a id="function-kernel-sumat"></a>
##### `Kernel(M): SuMat -> SuSpc`

<a id="function-image-spmat"></a>
##### `Image(M): SpMat -> SpSpc`

<a id="function-image-sumat"></a>
##### `Image(M): SuMat -> SuSpc`

Return the kernel or image of an $S_p^\nu$ or $S_u^\nu$ matrix as a module space. The `Image` also has a `Transform` parameter that gives the inclusion.

<a id="example-ex-8c19ad"></a>
##### `Example: Matrices over Sp Rings (ex-8c19ad)`

Here are some basic examples of operations with matrices over $S^\nu_p$.

```magma
> S<u> := SpRing (pAdicField (3, 20), 1/2); // slope 1/2
> M := SpMatrix (2, 3, [ S | u^2/3,u/3^2,0, u^3,3^2*u,3*u ]);
> E, T := EchelonForm (M : Transform); assert E eq T*M;
> LeadingTerms (E);
[(3^-1 + O(3^19))*$.1^2  (3^-2 + O(3^18))*$.1  O($.1^20)]
[O($.1^20)               (3^2 + O(3^18))*$.1   (3 + O(3^21))*$.1]
> WeierstrassTerms (E); // not the same
[(3^-1 + O(3^19))*$.1^2  (3^-2 + O(3^18))*$.1    O($.1^20)]
[O($.1^20)              -(3^-1 + O(3^19))*$.1^2  (3 + O(3^21))*$.1]
```

```magma
> S<u> := SpRing (pAdicField (5, 10), 3/2); // slope 3/2
> M := SpMatrix (3,5,[S|5^3,u,u^2/5,0,0, 0,0,25,u^3/25,3*5, 0,0,0,0,5^2]);
> H, T := HermiteForm (M : Transform); assert H eq T*M;
> WeierstrassTerms(H);
[5^3 + O(5^13)  $.1        O($.1^20)     -(5^-5 + O(5^5))*$.1^5  O($.1^20)]
[O($.1^20)      O($.1^20)  5^2 + O(5^9)  (5^-2 + O(5^8))*$.1^3   O($.1^20)]
[O($.1^20)      O($.1^20)  O($.1^20)     O($.1^20)               5^2 + O(5^12)]
> X, P, Q := SmithForm (M : Transform); assert P*M*Q eq X;
> WeierstrassTerms(X); // note that 5^3 divides 5^2 in this ring!
[5^3 + O(5^13)  O($.1^20)     O($.1^20)      O($.1^20)  O($.1^20)]
[O($.1^20)      5^2 + O(5^9)  O($.1^20)      O($.1^20)  O($.1^20)]
[O($.1^20)      O($.1^20)     5^2 + O(5^12)  O($.1^20)  O($.1^20)]
```

<a id="example-ex-970ed4"></a>
##### `Example: Matrices over Su Rings (ex-970ed4)`

Here are similar examples over $S^\nu_u$.

```magma
> S<u> := SuRing (pAdicField (5, 15), 2/3); // slope 2/3
> M := SuMatrix (2, 3, [ S | 5^2/u,0,u^2, u,5*u^2,5^3/u^2 ]);
> E, T := EchelonForm (M : Transform); assert E eq T*M;
> LeadingTerms (E);
[$.1        (5 + O(5^16))*$.1^2   (5^3 + O(5^18))*$.1^-2]
[O($.1^20)  5^3 + O(5^15)         (5^5 + O(5^20))*$.1^-4]
> WeierstrassTerms (E); // not the same, in lower right
[$.1        (5 + O(5^16))*$.1^2  (5^3 + O(5^18))*$.1^-2]
[O($.1^20)  5^3 + O(5^15)        -$.1^2]
```

```magma
> A := [S | 25/u,u,u^2/5,0,0, 0,0,25,125/u^2,50*u, 0,0,0,0,5*u^2];
> M := SuMatrix (3, 5, A);
> H, T := HermiteForm (M : Transform); assert H eq T*M;
> W := WeierstrassTerms(H); W;
[$.1^2 (5^-2 + O(5^13))*$.1^4 (5^-3 + O(5^12))*$.1^5 O($.1^20) O($.1^20)]
[O($.1^20) O($.1^20) 5^2 + O(5^17) (5^3 + O(5^18))*$.1^-2 O($.1^20)]
[O($.1^20) O($.1^20) O($.1^20) O($.1^20) (5 + O(5^16))*$.1^2]
> assert CanonicalElement (S, 4/3) eq S!W[1,1];
> assert CanonicalElement (S, 2) eq S!W[2,3];
> assert CanonicalElement (S, 7/3) eq S!W[3,5];
> X, P, Q := SmithForm (M : Transform); assert X eq P*M*Q;
> WeierstrassTerms(X);
[(5^-1 + O(5^14))*$.1^2 O($.1^20) O($.1^20) O($.1^20) O($.1^20)]
[O($.1^20) (5 + O(5^16))*$.1 O($.1^20) O($.1^20) O($.1^20)]
[O($.1^20) O($.1^20) (5 + O(5^16))*$.1^2 O($.1^20) O($.1^20)]
```

#### Modules

These are implemented as “vectors” over $S^\nu_p$ or $S^\nu_u$.

<a id="function-spspace-sprng-rngintelt"></a>
##### `SpSpace(R, n): SpRng, RngIntElt -> SpSpc`

<a id="function-suspace-surng-rngintelt"></a>
##### `SuSpace(R, n): SuRng, RngIntElt -> SuSpc`

Given an $S^\nu_p$ or $S^\nu_u$ ring and a nonnegative integer, construct the module of that degree.

<a id="function-spspace-spmat"></a>
##### `SpSpace(M): SpMat -> SpSpc`

<a id="function-suspace-sumat"></a>
##### `SuSpace(M): SuMat -> SuSpc`

Given an $S^\nu_p$ or $S^\nu_u$ matrix, construct the associated module space. This always computes the Hermite form to use as the basis.

<a id="function-spspace-seqenum"></a>
##### `SpSpace(v): SeqEnum -> SpSpc`

<a id="function-suspace-seqenum"></a>
##### `SuSpace(v): SeqEnum -> SuSpc`

Given a sequence of `SpVec`s or `SuVec`s, construct the module space generated by them. Again this always computes the Hermite form for the basis.

<a id="function-ambient-spspc"></a>
##### `Ambient(S): SpSpc -> SpSpc`

<a id="function-ambient-suspc"></a>
##### `Ambient(S): SuSpc -> SuSpc`

Given a module space, return the (full) ambient space of dimension equal to the degree.

<a id="function-parent-spvec"></a>
##### `Parent(v): SpVec -> SpSpc`

<a id="function-parent-suvec"></a>
##### `Parent(v): SuVec -> SuSpc`

The Parent of an `SpVec` or `SuVec` is always its `Ambient` space.

<a id="function-zerovector-spspc"></a>
##### `ZeroVector(S): SpSpc -> SpVec`

<a id="function-zerovector-suspc"></a>
##### `ZeroVector(S): SuSpc -> SuVec`

Return the zero vector of a module space.

<a id="function-spvector-seqenum"></a>
##### `SpVector(e): SeqEnum -> SpVec`

<a id="function-suvector-seqenum"></a>
##### `SuVector(e): SeqEnum -> SuVec`

Given a sequence of $S^\nu_p$ or $S^\nu_u$ elements, construct the vector of them.

<a id="function-basis-spspc"></a>
##### `Basis(S): SpSpc -> SeqEnum`

<a id="function-basis-suspc"></a>
##### `Basis(S): SuSpc -> SeqEnum`

Given a module space, return a basis as a sequence of vectors.

<a id="function-basismatrix-spspc"></a>
##### `BasisMatrix(S): SpSpc -> SpMat`

<a id="function-basismatrix-suspc"></a>
##### `BasisMatrix(S): SuSpc -> SuMat`

Given a module space, return a basis as a matrix.

<a id="function-dimension-spspc"></a>
##### `Dimension(S): SpSpc -> RngIntElt`

<a id="function-dimension-suspc"></a>
##### `Dimension(S): SuSpc -> RngIntElt`

<a id="function-degree-spspc"></a>
##### `Degree(S): SpSpc -> RngIntElt`

<a id="function-degree-suspc"></a>
##### `Degree(S): SuSpc -> RngIntElt`

The dimension and degree of a module space.

<a id="function-leadingterms-spvec"></a>
##### `LeadingTerms(v): SpVec -> ModTupRngElt`

<a id="function-leadingterms-suvec"></a>
##### `LeadingTerms(v): SuVec -> ModTupRngElt`

The leading term of each element in an `SpVec` or `SuVec`.

<a id="function-weierstrassterms-spvec"></a>
##### `WeierstrassTerms(v): SpVec -> ModTupRngElt`

<a id="function-weierstrassterms-suvec"></a>
##### `WeierstrassTerms(v): SuVec -> ModTupRngElt`

The Weierstrass term of each element in an `SpVec` or `SuVec`.

<a id="function-gaussvaluations-spvec"></a>
##### `GaussValuations(v): SpVec -> SeqEnum`

<a id="function-gaussvaluations-suvec"></a>
##### `GaussValuations(v): SuVec -> SeqEnum`

Returns a sequence of sequences of the Gauss valuations of the elements of a matrix. Since these can be `ExtendedReals`, the valuations themselves are put in an array rather than a vector.

<a id="function-weierstrassdegrees-spvec"></a>
##### `WeierstrassDegrees(v): SpVec -> SeqEnum`

<a id="function-weierstrassdegrees-suvec"></a>
##### `WeierstrassDegrees(v): SuVec -> SeqEnum`

Returns a sequence of sequences of the Weierstrass degrees of the elements of a vector. Since these can be `ExtendedReals`, the valuations themselves are put in an array rather than a vector.

<a id="function-isweaklyzero-spvec"></a>
##### `IsWeaklyZero(v): SpVec -> BoolElt`

<a id="function-isweaklyzero-suvec"></a>
##### `IsWeaklyZero(v): SuVec -> BoolElt`

Return whether an `SpVec` or `SuVec` is weakly zero.

<a id="operation-op-plus-spspc-spspc"></a>
##### `M1 + M2: SpSpc, SpSpc -> SpSpc`

<a id="operation-op-plus-suspc-suspc"></a>
##### `M1 + M2: SuSpc, SuSpc -> SuSpc`

<a id="function-directsum-spspc-spspc"></a>
##### `DirectSum(M1, M2): SpSpc, SpSpc -> SpSpc`

<a id="function-directsum-suspc-suspc"></a>
##### `DirectSum(M1, M2): SuSpc, SuSpc -> SuSpc`

<a id="operation-op-meet-spspc-spspc"></a>
##### `M1 meet M2: SpSpc, SpSpc -> SpSpc`

<a id="operation-op-meet-suspc-suspc"></a>
##### `M1 meet M2: SuSpc, SuSpc -> SuSpc`

The sum and intersection of two module spaces. The use of `DirectSum` requires the summands to be disjoint.

<a id="operation-op-times-spspc-spmat"></a>
##### `S * M: SpSpc, SpMat -> SpSpc`

<a id="operation-op-times-suspc-sumat"></a>
##### `S * M: SuSpc, SuMat -> SuSpc`

The transformation of a module space by a matrix. The basis of the resulting space will be given in Hermite form.

<a id="function-isconsistent-spmat-spvec"></a>
##### `IsConsistent(M, v): SpMat, SpVec -> BoolElt, SpVec`

<a id="function-isconsistent-sumat-suvec"></a>
##### `IsConsistent(M, v): SuMat, SuVec -> BoolElt, SuVec`

<a id="function-isconsistent-spmat-seqenum"></a>
##### `IsConsistent(M, e): SpMat, SeqEnum -> BoolElt, SeqEnum`

<a id="function-isconsistent-sumat-seqenum"></a>
##### `IsConsistent(M, e): SuMat, SeqEnum -> BoolElt, SeqEnum`

<a id="function-isconsistent-spmat-spmat"></a>
##### `IsConsistent(M, W): SpMat, SpMat -> BoolElt, SpMat, SpMat`

<a id="function-isconsistent-sumat-spmat"></a>
##### `IsConsistent(M, W): SuMat, SpMat -> BoolElt, SuMat, SuMat`

<a id="operation-op-in-spvec-spmat"></a>
##### `v in M: SpVec, SpMat -> BoolElt, SpVec`

<a id="operation-op-in-suvec-spmat"></a>
##### `v in M: SuVec, SpMat -> BoolElt, SuVec`

Determines whether $xM=v$ is solvable, and it so returns such an $x$. The second version takes an a sequence of vectors, and the third takes a matrix (and also includes the kernel as a third return value).

<a id="function-issubspace-spspc-spspc"></a>
##### `IsSubspace(A, B): SpSpc, SpSpc -> BoolElt, SpMat`

<a id="function-issubspace-suspc-suspc"></a>
##### `IsSubspace(A, B): SuSpc, SuSpc -> BoolElt, SuMat`

Determines whether $A$ is a subspace of $B$, and if so gives an inclusion map. Equality can be determined via symmetric inclusion, or alternatively via the Hermite form (which should be unique) of the basis matrix.

<a id="example-ex-3f4950"></a>
##### `Example: Modules over Sp Rings (ex-3f4950)`

Here are some basic examples of usage for modules.

```magma
> S<u> := SpRing (pAdicField (5, 25), 1/2); // slope 1/2
> A := SpSpace (S, 3);
> A.1;
[ 1 + O(5^25) + O(u^20), O(u^20), O(u^20) ]
> M := SpMatrix (2, 3, [ S | 5*u,5,u^2, 1/5,u^3,u ]);
> B := SpSpace (M); assert Dimension(B) eq 2;
> LeadingTerms(BasisMatrix(B));
[5^-1 + O(5^24) O($.1^20)    $.1]
[O($.1^20)      -5 + O(5^26) (24 + O(5^25))*$.1^2]
> B eq SpSpace (VerticalJoin (M, M)); // also gives inclusion
true
> A meet B eq B;
true
> Image(M) eq B; // by definition
true
> IsConsistent (M, A.1);
false
> IsConsistent (M, B.1);
true
> SpSpace([B.1]) + SpSpace([B.2]) eq B;
true
> SpSpace([B.1]) + SpSpace([u * B.2]) eq B; // u does not invert
false
> SpSpace([1/5 * B.1]) + SpSpace([5 * B.2]) eq B;
true
> sub<B|[B.1+B.2]> + sub<B|[B.2-B.1]> eq sub<B|[B.1,B.2]>;
true
```

<a id="example-ex-76e436"></a>
##### `Example: Module with a Nontrivial Kernel (ex-76e436)`

Here is an example over $S^\nu_p$ with a nontrivial kernel.

```magma
> S<u> := SpRing (pAdicField (7, 30), 1); // slope 1
> M := SpMatrix(3,5,[S|1,0,u,u^2,u,  u^2/7,0,1,0,0, 0,0,1,0,u^4/7^2]);
> ROWS := Rows(M);
> V := u * ROWS[1] + u^2/7 * ROWS[3]; // create a kernel
> MAT := SpMatrix(ROWS cat [Universe(ROWS)|V]); // 4 x 5
> Dimension (SpSpace (MAT)); // 3
3
> K := Kernel (MAT); K;
SpSpace of degree 4, dimension 1 over Sp-slope ring of slope 1 given
 by Power series ring in $.1 over pAdicField(7, 30)
Basis given by:
[ (-1 + O(7^30))*u + O(u^21), O(u^21),
  (-7^-1 + O(7^29))*u^2 + O(u^21), 1 + O(7^30) + O(u^21) ]
> KK := Kernel(BasisMatrix(K)); KK;
SpSpace of degree 1, dimension 0 over Sp-slope ring of slope 1 given
 by Power series ring in $.1 over pAdicField(7, 30)
> assert ZeroVector(Ambient(KK)) in KK;
```

<a id="example-ex-9b9567"></a>
##### `Example: Modules over Su Rings (ex-9b9567)`

Here is an example over $S^\nu_u$.

```magma
> S<u> := SuRing (pAdicField (7, 20), 5/4); // slope 5/4
> A := SuSpace (S, 3);
> B := SuSpace ([A.1, A.3]); // dimension 2
> SuSpace([B.1]) + SuSpace([7^5/u^4 * B.2]) eq B; // slope 5/4
true
> Basis(sub<A|[A.1+A.3]>)[1] in B;
true
> M := SuMatrix (2, 3, [S | 7^2/u,7,5*7*u, 7,u^3,u^2 ]);
> V := SuSpace(M);
> I := V meet B; assert Dimension(I) eq 1;
> v := Basis(I)[1]; assert v in I;
> WeierstrassTerms(v);
(7 + O(7^21) O($.1^20) $.1^2)
> WeierstrassDegrees(v);
[ 0, -Infinity, 2 ]
> I + B eq B; assert v in B;
true
> J := VerticalJoin (M, M);
> SetSeed(1); // ensure example works
> JJ := (SuMatrixSpace(S,4,4)!RandomSLnZ(4,8,16)) * J;
> assert Dimension(Kernel(JJ)) eq 2;
> assert Dimension(Image(JJ)) eq 2;
```

Note that the final commands, with the dimension of the kernel/image of the given space, can sometimes fail for various reasons involving precision loss.

<a id="galrep"></a>
## Local Galois Representations

- [Overview](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md)
  - [Notation and Printing](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#notation-and-printing)
    - [Example: Printing Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#example-ex-8ff07a)
  - [Conventions](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#conventions)
  - [Implementation Notes](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#implementation-notes)
- [Creating Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md)
  - [`ZeroRepresentation(K): FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-zerorepresentation-fldpad)
  - [Example: Zero Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-153a0b)
  - [`PrincipalCharacter(K): FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-principalcharacter-fldpad)
  - [Example: Principal Character of a Local Field](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-48649a)
  - [`CyclotomicCharacter(K): FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-cyclotomiccharacter-fldpad)
  - [Example: Cyclotomic Character](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-4a5d9f)
  - [`UnramifiedCharacter(K,c): FldPad, Any → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-unramifiedcharacter-fldpad-any)
  - [Example: Unramified Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-6bab13)
  - [`UnramifiedRepresentation(K,CharPoly): FldPad, RngUPolElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-unramifiedrepresentation-fldpad-rngupolelt)
  - [Example: Unramified Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-b1231d)
  - [`UnramifiedRepresentation(K,dim, dimcomputed,CharPoly): FldPad, RngIntElt, RngIntElt, RngUPolElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-unramifiedrepresentation-fldpad-rngintelt-rngintelt-rngupolelt)
  - [Example: Representations Not Fully Computed](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-f653e8)
  - [`SP(K,n): FldPad, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-sp-fldpad-rngintelt)
  - [Example: Special Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-8d3d78)
  - [`SP(K,f,n): FldPad, RngUPolElt, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-sp-fldpad-rngupolelt-rngintelt)
  - [Example: Twisted Special Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-3bd7e7)
  - [Representations from Finite Extensions](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#representations-from-finite-extensions)
    - [`GaloisRepresentations(F,K): FldPad, FldPad → SeqEnum[GalRep]`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentations-fldpad-fldpad)
    - [Example: Irreducible Characters of a Dihedral Extension](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-314f0e)
    - [`GaloisRepresentations(f): RngUPolEltFldPad → SeqEnum[GalRep]`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentations-rngupoleltfldpad)
    - [Example: One-Dimensional Characters of a Cyclotomic Extension](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-da3085)
    - [`PermutationCharacter(F,K): FldPad, FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-permutationcharacter-fldpad-fldpad)
    - [Example: Permutation Character of a Cubic Extension](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-ba722b)
    - [`A !! chi: GalRep, AlgChtrElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#operation-op-galrep-algchtrelt)
    - [`A !! chi: GalRep, SeqEnum → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#operation-op-galrep-seqenum)
    - [Example: Replacing the Character of a Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-b9793f)
  - [Local Representations of Global Objects](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#local-representations-of-global-objects)
    - [`GaloisRepresentation(chi,p): GrpDrchElt, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-grpdrchelt-rngintelt)
    - [Example: Local Components of a Dirichlet Character](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-a9f044)
    - [`GaloisRepresentation(A,p): ArtRep, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-artrep-rngintelt)
    - [Example: Local Components of an Artin Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-e01700)
    - [`GaloisRepresentation(E): CrvEll → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvell)
    - [Example: Galois Representation of a Local Elliptic Curve](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-29c470)
    - [`GaloisRepresentation(E,p): CrvEll, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvell-rngintelt)
    - [Example: Elliptic Curve 20a1 at Several Primes](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-94d575)
    - [`GaloisRepresentation(E,P): CrvEll, RngOrdIdl → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvell-rngordidl)
    - [Example: Elliptic Curve over a Cyclotomic Field](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-f7aec3)
    - [`GaloisRepresentation(C): CrvHyp[FldPad] → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvhyp-fldpad)
    - [Example: Hyperelliptic Curve over a p-adic Field](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-1fdb67)
    - [`GaloisRepresentation(C,p): CrvHyp[FldRat], RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvhyp-fldrat-rngintelt)
    - [Example: Hyperelliptic Curve over the Rationals](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-1f2ef0)
    - [`GaloisRepresentation(C,P): CrvHyp[FldNum], RngOrdIdl → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-crvhyp-fldnum-rngordidl)
    - [Example: Hyperelliptic Curve over a Cyclotomic Field](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-e4e4fd)
    - [`GaloisRepresentation(f,p): ModFrmElt, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#function-galoisrepresentation-modfrmelt-rngintelt)
    - [Example: Local Representations of a Modular Form](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-e7791f)
- [Basic Invariants](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md)
  - [`BaseField(A): GalRep → FldPad`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-basefield-galrep)
  - [`Degree(A): GalRep → RngIntElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-degree-galrep)
  - [`Dimension(A): GalRep → RngIntElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-dimension-galrep)
  - [Example: Degree and Base Field of Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-890f18)
  - [`Group(A): GalRep → GrpPerm`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-group-galrep)
  - [`GaloisGroup(A): GalRep → GrpPerm`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-galoisgroup-galrep)
  - [Example: Galois and Inertia Groups of Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-baedd9)
  - [`FrobeniusElement(A): GalRep → GrpPermElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-frobeniuselement-galrep)
  - [Example: Frobenius Element of an Unramified Extension](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-abc80d)
  - [`Character(A): GalRep → AlgChtrElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-character-galrep)
  - [Example: Character of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-ce7d20)
  - [`Field(A): GalRep → FldPad`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-field-galrep)
  - [`DefiningPolynomial(A): GalRep → RngUPolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-definingpolynomial-galrep)
  - [Example: Defining Polynomial of a Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-216918)
  - [`Automorphism(A,g): GalRep, GrpPermElt → Map`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-automorphism-galrep-grppermelt)
  - [Example: Field and Automorphisms of a Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-3bde84)
  - [`EulerFactor(A): GalRep → RngUPolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-eulerfactor-galrep)
  - [Example: Euler Factors of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-641625)
  - [`IsZero(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-iszero-galrep)
  - [`IsOne(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-isone-galrep)
  - [`Factorization(A): GalRep → List, GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-factorization-galrep)
  - [Example: Factorization of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-d8fc15)
  - [Ramification](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#ramification)
    - [`InertiaGroup(A): GalRep → GrpPerm`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-inertiagroup-galrep)
    - [Example: Inertia Groups of Irreducible Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-e156fa)
    - [`InertiaGroup(A,n): GalRep, RngIntElt → GrpPerm`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-inertiagroup-galrep-rngintelt)
    - [Example: Higher Ramification Groups](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-92ac63)
    - [`IsUnramified(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-isunramified-galrep)
    - [Example: Testing Whether a Representation Is Unramified](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-57fb0d)
    - [`IsRamified(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-isramified-galrep)
    - [Example: Ramification of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-27c5ab)
    - [`IsTamelyRamified(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-istamelyramified-galrep)
    - [`IsWildlyRamified(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-iswildlyramified-galrep)
    - [Example: Wild Ramification of Elliptic Curves](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-1ea277)
    - [`InertiaInvariants(A): GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-inertiainvariants-galrep)
    - [Example: Inertia Invariants of a Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-04fb22)
    - [`ConductorExponent(A): GalRep → RngIntElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-conductorexponent-galrep)
    - [`Conductor(A): GalRep → FldPadElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-conductor-galrep)
    - [Example: Conductor of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-7491ac)
    - [`EpsilonFactor(A): GalRep → FldComElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-epsilonfactor-galrep)
    - [`RootNumber(A): GalRep → FldComElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-rootnumber-galrep)
    - [Example: Epsilon Factors and Root Numbers](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-3d8d04)
  - [Semisimplicity and Irreducibles](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#semisimplicity-and-irreducibles)
    - [`IsIrreducible(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-isirreducible-galrep)
    - [Example: Irreducibility of Local Components](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-f6575f)
    - [`IsIndecomposable(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-isindecomposable-galrep)
    - [`IsSemisimple(A): GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-issemisimple-galrep)
    - [`Semisimplification(A): GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-semisimplification-galrep)
    - [`Decomposition(A): GalRep → SeqEnum[GalRep]`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#function-decomposition-galrep)
    - [Example: Decomposition of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/invariants.md#example-ex-2ab1fc)
- [Arithmetic](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md)
  - [`A1 + A2: GalRep, GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-plus-galrep-galrep)
  - [Example: Sums of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-1e67b8)
  - [`A1 - A2: GalRep, GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-minus-galrep-galrep)
  - [Example: Differences of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-2242b4)
  - [`A1 * A2: GalRep, GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-times-galrep-galrep)
  - [Example: Tensor Products of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-eb562c)
  - [`A1 / A2: GalRep, GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-div-galrep-galrep)
  - [`A1 / A2: RngIntElt, GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-div-rngintelt-galrep)
  - [`A ^ n: GalRep, Any → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-pow-galrep-any)
  - [Example: Powers of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-173850)
  - [`A1 eq A2: GalRep, GalRep → BoolElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#operation-op-eq-galrep-galrep)
  - [Example: Equality of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-e6a517)
  - [`Determinant(A): GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#function-determinant-galrep)
  - [Example: Determinant of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-e59efc)
  - [`TateTwist(A,n): GalRep, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#function-tatetwist-galrep-rngintelt)
  - [Example: Tate Twists of Galois Representations](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/arithmetic.md#example-ex-a9cca5)
- [Changing Precision](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/precision.md)
  - [`Precision(A): GalRep → RngIntElt`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/precision.md#function-precision-galrep)
  - [`ChangePrecision(~A,Prec): GalRep, RngIntElt → {}`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/precision.md#function-changeprecision-galrep-rngintelt-ref)
  - [`ChangePrecision(A,Prec): GalRep, RngIntElt → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/precision.md#function-changeprecision-galrep-rngintelt)
  - [Example: Changing the Precision of a Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/precision.md#example-ex-8bdd36)
- [Changing Fields](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md)
  - [`Minimize(A): GalRep → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-minimize)
  - [Example: Minimizing a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#example-ex-b8e822)
  - [`Restriction(A,L): GalRep, FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-restriction-galrep-fldpad)
  - [`BaseChange(A,L): GalRep, FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-basechange-galrep-fldpad)
  - [Example: Base Change of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#example-ex-3dc7d9)
  - [`Induction(A,K0): GalRep, FldPad → GalRep`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-induction-galrep-fldpad)
  - [Example: Induction of a Galois Representation](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#example-ex-aae099)
- [Advanced Examples](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md)
  - [Example: Local and Global Epsilon Factors for Dirichlet Characters](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-local-and-global-epsilon-factors-for-dirichlet-characters)
    - [Example: Local and Global Epsilon Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-ex-938a3a)
  - [Example: Reconstructing a Galois Representation from its Euler Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-reconstructing-a-galois-representation-from-its-euler-factors)
    - [Example: Reconstruction from Euler Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-ex-6f8047)
- [Bibliography](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/bibliography.md)

<a id="galrep-overview"></a>
<a id="id1"></a>
### Overview

This package provides functionality for working with Galois representations

$$
\mathop{\rm Gal}\nolimits(\bar{K}/K) \longrightarrow \mathop{\rm GL}\nolimits_m({\mathbb{C}})
$$

over $p$-adic fields $K$ (type `FldPad`). The representations we consider are precisely those on the ‘Galois side’ of the local Langlands correspondence, or, technically, the *Frobenius-semisimple Weil-Deligne representations* over $K$. We refer the reader to Tate’s article [[Tat79](https://docs.magma-maths.org/references.md#cite-tate), §4] for their basic properties.

In arithmetic geometry, such representations arise from $l$-adic étale cohomology of algebraic varieties over $K$ for $l\ne p$. Magma includes Galois representations that come from finite Galois groups of $p$-adic extensions, local components of Dirichlet characters and Artin representations, local Galois representations coming from a Tate module of an elliptic curve or a modular form, as well as various constructions to produce new representations from existing ones, such as direct sums, tensor products, induction, restriction, and semisimplification.

<a id="printing"></a>
<a id="galrep-printing"></a>
#### Notation and Printing

Suppose $K$ is a finite extension of $\Q_p$, with ring of integers $O$, maximal ideal $m$, and residue field $k=O/m\cong\F_q$. The absolute Galois group of $K$ fits into an exact sequence

$$
\begin{matrix}1 &\longrightarrow& I_K &\longrightarrow& \mathop{\rm Gal}\nolimits(\bar{K}/K) &\longrightarrow& \mathop{\rm Gal}\nolimits(\bar k/k) &\longrightarrow& 1, \\
    &    &     &    &    \sigma      &\mapsto& \sigma\ \mathop{\rm mod}\ m\end{matrix}
$$

where $I_K$ is the *inertia group* of $K$. The group $\mathop{\rm Gal}\nolimits(\bar k/k)$ is topologically generated by the automorphism $x\mapsto x^q$, and any of its lifts to $\mathop{\rm Gal}\nolimits(\bar{K}/K)$ is called an *arithmetic Frobenius element*, denoted $\mathop{\rm Frob}\nolimits_K$.

The *Weil group* $W_K$ *of* $K$ is a subgroup of $\mathop{\rm Gal}\nolimits(\bar{K}/K)$ generated by the inertia group $I_K$ and any Frobenius element. It fits in the same exact sequence as above, except that the profinite group $\mathop{\rm Gal}\nolimits(\bar k/k)\cong\hat{\mathbb{Z}}$ is replaced by a copy of ${\mathbb{Z}}$ with discrete topology. A *Weil representation* is a continuous representation

$$
\rho: W_K \longrightarrow \mathop{\rm GL}\nolimits_m({\mathbb{C}}).
$$

By continuity, the image of inertia $\rho(I_K)$ is finite, and $\rho$ is said to be *unramified* if it is trivial. We will always assume that $\rho$ is *Frobenius-semisimple*, that is $\rho(\mathop{\rm Frob}\nolimits_K)$ is a semisimple endomorphism of ${\mathbb{C}}^m$. Every such representation $\rho$ is a direct sum of irreducible representations of the form

$$
\psi \otimes R,
$$

where $\psi: I_K \mapsto 1, \mathop{\rm Frob}\nolimits_K\mapsto \alpha\in{\mathbb{C}}^\times$ is an unramified 1-dimensional character (uniquely determined by $\alpha\in{\mathbb{C}}^\times$) and $R$ is a representation of $\mathop{\rm Gal}\nolimits(F/K)$ for some finite Galois extension $F/K$.

Weil representations occur naturally as local components of Artin representations, and as representations associated to ($H^1$ of) elliptic curves and abelian varieties over $K$ with potentially good reduction. (By the Néron-Ogg-Shafarevich criterion, potentially good reduction is *equivalent* to $\rho(I_K)$ being finite.) To deal with arbitrary reduction behaviour one considers, more generally, *Weil-Deligne* representations. These come from Galois representations

$$
\rho: \mathop{\rm Gal}\nolimits(\bar{K}/K) \longrightarrow \mathop{\rm GL}\nolimits_m({\mathbb{C}})
$$

that can be described as follows.

As before, $\rho$ is a direct sum of indecomposable representations, and an indecomposable one is now of the form (cf. [[Tat79](https://docs.magma-maths.org/references.md#cite-tate), 4.1.5])

$$
\rho = \psi \otimes\hbox{\tt SP}(n) \otimes R,
$$

with $\psi$ and $R$ as above, and $\hbox{\tt SP}(n)$ is a ‘special’ representation ([[Tat79](https://docs.magma-maths.org/references.md#cite-tate), 4.1.4]),

$$
\hbox{\tt SP}(n) = {\mathbb{C}}e_0 + {\mathbb{C}}e_1 + \ldots + {\mathbb{C}}e_{n-1}.
$$

The $e_i$ are eigenvectors for $\mathop{\rm Frob}\nolimits_K$ with eigenvalues $q^{-i}$, and the action of inertia is nilpotent, and represented by a matrix $N$ (see [[Tat79](https://docs.magma-maths.org/references.md#cite-tate), 4.1.2]) that takes $e_i\mapsto e_{i+1}$ and $e_{n-1}\mapsto 0$.

This is precisely how Galois representations are stored in Magma,

$$
\rho = \bigoplus_i\,\, \psi_i \otimes\hbox{\tt SP}(n_i) \otimes R_i,
$$

except that it is convenient to

(1) assume that all $R_i$ factor through the same Galois group $G=\mathop{\rm Gal}\nolimits(F/K)$, and

(2) allow $\psi_i$ to be arbitrary unramified representations, not necessarily 1-dimensional. Such a $\psi$ is a sum of unramified characters $\chi_j: \mathop{\rm Frob}\nolimits_K\mapsto \alpha_j$, and $\psi$ is uniquely determined by its *Euler factor*

$$
\Psi(T) = \det (1-\mathop{\rm Frob}\nolimits_K^{-1}T|\psi) = \prod_j (1-\alpha_j^{-1} T) \in {\mathbb{C}}[T].
$$

In other words, every component of $\rho$ can be represented (though not quite uniquely) by a triple $\langle \Psi,n,c \rangle$, where $\Psi\in \C[T]$, $n\in \Z$, and $c$ is a character of a representation $R$ of a finite group $\mathop{\rm Gal}\nolimits(F/K)$. Throughout the chapter we will refer to $R$ as the ‘finite part’ of an indecomposable representation $\psi\mathbin{\tensor}\hbox{\tt SP}(n)\mathbin{\tensor} R$, though it depends on the choice of such a presentation.

Galois representations have Magma type `GalRep`. The base field $K$, field $F$, the Galois group $F/K$, and the list of components of $\rho$ can be obtained with `BaseField`, `Field`, `Group`, and `Factorization`, respectively.

<a id="example-ex-8ff07a"></a>
##### `Example: Printing Galois Representations (ex-8ff07a)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(Rationals());
```

First, construct a typical unramified representation specified by its Euler factor $\psi$.

```magma
> psi:=UnramifiedRepresentation(K,1+x^2); psi;
2-dim unramified Galois representation Unr(1+x^2) over Q2[20]
```

Next, construct a typical finite image representation, by picking a character of a finite Galois extension $F/K$, in this case an $S_3$-extension.

```magma
> S<z>:=PolynomialRing(K);
> F:=ext<K|z^3-2>;
> c:=GaloisRepresentations(F,K)[3]; c;
2-dim Galois representation (2,0,-1) with G=S3, I=C3, conductor 2^2 over Q2[20]
```

Here is a general Galois representation, the tensor product of all 3 terms, and another one — direct sum of the same three terms.

```magma
> psi*SP(K,2)*c;
8-dim Galois representation Unr(1+x^2)*SP(2)*(2,0,-1) with G=S3, I=C3,
   conductor 2^8 over Q2[20]
> psi+SP(K,2)+c;
6-dim Galois representation Unr(1+x^2) + (2,0,-1) + SP(2) with G=S3, I=C3,
   conductor 2^3 over Q2[20]
```

<a id="galrep-conventions"></a>
<a id="id6"></a>
#### Conventions

There are various choices of signs in local class field theory, for which there appears to be no consensus in the literature. Our conventions follow Tate [[Tat79](https://docs.magma-maths.org/references.md#cite-tate)], and are as follows. (We refer the reader to Tate’s article [[Tat79](https://docs.magma-maths.org/references.md#cite-tate)] for the definitions and properties of Weil-Deligne representations, and [[Del79](https://docs.magma-maths.org/references.md#cite-deligne-rootnumber), [Tat79](https://docs.magma-maths.org/references.md#cite-tate)] for their $\epsilon$-factors.)

For a $p$-adic field $K$ with ring of integers $O$, uniformizer $\pi$, and residue field $\F_q$,

$\bullet\,\,\,$ A Frobenius element $\mathop{\rm Frob}\nolimits_K$ is an arithmetic Frobenius, i.e. acts as $x\mapsto x^q$ on the residue field (**not** $x\mapsto x^{1/q}$).

$\bullet\,\,\,$ The local reciprocity map $\theta: K^\times\to \mathop{\rm Gal}\nolimits(\bar K/K)^{ab}$ takes $\pi$ to $\mathop{\rm Frob}\nolimits_K^{-1}$ (**not** $\mathop{\rm Frob}\nolimits_K$).

$\bullet\,\,\,$ The local epsilon-factors $\epsilon(\chi)=\epsilon(\chi,\psi,dx)$ rely implicitly on the choice of a measure $dx$ on $O$ and an additive character $\psi: K\to {\mathbb{C}}$. Our choices are that $dx$ is normalized, $\int_O dx=1$, and

$$
\psi(x) = \exp\bigl(2\pi i\,\mathop{\rm Tr}\nolimits_{K/{\mathbb{Q}}_p}(x)\bigr),
$$

viewing $\mathop{\rm Tr}\nolimits_{K/{\mathbb{Q}}_p}(x)\in{\mathbb{Q}}_p$ as any rational number $a/p^n\in{\mathbb{Q}}$ in the same class mod ${\mathbb{Z}}_p$. Finally, for 1-dimensional ramified $\chi$, the formula for $\epsilon(\chi)$ is as in [[Tat79](https://docs.magma-maths.org/references.md#cite-tate), 3.2.6.2],

$$
\epsilon(\chi) = \int_{c^{-1} O^\times} \chi^{-1}(\theta(x)) \psi(x),
$$

with

$$
v_K(c)\,=\,v_K({\rm Conductor}(\chi)) + v_p({\rm Discriminant}(O,{\mathbb{Z}}_p)).
$$

$\bullet\,\,\,$ Euler factors of global Artin representations $A$ (and of Dirichlet characters) are *the same* (**not** complex conjugate) as the local ones:

`EulerFactor(A,p) = EulerFactor(GaloisRepresentation(A,p))`.

As the Artin $L$-function $L(A,s)$ is defined using arithmetic Frobenius and Galois representations using geometric Frobenius, this means that the Galois representation `GaloisRepresentation(A,p)` comes from the Galois action on the *dual* vector space of $A$.

<a id="implementation"></a>
<a id="galrep-implementation"></a>
#### Implementation Notes

Galois representations attached to Artin representations are computed using the machinery of [[DD13](https://docs.magma-maths.org/references.md#cite-ddfrob13)]. Galois representations coming from elliptic curves rely partly on the theory of reconstructing representations from their Euler factors [[DD15](https://docs.magma-maths.org/references.md#cite-ddweil15)] (see §[Example: Reconstructing a Galois Representation from its Euler Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#galrep-ex2)), and Rachel Newton’s tame local reciprocity formula [[New12](https://docs.magma-maths.org/references.md#cite-newton2012)].

<a id="creating"></a>
<a id="galrep-creating"></a>
### Creating Galois Representations

<a id="function-zerorepresentation-fldpad"></a>
#### `ZeroRepresentation(K): FldPad -> GalRep`

Galois representation $0$ over a $p$-adic field $K$. It is 0-dimensional, and $0+A=A$, $0\otimes A=0$ for every Galois representation $A$.

<a id="example-ex-153a0b"></a>
#### `Example: Zero Galois Representation (ex-153a0b)`

```magma
> K:=pAdicField(3,20);
> zero:=ZeroRepresentation(K);
> zero;
Galois representation 0 with G=C1, I=C1 over Q3[20]
> zero + CyclotomicCharacter(K) eq CyclotomicCharacter(K);
true
> zero*CyclotomicCharacter(K) eq zero;
true
```

<a id="function-principalcharacter-fldpad"></a>
#### `PrincipalCharacter(K): FldPad -> GalRep`

Principal character $1$ of the absolute Galois group of $K$, as a Galois representation. It is a 1-dimensional unramified representation, same as `UnramifiedCharacter(K,1)`. Thus $1\otimes A=1$ for every Galois representation $A$.

<a id="example-ex-48649a"></a>
#### `Example: Principal Character of a Local Field (ex-48649a)`

Take $K={\mathbb{Q}}_3$, and $F/K$ the unramified extension of degree 4, so that $G=\mathop{\rm Gal}\nolimits(F/K)\cong C_4$. The 4 irreducible representations of $G$ can be viewed as Galois representations, and the first one of these is the principal character (for any group).

```magma
> K:=pAdicField(3,20);
> one:=PrincipalCharacter(K);
> one;
1-dim trivial Galois representation 1 over Q3[20]
> F:=ext<K|4>;
> A1,A2,A3,A4:=Explode(GaloisRepresentations(F,K));
> A1 eq one;
true
```

<a id="function-cyclotomiccharacter-fldpad"></a>
#### `CyclotomicCharacter(K): FldPad -> GalRep`

Cyclotomic character over $K$. It is an unramified character (trivial on inertia) and takes the value $q$, the size of the residue field of $K$, on any Frobenius element.

<a id="example-ex-4a5d9f"></a>
#### `Example: Cyclotomic Character (ex-4a5d9f)`

```magma
> K:=pAdicField(3,20);
> chi:=CyclotomicCharacter(K);
> chi,EulerFactor(chi);
1-dim unramified Galois representation Unr(1/3) over Q3[20]
-1/3*x + 1
> chi^3,EulerFactor(chi^3);
1-dim unramified Galois representation Unr(1/27) over Q3[20]
-1/27*x + 1
```

<a id="function-unramifiedcharacter-fldpad-any"></a>
#### `UnramifiedCharacter(K, c): FldPad, Any -> GalRep`

Galois representation over $K$ given by an unramified character that sends the arithmetic Frobenius element $\mathop{\rm Frob}\nolimits_K\mapsto c^{-1}$ (and, so, the geometric Frobenius element $\mathop{\rm Frob}\nolimits_K^{-1}\mapsto c$.) The parameter $c$ must be a non-zero complex number.

<a id="example-ex-6bab13"></a>
#### `Example: Unramified Characters (ex-6bab13)`

```magma
> K:=pAdicField(3,20);
> assert UnramifiedCharacter(K,1) eq PrincipalCharacter(K);
> assert UnramifiedCharacter(K,1/3) eq CyclotomicCharacter(K);
> C<i>:=ComplexField();
> UnramifiedCharacter(K,2+i);
1-dim unramified Galois representation Unr(2+i) over Q3[20]
```

<a id="function-unramifiedrepresentation-fldpad-rngupolelt"></a>
#### `UnramifiedRepresentation(K, CharPoly): FldPad, RngUPolElt -> GalRep`

Unique unramified Galois representation $\rho$ over $K$ with Euler factor $\det(1-\mathop{\rm Frob}\nolimits_K^{-1}|\rho)={\rm CharPoly}$.

<a id="example-ex-b1231d"></a>
#### `Example: Unramified Galois Representations (ex-b1231d)`

```magma
> K:=pAdicField(37,20);
> R<x>:=PolynomialRing(Rationals());
> rho:=UnramifiedRepresentation(K,(1-37*x)*(1-3*x));
> rho;
2-dim unramified Galois representation Unr(1-40*x+111*x^2) over Q37[20]
> rho eq CyclotomicCharacter(K)^(-1)+UnramifiedCharacter(K,3);
true
```

<a id="function-unramifiedrepresentation-fldpad-rngintelt-rngintelt-rngupolelt"></a>
#### `UnramifiedRepresentation(K, dim, dimcomputed, CharPoly): FldPad, RngIntElt, RngIntElt, RngUPolElt -> GalRep`

Unramified Galois representation over $K$ of dimension *dim*, with Euler factor *CharPoly* computed up to and inclusive degree *dimcomputed*.

<a id="example-ex-f653e8"></a>
#### `Example: Representations Not Fully Computed (ex-f653e8)`

Consider the hyperelliptic curve $C: y^2=x^5+x+1$ over the $p$-adic field ${\mathbb{Q}}_{10007}$.

```magma
> _<x>:=PolynomialRing(Rationals());
> p:=10007;
> K:=pAdicField(p,20);
> _<X>:=PolynomialRing(K);
> C:=HyperellipticCurve(X^5+X+1); C;
Hyperelliptic Curve defined by y^2 = x^5 + O(10007^20)*x^4 + O(10007^20)*x^3 +
   O(10007^20)*x^2 + x + 1 + O(10007^20) over pAdicField(10007, 20)
```

The Galois representation $A$ associated to $H^1(C)$ is unramified, of dimension 4, and could be defined by

`UnramifiedRepresentation(K,1-ap*x+bp*x^2-p*ap+p^2);`

if we find $a_p$ and $b_p$ by counting points of $C$ over ${\mathbb{F}}_p$ and ${\mathbb{F}}_{p^2}$. The coefficient $a_p$ can be computed very quickly:

```magma
> k:=ResidueClassField(Integers(K));
> _<X>:=PolynomialRing(k);
> Ck:=HyperellipticCurve(X^5+X+1);
> ap:=p+1-#Ck; ap;
-21
```

However, $b_p$ would take a long time. If we are only interested in working with $A$ up to degree 1 (e.g. to compute $L$-series of $C/{\mathbb{Q}}$ with $<10^8$ terms), there is no reason to compute it. Instead, we can define an unramified Galois representation of degree 4, which is known to be computed only up to degree 1:

```magma
> A:=UnramifiedRepresentation(K,4,1,1-ap*x);
> A;
4-dim unramified Galois representation Unr(1+21*x+O(x^2)) over Q10007[20]
```

One can still take direct sums, and tensor products of such representations with (possibly ramified) Galois representations, and the Euler factors will still be correct up to degree 1:

```magma
> A*A;
16-dim unramified Galois representation Unr(1-441*x+O(x^2)) over Q10007[20]
> EulerFactor(A*A+1/CyclotomicCharacter(K));
-10448*x + 1
```

<a id="function-sp-fldpad-rngintelt"></a>
#### `SP(K, n): FldPad, RngIntElt -> GalRep`

The $n$-dimensional indecomposable Galois representation `SP(n)` over a $p$-adic field $K$; see §[Notation and Printing](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#galrep-printing) for its description.

<a id="example-ex-8d3d78"></a>
#### `Example: Special Galois Representations (ex-8d3d78)`

```magma
> K:=pAdicField(3,20);
> SP(K,1) eq PrincipalCharacter(K);
true
> rho:=SP(K,2); rho;
2-dim Galois representation SP(2) over Q3[20]
> Degree(rho);
2
> Semisimplification(rho);
2-dim unramified Galois representation Unr(1-4/3*x+1/3*x^2) over Q3[20]
> $1 eq PrincipalCharacter(K)+CyclotomicCharacter(K);
true
> InertiaInvariants(rho);
1-dim unramified Galois representation Unr(1/3) over Q3[20]
> EulerFactor(rho);
-1/3*x + 1
```

<a id="function-sp-fldpad-rngupolelt-rngintelt"></a>
#### `SP(K, f, n): FldPad, RngUPolElt, RngIntElt -> GalRep`

Unramified twist $\psi\otimes{\hbox{\tt SP}(n)}$ over a $p$-adic field $K$, with $\psi$ specified by its Euler factor $f$.

<a id="example-ex-3bd7e7"></a>
#### `Example: Twisted Special Representations (ex-3bd7e7)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(Rationals());
> SP(K,1-x^2,2);
4-dim Galois representation Unr(1-x^2)*SP(2) over Q2[20]
> $1*$1;     // Tensor product with itself
16-dim Galois representation Unr(1-1/2*x^2+1/16*x^4) + Unr(1-2*x^2+x^4)*SP(3)
   over Q2[20]
```

<a id="finiteg"></a>
<a id="galrep-finiteg"></a>
#### Representations from Finite Extensions

<a id="function-galoisrepresentations-fldpad-fldpad"></a>
##### `GaloisRepresentations(F, K): FldPad, FldPad -> SeqEnum[GalRep]`

For a $p$-adic extension $F/K$, compute all irreducible Galois representations that factor through the (Galois closure of) $F/K$.

<a id="example-ex-314f0e"></a>
##### `Example: Irreducible Characters of a Dihedral Extension (ex-314f0e)`

We take $F$ to be a degree 16 dihedral extension of $K={\mathbb{Q}}_2$, and compute the irreducible characters of $\mathop{\rm Gal}\nolimits(F/K)$, viewed as Galois representations over $K$.

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> F:=ext<K|x^8+2>;
> list:=GaloisRepresentations(F,K);
> list;
[
1-dim trivial Galois representation 1 over Q2[20],
1-dim Galois representation (1,1,-1,-1,1,1,1) with G=D8, I=D8, conductor 2^2
   over Q2[20],
1-dim Galois representation (1,1,-1,1,1,-1,-1) with G=D8, I=D8, conductor 2^3
   over Q2[20],
1-dim Galois representation (1,1,1,-1,1,-1,-1) with G=D8, I=D8, conductor 2^3
   over Q2[20],
2-dim Galois representation (2,2,0,0,-2,0,0) with G=D8, I=D8, conductor 2^8
   over Q2[20],
2-dim Galois representation (2,-2,0,0,0,-zeta(8)_8^3+zeta(8)_8,
   zeta(8)_8^3-zeta(8)_8) with G=D8, I=D8, conductor 2^10 over Q2[20],
2-dim Galois representation (2,-2,0,0,0,zeta(8)_8^3-zeta(8)_8,
   -zeta(8)_8^3+zeta(8)_8) with G=D8, I=D8, conductor 2^10 over Q2[20]
]
```

The first 5 characters are not faithful, and we can descend them to smaller quotients of $\mathop{\rm Gal}\nolimits(F/K)$.

```magma
> min:=[Minimize(rho): rho in list | not IsFaithful(Character(rho))];
> min;
[
1-dim trivial Galois representation 1 over Q2[20],
1-dim Galois representation (1,-1) with G=C2, I=C2, conductor 2^2 over Q2[20],
1-dim Galois representation (1,-1) with G=C2, I=C2, conductor 2^3 over Q2[20],
1-dim Galois representation (1,-1) with G=C2, I=C2, conductor 2^3 over Q2[20],
2-dim Galois representation (2,-2,0,0,0) with G=D4, I=D4, conductor 2^8
   over Q2[20]
]
```

<a id="function-galoisrepresentations-rngupoleltfldpad"></a>
##### `GaloisRepresentations(f): RngUPolEltFldPad -> SeqEnum[GalRep]`

For a polynomial $f$ over a $p$-adic field $K$ and splitting field $F$, returns irreducible representations of $\mathop{\rm Gal}\nolimits(F/K)$.

<a id="example-ex-da3085"></a>
##### `Example: One-Dimensional Characters of a Cyclotomic Extension (ex-da3085)`

We construct 4 one-dimensional characters of ${\mathbb{Q}}_2(\zeta_8)/{\mathbb{Q}}_2$.

```magma
> K:=pAdicField(2,20);
> R:=PolynomialRing(K);
> GaloisRepresentations(R!CyclotomicPolynomial(8));
[
1-dim trivial Galois representation 1 over Q2[20],
1-dim Galois representation (1,-1,1,-1) with G=C2^2, I=C2^2, conductor 2^3
   over Q2[20],
1-dim Galois representation (1,1,-1,-1) with G=C2^2, I=C2^2, conductor 2^2
   over Q2[20],
1-dim Galois representation (1,-1,-1,1) with G=C2^2, I=C2^2, conductor 2^3
   over Q2[20]
]
```

<a id="function-permutationcharacter-fldpad-fldpad"></a>
##### `PermutationCharacter(F, K): FldPad, FldPad -> GalRep`

For a $p$-adic extension $F/K$, compute ${\mathbb{C}}[\mathop{\rm Gal}\nolimits(\bar{K}/K)/\mathop{\rm Gal}\nolimits(\bar{K}/F)]$ as a Galois representation over $K$ of degree $[F:K]$.

<a id="example-ex-ba722b"></a>
##### `Example: Permutation Character of a Cubic Extension (ex-ba722b)`

Take $K={\mathbb{Q}}_2$ and $F={\mathbb{Q}}_2(\root 3 \of 2)$. Then `PermutationCharacter(F,K)` is a 3-dimensional representation which is the trivial representation plus a 2-dimensional irreducible one.

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> F:=ext<K|x^3-2>;
> PermutationCharacter(F,K);
3-dim Galois representation (3,1,0) with G=S3, I=C3, conductor 2^2 over Q2[20]
> $1 - PrincipalCharacter(K);
2-dim Galois representation (2,0,-1) with G=S3, I=C3, conductor 2^2 over Q2[20]
```

<a id="operation-op-galrep-algchtrelt"></a>
##### `A !! chi: GalRep, AlgChtrElt -> GalRep`

<a id="operation-op-galrep-seqenum"></a>
##### `A !! chi: GalRep, SeqEnum -> GalRep`

Change a Galois representation by a finite representation with character $\chi$, which must be a character of `Group(A)`, or a list of values that determine such a character.

<a id="example-ex-b9793f"></a>
##### `Example: Replacing the Character of a Representation (ex-b9793f)`

Take $K={\mathbb{Q}}_2$ and $F={\mathbb{Q}}_2(\root 3 \of 2)$, so that $G=\mathop{\rm Gal}\nolimits(F/K)\cong S_3$. Using `!!` we can start with any Galois representation whose finite part comes from this Galois group, and replace it by any other character of $G$.

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> F:=ext<K|x^3-2>;
> rho:=PermutationCharacter(F,K);
> rho!![1,1,1];
1-dim trivial Galois representation 1 over Q2[20]
> rho!![6,0,0];
6-dim Galois representation (6,0,0) with G=S3, I=C3, conductor 2^4 over Q2[20]
> rho!![0,0,0];   // but not [-1,0,0] - may not be virtual
Galois representation 0 with G=S3, I=C3 over Q2[20]
```

<a id="artinetc"></a>
<a id="galrep-artinetc"></a>
#### Local Representations of Global Objects

<a id="function-galoisrepresentation-grpdrchelt-rngintelt"></a>
##### `GaloisRepresentation(chi, p): GrpDrchElt, RngIntElt -> GalRep`

```magma
Precision: RngIntElt                    Default: 40
```

Local Galois representation at $p$ of a Dirichlet character $\chi$.

<a id="example-ex-a9f044"></a>
##### `Example: Local Components of a Dirichlet Character (ex-a9f044)`

Local components of a Dirichet character $\chi$ of order 6 at $p=2,3,7$.

```magma
> G<chi>:=FullDirichletGroup(7);
> GaloisRepresentation(chi,2);
1-dim unramified Galois representation (1,-zeta(3)_3-1,zeta(3)_3)
   with G=C3, I=C1 over Q2[40]
> GaloisRepresentation(chi,3);
1-dim unramified Galois representation (1,-1,-zeta(3)_3-1,zeta(3)_3,-zeta(3)_3,
   zeta(3)_3+1) with G=C6, I=C1 over Q3[40]
> GaloisRepresentation(chi,7);
1-dim Galois representation (1,-1,-zeta(3)_3-1,zeta(3)_3,-zeta(3)_3,zeta(3)_3+1)
   with G=C6, I=C6, conductor 7^1 over Q7[40]
```

By our convention, the character $\chi$, the associated Artin representation, and the Galois representations associated to them all have the same Euler factors.

```magma
> loc1:=EulerFactor(chi,2);
> loc2:=EulerFactor(ArtinRepresentation(chi),2);
> loc3:=EulerFactor(GaloisRepresentation(chi,2));
> loc4:=EulerFactor(GaloisRepresentation(ArtinRepresentation(chi),2));
> [PolynomialRing(ComplexField(5))| loc1,loc2,loc3,loc4];
[
(0.50000 - 0.86603*$.1)*$.1 + 1.0000,
(0.50000 - 0.86603*$.1)*$.1 + 1.0000,
(0.50000 - 0.86603*$.1)*$.1 + 1.0000,
(0.50000 - 0.86603*$.1)*$.1 + 1.0000
]
```

<a id="function-galoisrepresentation-artrep-rngintelt"></a>
##### `GaloisRepresentation(A, p): ArtRep, RngIntElt -> GalRep`

```magma
Precision: RngIntElt                    Default: 40
Minimize : BoolElt                      Default: false
```

Local Galois representation at $p$ of an Artin representation $A$. This is the representation of a decomposition group at $p$ of $\mathop{\rm Gal}\nolimits(\bar {\mathbb{Q}}/{\mathbb{Q}})$ on the *dual* vector space of $A$. (The reason for the dual is that, by our convention, the global and the local Euler factors agree; see §[Conventions](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#galrep-conventions) and Example [Local Components of a Dirichlet Character](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-a9f044).) If `Minimize` is `true`, choose the field through which it factors to be as small as possible (automatic for faithful representations).

<a id="example-ex-e01700"></a>
##### `Example: Local Components of an Artin Representation (ex-e01700)`

Local components of an Artin representation. We take the Trinks’ polynomial $x^7-7x-3$ with Galois group $\PSL(2,7)$ over $\Q$, one of its 7-dimensional representations $A$ of conductor $3^87^8$, and compute its local components over $\Q_2$, $\Q_3$, $\Q_5$, and $\Q_7$.

```magma
> R<x>:=PolynomialRing(Rationals());
> K:=NumberField(x^7-7*x-3);
> GroupName(GaloisGroup(K));
PSL(2,7)
> A:=ArtinRepresentations(K)[5];
> GaloisRepresentation(A,2);
7-dim unramified Galois representation (7,0,0,0,0,0,0) with G=C7, I=C1
   over Q2[40]
> GaloisRepresentation(A,3);
7-dim Galois representation (7,-1,1) with G=S3, I=S3, conductor 3^8 over Q3[40]
> GaloisRepresentation(A,5);
7-dim unramified Galois representation (7,0,0,0,0,0,0) with G=C7, I=C1
   over Q5[40]
> GaloisRepresentation(A,7);
7-dim Galois representation (7,1,1,0,0) with G=C7:C3, I=C7:C3, conductor 7^8
   over Q7[40]
> Conductor(A) eq 3^8*7^8;
true
```

<a id="function-galoisrepresentation-crvell"></a>
##### `GaloisRepresentation(E): CrvEll -> GalRep`

```magma
Minimize: BoolElt                    Default: true
```

Local Galois representation of (the first $l$-adic étale cohomology group of) an elliptic curve over a $p$-adic field. If `Minimize` is `true` (default), choose the field through which it factors to be as small as possible.

<a id="example-ex-29c470"></a>
##### `Example: Galois Representation of a Local Elliptic Curve (ex-29c470)`

Take an elliptic curve $E/{\mathbb{Q}}_5$, with additive (potentially good) reduction of type II.

```magma
> K:=pAdicField(5,20);
> E:=EllipticCurve([K|0,5]);
> E;
Elliptic Curve defined by y^2 = x^3 + O(5^20)*x + (5 + O(5^21))
   over pAdicField(5, 20)
> loc:=LocalInformation(E); loc;
<5 + O(5^21), 2, 2, 1, II, true>
```

Its Galois representation is an unramified twist of a representation with finite image that factors through the dihedral extension ${\mathbb{Q}}_5(\zeta_6,{\root 6\of 5})$ of ${\mathbb{Q}}_5$.

```magma
> A:=GaloisRepresentation(E); A;
2-dim Galois representation Unr(sqrt(5)*i)*(2,-2,0,0,-1,1) with G=D6, I=C6,
   conductor 5^2 over Q5[20]
> Field(A);
Totally ramified extension defined by the polynomial x^6 - 5
 over Unramified extension defined by the polynomial x^2 + 4*x + 2
 over 5-adic field mod 5^20
```

<a id="function-galoisrepresentation-crvell-rngintelt"></a>
##### `GaloisRepresentation(E, p): CrvEll, RngIntElt -> GalRep`

```magma
Precision: RngIntElt                    Default: 40
Minimize : BoolElt                      Default: true
```

Local Galois representation of (the first $l$-adic étale cohomology group of) an elliptic curve over ${\mathbb{Q}}$ at $p$. If `Minimize` is `true` (default), choose the field through which it factors to be as small as possible.

<a id="example-ex-94d575"></a>
##### `Example: Elliptic Curve 20a1 at Several Primes (ex-94d575)`

We take the elliptic curve 20a1 over ${\mathbb{Q}}$ and compute its local Galois representation at a prime $p=3$ of good reduction, $p=5$ of (non-split) multiplicative reduction and $p=2$ of additive reduction.

```magma
> E:=EllipticCurve("20a1");
> GaloisRepresentation(E,3);
2-dim unramified Galois representation Unr(1+2*x+3*x^2) over Q3[40]
> GaloisRepresentation(E,5);
2-dim Galois representation Unr(-5)*SP(2) over Q5[40]
> GaloisRepresentation(E,2);
2-dim Galois representation Unr(sqrt(2)*i)*(2,0,-1) with G=S3, I=C3, conductor
   2^2 over Q2[40]
> EulerFactor($3),EulerFactor($2),EulerFactor($1);
3*x^2 + 2*x + 1
x + 1
1
```

<a id="function-galoisrepresentation-crvell-rngordidl"></a>
##### `GaloisRepresentation(E, P): CrvEll, RngOrdIdl -> GalRep`

```magma
Precision: RngIntElt                    Default: 40
Minimize : BoolElt                      Default: true
```

Local Galois representation of (the first $l$-adic étale cohomology group of) an elliptic curve $E$ over a number field $F$ at a given prime ideal $P$. If `Minimize` is `true` (default), choose the field through which it factors to be as small as possible.

<a id="example-ex-f7aec3"></a>
##### `Example: Elliptic Curve over a Cyclotomic Field (ex-f7aec3)`

```magma
> K:=CyclotomicField(5);
> E:=BaseChange(EllipticCurve("75a1"),K);
> P:=Ideal(Decomposition(K,5)[1,1]);
> GaloisRepresentation(E,P);
2-dim Galois representation Unr(sqrt(5)*i)*(2,0,-1) with G=S3, I=C3, conductor
   pi^2 over ext<Q5[10]|x^4-15*x^3-40*x^2-90*x-45>
```

<a id="function-galoisrepresentation-crvhyp-fldpad"></a>
##### `GaloisRepresentation(C): CrvHyp[FldPad] -> GalRep`

```magma
Degree  : RngIntElt                    Default: Infinity()
Minimize: BoolElt                      Default: false
```

Galois representation associated to ($H^1$ of) a hyperelliptic curve $C$ over a $p$-adic field. `Degree` specifies that Euler factors of unramified pieces should only be computed up to that degree. (See Example [Representations Not Fully Computed](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-f653e8).) Setting `Minimize:=true` forces the representation to be minimized. (See [`Minimize`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-minimize).)

<a id="example-ex-1fdb67"></a>
##### `Example: Hyperelliptic Curve over a p-adic Field (ex-1fdb67)`

We take a curve $C$ over $K={\mathbb{Q}}_{23}$ of conductor $23^2$ and compute its Galois representation.

```magma
> K:=pAdicField(23,20);
> R<x>:=PolynomialRing(K);
> C:=HyperellipticCurve(-x,x^3+x^2+1);    // genus 2, conductor 23^2
> A:=GaloisRepresentation(C); A;
4-dim Galois representation Unr(1-46*x+529*x^2)*SP(2) over Q23[20]
```

If $F/K$ is a finite extension, then the base change of $A$ to $F$ is the same as the Galois representation of $C/F$:

```magma
> F:=ext<K|2>;
> BaseChange(A,F);
4-dim Galois representation Unr(1-1058*x+279841*x^2)*SP(2) over ext<Q23[20]|2>
> GaloisRepresentation(BaseChange(C,F));
4-dim Galois representation Unr(1-1058*x+279841*x^2)*SP(2) over ext<Q23[20]|2>
```

<a id="function-galoisrepresentation-crvhyp-fldrat-rngintelt"></a>
##### `GaloisRepresentation(C, p): CrvHyp[FldRat], RngIntElt -> GalRep`

```magma
Degree  : RngIntElt                    Default: Infinity()
Minimize: BoolElt                      Default: false
```

Galois representation associated to ($H^1$ of) a hyperelliptic curve $C/{\mathbb{Q}}$ at $p$. `Degree` specifies that Euler factors of unramified pieces should only be computed up to that degree. (See Example [Representations Not Fully Computed](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-f653e8).) Setting `Minimize:=true` forces the representation to be minimized. (See [`Minimize`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-minimize).)

<a id="example-ex-1f2ef0"></a>
##### `Example: Hyperelliptic Curve over the Rationals (ex-1f2ef0)`

```magma
> R<x>:=PolynomialRing(Rationals());
> C:=HyperellipticCurve((x^2+5)*(x+1)*(x+2)*(x+3));
> GaloisRepresentation(C,5);   // bad reduction
4-dim Galois representation Unr(1+2*x+5*x^2) + Unr(5)*SP(2) over Q5[20]
> GaloisRepresentation(C,11);  // good reduction
4-dim unramified Galois representation Unr(1-2*x+6*x^2-22*x^3+121*x^4)
   over Q11[5]
> GaloisRepresentation(C,997: Degree:=1);  // don't count pts over GF(997^2)
4-dim unramified Galois representation Unr(1+26*x+O(x^2)) over Q997[5]
```

<a id="function-galoisrepresentation-crvhyp-fldnum-rngordidl"></a>
##### `GaloisRepresentation(C, P): CrvHyp[FldNum], RngOrdIdl -> GalRep`

```magma
Degree  : RngIntElt                    Default: Infinity()
Minimize: BoolElt                      Default: false
```

Galois representation associated to ($H^1$ of) a hyperelliptic curve $C$ over a number field at a prime ideal $P$. `Degree` specifies that Euler factors of unramified pieces should only be computed up to that degree. (See Example [Representations Not Fully Computed](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/creating.md#example-ex-f653e8).) Setting `Minimize:=true` forces the representation to be minimized. (See [`Minimize`](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields.md#function-minimize).)

<a id="example-ex-e4e4fd"></a>
##### `Example: Hyperelliptic Curve over a Cyclotomic Field (ex-e4e4fd)`

We take a curve of genus 4 over ${\mathbb{Q}}(\zeta_{11})$ and compute its Galois representation at a unique prime $P$ above 11.

```magma
> K<zeta>:=CyclotomicField(11);
> R<x>:=PolynomialRing(K);
> C:=HyperellipticCurve(x^9+x^2+(zeta-1));
> P:=Ideal(Decomposition(K,11)[1,1]);
> GaloisRepresentation(C,P);
8-dim Galois representation Unr(1-44*x^3+1331*x^6) + Unr(11)*SP(2)
   over ext<Q11[2]|x^10+22*x^9+55*x^8+44*x^7-33*x^6-22*x^5-22*x^4-33*x^3+44*x^2+
   55*x+11>
```

<a id="function-galoisrepresentation-modfrmelt-rngintelt"></a>
##### `GaloisRepresentation(f, p): ModFrmElt, RngIntElt -> GalRep`

```magma
Precision: RngIntElt                    Default: 40
```

Local Galois representation at $p$ of a modular form $f$. Currently only implemented when $p^2$ does not divide the level.

<a id="example-ex-e7791f"></a>
##### `Example: Local Representations of a Modular Form (ex-e7791f)`

We take a rational modular form of weight 4 and level 5, and compute its Galois representations at $p=3$ (unramified principal series) and $p=5$ (Steinberg).

```magma
> f:=Newforms("5k4")[1,1];
> GaloisRepresentation(f,3);
2-dim unramified Galois representation Unr(1-2*x+27*x^2) over Q3[40]
> GaloisRepresentation(f,5);
2-dim Galois representation Unr(-25)*SP(2) over Q5[40]
```

<a id="invariants"></a>
<a id="galrep-invariants"></a>
### Basic Invariants

<a id="function-basefield-galrep"></a>
#### `BaseField(A): GalRep -> FldPad`

The base field $K$ of the Galois representation $A: \mathop{\rm Gal}\nolimits(\bar K/K)\to\mathop{\rm GL}\nolimits_m({\mathbb{C}})$.

<a id="function-degree-galrep"></a>
#### `Degree(A): GalRep -> RngIntElt`

<a id="function-dimension-galrep"></a>
#### `Dimension(A): GalRep -> RngIntElt`

Degree ($=$dimension) $m$ of a Galois representation $A: \mathop{\rm Gal}\nolimits(\bar K/K)\to\mathop{\rm GL}\nolimits_m({\mathbb{C}})$

<a id="example-ex-890f18"></a>
#### `Example: Degree and Base Field of Representations (ex-890f18)`

```magma
> K:=pAdicField(3,20);
> R<x>:=PolynomialRing(K);
> F:=ext<K|x^3-3>;
> list:=GaloisRepresentations(F,K);
> forall{A: A in list | BaseField(A) eq K};
true
> [Degree(A): A in list];
[ 1, 1, 2 ]
```

<a id="function-group-galrep"></a>
#### `Group(A): GalRep -> GrpPerm`

<a id="function-galoisgroup-galrep"></a>
#### `GaloisGroup(A): GalRep -> GrpPerm`

Finite Galois group $\mathop{\rm Gal}\nolimits(F/K)$ that computes the finite part of a Galois representation, where $F$ is `Field(A)` and $K$ is `BaseField(A)`.

<a id="example-ex-baedd9"></a>
#### `Example: Galois and Inertia Groups of Representations (ex-baedd9)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> list1:=[PrincipalCharacter(K),CyclotomicCharacter(K),SP(K,3)];
> [Degree(A): A in list1];
[ 1, 1, 3 ]
> [GroupName(Group(A)): A in list1];
[ C1, C1, C1 ]
> list2:=GaloisRepresentations(x^4-2);
> [Degree(A): A in list2];
[ 1, 1, 1, 1, 2 ]
> [GroupName(Group(A)): A in list2];
[ D4, D4, D4, D4, D4 ]
> list1[1] eq list2[1];
true
```

<a id="function-frobeniuselement-galrep"></a>
#### `FrobeniusElement(A): GalRep -> GrpPermElt`

An arithmetic Frobenius element of `Group(A)` for a Galois representation $A$.

<a id="example-ex-abc80d"></a>
#### `Example: Frobenius Element of an Unramified Extension (ex-abc80d)`

Take $K={\mathbb{Q}}_2$ and $F={\mathbb{Q}}_2(\zeta_5)$, a degree 4 unramified extension of $K$. A Frobenius element $\mathop{\rm Frob}\nolimits\in\mathop{\rm Gal}\nolimits(F/K)$ is characterized by the property that $\mathop{\rm Frob}\nolimits(x)\equiv x^q\ \mathop{\rm mod}\ m_F$. In this example, $q=2$ (size of the residue field of $K$).

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> A:=GaloisRepresentations(x^4+x^3+x^2+x+1)[4]; A;
1-dim unramified Galois representation (1,-1,-zeta(4)_4,zeta(4)_4)
   with G=C4, I=C1 over Q2[20]
> frob:=FrobeniusElement(A); frob;
(1, 2, 4, 3)
> F<u>:=Field(A);
> Valuation(Automorphism(A,frob)(u)-u^2) gt 0;
true
```

<a id="function-character-galrep"></a>
#### `Character(A): GalRep -> AlgChtrElt`

Character of the finite part of a Galois representation $A$. For this to be well-defined, $A$ must have only one component (and not several components with different characters).

<a id="example-ex-ce7d20"></a>
#### `Example: Character of a Galois Representation (ex-ce7d20)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> A1:=PrincipalCharacter(K);
> Character(A1);
( 1 )
> A2:=CyclotomicCharacter(K);
> Character(A2);
( 1 )
> A3:=PermutationCharacter(ext<K|3>,K);
> Character(A3);
( 3, 0, 0 )
> A1+A2+A3;
5-dim unramified Galois representation Unr(1-3/2*x+1/2*x^2) + (3,0,0)
   with G=C3, I=C1 over Q2[20]
```

<a id="function-field-galrep"></a>
#### `Field(A): GalRep -> FldPad`

Given a Galois representation $A$, return the $p$-adic field $F$ such that the finite part of $A$ factors through $\mathop{\rm Gal}\nolimits(F/K)$, $K =$ `BaseField(A)`.

<a id="function-definingpolynomial-galrep"></a>
#### `DefiningPolynomial(A): GalRep -> RngUPolElt`

For a Galois representation $A$ over $K$, returns a polynomial over $K$ whose splitting field is $F=$`Field(A)`. The Galois group $\mathop{\rm Gal}\nolimits(F/K)$ is represented as a permutation group `Group(A)` on the roots of this polynomial.

<a id="example-ex-216918"></a>
#### `Example: Defining Polynomial of a Representation (ex-216918)`

In this example $K={\mathbb{Q}}_5$ and $F/K$ is a dihedral extension of degree 12, represented as a splitting field of a degree 6 polynomial.

```magma
> K:=pAdicField(5,20);
> E:=EllipticCurve([K|0,5]);
> A:=GaloisRepresentation(E); A;
2-dim Galois representation Unr(sqrt(5)*i)*(2,-2,0,0,-1,1) with G=D6, I=C6,
   conductor 5^2 over Q5[20]
> Field(A);
Totally ramified extension defined by the polynomial x^6 - 5
 over Unramified extension defined by the polynomial x^2 + 4*x + 2
 over 5-adic field mod 5^20
> DefiningPolynomial(A);
x^6 + O(5^20)*x^5 + O(5^20)*x^4 + O(5^20)*x^3 + O(5^20)*x^2 + O(5^20)*x - 5 +
   O(5^20)
```

<a id="function-automorphism-galrep-grppermelt"></a>
#### `Automorphism(A, g): GalRep, GrpPermElt -> Map`

The automorphism of `Field(A)`$/$`BaseField(A)` given by $g$.

<a id="example-ex-3bde84"></a>
#### `Example: Field and Automorphisms of a Representation (ex-3bde84)`

In this example $K={\mathbb{Q}}_5$ and $F/K$ is a dihedral extension of degree 12, represented as a splitting field of the polynomial $x^6-5$.

```magma
> R<x>:=PolynomialRing(Rationals());
> K:=NumberField(x^6-5);
> a:=ArtinRepresentations(K)[6];
> A:=GaloisRepresentation(a,5); A;
2-dim Galois representation (2,-2,0,0,-1,1) with G=D6, I=C6, conductor 5^2
   over Q5[40]
> F:=Field(A); F;
Totally ramified extension defined by the polynomial x^6 - 5
 over Unramified extension defined by the polynomial x^2 + 4*x + 2
 over 5-adic field mod 5^40
> DefiningPolynomial(A);
x^6 - 5
```

The 12 elements $\sigma\in\mathop{\rm Gal}\nolimits(F/K)\cong D_6$ act on $\pi=\root 6 \of 5$ by multiplying it by 6th roots of unity, with $\sigma(\pi)=\pi$ for 2 of them, and $v(\sigma(\pi)-\pi)=1$ for the other 10.

```magma
> pi:=UniformizingElement(F);
> autF:=[* Automorphism(A,g): g in Group(A) *];
> [Valuation(sigma(pi)-pi): sigma in autF];
[ 241, 1, 1, 1, 1, 1, 240, 1, 1, 1, 1, 1 ]
```

<a id="function-eulerfactor-galrep"></a>
#### `EulerFactor(A): GalRep -> RngUPolElt`

```magma
R: Rng                    Default: 
```

Euler factor (=local polynomial) of a Galois representation $A$ over a $p$-adic field $K$. It is defined by

$$
P(T) = \det (1-\mathop{\rm Frob}\nolimits_K^{-1}T|A^{I_K}),
$$

and has degree `Dimension(A)` if and only if $A$ is unramified. The coefficient ring of $P$ (rational/complex/cyclotomic field) may be specified with the optional parameter $R$.

<a id="example-ex-641625"></a>
#### `Example: Euler Factors of Galois Representations (ex-641625)`

```magma
> G<chi>:=DirichletGroup(5);
> A:=GaloisRepresentation(chi,2);
> EulerFactor(A);
x + 1
> A:=GaloisRepresentation(chi,5);
> EulerFactor(A);
1
```

<a id="function-iszero-galrep"></a>
#### `IsZero(A): GalRep -> BoolElt`

Return `true` if $A$ is the Galois representation $0$.

<a id="function-isone-galrep"></a>
#### `IsOne(A): GalRep -> BoolElt`

Return `true` if $A$ is the trivial $1$-dimensional Galois representation.

<a id="function-factorization-galrep"></a>
#### `Factorization(A): GalRep -> List, GalRep`

Returns the list of tuples $\langle\chi_i$,$n_i$,$\rho_i\rangle$, where $A$ is the direct sum over $i$ of twists by ${\tt SP}(n_i)$ by unramified representations with Euler factor $\chi_i$, and a finite Weil representation given by a character $\rho_i$ of `Group(A)`.

<a id="example-ex-d8fc15"></a>
#### `Example: Factorization of a Galois Representation (ex-d8fc15)`

```magma
> R<x>:=PolynomialRing(ComplexField());    // prettier print for complex polys
> K:=pAdicField(2,20);
> S:=SP(K,2);
> S; Factorization(S);
2-dim Galois representation SP(2) over Q2[20]
[*
<-x + 1, 2, ( 1 )>
*]
> A:=Semisimplification(S);
> A; Factorization(A);
2-dim unramified Galois representation Unr(1-3/2*x+1/2*x^2) over Q2[20]
[*
<1/2*x^2 - 3/2*x + 1, 1, ( 1 )>
*]
> [Factorization(I)[1]: I in Decomposition(A)];
[ <-x + 1, 1, ( 1 )>, <-1/2*x + 1, 1, ( 1 )> ]
```

<a id="galrep-ramification"></a>
<a id="id1"></a>
#### Ramification

<a id="function-inertiagroup-galrep"></a>
##### `InertiaGroup(A): GalRep -> GrpPerm`

For a Galois representation $A$ over a $p$-adic field $K$ this is the image of inertia $I_K\subset\mathop{\rm Gal}\nolimits(\bar K/K)$ under the semisimplification of $A$. Equivalently, if

$$
A = \psi \otimes\hbox{\tt SP}(n) \otimes R,
$$

as in §[Notation and Printing](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/overview.md#galrep-printing), with $\psi$ unramified and $R$ a representation of a finite Galois group $\mathop{\rm Gal}\nolimits(F/K)$, this is the image of the inertia subgroup of $\mathop{\rm Gal}\nolimits(F/K)$ under $R$. If $F$ is chosen to be minimal possible (so that $R$ is faithful), then `InertiaGroup(A)` simply *is* the inertia subgroup of $\mathop{\rm Gal}\nolimits(F/K)$.

<a id="example-ex-e156fa"></a>
##### `Example: Inertia Groups of Irreducible Representations (ex-e156fa)`

Take $K={\mathbb{Q}}_3$ and $F=K(\zeta_6,\root 6\of 3)$, a $D_6$-extension of $K$. For each of the 6 irreducible representations of $\mathop{\rm Gal}\nolimits(F/K)$ we compute their inertia (=ramification) groups:

```magma
> K:=pAdicField(3,20);
> R<x>:=PolynomialRing(K);
> list:=GaloisRepresentations(x^6-3);
> [GroupName(InertiaGroup(A)): A in list];
[ C1, C2, C1, C2, S3, S3 ]
```

<a id="function-inertiagroup-galrep-rngintelt"></a>
##### `InertiaGroup(A, n): GalRep, RngIntElt -> GrpPerm`

The $n$th (lower) ramification subgroup of `InertiaGroup(A)`.

<a id="example-ex-92ac63"></a>
##### `Example: Higher Ramification Groups (ex-92ac63)`

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> list:=GaloisRepresentations(x^8-2);
> a:=list[#list]; a;
2-dim Galois representation (2,-2,0,0,0,zeta(8)_8^3+zeta(8)_8,
   -zeta(8)_8^3-zeta(8)_8) with G=SD16, I=SD16, conductor 2^10 over Q2[20]
> [GroupName(InertiaGroup(a,n)): n in [1..17]];
[ SD16, SD16, C8, C8, C4, C4, C4, C4, C2, C2, C2, C2, C2, C2, C2, C2, C1 ]
```

<a id="function-isunramified-galrep"></a>
##### `IsUnramified(A): GalRep -> BoolElt`

Return `true` if a Galois representation is unramified.

<a id="example-ex-57fb0d"></a>
##### `Example: Testing Whether a Representation Is Unramified (ex-57fb0d)`

```magma
> K:=pAdicField(2,20);
> IsUnramified(CyclotomicCharacter(K));
true
> IsUnramified(SP(K,2));
false
> IsUnramified(Semisimplification(SP(K,2)));
true
```

<a id="function-isramified-galrep"></a>
##### `IsRamified(A): GalRep -> BoolElt`

Return `true` if a Galois representation is ramified.

<a id="example-ex-27c5ab"></a>
##### `Example: Ramification of a Galois Representation (ex-27c5ab)`

```magma
> K:=pAdicField(2,20);
> IsRamified(CyclotomicCharacter(K));
false
> IsRamified(SP(K,2));
true
> IsRamified(Semisimplification(SP(K,2)));
false
```

<a id="function-istamelyramified-galrep"></a>
##### `IsTamelyRamified(A): GalRep -> BoolElt`

Return `true` if a Galois representation $A$ over a $p$-adic field $K$ is tamely ramified. Equivalently, `InertiaGroup(A)` has order prime to $p$ (and is then automatically cyclic).

<a id="function-iswildlyramified-galrep"></a>
##### `IsWildlyRamified(A): GalRep -> BoolElt`

Return `true` if a Galois representation $A$ over a $p$-adic field $K$ is wildly ramified, i.e. not tamely ramified. Equivalently, `InertiaGroup(A)` has non-trivial $p$-Sylow.

<a id="example-ex-1ea277"></a>
##### `Example: Wild Ramification of Elliptic Curves (ex-1ea277)`

Galois representations attached to elliptic curves are always tamely ramified when $p\ge 5$, but may be wildly ramified when $p=2$ or $3$.

```magma
> E:=EllipticCurve("75a1");
> A5:=GaloisRepresentation(E,5); A5;
2-dim Galois representation Unr(sqrt(5)*i)*(2,0,-1) with G=S3, I=C3, conductor
   5^2 over Q5[40]
> IsWildlyRamified(A5);
false
> E:=EllipticCurve("256a1");
> A2:=GaloisRepresentation(E,2); A2;
2-dim Galois representation Unr(sqrt(2))*(2,-2,0,0,0) with G=D4, I=C4,
   conductor 2^8 over Q2[40]
> IsWildlyRamified(A2);
true
```

<a id="function-inertiainvariants-galrep"></a>
##### `InertiaInvariants(A): GalRep -> GalRep`

Inertia invariants of a Galois representation $A$. This is an unramified Galois representation.

<a id="example-ex-04fb22"></a>
##### `Example: Inertia Invariants of a Representation (ex-04fb22)`

```magma
> K:=pAdicField(5,20);
> E:=BaseChange(EllipticCurve("15a1"),K);
> A:=GaloisRepresentation(E); A;
2-dim Galois representation Unr(5)*SP(2) over Q5[20]
> I:=InertiaInvariants(A); I;
1-dim trivial Galois representation 1 over Q5[20]
> Dimension(A),Dimension(I);
2 1
```

<a id="function-conductorexponent-galrep"></a>
##### `ConductorExponent(A): GalRep -> RngIntElt`

Conductor exponent of a Galois representation.

<a id="function-conductor-galrep"></a>
##### `Conductor(A): GalRep -> FldPadElt`

Conductor of a Galois representation.

<a id="example-ex-7491ac"></a>
##### `Example: Conductor of a Galois Representation (ex-7491ac)`

```magma
> K:=pAdicField(2,40);
> E:=BaseChange(EllipticCurve("256a1"),K);
> A:=GaloisRepresentation(E); A;
2-dim Galois representation Unr(sqrt(2))*(2,-2,0,0,0) with G=D4, I=C4,
   conductor 2^8 over Q2[40]
> ConductorExponent(A);
8
> Conductor(A);
2^8 + O(2^48)
> Conductor(E);    // same, by definition
2^8 + O(2^48)
```

<a id="function-epsilonfactor-galrep"></a>
##### `EpsilonFactor(A): GalRep -> FldComElt`

Epsilon-factor $\epsilon(A)$ of a Galois representation over a $p$-adic field. Currently only implemented in a few basic cases, and raises an error otherwise. See also Example [Local and Global Epsilon Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-ex-938a3a) in §[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-galrep"></a>
##### `RootNumber(A): GalRep -> FldComElt`

Root number $\epsilon(A)/|\epsilon(A)|$ of a Galois representation. Currently only implemented in a few basic cases, and raises an error otherwise. See also Example [Local and Global Epsilon Factors](https://docs.magma-maths.org/LocalFields/LocalGaloisRepresentations/fields-2.md#example-ex-938a3a) in §[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-3d8d04"></a>
##### `Example: Epsilon Factors and Root Numbers (ex-3d8d04)`

```magma
> E:=EllipticCurve("98a1");
> A:=GaloisRepresentation(E,7); A;
2-dim Galois representation Unr(7)*SP(2)*(1,-1) with G=C2, I=C2, conductor 7^2
   over Q7[40]
> RootNumber(A);
-1
> RootNumber(E,7);  // same
-1
```

<a id="decomposition"></a>
<a id="galrep-decomposition"></a>
#### Semisimplicity and Irreducibles

<a id="function-isirreducible-galrep"></a>
##### `IsIrreducible(A): GalRep -> BoolElt`

Return `true` if a Galois representation $A$ is irreducible.

<a id="example-ex-f6575f"></a>
##### `Example: Irreducibility of Local Components (ex-f6575f)`

We take the polynomial $x^8-6$ with Galois group $C_8:C_2^2$ over $\Q$, its irreducible 4-dimensional Artin representation $A$, and compute whether its local components over $\Q_2$, $\Q_3$, $\Q_5$, and $\Q_7$ are irreducible.

```magma
> R<x>:=PolynomialRing(Rationals());
> K:=NumberField(x^8-6);
> GroupName(GaloisGroup(K));
C8:C2^2
> assert exists(A){A: A in ArtinRepresentations(K) | Degree(A) eq 4};
> A;
Artin representation C8:C2^2: (4,-4,0,0,0,0,0,0,0,0,0) of ext<Q|x^8-6>
> [IsIrreducible(GaloisRepresentation(A,p)): p in PrimesUpTo(10)];
[ true, false, false, false ]
```

<a id="function-isindecomposable-galrep"></a>
##### `IsIndecomposable(A): GalRep -> BoolElt`

Return `true` if a Galois representation $A$ is indecomposable (for semisimple representations, i.e. Weil representations, same as irreducible).

<a id="function-issemisimple-galrep"></a>
##### `IsSemisimple(A): GalRep -> BoolElt`

Return `true` if a Galois representation $A$ is semisimple, i.e. a Weil representation.

<a id="function-semisimplification-galrep"></a>
##### `Semisimplification(A): GalRep -> GalRep`

Semisimplification of a Galois representation $A$.

<a id="function-decomposition-galrep"></a>
##### `Decomposition(A): GalRep -> SeqEnum[GalRep]`

Decompose $A$ into indecomposable (for semisimple representations same as irreducible) consituents and return them as a sequence, possibly with repetitions.

<a id="example-ex-2ab1fc"></a>
##### `Example: Decomposition of a Galois Representation (ex-2ab1fc)`

```magma
> K:=pAdicField(2,20);
> S:=SP(K,2);
> IsIndecomposable(S);
true
> IsIrreducible(S);
false
> IsSemisimple(S);
false
> Decomposition(S);
[ 2-dim Galois representation SP(2) over Q2[20] ]
> Decomposition(Semisimplification(S));
[
1-dim trivial Galois representation 1 over Q2[20],
1-dim unramified Galois representation Unr(1/2) over Q2[20]
]
```

<a id="galrep-arithmetic"></a>
<a id="id1"></a>
### Arithmetic

<a id="operation-op-plus-galrep-galrep"></a>
#### `A1 + A2: GalRep, GalRep -> GalRep`

Direct sum of two Galois representations, both defined over the same $p$-adic field $K$.

<a id="example-ex-1e67b8"></a>
#### `Example: Sums of Galois Representations (ex-1e67b8)`

```magma
> K:=pAdicField(2,20);
> SP(K,1)+SP(K,2)+SP(K,3);
6-dim Galois representation 1 + SP(2) + SP(3) over Q2[20]
```

<a id="operation-op-minus-galrep-galrep"></a>
#### `A1 - A2: GalRep, GalRep -> BoolElt`

Assuming $A2$ is a Galois subrepresentation of $A1$, compute $A1-A2$.

<a id="example-ex-2242b4"></a>
#### `Example: Differences of Galois Representations (ex-2242b4)`

We take $K={\mathbb{Q}}_2$, $F$ its unique degree 3 unramified extension, and compute the regular representation $\mathop{\rm Gal}\nolimits(F/K)$ minus the trivial representation, as a Galois representation over $K$.

```magma
> K:=pAdicField(2,20);
> F:=ext<K|3>;
> PermutationCharacter(F,K)-PrincipalCharacter(K);
2-dim unramified Galois representation (2,-1,-1) with G=C3, I=C1 over Q2[20]
```

<a id="operation-op-times-galrep-galrep"></a>
#### `A1 * A2: GalRep, GalRep -> GalRep`

Tensor product of two Galois representations, both defined over the same $p$-adic field $K$.

<a id="example-ex-eb562c"></a>
#### `Example: Tensor Products of Galois Representations (ex-eb562c)`

We take $K={\mathbb{Q}}_2$ and compute `SP(K,3)`$\otimes$`SP(K,3)`; this is basically the Clebsch-Gordan decomposition.

```magma
> K:=pAdicField(2,20);
> SP(K,3)*SP(K,3);
9-dim Galois representation Unr(1/4) + Unr(1/2)*SP(3) + SP(5) over Q2[20]
```

<a id="operation-op-div-galrep-galrep"></a>
#### `A1 / A2: GalRep, GalRep -> GalRep`

<a id="operation-op-div-rngintelt-galrep"></a>
#### `A1 / A2: RngIntElt, GalRep -> GalRep`

Tensor $A_1$ with $A_2^{-1}$, for $1$-dimensional $A_2$. ($A_1$ may also be the integer 0 or the integer 1.)

<a id="operation-op-pow-galrep-any"></a>
#### `A ^ n: GalRep, Any -> GalRep`

Tensor power of a Galois representation. The power $n$ should be a non-negative integer for a general representation, but may be negative for 1-dimensional representations, and an arbitrary complex number for (powers of) the cyclotomic character.

<a id="example-ex-173850"></a>
#### `Example: Powers of Galois Representations (ex-173850)`

```magma
> K:=pAdicField(2,20);
> CyclotomicCharacter(K)^(1/2);
1-dim unramified Galois representation Unr(1/2*sqrt(2)) over Q2[20]
> SP(K,2)^2 / CyclotomicCharacter(K);
4-dim Galois representation 1 + Unr(2)*SP(3) over Q2[20]
```

<a id="operation-op-eq-galrep-galrep"></a>
#### `A1 eq A2: GalRep, GalRep -> BoolElt`

Return `true` if the two Galois representations are equal.

<a id="example-ex-e6a517"></a>
#### `Example: Equality of Galois Representations (ex-e6a517)`

```magma
> K:=pAdicField(2,20);
> w:=CyclotomicCharacter(K);
> A:=Semisimplification(SP(K,2));
> A eq w^0+w;
true
```

<a id="function-determinant-galrep"></a>
#### `Determinant(A): GalRep -> GalRep`

Determinant of a Galois representation (a $1$-dimensional Galois representation).

<a id="example-ex-e59efc"></a>
#### `Example: Determinant of a Galois Representation (ex-e59efc)`

```magma
> K:=pAdicField(5,20);
> E:=EllipticCurve([K|0,5]);
> A:=GaloisRepresentation(E); A;
2-dim Galois representation Unr(sqrt(5)*i)*(2,-2,0,0,-1,1) with G=D6, I=C6,
   conductor 5^2 over Q5[20]
> Determinant(A) eq CyclotomicCharacter(K)^(-1);
true
```

<a id="function-tatetwist-galrep-rngintelt"></a>
#### `TateTwist(A, n): GalRep, RngIntElt -> GalRep`

Tate twist $A(n)$ of a Galois representation. So $A(n)=A\otimes w^{\otimes n}$ where $w$ is the cyclotomic character.

<a id="example-ex-a9cca5"></a>
#### `Example: Tate Twists of Galois Representations (ex-a9cca5)`

```magma
> K:=pAdicField(5,20);
> R<x>:=PolynomialRing(K);
> A:=GaloisRepresentations(x^2-2)[2];
> A;
1-dim unramified Galois representation (1,-1) with G=C2, I=C1 over Q5[20]
> TateTwist(A,1);
1-dim unramified Galois representation Unr(1/5)*(1,-1) with G=C2, I=C1
   over Q5[20]
> [EulerFactor(TateTwist(A,n)): n in [-2..2]];
[ 25*x + 1, 5*x + 1, x + 1, 1/5*x + 1, 1/25*x + 1 ]
```

### Changing Precision

<a id="function-precision-galrep"></a>
#### `Precision(A): GalRep -> RngIntElt`

Get $p$-adic precision of the base field of a Galois representation.

<a id="function-changeprecision-galrep-rngintelt-ref"></a>
#### `ChangePrecision(~A, Prec): GalRep, RngIntElt -> {}`

Destructively change $p$-adic precision of the base field of a Galois representation.

<a id="function-changeprecision-galrep-rngintelt"></a>
#### `ChangePrecision(A, Prec): GalRep, RngIntElt -> GalRep`

Change $p$-adic precision of the base field of a Galois representation.

<a id="example-ex-8bdd36"></a>
#### `Example: Changing the Precision of a Representation (ex-8bdd36)`

```magma
> K:=pAdicField(5,20);
> R<x>:=PolynomialRing(K);
> A:=GaloisRepresentations(x^4-5)[3];
> A;
1-dim Galois representation (1,1,-1,-1) with G=C4, I=C4, conductor 5^1
   over Q5[20]
> Precision(A);
20
> ChangePrecision(~A,40);
> Precision(A);
40
> ChangePrecision(A,20);
1-dim Galois representation (1,1,-1,-1) with G=C4, I=C4, conductor 5^1
   over Q5[20]
```

<a id="fields"></a>
<a id="galrep-fields"></a>
### Changing Fields

<a id="function-minimize"></a>
#### `Minimize(A): GalRep -> GalRep`

```magma
To: GalRep                    Default: 
```

Replace `Group(A)` by its smallest possible quotient through which all components of $A$ factor. If `To` is specified, instead replace `Group(A)` by `Group(To)`, assuming the $A$ factors through it.

<a id="example-ex-b8e822"></a>
#### `Example: Minimizing a Galois Representation (ex-b8e822)`

We take an extension $F$ of $K=\Q_3$ with Galois group $F_5=C_5:C_4$ of order 20. It has five irreducible representations. Four of them are 1-dimensional, and so they actually factor through a smaller Galois group ($C_1$, $C_2$, or $C_4$). Minimize descends them to these Galois groups, although they are of course still the same as representations of the absolute Galois group.

```magma
> K:=pAdicField(3,20);
> R<x>:=PolynomialRing(K);
> list:=GaloisRepresentations(x^5-3);
> list;
[
1-dim trivial Galois representation 1 over Q3[20],
1-dim unramified Galois representation (1,1,-1,-1,1) with G=F5, I=C5
   over Q3[20],
1-dim unramified Galois representation (1,-1,-zeta(4)_4,zeta(4)_4,1)
   with G=F5, I=C5 over Q3[20],
1-dim unramified Galois representation (1,-1,zeta(4)_4,-zeta(4)_4,1)
   with G=F5, I=C5 over Q3[20],
4-dim Galois representation (4,0,0,0,-1) with G=F5, I=C5, conductor 3^4
   over Q3[20]
]
> [Minimize(A): A in list];
[
1-dim trivial Galois representation 1 over Q3[20],
1-dim unramified Galois representation (1,-1) with G=C2, I=C1 over Q3[20],
1-dim unramified Galois representation (1,-1,-zeta(4)_4,zeta(4)_4)
   with G=C4, I=C1 over Q3[20],
1-dim unramified Galois representation (1,-1,zeta(4)_4,-zeta(4)_4)
   with G=C4, I=C1 over Q3[20],
4-dim Galois representation (4,0,0,0,-1) with G=F5, I=C5, conductor 3^4
   over Q3[20]
]
> forall{A: A in list | A eq Minimize(A)};
true
```

Finally, we illustrate how the parameter To may be used to descend a Galois representation to a specific Galois group, in this case the Galois group $\mathop{\rm Gal}\nolimits(F/K)\cong C_4$ of the degree 4 unramified extension of $K$.

```magma
> F:=ext<K|4>;                    // Take F = degree 4 unr. ext. of K, and
> B:=PermutationCharacter(F,K);   // any B with BaseField(B)=K, Field(B)=F
> list[2];
1-dim unramified Galois representation (1,1,-1,-1,1) with G=F5, I=C5 over Q3[20]
> Minimize(list[2]: To:=B);
1-dim unramified Galois representation (1,1,-1,-1) with G=C4, I=C1 over Q3[20]
> Minimize(list[2]);
1-dim unramified Galois representation (1,-1) with G=C2, I=C1 over Q3[20]
```

<a id="function-restriction-galrep-fldpad"></a>
#### `Restriction(A, L): GalRep, FldPad -> GalRep`

<a id="function-basechange-galrep-fldpad"></a>
#### `BaseChange(A, L): GalRep, FldPad -> GalRep`

Base change (restriction) of a Galois representation $A$ over $K$ over a finite extension $L/K$.

<a id="example-ex-3dc7d9"></a>
#### `Example: Base Change of a Galois Representation (ex-3dc7d9)`

We take a 2-dimensional irreducible representation of $\mathop{\rm Gal}\nolimits({\mathbb{Q}}_2(\zeta_3,\root 3 \of 2))\cong S_3$ and check that its base change to ${\mathbb{Q}}_2(\zeta_3)$ is reducible.

```magma
> K:=pAdicField(2,20);
> R<x>:=PolynomialRing(K);
> A:=GaloisRepresentations(x^3-2)[3]; A;
2-dim Galois representation (2,0,-1) with G=S3, I=C3, conductor 2^2 over Q2[20]
> L:=ext<K|2>;
> R:=Restriction(A,L); R;
2-dim Galois representation (2,-1,-1) with G=C3, I=C3, conductor 2^2
   over ext<Q2[20]|2>
> IsIrreducible(A),IsIrreducible(R);
true false
```

<a id="function-induction-galrep-fldpad"></a>
#### `Induction(A, K0): GalRep, FldPad -> GalRep`

Induction of a Galois representation $A$ over $K$ to a subfield $K_0\subset K$.

<a id="example-ex-aae099"></a>
#### `Example: Induction of a Galois Representation (ex-aae099)`

```magma
> K0:=pAdicField(2,20);     // K0=Q2
> K:=ext<K0|2>;             // K=Q2(zeta_3)
> R<x>:=PolynomialRing(K);
> A:=GaloisRepresentations(x^3-102)[3];
> A;                        // 1-dim character over K
1-dim Galois representation (1,-zeta(3)_3-1,zeta(3)_3) with G=C3, I=C3,
   conductor 2^1 over ext<Q2[20]|2>
> Induction(A,K0);          // Induced to K0
2-dim Galois representation (2,0,-1) with G=S3, I=C3, conductor 2^2 over Q2[20]
```

<a id="fields-2"></a>
<a id="galrep-advanced"></a>
### Advanced Examples

<a id="galrep-s-ex1"></a>
<a id="galrep-ex1"></a>
#### Example: Local and Global Epsilon Factors for Dirichlet Characters

<a id="example-ex-938a3a"></a>
##### `Example: Local and Global Epsilon Factors (ex-938a3a)`

We illustrate the relation between local and global epsilon-factors for Dirichlet characters (or Artin representations). Pick any Dirichlet character $\chi$; in this example we take the unique odd one of conductor $5\cdot 19$, order 6, and $\Im\,\chi(2)>0$.

```magma
> D:=FullDirichletGroup(5*19);
> L:=[chi: chi in Elements(D) | (Order(chi) eq 6) and
>   (Conductor(chi) eq 5*19) and IsOdd(chi) and (Imaginary(chi(2)) ge 0)];
> assert #L eq 1;
> chi:=L[1];
```

We compute its local Galois representations at all the bad places: 5, 19, and $\infty$. (See §[Hodge Structure](https://docs.magma-maths.org/ArithmeticGeometry/LFunctions/arithmetic.md#sec-hodgestruc) for Hodge structures at $\infty$.)

```magma
> G5:=GaloisRepresentation(chi,5); G5;
1-dim Galois representation (1,-1,-zeta(3)_3-1,zeta(3)_3,zeta(3)_3+1,-zeta(3)_3)
   with G=C6, I=C2, conductor 5^1 over Q5[40]
> G19:=GaloisRepresentation(chi,19); G19;
1-dim Galois representation (1,-1,zeta(3)_3,-zeta(3)_3-1,zeta(3)_3+1,-zeta(3)_3)
   with G=C6, I=C6, conductor 19^1 over Q19[40]
> Ginfty:=HodgeStructure(ArtinRepresentation(chi)); Ginfty;
Hodge structure of weight 0 given by <0,0,1>
```

Now compute the corresponding local root numbers - the way the conventions are set up for Artin representations, at $\infty$ it is the root number of the Hodge structure that enters the functional equation.

```magma
> localrootno:=[ComplexField()| RootNumber(G5),RootNumber(G19),
>               RootNumber(Ginfty)];
> globalrootno:=&*localrootno;
```

The global root number is the sign of the L-series of $\chi$, and we check that it agrees with the one determined numerically from the functional equation:

```magma
> L:=LSeries(chi);
> ok:=CheckFunctionalEquation(L);
> Sign(L);
0.910747215816471738723996800097 + 0.412964294924567358770699943664*I
> globalrootno;
0.910747215816471738723996800108 + 0.412964294924567358770699943647*I
```

<a id="galrep-s-ex2"></a>
<a id="galrep-ex2"></a>
#### Example: Reconstructing a Galois Representation from its Euler Factors

<a id="example-ex-6f8047"></a>
##### `Example: Reconstruction from Euler Factors (ex-6f8047)`

Every semisimple Galois representation $A$ over a $p$-adic field $K$ can be uniquely recovered from its Euler factors over the extensions of $K$ ([[DD15](https://docs.magma-maths.org/references.md#cite-ddweil15), Thm. 1]). We illustrate this with a Galois representation attached to an elliptic curve

$$
E/K: y^2 = x^3-26x, \qquad K={\mathbb{Q}}_{13}.
$$

```magma
> K:=pAdicField(13,20);
> E:=EllipticCurve([K|-26,0]);
> A:=GaloisRepresentation(E);
> Degree(A),IsSemisimple(A);
2 true
```

Without looking at $A$, let us reconstruct it from its Euler factors over extensions of $K$. First we determine the inertia group `InertiaGroup(A)` by looking for a field over which $A$ is unramified (i.e. $E$ has good reduction). As the residue characteristic is $>3$, one of the fields ${\mathbb{Q}}_{13}(\root d\of{13})$ will do, for $d=1,2,3,4$ or 6.

```magma
> R<x>:=PolynomialRing(K);
> [EulerFactor(BaseChange(A,ext<K|x^d-13>)): d in [1,2,3,4,6]];
[ 1, 1, 1, 13*x^2 + 4*x + 1, 1 ]
```

We see that the representation becomes unramified over $L={\mathbb{Q}}_{13}(\root 4\of{13})$, a cyclic extension of degree 4, but not over its subfields. So the inertia group must be $C_4$,

$$
{\rm InertiaGroup}(A) \,\,\cong\,\, I_{L/K}
       \,\,=\,\, \mathop{\rm Gal}\nolimits(L/K) \,\,\cong\,\, C_4.
$$

Over $L$ the representation $U=\mathop{\rm Res}\nolimits_{L} A$ is unramified, and there it is determined by its Euler factor. It is a sum of two unramified characters, $\mathop{\rm Frob}\nolimits_{L}^{-1}\mapsto -2\pm 3i$.

```magma
> L:=ext<K|x^4-13>;
> f1:=EulerFactor(BaseChange(A,L));
> U:=UnramifiedRepresentation(L,f1); U;
2-dim unramified Galois representation Unr(1+4*x+13*x^2) over
   ext<Q13[20]|x^4-13>
> Decomposition(U);
[
1-dim unramified Galois representation Unr(-2+3*i) over ext<Q13[20]|x^4-13>,
1-dim unramified Galois representation Unr(-2-3*i) over ext<Q13[20]|x^4-13>
]
```

We are ready to reconstruct $A$. Its restriction to inertia is a faithful 2-dimensional representation of $C_4$, of determinant 1 (as it comes from an elliptic curve), so it must be $\sigma\oplus\sigma^{-1}$ where $\sigma$ is one of the faithful 1-dimensional characters of $C_4$.

```magma
> GroupName(InertiaGroup(A)),IsUnramified(Determinant(A));  // just checking
C4 true
> list:=GaloisRepresentations(x^4-13);
> sigma:=[g: g in list | Order(Character(g)) eq 4][1];
> sigma;
1-dim Galois representation (1,-1,zeta(4)_4,-zeta(4)_4) with G=C4, I=C4,
   conductor 13^1 over Q13[20]
```

Since $\mathop{\rm Frob}\nolimits_K=\mathop{\rm Frob}\nolimits_L$ commutes with inertia in the Galois group

$$
\mathop{\rm Gal}\nolimits(K^{nr}(\root 4 \of{13})/K) \cong\mathop{\rm Gal}\nolimits(K^{nr}/K) \times \mathop{\rm Gal}\nolimits(L/K)
       \cong\hat{\mathbb{Z}}\times C_4
$$

through which $A$ factors, $A(\mathop{\rm Frob}\nolimits_K)$ and $A(\sigma)$ are simultaneously diagonalizable in $\mathop{\rm GL}\nolimits_2({\mathbb{C}})$, so $A$ must be one of the following two representations $A_1$ and $A_2$:

```magma
> Qi<i>:=CyclotomicField(4);
> A1 := sigma * UnramifiedCharacter(K,-2-3*i) +
>       sigma^(-1)*UnramifiedCharacter(K,-2+3*i);
> A2 := sigma * UnramifiedCharacter(K,-2+3*i) +
>       sigma^(-1)*UnramifiedCharacter(K,-2-3*i);
```

Finally, to determine which one it is, we pick *another* extension of $K$ where $A$ becomes unramified and compare the Euler factors. Then we see that $A$ must be $A_2$.

```magma
> L2:=ext<K|x^4-26>;
> EulerFactor(BaseChange(A,L2));
13*x^2 - 6*x + 1
> EulerFactor(BaseChange(A1,L2));
13*x^2 + 6*x + 1
> EulerFactor(BaseChange(A2,L2));
13*x^2 - 6*x + 1
> A eq A2;
true
```
