# Operations on Elements

## `x + y: AlgLieElt, AlgLieElt -> AlgLieElt`

## `x + y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

## `x - y: AlgLieElt, AlgLieElt -> AlgLieElt`

## `x - y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

## `x * y: AlgLieElt, AlgLieElt -> AlgLieElt`

## `x * y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

## `IsCentral(L, M): AlgLie, AlgLieElt -> BoolElt`

## `IsCentral(L, M): AlgMatLie, AlgMatLieElt -> BoolElt`

Given an element $x$ of the Lie algebra $L$, return `true` if $x$ is central in $L$.

## `NonNilpotentElement(L): AlgLie -> AlgLieElt`

Given a (structure constant) Lie algebra $L$, this function returns an element of $L$ that is *not* nilpotent, or the zero element of $L$ if no such element exists.

The algorithm follows [[de Graaf, 2000](../../references.md#cite-wdg-lie-alg)], §2.7.

## `Example: Non Nilpotent Element (ex-a38e8a)`

We construct a non-nilpotent element of a Lie algebra.

```magma
> L:=LieAlgebra("G2",RationalField());
> NonNilpotentElement(L);
(0 0 0 0 0 1 0 0 0 0 0 0 0 0)

```

## `AdjointMatrix(L, x): AlgLie, AlgLieElt -> AlgMatLieElt`

## `RightAdjointMatrix(L, x): AlgLie, AlgLieElt -> AlgMatLieElt`

Given a (structure constant) Lie algebra $L$ and an element $x$ of a subalgebra or ideal of $L$, return the matrix of ${\rm ad} x$ as an element of a matrix Lie algebra.

## `Example: Other (ex-c4c36f)`

```magma
> L:=LieAlgebra("B2",RationalField());
> AdjointMatrix(L, L.1);
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 1  0  0  0  0  0  0  0  0  0]
[ 2  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0 -1  0  0  0  0  0  0  0  0]
[ 0  0  1  0  0  0  0  0  0  0]
[ 0  0  0  0  0 -1  0  0  0  0]

```

## Indexing

### `a[i]: AlgLieElt, RngIntElt -> RngElt`

### `a[i]: AlgMatLieElt, RngIntElt -> ModTupRngElt`

If $a$ is an element of a structure constant Lie algebra $L$ of dimension $n$ and $1 \leq i\leq n$ is a positive integer, then the $i$-th component of the element $a$ is returned (as an element of the base ring $R$ of $L$).

If $a$ is an element of a matrix Lie algebra $L$ of degree $n$ and $1 \leq i \leq n$ then the $i$th row of the matrix $a$ is returned.

### `a[i] := r: AlgLieElt, RngIntElt, RngElt -> AlgLieElt`

### `a[i] := r: AlgMatLieElt, RngIntElt, ModTupRngElt -> AlgMatLieElt`

Given an element $a$ belonging to a structure constant Lie algebra of dimension $n$ over $R$, a positive integer $1 \leq i\leq n$ and an element $r \in R$, the $i$-th component of the element $a$ is redefined to be $r$.

If $a$ is an element of a matrix Lie algebra $L$ of degree $n$ over $R$ and $1 \leq i \leq n$, the $i$th row of the matrix $a$ is redefined to be the vector $r$ over $R$.

### `a[i, j]: AlgMatLieElt, RngIntElt, RngIntElt -> RngElt`

### `a[i, j] := r: AlgMatLieElt, RngIntElt, RngIntElt, RngElt -> AlgMatLieElt`

For an element $a$ of a matrix Lie algebra $L$ of degree $n$ and integers $1 \leq i, j \leq n$ return the element in the $i$th row and $j$th column of $a$ or set this element to be $r$ where $r$ is an element of the coefficient ring of $L$.
