# Elements

## `Parent(x): AlgEtQElt -> AlgEtQ`

## `Algebra(x): AlgEtQElt -> AlgEtQ`

Returns the algebra to which the element $x$ belongs to.

## `Components(x): AlgEtQElt -> SeqEnum`

Given an element $x$, returns its components, which are elements of number fields.

## `AbsoluteCoordinates(x): AlgEtQElt -> SeqEnum`

Given an element $x$, returns the coordinates relative to the absolute basis, which are elements of the prime rational field.

## `AbsoluteCoordinates(x, S): AlgEtQElt, AlgEtQOrd -> SeqEnum`

Given an element $x$ and an order $S$, returns the coordinates of $x$ with respect to the stored Z-basis of $S$.

## `IsCoercible(A, x): AlgEtQ, Any -> BoolElt, AlgEtQElt`

Return whether the element $x$ is coercible into the algebra $A$ and the result of the coercion if so.

## `A ! x: AlgEtQ, Any) -> AlgEtQElt`

Coerce $x$ into the algebra $A$.

## `One(A): AlgEtQ -> AlgEtQElt`

The multiplicative neutral element of the algebra $A$.

## `Zero(A): AlgEtQ -> AlgEtQElt`

The additive neutral element of the algebra $A$.

## `IsUnit(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ is a unit in its algebra $A$.

## `IsZeroDivisor(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ is a zero-divisor in its algebra $A$.

## `Random(A, bd): AlgEtQ, RngIntElt -> AlgEtQElt`

Returns a random element of the algebra $A$. The coefficients are bounded by the positive integer $bd$.

## `Random(A): AlgEtQ -> AlgEtQElt`

```magma
bd: RngIntElt                    Default: 3
```

Returns a random element of the algebra $A$. The coefficients are bounded by the parameter $bd$ (default 3).

## `RandomUnit(A, bd): AlgEtQ, RngIntElt -> AlgEtQElt`

Returns a random unit of the algebra $A$. The coefficients are bounded by the positive integer $bd$.

## `x1 eq x2: AlgEtQElt, AlgEtQElt -> BoolElt`

## `x1 eq x2: RngIntElt, AlgEtQElt -> BoolElt`

## `x1 eq x2: AlgEtQElt, RngIntElt -> BoolElt`

## `x1 eq x2: FldRatElt, AlgEtQElt -> BoolElt`

## `x1 eq x2: AlgEtQElt, FldRatElt -> BoolElt`

Returns whether the elements $x1$ and $x2$ are equal.

## `x1 + x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

## `x1 + x2: Any, AlgEtQElt -> AlgEtQElt`

## `x1 + x2: AlgEtQElt, Any -> AlgEtQElt`

## `- x: AlgEtQElt -> AlgEtQElt`

## `x1 - x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

## `x1 - x2: Any, AlgEtQElt -> AlgEtQElt`

## `x1 - x2: AlgEtQElt, Any -> AlgEtQElt`

## `x1 * x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

## `x1 * x2: Any, AlgEtQElt -> AlgEtQElt`

## `x1 * x2: AlgEtQElt, Any -> AlgEtQElt`

## `Inverse(x): AlgEtQElt -> AlgEtQElt`

The multiplicative inverse of the algebra element $x$.

## `x ^ n: AlgEtQElt, RngIntElt -> AlgEtQElt`

## `x1 / x2: AlgEtQElt, AlgEtQElt -> AlgEtQElt`

## `x1 / x2: Any, AlgEtQElt -> AlgEtQElt`

## `x1 / x2: AlgEtQElt, Any -> AlgEtQElt`

## `&+ seq: SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence of `AlgEtQElt` returns the sum of the entries.

## `&* seq: SeqEnum[AlgEtQElt] -> AlgEtQElt`

Given a sequence of `AlgEtQElt` returns the product of the entries.

## `DotProduct(a, b): SeqEnum, SeqEnum -> Any`

Given two sequences $a=[a_1,\ldots,a_n]$ and $b=[b_1,\ldots,b_n]$, returns $\sum_i a_i\cdot b_i$.

## `Example: Dot Product Example (ex-1d7031)`

```magma
> _<x>:=PolynomialRing(Integers());
> f := (x^8+16)*(x^8+81);
> A := EtaleAlgebra(f);
> // We compute the `canonical` primitive element, which is the class of the
> // variable x in A.
> a := PrimitiveElement(A); a;
<$.1, $.1>
> // The algebra A has two components:
> comps, embeddings, projections:=Components(A);
> K1, K2 := Explode(comps);
> // The unit element of each component corresponds to an orthogonal idempotent
> //                                                                       of A:
> [ embeddings[1](K1!1),embeddings[2](K2!1) ] eq OrthogonalIdempotents(A);
true
> // We conclude this example by showing the use of DotProduct and
> //                                              its timings advantages:
> N := 10^5;
> elts1 := [ a+i : i in [1..N] ];
> elts2 := [ a-i : i in [1..N] ];
> time s1 := &+[ elts1[i]*elts2[i] : i in [1..N] ];
Time: 0.450
> time s2 := DotProduct(elts1,elts2);
Time: 0.150
> s1 eq s2;
true

```

## `MinimalPolynomial(x): AlgEtQElt -> RngUPolElt`

Returns the minimal polynomial over the common base ring of the number fields defining the algebra $A$ of the element $x$.

## `MinimalPolynomial(x, F): AlgEtQElt, Rng -> RngUPolElt`

Returns the minimal polynomial over the ring $F$ of the element $x$.

## `AbsoluteMinimalPolynomial(x): AlgEtQElt -> RngUPolElt`

Returns the minimal polynomial over the prime field of the element $x$ or an algebra.

## `IsIntegral(x): AlgEtQElt -> BoolElt`

Returns whether the element $x$ of an algebra is integral (over the integers).

## `Evaluate(f, a): RngUPolElt, AlgEtQElt -> AlgEtQElt`

Evaluate the polynomial $f$ at the algebra element $a$.

## `PrimitiveElement(A): AlgEtQ -> AlgEtQElt`

Returns the primitive element of the étale algebra $A$. Note that $A$ has a primitive element only if it is the product of distinct number fields.

Given an étale algebra $A$ over ${{\Bbb Q}}$ there exists an element $a\in A$ such that $A = {{\Bbb Q}}[a]$, that is, every element can be written as a polynomial with rational coefficients in $a$. Such an element is called a *primitive element* of $A$. It is characterized by having a minimal polynomial whose degree equals the absolute dimension of $A$.

The intrinsic `PrimitiveElement` produces such an element of the étale algebra $A$ using a deterministic procedure which we now describe: Let $N$ be the number of components of $A$, each one having primitive element $a_i$. Set $b_1$ = $a_1$. For $i=2,\ldots,N$, set $b_i = a_i+j$ where $j$ is the smallest non-negative integer such that the minimal polynomial of $a_i+j$ is not in the set of minimal polynomials of the elements $b_1,\ldots,b_{i-1}$. The output is the element of $A$ whose components are $b_1,...,b_N$. In particular, if $A$ is a product of number fields with different defining polynomials, then the output is the element of $A$ whose components are the primitive elements of the components.

## `PowerBasis(A): AlgEtQ -> SeqEnum[AlgEtQElt]`

Returns the power basis of the étale algebra $A$, consisting of powers of the primitive element of $A$.

## `Basis(A): AlgEtQ -> SeqEnum`

Returns a basis of the algebra $A$ over the common base field.

## `AbsoluteBasis(A): AlgEtQ -> SeqEnum`

Returns a basis of the algebra $A$ over the prime field.

## `A . i: AlgEtQ, RngIntElt -> AlgEtQElt`

Returns the $i$-th element of the absolute basis of $A$.

## `AbsoluteCoordinates(seq, basis): SeqEnum[AlgEtQElt], SeqEnum[AlgEtQElt] -> SeqEnum`

Given a sequence of elements and a basis over the `PrimeField` returns a sequence whose entries are the coordinates in the `PrimeField` with respect to the given basis.

## `OrthogonalIdempotents(A): AlgEtQ -> SeqEnum`

Returns the orthogonal idempotent element of the étale algebra $A$.

## `Idempotents(A): AlgEtQ -> SeqEnum`

Returns the idempotent element of the étale algebra $A$.
