---
title: "Basic Element Operations"
canonical: "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.html"
source: "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/operation-element.md"
part: "Local Fields"
chapter: "Power, Laurent, and Puiseux Series"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Local Fields", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/index-local-fields.md"}
  - {"title": "Power, Laurent, and Puiseux Series", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/index-power-laurent-and-puiseux-series.md"}
prev: {"title": "Structure Operations", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/operation-structure.md"}
next: {"title": "Transcendental Functions", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/PowerLaurentAndPuiseuxSeries/transcendental.md"}
intrinsics:
  - {"name": "Parent", "signature": "Parent(r): RngSerElt -> RngSer"}
  - {"name": "Category", "signature": "Category(r): RngSerElt -> Cat"}
  - {"name": "+", "signature": "+ b: RngSerElt -> RngSerElt"}
  - {"name": "-", "signature": "- b: RngSerElt -> RngSerElt"}
  - {"name": "+", "signature": "a + b: RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "-", "signature": "a - b: RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "*", "signature": "a * b: RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "^", "signature": "a ^ k: RngSerElt, RngIntElt -> RngSerElt"}
  - {"name": "div", "signature": "a div b: RngSerPowElt, RngSerPowElt -> RngSerPowElt"}
  - {"name": "/", "signature": "a / b: RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "eq", "signature": "a eq b: RngSerElt, RngSerElt -> BoolElt"}
  - {"name": "ne", "signature": "a ne b: RngSerElt, RngSerElt -> BoolElt"}
  - {"name": "in", "signature": "a in R: RngSerElt, RngSer -> BoolElt"}
  - {"name": "notin", "signature": "a notin R: RngSerElt, RngSer -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(a): RngSerElt -> BoolElt"}
  - {"name": "IsOne", "signature": "IsOne(a): RngSerElt -> BoolElt"}
  - {"name": "IsMinusOne", "signature": "IsMinusOne(a): RngSerElt -> BoolElt"}
  - {"name": "IsNilpotent", "signature": "IsNilpotent(x): RngSerElt -> BoolElt"}
  - {"name": "IsIdempotent", "signature": "IsIdempotent(x): RngSerElt -> BoolElt"}
  - {"name": "IsUnit", "signature": "IsUnit(a): RngSerElt -> BoolElt"}
  - {"name": "IsZeroDivisor", "signature": "IsZeroDivisor(x): RngSerElt -> BoolElt"}
  - {"name": "IsRegular", "signature": "IsRegular(x): RngSerElt -> BoolElt"}
  - {"name": "IsIrreducible", "signature": "IsIrreducible(x): RngSerElt -> BoolElt"}
  - {"name": "IsPrime", "signature": "IsPrime(x): RngSerElt -> BoolElt"}
  - {"name": "IsWeaklyZero", "signature": "IsWeaklyZero(f): RngSerElt -> BoolElt"}
  - {"name": "IsWeaklyEqual", "signature": "IsWeaklyEqual(f, g): RngSerElt, RngSerElt -> BoolElt"}
  - {"name": "IsIdentical", "signature": "IsIdentical(f, g): RngSerElt, RngSerElt -> BoolElt"}
  - {"name": "AbsolutePrecision", "signature": "AbsolutePrecision(f): RngSerElt -> RngIntElt"}
  - {"name": "RelativePrecision", "signature": "RelativePrecision(f): RngSerElt -> RngIntElt"}
  - {"name": "ChangePrecision", "signature": "ChangePrecision(f, r): RngSerElt, RngIntElt -> RngSerElt"}
  - {"name": "ChangePrecision", "signature": "ChangePrecision(f, r): RngSerElt, Infty -> RngSerElt"}
  - {"name": "ChangePrecision", "signature": "ChangePrecision(~f, r): RngSerElt, RngIntElt"}
  - {"name": "ChangePrecision", "signature": "ChangePrecision(~f, r): RngSerElt, Infty"}
  - {"name": "Coefficients", "signature": "Coefficients(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt"}
  - {"name": "ElementToSequence", "signature": "ElementToSequence(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt"}
  - {"name": "Eltseq", "signature": "Eltseq(f): RngSerElt -> [ RngElt ], RngIntElt, RngIntElt"}
  - {"name": "Coefficient", "signature": "Coefficient(f, i): RngSerElt, RngElt -> RngElt"}
  - {"name": "LeadingCoefficient", "signature": "LeadingCoefficient(f): RngSerElt -> RngElt"}
  - {"name": "LeadingTerm", "signature": "LeadingTerm(f): RngSerElt -> RngElt"}
  - {"name": "Truncate", "signature": "Truncate(f): RngSerElt -> RngSerElt"}
  - {"name": "ExponentDenominator", "signature": "ExponentDenominator(f): RngMSerElt -> RngElt"}
  - {"name": "Degree", "signature": "Degree(f): RngSerElt -> RngIntElt"}
  - {"name": "Valuation", "signature": "Valuation(f): RngSerElt -> RngIntElt"}
  - {"name": "ExponentDenominator", "signature": "ExponentDenominator(f): RngSerElt -> RngIntElt"}
  - {"name": "Derivative", "signature": "Derivative(f): RngSerElt -> RngSerElt"}
  - {"name": "Derivative", "signature": "Derivative(f, n): RngSerElt, RngIntElt -> RngSerElt"}
  - {"name": "Integral", "signature": "Integral(f): RngSerElt -> RngSerElt"}
  - {"name": "Evaluate", "signature": "Evaluate(f, s): RngSerElt, RngElt -> RngElt"}
  - {"name": "Laplace", "signature": "Laplace(f): RngSerElt -> RngSerElt"}
  - {"name": "SquareRoot", "signature": "SquareRoot(f): RngSerElt -> RngSerElt"}
  - {"name": "Sqrt", "signature": "Sqrt(f): RngSerElt -> RngSerElt"}
  - {"name": "Composition", "signature": "Composition(f, g): RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "Reversion", "signature": "Reversion(f): RngSerElt -> RngSerElt"}
  - {"name": "Reverse", "signature": "Reverse(f): RngSerElt -> RngSerElt"}
  - {"name": "Convolution", "signature": "Convolution(f, g): RngSerElt, RngSerElt -> RngSerElt"}
examples:
  - "ex-cad173"
---

# 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))
```
