# Roots, Coroots and Reflections

The functions in this section give access to the underlying root system (or datum) of a permutation Coxeter group. These functions do not apply to finitely presented Coxeter groups

Roots are stored as an indexed set

$$
\{@\; \alpha_1,\dots,\alpha_N,\alpha_{N+1},\dots,\alpha_{2N} \; @\},
$$

where $\alpha_1,\dots,\alpha_N$ are the positive roots in an order compatible with height; and $\alpha_{N+1},\dots,\alpha_{2N}$ are the corresponding negative roots (i.e. $\alpha_{i+N}=-\alpha_i$). The simple roots are $\alpha_1,\dots,\alpha_n$ where $n$ is the rank.

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](#subsectgrppermcoxrootweight) below).

## Accessing Roots and Coroots

### `RootSpace(W): GrpPermCox -> .`

### `CorootSpace(W): GrpPermCox -> .`

The (co)root space of the Coxeter group $W$. This can be a vector space over a field of characteristic zero (Chapter [Vector Spaces](../../MatricesLinearAlgebra/VectorSpaces/index-vector-spaces.md#chapvectspace)), or an integer lattice in the crystallographic case (Chapter [Lattices](../../LatticesQuadraticForms/Lattices/index-lattices.md#chaplat)). The (co)reflection group of $W$ acts on the (co)root space.

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

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

The simple (co)roots of the Coxeter group $W$ as the rows of a matrix.

### `Example: Root Space (ex-18ee8e)`

```magma
> W := CoxeterGroup("G2");
> RootSpace(W);
Full Vector space of degree 2 over Rational Field
> CorootSpace(W);
Full Vector space of degree 2 over Rational Field
> SimpleRoots(W);
[1 0]
[0 1]
> SimpleCoroots(W);
[ 2 -3]
[-1  2]
> CartanMatrix(W);
[ 2 -1]
[-3  2]

```

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

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

The number of positive roots of the Coxeter group $W$.

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

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

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

An indexed set containing the (co)roots of the Coxeter group $W$.

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

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

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

An indexed set containing the positive (co)roots of the Coxeter group $W$.

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

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

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

The $r$th (co)root of the Coxeter group $W$.

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

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

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

If $v$ is a (co)root of the Coxeter group $W$, this returns its position; otherwise it returns 0. These functions will try to coerce $v$, which can be a vector or a sequence representing a vector, into the appropriate vector space; $v$ should be written with respect to the basis specified by the parameter `Basis`.

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

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

```

### `HighestRoot(W): GrpPermCox -> .`

### `HighestLongRoot(W): GrpPermCox -> .`

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

The unique (long) root of greatest height of the irreducible Coxeter group $W$.

### `HighestShortRoot(W): GrpPermCox -> .`

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

The unique short root of greatest height of the irreducible Coxeter group $W$.

### `Example: Heighest Roots (ex-3e3fcd)`

```magma
> W := RootDatum("G2");
> HighestRoot(W);
(3 2)
> HighestLongRoot(W);
(3 2)
> HighestShortRoot(W);
(2 1)

```

### `CoxeterForm(W): GrpPermCox -> AlgMatElt`

### `DualCoxeterForm(W): GrpPermCox -> AlgMatElt`

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

The matrix of an inner product on the (co)root space of the finite Coxeter group $W$ which is invariant under the action of $W$. This inner product is uniquely determined up to a constant on each irreducible component of $W$. The inner product is normalised so that the short roots in each crystallographic component have length one.

### `AdditiveOrder(W): GrpPermCox -> SeqEnum`

An additive order on the positive roots of the finite Coxeter group $W$, i.e. a sequence containing the numbers $1,\dots,N$ in some order such that $\alpha_r+\alpha_s=\alpha_t$ implies $t$ is between $r$ and $s$. This is computed using the techniques of Papi [[Papi, 1994](../../references.md#cite-papi)].

### `PapiOrder(W, w): GrpPermCox, GrpPermElt -> SeqEnum`

### `PapiOrder(W, wd): GrpPermCox, SeqEnum[RngIntElt] -> SeqEnum`

An additive order for the set of positive roots of the finite Coxeter group $W$ sent negative by $w^{-1}$. The element $w$ can be supplied either as an element of the permutation group $W$ or as a sequence representing a word in its generators.

## Operations and Properties for Root and Coroot Indices

### `Sum(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The index of the sum of the $r$th and $s$th roots in the Coxeter group $W$, or 0 if the sum is not a root. In other words, if $t = \hbox{\tt Sum(W,r,s)} \ne 0$ then $\alpha_t=\alpha_r+\alpha_s$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

### `IsPositive(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the Coxeter group $W$ is a positive root.

### `IsNegative(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the Coxeter group $W$ is a negative root.

### `Negative(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The index of the negative of the $r$th (co)root of the Coxeter group $W$. In other words, if $s = \hbox{\tt Negative(W,r)}$ then $\alpha_s=-\alpha_r$.

### `LeftString(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

Root indices in the Coxeter group $W$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s-\alpha_r,\alpha_s-2\alpha_r,\dots,\alpha_s-p\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_p]$ where $\alpha_{r_i}=\alpha_s-i\alpha_r$ and $\alpha_s-(p+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

### `RightString(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

Root indices of the Coxeter group $W$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s+\alpha_r,\alpha_s+2\alpha_r,\dots,\alpha_s+q\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_q]$ where $\alpha_{r_i}=\alpha_s+i\alpha_r$ and $\alpha_s+(q+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

### `LeftStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The largest $p$ such that $\alpha_s-p\alpha_r$ is a root of the Coxeter group $W$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

### `RightStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The largest $q$ such that $\alpha_s+q\alpha_r$ is a root of the Coxeter group $W$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

### `Example: Root Arithmetic (ex-9ecc9b)`

```magma
> W := RootDatum("G2");
> Sum(W, 1, Negative(W,5));
10
> IsPositive(W, 10);
false
> Negative(W, 10);
4
> P := PositiveRoots(W);
> P[1] - P[5] eq -P[4];
true

```

### `RootHeight(W, r): GrpPermCox, RngIntElt -> RngIntElt`

### `CorootHeight(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The height of the $r$th (co)root of the Coxeter group $W$, i.e. the sum of the coefficients of $\alpha_r$ (respectively, $\alpha_r^\star$) with respect to the simple (co)roots.

### `RootNorms(W): GrpPermCox -> [RngIntElt]`

### `CorootNorms(W): GrpPermCox -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the Coxeter group $W$.

### `RootNorm(W, r): GrpPermCox, RngIntElt -> RngIntElt`

### `CorootNorm(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the Coxeter group $W$.

### `IsLongRoot(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the Coxeter group $W$ is long, i.e. the $r$th coroot is short. An error is flagged unless $W$ is irreducible and crystallographic.

### `IsShortRoot(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the Coxeter group $W$ is short, i.e. the $r$th coroot is long. An error is flagged unless $W$ is irreducible and crystallographic.

### `Example: Root Operations (ex-237223)`

```magma
> W := RootDatum("G2");
> RootHeight(W, 5);
4
> F := CoxeterForm(W);
> v := VectorSpace(Rationals(),2) ! Root(W, 5);
> (v*F, v) eq RootNorm(W, 5);
true
> IsLongRoot(W, 5);
true
> LeftString(W, 1, 5);
[ 4, 3, 2 ]
> roots := Roots(W);
> for i in [1..3] do
>   RootPosition(W, roots[5]-i*roots[1]);
> end for;
4
3
2

```

## Weights

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

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

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

### `FundamentalWeights(W): GrpPermCox -> SeqEnum`

### `FundamentalCoweights(W): GrpPermCox -> SeqEnum`

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

The fundamental (co)weights of the Coxeter group $W$. The roots and coroots of $W$ must have integral components.

### `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): GrpPermCox, . -> ModTupFldElt, GrpFPCoxElt`

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

The unique element in the $W$-orbit of the weight $v$ which lies in the fundamental Weyl chamber, and the word in the generators which sends $v$ to this element. The Coxeter group $W$ must have a root datum. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

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

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

The orbit of the weight $v$ under the action of $W$. The Coxeter group $W$ must have a root datum. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

### `Example: Dominant Weights (ex-181d61)`

```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

```
