---
title: "Element Operations on Differential Operators"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/element-operations-diff-op-rings.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/element-operations-diff-op-rings.md"
part: "Commutative Algebra"
chapter: "Differential Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Differential Rings", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/index-differential-rings.md"}
prev: {"title": "Structure Operations on Differential Operator Rings", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/structure-operations-diff-op-rings.md"}
next: {"title": "Related Maps", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/related-maps-diff-op-rings.md"}
intrinsics:
  - {"name": "Category", "signature": "Category(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Type", "signature": "Type(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Parent", "signature": "Parent(L): RngDiffOpElt -> RngDiffOp"}
  - {"name": "+", "signature": "s + t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "+", "signature": "s + t: RngDiffOpElt, RngElt -> RngDiffOpElt"}
  - {"name": "+", "signature": "s + t: RngElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "-", "signature": "- s: RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "-", "signature": "s - t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "-", "signature": "s - t: RngDiffOpElt, RngElt -> RngDiffOpElt"}
  - {"name": "-", "signature": "s - t: RngElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "*", "signature": "s * t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "*", "signature": "s * t: RngDiffOpElt, RngElt -> RngDiffOpElt"}
  - {"name": "*", "signature": "s * t: RngElt, RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "^", "signature": "s ^ n: RngDiffOpElt, RngIntElt -> RngDiffElt"}
  - {"name": "eq", "signature": "s eq t: RngDiffOpElt, RngDiffOpElt -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(L): RngDiffOpElt -> BoolElt"}
  - {"name": "IsOne", "signature": "IsOne(L): RngDiffOpElt -> BoolElt"}
  - {"name": "IsMonic", "signature": "IsMonic(L): RngDiffOpElt -> BoolElt"}
  - {"name": "IsWeaklyEqual", "signature": "IsWeaklyEqual(L, P): RngDiffOpElt, RngDiffOpElt -> BoolElt"}
  - {"name": "IsWeaklyZero", "signature": "IsWeaklyZero(L): RngDiffOpElt -> BoolElt"}
  - {"name": "IsWeaklyMonic", "signature": "IsWeaklyMonic(L): RngDiffOpElt -> BoolElt"}
  - {"name": "Eltseq", "signature": "Eltseq(L): RngDiffOpElt -> SeqEnum"}
  - {"name": "Coefficients", "signature": "Coefficients(L): RngDiffOpElt -> SeqEnum"}
  - {"name": "Coefficient", "signature": "Coefficient(L, i): RngDiffOpElt, RngIntElt -> RngElt"}
  - {"name": "LeadingCoefficient", "signature": "LeadingCoefficient(L): RngDiffOpElt -> RngElt"}
  - {"name": "LeadingTerm", "signature": "LeadingTerm(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Terms", "signature": "Terms(L): RngDiffOpElt -> SeqEnum"}
  - {"name": "Order", "signature": "Order(L): RngDiffOpElt -> RngIntElt"}
  - {"name": "Degree", "signature": "Degree(L): RngDiffOpElt -> RngIntElt"}
  - {"name": "WeakOrder", "signature": "WeakOrder(L): RngDiffOpElt -> RngIntElt"}
  - {"name": "WeakDegree", "signature": "WeakDegree(L): RngDiffOpElt -> RngIntElt"}
  - {"name": "MonicDifferentialOperator", "signature": "MonicDifferentialOperator(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Adjoint", "signature": "Adjoint(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Translation", "signature": "Translation(L, e): RngDiffOpElt, RngElt -> RngDiffOpElt, Map"}
  - {"name": "TruncateCoefficients", "signature": "TruncateCoefficients(L): RngDiffOpElt -> RngDiffOpElt"}
  - {"name": "Apply", "signature": "Apply(L, f): RngDiffOpElt, RngElt -> RngElt"}
  - {"name": "L", "signature": "L(f): RngElt, RngDiffOpElt -> RngElt"}
  - {"name": "@", "signature": "f @ L: RngElt, RngDiffOpElt -> RngElt"}
examples:
  - "ex-a0ba79"
  - "ex-d50a45"
  - "ex-873e6e"
  - "ex-978632"
  - "ex-32cf07"
  - "ex-1a4536"
---

# Element Operations on Differential Operators

## Category and Parent

<a id="function-category-rngdiffopelt"></a>
### `Category(L): RngDiffOpElt -> RngDiffOpElt`

<a id="function-type-rngdiffopelt"></a>
### `Type(L): RngDiffOpElt -> RngDiffOpElt`

The category, or type, of the differential operator $L$.

<a id="function-parent-rngdiffopelt"></a>
### `Parent(L): RngDiffOpElt -> RngDiffOp`

The parent of the differential operator $L$.

## Arithmetic

All the usual arithmetic operations are possible for differential operators. It follows from the multiplication rule for differential operators that the multiplication of differential operators is non–commutative.

<a id="operation-op-plus-rngdiffopelt-rngdiffopelt"></a>
### `s + t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt`

<a id="operation-op-plus-rngdiffopelt-rngelt"></a>
### `s + t: RngDiffOpElt, RngElt -> RngDiffOpElt`

<a id="operation-op-plus-rngelt-rngdiffopelt"></a>
### `s + t: RngElt, RngDiffOpElt -> RngDiffOpElt`

The sum of the two differential operators $s$ and $t$.

<a id="operation-operation-rngdiffopelt-rngdiffopelt"></a>
### `- s: RngDiffOpElt -> RngDiffOpElt`

The negation of the differential operator $s$.

<a id="operation-op-minus-rngdiffopelt-rngdiffopelt"></a>
### `s - t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt`

<a id="operation-op-minus-rngdiffopelt-rngelt"></a>
### `s - t: RngDiffOpElt, RngElt -> RngDiffOpElt`

<a id="operation-op-minus-rngelt-rngdiffopelt"></a>
### `s - t: RngElt, RngDiffOpElt -> RngDiffOpElt`

The difference between the differential operators $s$ and $t$.

<a id="operation-op-times-rngdiffopelt-rngdiffopelt"></a>
### `s * t: RngDiffOpElt, RngDiffOpElt -> RngDiffOpElt`

<a id="operation-op-times-rngdiffopelt-rngelt"></a>
### `s * t: RngDiffOpElt, RngElt -> RngDiffOpElt`

<a id="operation-op-times-rngelt-rngdiffopelt"></a>
### `s * t: RngElt, RngDiffOpElt -> RngDiffOpElt`

The product of the differential operators $s$ and $t$.

<a id="operation-op-pow-rngdiffopelt-rngintelt"></a>
### `s ^ n: RngDiffOpElt, RngIntElt -> RngDiffElt`

Given a differential operator $s$ and an integer $n\ge 0$, return the $n$-th power of $s$.

<a id="example-ex-a0ba79"></a>
### `Example: Arithmetic of Differential Operators (ex-a0ba79)`

```magma
> F<z> := RationalDifferentialField(Rationals());
> R<D> := DifferentialOperatorRing(F);
> (z*D-1)*(D+1);
z*D^2 + (z - 1)*D + -1
> (D+1)*(z*D-1);
z*D^2 + z*D + -1
> (D-1/z)^2;
D^2 + -2/z*D + 2/z^2
```

## Predicates and Booleans

<a id="operation-op-eq-rngdiffopelt-rngdiffopelt"></a>
### `s eq t: RngDiffOpElt, RngDiffOpElt -> BoolElt`

Return `true` iff the differential operators $s$ and $t$ are exactly the same.

<a id="function-iszero-rngdiffopelt"></a>
### `IsZero(L): RngDiffOpElt -> BoolElt`

Return `true` iff the differential operator $L$ is the zero element of its parent.

<a id="function-isone-rngdiffopelt"></a>
### `IsOne(L): RngDiffOpElt -> BoolElt`

Return `true` iff the differential operator $L$ is the unity element of its parent.

<a id="function-ismonic-rngdiffopelt"></a>
### `IsMonic(L): RngDiffOpElt -> BoolElt`

Return `true` iff the differential operator $L$ is monic.

<a id="function-isweaklyequal-rngdiffopelt-rngdiffopelt"></a>
### `IsWeaklyEqual(L, P): RngDiffOpElt, RngDiffOpElt -> BoolElt`

Returns `true` if and only if the differential operator $L$ is weakly equal to the operator $P$. This means that the $i$-th coefficients of $L$ and $P$ should be weakly equal to each other for every $i \in [0..\max(\deg(L),\deg(P))]$.

<a id="function-isweaklyzero-rngdiffopelt"></a>
### `IsWeaklyZero(L): RngDiffOpElt -> BoolElt`

Returns `true` if and only if the differential operator $L\in R$ is weakly equal to $R ! 0$.

<a id="function-isweaklymonic-rngdiffopelt"></a>
### `IsWeaklyMonic(L): RngDiffOpElt -> BoolElt`

Returns `true` if and only if the leading coefficient of the differential operator $L$ is weakly equal to $1$.

## Coefficients and Terms

Differential operators look like univariate polynomials with coefficients in a differential ring. Some of the terminology used for polynomial rings is mimicked for differential operators.

<a id="function-eltseq-rngdiffopelt"></a>
### `Eltseq(L): RngDiffOpElt -> SeqEnum`

<a id="function-coefficients-rngdiffopelt"></a>
### `Coefficients(L): RngDiffOpElt -> SeqEnum`

Given an operator $L$ with coefficients in $R$, this function returns the sequence of elements in $R$, that are the coefficients of $L$. The sequence is ordered from the constant coefficient to the coefficient of the highest order term of $L$.

<a id="function-coefficient-rngdiffopelt-rngintelt"></a>
### `Coefficient(L, i): RngDiffOpElt, RngIntElt -> RngElt`

Given an operator $L$ with coefficients in $R$, this function returns the coefficient of the monomial of degree $i$ in $L$, as an element of $R$.

<a id="function-leadingcoefficient-rngdiffopelt"></a>
### `LeadingCoefficient(L): RngDiffOpElt -> RngElt`

Given an operator $L$ with coefficients in $R$, this function returns the coefficient of the highest order term of $L$.

<a id="function-leadingterm-rngdiffopelt"></a>
### `LeadingTerm(L): RngDiffOpElt -> RngDiffOpElt`

The leading term of the differential operator $L$.

<a id="function-terms-rngdiffopelt"></a>
### `Terms(L): RngDiffOpElt -> SeqEnum`

Given an operator $L$ with coefficients in $R$, this function returns the sequence of non–zero coefficients of $L$ as elements of $R$. The sequence is ordered from the lowest order term to the highest order term in $L$.

<a id="example-ex-d50a45"></a>
### `Example: Coefficients and Terms of an Operator (ex-d50a45)`

```magma
> F<z> := RationalDifferentialField(Rationals());
> R<D> := DifferentialOperatorRing(F);
> L := D^3  + (-4*z + 5)*D + (3*z - 4);
> L;
D^3 + (-4*z + 5)*D + 3*z - 4
> Eltseq(L);
[ 3*z - 4, -4*z + 5, 0, 1 ]
> LeadingTerm(L);
D^3
> Terms(L);
[
    3*z - 4,
    (-4*z + 5)*D,
    D^3
]
```

## Order and Degree

<a id="function-order-rngdiffopelt"></a>
### `Order(L): RngDiffOpElt -> RngIntElt`

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

Returns the order of the differential operator $L$. In the case that $L$ is identically $0$, the order is defined to be $-1$.

<a id="function-weakorder-rngdiffopelt"></a>
### `WeakOrder(L): RngDiffOpElt -> RngIntElt`

<a id="function-weakdegree-rngdiffopelt"></a>
### `WeakDegree(L): RngDiffOpElt -> RngIntElt`

If the differential operator $L$ is defined over a differential series ring, then the exponent of the highest coefficient of $L$ that is not weakly $0$ is returned.

<a id="example-ex-873e6e"></a>
### `Example: Order and Degree of Operators (ex-873e6e)`

```magma
> S<t> := DifferentialLaurentSeriesRing(Rationals());
> R<D> := DifferentialOperatorRing(S);
> L := D^2 + 2*t;
> P := O(t)*D^3 + (1+O(t))*D^2  + 2*t;
> Order(L);
2
> Degree(P);
3
> L eq P;
false
> IsWeaklyEqual(L,P);
true
> WeakOrder(P);
2
```

## Related Differential Operators

<a id="function-monicdifferentialoperator-rngdiffopelt"></a>
### `MonicDifferentialOperator(L): RngDiffOpElt -> RngDiffOpElt`

Given the differential operator $L$, this function returns the monic differential operator $1/c\cdot L$, where c is the leading coefficient of $L$.

<a id="function-adjoint-rngdiffopelt"></a>
### `Adjoint(L): RngDiffOpElt -> RngDiffOpElt`

Returns the formal adjoint of the differential operator $L$. The *formal adjoint* of $L=\sum_{i=0}^n a_iD^i$ in the differential operator ring $R=F[D]$ over $F$, is the differential operator $L^*:=\sum_{i=0}^n (-1)^iD^i*a_i\in R$. It follows from the definition that the orders of $L$ and $L^*$ are the same and that the leading coefficient of $L^*$ is $(-1)^n a_n$.

<a id="function-translation-rngdiffopelt-rngelt"></a>
### `Translation(L, e): RngDiffOpElt, RngElt -> RngDiffOpElt, Map`

If $R$ is the parent of the differential operator $L$ and $e$ is a suitable ring element, then the operator in $R$ obtained by replacing $R.1$ by $R.1+e$ in $L$ is returned. The second argument returned is the translation map on $R$ by $e$.

<a id="function-truncatecoefficients-rngdiffopelt"></a>
### `TruncateCoefficients(L): RngDiffOpElt -> RngDiffOpElt`

If $L$ is defined over a differential series ring, then returned is the operator whose coefficients are the truncations of the coefficients of $L$.

<a id="example-ex-978632"></a>
### `Example: Related Differential Operators (ex-978632)`

```magma
> F<z> := RationalDifferentialField(Rationals());
> R<D> := DifferentialOperatorRing(F);
> L := z*D^3  + (-4*z + 5)*D + (3*z - 4);
> Order(L);
3
> MonicDifferentialOperator(L);
D^3 + (-4*z + 5)/z*D + (3*z - 4)/z
> Adjoint(L);
-z*D^3 + -3*D^2 + (4*z - 5)*D + 3*z
> trans, mp := Translation(L, 2);
> trans;
z*D^3 + 6*z*D^2 + (8*z + 5)*D + 3*z + 6
```

<a id="example-ex-32cf07"></a>
### `Example: Truncating Operator Coefficients (ex-32cf07)`

```magma
> S<t> := DifferentialLaurentSeriesRing(Rationals());
> RS<DS> := DifferentialOperatorRing(S);
> L := (5-O(t))*DS^3+(2*t^-1+t^2+O(t^4))*DS - t^-2+t+O(t^3);
> L;
(5 + O(t))*DS^3 + (2*t^-1 + t^2 + O(t^4))*DS + -t^-2 + t + O(t^3)
> TruncateCoefficients(L);
5*DS^3 + (2*t^-1 + t^2)*DS + -t^-2 + t
> L -TruncateCoefficients(L);
O(t)*DS^3 + O(t^4)*DS + O(t^3)
```

## Application of Operators

As pointed out in the introduction a differential operator $L=a_nD^n+a_{n-1}D^{n-1}+\cdots+a_1D+a_0$ in $F[D]$ leads to the differential equation $L(y)=0$ given by

$$
L(y)=a_n \delta_F^n(y)+a_{n-1} \delta_F^{n-1}(y)+
     \cdots+a_1 \delta_F(y)+a_0 y
$$

This notation is formal, but also defines an action of $L$ on any element $y\in F$. The function `Apply` returns the ring element obtained by this action.

<a id="function-apply-rngdiffopelt-rngelt"></a>
### `Apply(L, f): RngDiffOpElt, RngElt -> RngElt`

<a id="function-l-rngelt-rngdiffopelt"></a>
### `L(f): RngElt, RngDiffOpElt -> RngElt`

<a id="operation-operation-rngelt-rngdiffopelt-rngelt"></a>
### `f @ L: RngElt, RngDiffOpElt -> RngElt`

Given a differential operator $L$ and a ring element $f$, return the ring element obtained after applying $L$ to $f$, as an element of the base ring of $L$. The element $f$ must be coercible into the base ring of $L$.

<a id="example-ex-1a4536"></a>
### `Example: Applying an Operator to a Function (ex-1a4536)`

```magma
> F<z> := RationalDifferentialField(Rationals());
> R<D> := DifferentialOperatorRing(F);
> L := D^2-2/z^2;
> Apply(L, z);
-2/z
> L(z);
-2/z
> Apply(L, z^2);
0
```
