---
title: "Operations on Elements"
canonical: "https://docs.magma-maths.org/v2.30-1/BasicRings/Nearfields/nearfield-eltops.html"
source: "https://docs.magma-maths.org/v2.30-1/BasicRings/Nearfields/nearfield-eltops.md"
part: "Basic Rings"
chapter: "Nearfields"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Basic Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/index-basic-rings.md"}
  - {"title": "Nearfields", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/Nearfields/index-nearfields.md"}
prev: {"title": "Constructing Nearfields", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/Nearfields/nearfield-code.md"}
next: {"title": "Operations on Nearfields", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/Nearfields/nearfield-ops.md"}
intrinsics:
  - {"name": "+", "signature": "+ a: NfdElt -> NfdElt"}
  - {"name": "-", "signature": "- a: NfdElt -> NfdElt"}
  - {"name": "+", "signature": "a + b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "-", "signature": "a - b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "*", "signature": "a * b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "/", "signature": "a / b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "^", "signature": "a ^ k: NfdElt, RngIntElt -> NfdElt"}
  - {"name": "+:=", "signature": "a +:= b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "-:=", "signature": "a -:= b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "*:=", "signature": "a *:= b: NfdElt, NfdElt -> NfdElt"}
  - {"name": "Inverse", "signature": "Inverse(a): NfdElt -> NfdElt"}
  - {"name": "eq", "signature": "a eq b: NfdElt, NfdElt -> BoolElt"}
  - {"name": "ne", "signature": "a ne b: NfdElt, NfdElt -> BoolElt"}
  - {"name": "in", "signature": "a in N: NfdElt, Rng -> BoolElt"}
  - {"name": "notin", "signature": "a notin N: NfdElt, Rng -> BoolElt"}
  - {"name": "Parent", "signature": "Parent(a): NfdElt -> FldFin"}
  - {"name": "Category", "signature": "Category(a): NfdElt -> Cat"}
  - {"name": "!", "signature": "N ! x: Nfd, FldFinElt -> NfdElt"}
  - {"name": "Element", "signature": "Element(N, x): Nfd, FldFinElt -> NfdElt"}
  - {"name": "ElementToSequence", "signature": "ElementToSequence(x): NfdElt -> SeqEnum"}
  - {"name": "IsZero", "signature": "IsZero(a): NfdElt -> BoolElt"}
  - {"name": "IsUnit", "signature": "IsUnit(a): NfdElt -> BoolElt"}
  - {"name": "IsIdentity", "signature": "IsIdentity(a): NfdElt -> BoolElt"}
examples:
  - "ex-bb693c"
  - "ex-60b080"
---

<a id="nearfield-eltops"></a>
<a id="sectfldneareltops"></a>
# Operations on Elements

<a id="arithmetic"></a>
<a id="subsectarith"></a>
## Nearfield Arithmetic

The operations of addition, subtraction, and negation are inherited from the underlying Galois field.

The operation of multiplication distinguishes a nearfield from a field. In a nearfield, multiplication is not commutative and the left distributive law fails.

<a id="operation-operation-nfdelt-nfdelt"></a>
### `+ a: NfdElt -> NfdElt`

<a id="operation-operation-nfdelt-nfdelt-2"></a>
### `- a: NfdElt -> NfdElt`

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

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

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

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

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

<a id="operation-operation-nfdelt-nfdelt-nfdelt"></a>
### `a +:= b: NfdElt, NfdElt -> NfdElt`

<a id="operation-operation-nfdelt-nfdelt-nfdelt-2"></a>
### `a -:= b: NfdElt, NfdElt -> NfdElt`

<a id="operation-operation-nfdelt-nfdelt-nfdelt-3"></a>
### `a *:= b: NfdElt, NfdElt -> NfdElt`

<a id="function-inverse-nfdelt"></a>
### `Inverse(a): NfdElt -> NfdElt`

The inverse of $a$.

## Equality and Membership

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

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

<a id="operation-op-in-nfdelt-rng"></a>
### `a in N: NfdElt, Rng -> BoolElt`

<a id="operation-op-notin-nfdelt-rng"></a>
### `a notin N: NfdElt, Rng -> BoolElt`

## Parent and Category

<a id="function-parent-nfdelt"></a>
### `Parent(a): NfdElt -> FldFin`

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

<a id="operation-op-nfd-fldfinelt"></a>
### `N ! x: Nfd, FldFinElt -> NfdElt`

<a id="function-element-nfd-fldfinelt"></a>
### `Element(N, x): Nfd, FldFinElt -> NfdElt`

Create a nearfield element from a finite field element.

<a id="function-elementtosequence-nfdelt"></a>
### `ElementToSequence(x): NfdElt -> SeqEnum`

Create a sequence from an element $x$ of a nearfield.

## Predicates on Nearfield Elements

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

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

<a id="function-isidentity-nfdelt"></a>
### `IsIdentity(a): NfdElt -> BoolElt`

<a id="example-ex-bb693c"></a>
### `Example: Simple Nearfield Arithmetic (ex-bb693c)`

This example illustrates some of the basic operations available on nearfields and their elements. There is a strong connection with the arithmetic of the underlying Galois field of a nearfield `D`, which is available as the attribute ``D`gf``.

```magma
> D := DicksonNearfield(3^2,2);
> K := D`gf;
> x := Element(D,K.1);
> x;
$.1
> Parent(x);
Nearfield D of Dickson type defined by the pair (9, 2)
Order = 81
> x^2;
$.1^10
> Identity(D);
1
> assert x ne Identity(D);
> assert x eq x;
> Zero(D);
0
> Parent(Zero(D));
Nearfield D of Dickson type defined by the pair (9, 2)
Order = 81
> assert not IsZero(D!1);
> assert not IsZero(x);
> assert IsZero(Zero(D));
> K<z> := GF(3,4);
> x := Element(D,z^61);
> y := Element(D,z^54);
> assert x + y eq Element(D,z^61+z^54);
> assert x - y eq Element(D,z^61-z^54);
> x*y;
z^35
> x/y;
z^7
> x^y;
z^29
```

<a id="example-ex-60b080"></a>
### `Example: Failure of Left Distributivity (ex-60b080)`

A nearfield is right-distributive, but unlike a Galois field, multiplication is not commutative and the left-distributive law may fail.

```magma
> N := DicksonNearfield(3^2,4);
> F<a> := N`gf;
> x := Element(N,a^5215);
> y := Element(N,a^5140);
> z := Element(N,a^5819);
> x*y eq y*x;
false
> x*(y+z) eq x*y+x*z;
false
> (y+z)*x eq y*x+z*x;
true
```
