# Roots, Coroots and Reflections

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space. This is the default.

2. `"Root"`: the basis of simple (co)roots.

3. `"Weight"`: the basis of fundamental (co)weights (see Subsection [Weights](#subsectgrprflrootweight) below).

## Accessing Roots and Coroots

### `RootSpace(W): GrpMat -> Lat`

### `CorootSpace(W): GrpMat -> Lat`

The base space of the reflection group $W$. If $W$ is not a reflection group, an error occurs.

### `Example: Root Space (ex-16412e)`

```magma
> W := ComplexReflectionGroup("M", 3);
> RootSpace(W);
Full Vector space of degree 3 over Cyclotomic Field of order 24 and degree 8

```

### `SimpleOrders(W): GrpMat -> [RngIntElt]`

The sequence of simple orders of the reflection group $W$. If $W$ is not a reflection group, an error is flagged.

### `SimpleRoots(W): GrpMat -> Mtrx`

### `SimpleCoroots(W): GrpMat -> Mtrx`

The simple (co)roots of the reflection group $W$ as the rows of a matrix, i.e. $A$ (resp. $B$).

### `NumberOfPositiveRoots(W): GrpMat -> RngIntElt`

### `NumPosRoots(W): GrpMat -> RngIntElt`

The number of positive roots of the real reflection group $W$. This is also the number of positive coroots. The total number of (co)roots is twice the number of positive (co)roots. This number is finite if and only if $W$ is finite.

### `Roots(W): GrpMat -> SetIndx`

### `Coroots(W): GrpMat -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of (co)roots of the real reflection group $W$, i.e. $\{@\,\alpha_1,\dots\alpha_{2N}\,@\}$ (resp. $\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}$). If $W$ is infinite, an error is flagged.

### `PositiveRoots(W): GrpMat -> SetIndx`

### `PositiveCoroots(W): GrpMat -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of positive (co)roots of the real reflection group $W$, that is, $\{@\,\alpha_1,\dots\alpha_N\,@\}$ (resp. $\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}$). If $W$ is infinite, an error is flagged.

### `Root(W, r): GrpMat, RngIntElt -> SetIndx`

### `Coroot(W, r): GrpMat, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root $\alpha_r$ (resp. $\alpha_r^\star$) of the real reflection group $W$. If $W$ is infinite, an error is flagged.

### `RootPosition(W, v): GrpMat, . -> SetIndx`

### `CorootPosition(W, v): GrpMat, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root in the finite real reflection group $W$, return its index; otherwise return 0. These functions will try to coerce $v$ into the appropriate lattice; $v$ should be written with respect to the basis specified by the parameter `Basis`. If $W$ is infinite, an error is flagged.

### `Example: Roots Coroots (ex-194100)`

```magma
> W := ReflectionGroup("A3");
> Roots(W);
{@
    (1 0 0),
    (0 1 0),
    (0 0 1),
    (1 1 0),
    (0 1 1),
    (1 1 1),
    (-1  0  0),
    (0 -1  0),
    (0  0 -1),
    (-1 -1  0),
    (0 -1 -1),
    (-1 -1 -1)
@}
> PositiveCoroots(W);
{@
    (2 -1  0),
    (-1  2 -1),
    (0 -1  2),
    (1  1 -1),
    (-1  1  1),
    (1 0 1)
@}
> #Roots(W) eq 2*NumPosRoots(W);
true
> Root(W, 4);
(1 1 0)
> Root(W, 4 : Basis := "Root");
(1 1 0)
> RootPosition(W, [1,1,0]);
4
> A := Matrix(3,3,[1,0,0, -1,-1,-3, 1,2,4]);
> B := Matrix(3,3,[2,-1,0, -1,2,-1, 0,1,0]);
> W := ReflectionGroup(A,B);
> Roots(W);
{@
    (1 0 0),
    (-1 -1 -3),
    (1 2 4),
    (0 -1 -3),
    (0 1 1),
    (1 1 1),
    (-1  0  0),
    (1 1 3),
    (-1 -2 -4),
    (0 1 3),
    (0 -1 -1),
    (-1 -1 -1)
@}
> PositiveCoroots(W);
{@
    (2 -1  0),
    (-1  2 -1),
    (0 1 0),
    (1  1 -1),
    (-1  3 -1),
    (1  2 -1)
@}
> #Roots(W) eq 2*NumPosRoots(W);
true
> Root(W, 4);
(0 -1 -3)
> Root(W, 4 : Basis := "Root");
(1 1 0)
> RootPosition(W, [0,-1,-3]);
4

```

## Reflections

The root $\alpha$ acts on the root space via the reflection $s_\alpha$; the coroot $\alpha^\star$ acts on the coroot space via the coreflection $s_\alpha^\star$.

### `ReflectionMatrices(W): GrpMat -> [AlgMatElt]`

### `CoreflectionMatrices(W): GrpMat -> [AlgMatElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of reflections in the finite real reflection group $W$. The $r$th reflection in the sequence corresponds to the $r$th (co)root.

### `SimpleReflectionMatrices(W): GrpMat -> [AlgMatElt]`

### `SimpleCoreflectionMatrices(W): GrpMat -> [AlgMatElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrices giving the action of the simple (co)roots on the (co)root space of the finite real reflection group $W$.

### `ReflectionMatrix(W, r): GrpMat, RngIntElt -> AlgMatElt`

### `CoreflectionMatrix(W, r): GrpMat, RngIntElt -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The reflection in finite real reflection group $W$ corresponding to the $r$th (co)root. If $r=1,\dots,n$, this is a generator of $W$.

### `SimpleReflectionPermutations(W): GrpMat -> []`

The sequence of permutations giving the action of the simple (co)roots of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

### `ReflectionPermutations(W): GrpMat -> []`

The sequence of permutations giving the action of the (co)roots of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

### `ReflectionPermutation(W, r): GrpMat, RngIntElt -> []`

The permutation giving the action of the $r$th (co)root of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

### `ReflectionWords(W): GrpMat -> []`

The sequence of words in the simple reflections for all the reflections of the real reflection group $W$. These words are given as sequences of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWords(W)[r]}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

### `ReflectionWord(W, r): GrpMat, RngIntElt -> []`

The word in the simple reflections for the $r$th reflection of the real reflection group $W$. The word is given as a sequence of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWord(W,r)}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

### `Example: Action (ex-a49ddd)`

```magma
> Q := RationalField();
> W := ReflectionGroup("A3");
> mx := ReflectionMatrix(W, 4);
> perm := ReflectionPermutation(W, 4);
> RootPosition(W, Vector(Q, Eltseq(Root(W,2))) * mx) eq 2^perm;
true
> mx := CoreflectionMatrix(W, 4);
> CorootPosition(W, Coroot(W,2) * mx) eq 2^perm;
true

```

### `Length(w): GrpMatElt -> RngIntElt`

### `CoxeterLength(w): GrpMatElt -> RngIntElt`

The length of $w$ as an element of the Coxeter group $W$, i.e. the number of positive roots of $W$ which become negative under the action of $w$.

## Weights

### `WeightLattice(W): GrpMat -> Lat`

### `CoweightLattice(W): GrpMat -> Lat`

The (co)weight lattice of the real reflection group $W$. The roots and coroots of $W$ must have integral components.

### `FundamentalWeights(W): GrpMat -> Mtrx`

### `FundamentalCoweights(W): GrpMat -> Mtrx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental weights of the real reflection group $W$ given as the rows of a matrix. The roots and coroots of $W$ must have integral components.

### `Example: Weights (ex-843e25)`

```magma
> W := ReflectionGroup("E6");
> WeightLattice(W);
Lattice of rank 6 and degree 6
Basis:
(4  3  5  6  4  2)
(3  6  6  9  6  3)
(5  6 10 12  8  4)
(6  9 12 18 12  6)
(4  6  8 12 10  5)
(2  3  4  6  5  4)
Basis Denominator: 3
> FundamentalWeights(W);
[ 4/3    1  5/3    2  4/3  2/3]
[   1    2    2    3    2    1]
[ 5/3    2 10/3    4  8/3  4/3]
[   2    3    4    6    4    2]
[ 4/3    2  8/3    4 10/3  5/3]
[ 2/3    1  4/3    2  5/3  4/3]

```

### `IsDominant(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

Returns `true` if and only if $v$ is a dominant weight for the root datum $R$, ie, a nonnegative integral linear combination of the fundamental weights.

### `DominantWeight(W, v): GrpMat, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique dominant weight in the same $W$-orbit as $v$, where $W$ is a real reflection group and $v$ is a weight given as a vector or a sequence representing a vector. The second value returned is a Coxeter group element taking $v$ to the dominant weight.

### `WeightOrbit(W, v): GrpMat, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $W$-orbit of $v$ as an indexed set, where $W$ is a real reflection group and $v$ is a weight given as a vector or a sequence representing a vector. The first element in the orbit is always dominant. The second value returned is a sequence of Coxeter group words taking the weight $v$ to the corresponding element of the orbit.

### `Example: Dominant Weights (ex-a17dda)`

```magma
> W := CoxeterGroup("B3");
> DominantWeight(W, [1,-1,0] : Basis:="Weight");
(1 0 0)
$.2 * $.3 * $.2 * $.1
> #WeightOrbit(W, [1,-1,0] : Basis:="Weight");
6

```
