---
title: "Arithmetic"
canonical: "https://docs.magma-maths.org/v2.30-1/LocalFields/AlgebraicPowerSeriesRings/arith.html"
source: "https://docs.magma-maths.org/v2.30-1/LocalFields/AlgebraicPowerSeriesRings/arith.md"
part: "Local Fields"
chapter: "Algebraic Power Series Rings"
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": "Algebraic Power Series Rings", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/AlgebraicPowerSeriesRings/index-algebraic-power-series-rings.md"}
prev: {"title": "Accessors and Expansion", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/AlgebraicPowerSeriesRings/accessors.md"}
next: {"title": "Predicates", "source": "https://docs.magma-maths.org/v2.30-1/LocalFields/AlgebraicPowerSeriesRings/preds.md"}
intrinsics:
  - {"name": "AlgComb", "signature": "AlgComb(c, ss): RngMPolElt, SeqEnum -> RngPowAlgElt"}
  - {"name": "+", "signature": "s + t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt"}
  - {"name": "-", "signature": "s - t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt"}
  - {"name": "*", "signature": "s * t: RngPowAlgElt, RngPowAlgElt -> RngPowAlgElt"}
examples:
  - "ex-46bd4b"
---

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