# Element Operations

See also Section [Generic Element Functions](../IntroductionToRings/element.md#rngintro-elt-funcs).

## Arithmetic Operators

### `+ a: FldFinElt -> FldFinElt`

### `- a: FldFinElt -> FldFinElt`

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

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

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

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

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

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

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

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

## Equality and Membership

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

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

### `a in F: FldFinElt, Rng -> BoolElt`

### `a notin F: FldFinElt, Rng -> BoolElt`

## Parent and Category

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

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

## Predicates on Ring Elements

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

### `IsOne(a): FldFinElt -> BoolElt`

### `IsMinusOne(a): FldFinElt -> BoolElt`

### `IsNilpotent(a): FldFinElt -> BoolElt`

### `IsIdempotent(a): FldFinElt -> BoolElt`

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

### `IsZeroDivisor(a): FldFinElt -> BoolElt`

### `IsRegular(a): FldFin -> BoolElt`

### `IsIrreducible(a): FldFinElt -> BoolElt`

### `IsPrime(a): FldFinElt -> BoolElt`

### `IsPrimitive(a): FldFinElt -> BoolElt`

Returns `true` if and only if the element $a$ of $F$ is a primitive element for $F$ (i.e., if and only if the multiplicative order of $a$ is $\#F-1$).

### `IsPrimitive(f): RngUPolElt -> BoolElt`

Given a univariate polynomial $f\in F[x]$, over a finite field $F$, such that the degree of $f$ is greater than or equal to 1, this function returns `true` if and only if $f$ defines a primitive extension $G=F[x]/f$ of $F$ (that is, $x$ is primitive in $G$).

### `IsNormal(a): FldFinElt -> BoolElt`

Returns `true` if and only if the element $a$ of $F$ generates a normal basis for the field over the ground field, that is, if and only if $a, a^q, \ldots, a^{q^{n-1}}$ form a basis for $F$ over the ground field $G={\bf F}_{q}$.

### `IsNormal(a, E): FldFinElt -> BoolElt`

Returns `true` if and only if the element $a$ of the finite field $F$ with $q^n$ elements generates a normal basis for $F$ over its subfield $E$, that is, if and only if $a, a^q, \ldots, a^{q^{n-1}}$ form a basis for $F$ over $E$ for $q=\#E$.

### `IsSquare(a): FldFinElt -> BoolElt`

Given a finite field element $a\in F$, this function returns either `true` and an element $b\in F$ such that $b^2=a$, or it returns `false` in the case that such an element does not exist.

## Minimal and Characteristic Polynomial

### `MinimalPolynomial(a): FldFinElt -> RngUPolElt`

The minimal polynomial of the element $a$ of the field $F$, relative to the ground field of $F$. This is the unique minimal-degree monic polynomial with coefficients in the ground field, having $a$ as a root.

### `MinimalPolynomial(a, E): FldFinElt, FldFin -> RngUPolElt`

The minimal polynomial of the element $a$ of the field $F$, relative to the subfield $E$ of $F$. This is the unique minimal-degree monic polynomial with coefficients in $E$, having $a$ as a root.

### `CharacteristicPolynomial(a): FldFinElt -> RngUPolElt`

Given an element $a$ of a finite field $F$, return the characteristic polynomial of $a$ with respect to the ground field of $F$. (This polynomial is the characteristic polynomial of the companion matrix of $a$ written as a polynomial over the ground field, and is a power of the minimal polynomial.)

### `CharacteristicPolynomial(a, E): FldFinElt, FldFin -> RngUPolElt`

Given an element $a$ of a finite field $F$, return the characteristic polynomial of $a$ with respect to the subfield $E$ of $F$. (This polynomial is the characteristic polynomial of the companion matrix of $a$ written as a polynomial over $E$, and is a power of the minimal polynomial over $E$.)

## Norm, Trace and Frobenius

### `Norm(a): FldFinElt -> FldFinElt`

The norm of the element $a$ from the field $F$ to the ground field of $F$.

### `Norm(a, E): FldFinElt, FldFin -> FldFinElt`

The relative norm of the element $a$ from the field $F$, with respect to the subfield $E$ of $F$. The result is an element of $E$.

### `AbsoluteNorm(a): FldFinElt -> FldFinElt`

### `NormAbs(a): FldFinElt -> FldFinElt`

The absolute norm of the element $a$, that is, the norm to the prime subfield of the parent field $F$ of $a$.

### `Trace(a): FldFinElt -> FldFinElt`

The trace of the element $a$ from the field $F$ to the ground field of $F$.

### `Trace(a, E): FldFinElt, FldFin -> FldFinElt`

The relative trace of the element $a$ from field $F$, with respect to the subfield $E$ of $F$. The result is an element of $E$.

### `AbsoluteTrace(a): FldFinElt -> FldFinElt`

### `TraceAbs(a): FldFinElt -> FldFinElt`

The trace of the element $a$, that is, the trace to the prime subfield of the parent field $F$ of $a$.

### `Frobenius(a): FldFinElt -> FldFinElt`

The Frobenius image of $a$ w.r.t. the ground field of $K$; i.e., $a^{\#G}$, where $G$ is the ground field of the parent of $a$.

### `Frobenius(a, r): FldFinElt, RngIntElt -> FldFinElt`

The $r$-th Frobenius image of $a$ w.r.t. the ground field of $K$; i.e., $a^{(\#G)^r}$, where $G$ is the ground field of the parent of $a$.

### `Frobenius(a, E): FldFinElt, FldFin -> FldFinElt`

The Frobenius image of x w.r.t. $E$; i.e., $x^{\#E}$.

### `Frobenius(a, E, r): FldFinElt, FldFin, RngIntElt -> FldFinElt`

The Frobenius image of x w.r.t. $E$; i.e., $x^{(\#E)^r}$.

### `NormEquation(K, y): FldFin, FldFin -> BoolElt, FldFinElt`

Given a finite field $K$ and an element $y$ of a subfield $S$ of $K$, return whether an element $x\in K$ exists such that Norm$(x, S) = y$, and, if so, such an element $x$ (in $K$).

### `Hilbert90(a, q): FldFinElt, RngIntElt -> FldFinElt`

Given an element $a$ of some finite field $k$ and a power $q$ of the characteristic of $k$, return a solution of the Hilbert 90 equation $x^qx^{-1}=a$. Note that the solution may be in a finite-degree extension of $k$.

### `AdditiveHilbert90(a, q): FldFinElt, RngIntElt -> FldFinElt`

Given an element $a$ of some finite field $k$ and a power $q$ of the characteristic of $k$, return a solution of the additive Hilbert 90 equation $x^q - x=a$. Note that the solution may be in a finite-degree extension of $k$.

## Order and Roots

### `Order(a): FldFinElt -> RngIntElt`

The multiplicative order of the non-zero element $a$ of the field $F$.

### `FactoredOrder(a): FldFinElt -> RngIntElt`

The multiplicative order of the non-zero element $a$ of the field $F$ as a factorization sequence.

### `SquareRoot(a): FldFinElt -> FldFinElt`

### `Sqrt(a): FldFinElt -> FldFinElt`

The square root of the non-zero element $a$ from the field $F$, i.e., an element $y$ of $F$ such that $y^2 = a$. An error results if $a$ is not a square.

### `Root(a, n): FldFinElt, RngIntElt -> FldFinElt`

The $n$-th root of the non-zero element $a$ from the field $F$, i.e., an element $y$ of $F$ such that $y^n = a$. An error results if no such root exists.

### `IsPower(a, n): FldFinElt, RngIntElt -> BoolElt, FldFinElt`

Given a finite field element $a\in F$, and an integer $n>0$, this function returns either `true` and an element $b\in F$ such that $b^n=a$, or it returns `false` in the case that such an element does not exist.

### `AllRoots(a, n): FldFinElt, RngIntElt -> SeqEnum`

Given a finite field element $a\in F$, and an integer $n>0$, return a sequence containing all of the $n$-th roots of $a$ which lie in the same field $F$.

### `Example: Functions (ex-ead4e7)`

Given the fields $F$ and $F49$ defined above, we can use the following functions:

```magma
> F7 := FiniteField(7);
> F49<w> := ext< F7 | 2 >;
> F<z> := ext< F49 | 2 >;
> Root(z^73, 7);
z^1039
> Trace(z^73);
1
> Trace(z^73, F49);
w^44
> Norm(z^73);
3
> Norm(z^73, F49);
w^37
> Norm(w^37);
3
> MinimalPolynomial(z^73);
x^2 + w^20*x + w^43
> MinimalPolynomial(z^73, F7);
x^4 + 4*x^2 + 4*x + 3

```

We now demonstrate the `NormEquation` function.

```magma
> Norm(z);
3
> NormEquation(F, F7!3);
true z
> Norm(z^30, F49);
w^30
> Parent(z) eq F;
true
> NormEquation(F, w^30);
true z^30

```
