# Operations on Elements

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

### `- a: NfdElt -> NfdElt`

### `a + b: NfdElt, NfdElt -> NfdElt`

### `a - b: NfdElt, NfdElt -> NfdElt`

### `a * b: NfdElt, NfdElt -> NfdElt`

### `a / b: NfdElt, NfdElt -> NfdElt`

### `a ^ k: NfdElt, RngIntElt -> NfdElt`

### `a +:= b: NfdElt, NfdElt -> NfdElt`

### `a -:= b: NfdElt, NfdElt -> NfdElt`

### `a *:= b: NfdElt, NfdElt -> NfdElt`

### `Inverse(a): NfdElt -> NfdElt`

The inverse of $a$.

## Equality and Membership

### `a eq b: NfdElt, NfdElt -> BoolElt`

### `a ne b: NfdElt, NfdElt -> BoolElt`

### `a in N: NfdElt, Rng -> BoolElt`

### `a notin N: NfdElt, Rng -> BoolElt`

## Parent and Category

### `Parent(a): NfdElt -> FldFin`

### `Category(a): NfdElt -> Cat`

### `N ! x: Nfd, FldFinElt -> NfdElt`

### `Element(N, x): Nfd, FldFinElt -> NfdElt`

Create a nearfield element from a finite field element.

### `ElementToSequence(x): NfdElt -> SeqEnum`

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

## Predicates on Nearfield Elements

### `IsZero(a): NfdElt -> BoolElt`

### `IsUnit(a): NfdElt -> BoolElt`

### `IsIdentity(a): NfdElt -> BoolElt`

### `Example: simplearith (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

```

### `Example: leftdist (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

```
