# Invariants

Converting an algebra to a tensor enables Magma to compute standard invariants of any algebra. We note that there are known errors for ${\mathbb{R}}$ and ${\mathbb{C}}$ due to the numerical stability of the linear algebra involved in the computations.

## `Center(A): Alg -> Alg`

## `Centre(A): Alg -> Alg`

Returns the center of the algebra $A$.

## `Centroid(A): Alg -> AlgMat`

Returns the centroid of the $K$-algebra $A$ as a subalgebra of $\rm{End}_K(A)$.

## `Example: Center Centroids (ex-ebe4ae)`

We will construct a representation of $\rm{SL}_2(9)$ in $\rm{Mat}_4({\bf F}_{3})$. First we construct $\rm{GL}_2(9)$ from $\rm{Mat}_4({\bf F}_{3})$.

```magma
> M := MatrixAlgebra(GF(3), 4);
> f := ConwayPolynomial(3, 2);
> C := CompanionMatrix(f);
> I := IdentityMatrix(GF(3), 2);
> A := sub< M | [InsertBlock(M!0, X, i, j) :
>     X in [I, C], i in [1, 3], j in [1, 3]] >;
> T := CommutatorTensor(A);
> T;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 8 over GF(3)
U1 : Full Vector space of degree 8 over GF(3)
U0 : Full Vector space of degree 8 over GF(3)
> GL2 := HeisenbergAlgebra(T);
> GL2;
Algebra of dimension 8 with base ring GF(3)

```

Our Lie algebra is not simple as it has a nontrivial center, so we will obtain $\rm{SL}_2$ by factoring out the center. Note that our algebras are over the prime field ${\bf F}_{3}$, so the center is 2-dimensional (over ${\bf F}_{3}$). Notice that $\rm{SL}_2(9)$ has a trivial center but has a 2-dimensional centroid.

```magma
> SL2 := GL2/Center(GL2);
> SL2;
Algebra of dimension 6 with base ring GF(3)
> Center(SL2);
Algebra of dimension 0 with base ring GF(3)
> Centroid(SL2);
Matrix Algebra of degree 6 with 2 generators over GF(3)

```

## `LeftNucleus(A): Alg -> AlgMat`

## `RightNucleus(A): Alg -> AlgMat`

## `MidNucleus(A): Alg -> AlgMat`

Returns the nucleus of the algebra $A$ as a subalgebra of the enveloping algebra of right multiplication ${\cal R}(A)$.

## `DerivationAlgebra(A): Alg -> AlgMatLie`

Returns the derivation algebra of the algebra $A$ as a Lie subalgebra of $\rm{End}_K(A)$.

## `Example: Derivation Alg (ex-8c0a5c)`

We will compute the derivation algebra of the (rational) octonions $O$ and also the 27 dimension exceptional Jordan algebra ${\cal H}_3( O )$. Because the intrinsics use exact linear algebra, we do not use the more familiar field ${\mathbb{C}}$ in this context. First we consider $O$. We verify that $\rm{Der}( O )\cong G_2$.

```magma
> A := OctonionAlgebra(Rationals(), -1, -1, -1);
> A;
Algebra of dimension 8 with base ring Rational Field
> D := DerivationAlgebra(A);
> D;
Matrix Lie Algebra of degree 8 over Rational Field
> SemisimpleType(D);
G2

```

Now we will just briefly perform a sanity check and verify that `D` acts as it should.

```magma
> a := Random(Basis(A));
> b := Random(Basis(A));
> del := Random(Basis(D));
> (a*b)*del eq (a*del)*b + a*(b*del);
true

```

Finally, we construct ${\cal H}_3( O )$ the $3\times 3$ Hermitian matrices, and we verify that $\rm{Der}({\cal H}_3( O )\cong F_4$.

```magma
> J := ExceptionalJordanCSA(A);
> J;
Algebra of dimension 27 with base ring Rational Field
> D_J := DerivationAlgebra(J);
> Dimension(D_J);
52
> SemisimpleType(D_J);
F4

```

## `Example: Alg Invariants (ex-a850f6)`

We demonstrate further how to use these functions to get invariants of nonassociative algebras. First, we will obtain the derivation Lie algebra of the Octonions, which are of type $G_2$.

```magma
> A := OctonionAlgebra(GF(7),-1,-1,-1);
> A;
Algebra of dimension 8 with base ring GF(7)
> D := DerivationAlgebra(A);
> D.1;
[0 0 0 0 0 0 0 0]
[0 0 6 0 6 3 2 1]
[0 1 0 3 4 1 1 3]
[0 0 4 0 6 4 2 3]
[0 1 3 1 0 6 2 0]
[0 4 6 3 1 0 6 2]
[0 5 6 5 5 1 0 4]
[0 6 4 4 0 5 3 0]
> Dimension(D);
14
> SemisimpleType(D);
G2

```

Now we will show that the left, mid, and right nuclei are all one dimensional. All of which are generated by $R_1$, multiplication by $1_A$.

```magma
> Z := Center(A);
> Z;
Algebra of dimension 1 with base ring GF(7)
>
> L := LeftNucleus(A);
> L;
Matrix Algebra of degree 8 with 1 generator over GF(7)
> L.1;
[1 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 0 0 1 0 0 0 0]
[0 0 0 0 1 0 0 0]
[0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 1]
>
> L eq MidNucleus(A);
true
> L eq RightNucleus(A);
true

```
