---
title: "Roots, Coroots, and Weights"
canonical: "https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/roots-coroots-weights.html"
source: "https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/roots-coroots-weights.md"
part: "Lie Theory"
chapter: "Root Data"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Lie Theory", "source": "https://docs.magma-maths.org/v2.30-1/LieTheory/index-lie-theory.md"}
  - {"title": "Root Data", "source": "https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/index-root-data.md"}
prev: {"title": "Properties of Root Data", "source": "https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/properties-root-datum.md"}
next: {"title": "Building Root Data", "source": "https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/create-new-root-datum.md"}
intrinsics:
  - {"name": "RootSpace", "signature": "RootSpace(R): RootStr -> ModTupFld"}
  - {"name": "CorootSpace", "signature": "CorootSpace(R): RootStr -> ModTupFld"}
  - {"name": "FullRootLattice", "signature": "FullRootLattice(R): RootDtm -> Lat, Map"}
  - {"name": "FullCorootLattice", "signature": "FullCorootLattice(R): RootDtm -> Lat, Map"}
  - {"name": "RootLattice", "signature": "RootLattice(R): RootDtm -> Lat, Map"}
  - {"name": "CorootLattice", "signature": "CorootLattice(R): RootDtm -> Lat, Map"}
  - {"name": "IsRootSpace", "signature": "IsRootSpace(V): ModTupFld -> BoolElt"}
  - {"name": "IsCorootSpace", "signature": "IsCorootSpace(V): ModTupFld -> BoolElt"}
  - {"name": "IsInRootSpace", "signature": "IsInRootSpace(v): ModTupFldElt -> BoolElt"}
  - {"name": "IsCorootSpace", "signature": "IsCorootSpace(v): ModTupFldElt -> BoolElt"}
  - {"name": "RootDatum", "signature": "RootDatum(V): ModTupFld -> RootDtm"}
  - {"name": "ZeroRootLattice", "signature": "ZeroRootLattice(R): RootDtm -> Lat"}
  - {"name": "ZeroRootSpace", "signature": "ZeroRootSpace(R): RootDtm -> ModTupFld, Map"}
  - {"name": "RelativeRootSpace", "signature": "RelativeRootSpace(R): RootDtm -> ModTupFld, Map"}
  - {"name": "SimpleRoots", "signature": "SimpleRoots(R): RootStr -> Mtrx"}
  - {"name": "SimpleCoroots", "signature": "SimpleCoroots(R): RootStr -> Mtrx"}
  - {"name": "NumberOfPositiveRoots", "signature": "NumberOfPositiveRoots(R): RootStr -> RngIntElt"}
  - {"name": "NumPosRoots", "signature": "NumPosRoots(R): RootStr -> RngIntElt"}
  - {"name": "Roots", "signature": "Roots(R): RootStr -> SetIndx"}
  - {"name": "Coroots", "signature": "Coroots(R): RootStr -> SetIndx"}
  - {"name": "PositiveRoots", "signature": "PositiveRoots(R): RootStr -> SetIndx"}
  - {"name": "PositiveCoroots", "signature": "PositiveCoroots(R): RootStr -> SetIndx"}
  - {"name": "Root", "signature": "Root(R, r): RootStr, RngIntElt -> SetIndx"}
  - {"name": "Coroot", "signature": "Coroot(R, r): RootStr, RngIntElt -> SetIndx"}
  - {"name": "RootPosition", "signature": "RootPosition(R, v): RootStr, . -> SetIndx"}
  - {"name": "CorootPosition", "signature": "CorootPosition(R, v): RootStr, . -> SetIndx"}
  - {"name": "BasisChange", "signature": "BasisChange(R, v): RootStr, Any -> SeqEnum"}
  - {"name": "IsInRootSpace", "signature": "IsInRootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt"}
  - {"name": "IsInCorootSpace", "signature": "IsInCorootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt"}
  - {"name": "HighestRoot", "signature": "HighestRoot(R): RootStr -> ."}
  - {"name": "HighestCoroot", "signature": "HighestCoroot(R): RootStr -> ."}
  - {"name": "HighestLongRoot", "signature": "HighestLongRoot(R): RootStr -> ."}
  - {"name": "HighestLongCoroot", "signature": "HighestLongCoroot(R): RootStr -> ."}
  - {"name": "HighestShortRoot", "signature": "HighestShortRoot(R): RootStr -> ."}
  - {"name": "HighestShortCoroot", "signature": "HighestShortCoroot(R): RootStr -> ."}
  - {"name": "RelativeRoots", "signature": "RelativeRoots(R): RootDtm -> SetIndx"}
  - {"name": "PositiveRelativeRoots", "signature": "PositiveRelativeRoots(R): RootDtm -> SetIndx"}
  - {"name": "NegativeRelativeRoots", "signature": "NegativeRelativeRoots(R): RootDtm -> SetIndx"}
  - {"name": "SimpleRelativeRoots", "signature": "SimpleRelativeRoots(R): RootDtm -> SetIndx"}
  - {"name": "RelativeRootDatum", "signature": "RelativeRootDatum(R): RootDtm -> RootDtm"}
  - {"name": "GammaOrbitsRepresentatives", "signature": "GammaOrbitsRepresentatives(R, delta): RootDtm, RngIntElt -> SeqEnum"}
  - {"name": "CoxeterForm", "signature": "CoxeterForm(R): RootDtm -> AlgMatElt"}
  - {"name": "DualCoxeterForm", "signature": "DualCoxeterForm(R): RootDtm -> AlgMatElt"}
  - {"name": "SimpleReflectionMatrices", "signature": "SimpleReflectionMatrices(R): RootDtm -> []"}
  - {"name": "SimpleCoreflectionMatrices", "signature": "SimpleCoreflectionMatrices(R): RootDtm -> []"}
  - {"name": "ReflectionMatrices", "signature": "ReflectionMatrices(R): RootDtm -> []"}
  - {"name": "CoreflectionMatrices", "signature": "CoreflectionMatrices(R): RootDtm -> []"}
  - {"name": "ReflectionMatrix", "signature": "ReflectionMatrix(R, r): RootDtm, RngIntElt -> []"}
  - {"name": "CoreflectionMatrix", "signature": "CoreflectionMatrix(R, r): RootDtm, RngIntElt -> []"}
  - {"name": "SimpleReflectionPermutations", "signature": "SimpleReflectionPermutations(R): RootDtm -> []"}
  - {"name": "ReflectionPermutations", "signature": "ReflectionPermutations(R): RootDtm -> []"}
  - {"name": "ReflectionPermutation", "signature": "ReflectionPermutation(R, r): RootDtm, RngIntElt -> []"}
  - {"name": "ReflectionWords", "signature": "ReflectionWords(R): RootDtm -> []"}
  - {"name": "ReflectionWord", "signature": "ReflectionWord(R, r): RootDtm, RngIntElt -> []"}
  - {"name": "Sum", "signature": "Sum(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt"}
  - {"name": "IsPositive", "signature": "IsPositive(R, r): RootStr, RngIntElt -> BoolElt"}
  - {"name": "IsNegative", "signature": "IsNegative(R, r): RootStr, RngIntElt -> BoolElt"}
  - {"name": "Negative", "signature": "Negative(R, r): RootStr, RngIntElt -> RngIntElt"}
  - {"name": "LeftString", "signature": "LeftString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt"}
  - {"name": "RightString", "signature": "RightString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt"}
  - {"name": "LeftStringLength", "signature": "LeftStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt"}
  - {"name": "RightStringLength", "signature": "RightStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt"}
  - {"name": "RootHeight", "signature": "RootHeight(R, r): RootStr, RngIntElt -> RngIntElt"}
  - {"name": "CorootHeight", "signature": "CorootHeight(R, r): RootStr, RngIntElt -> RngIntElt"}
  - {"name": "RootNorms", "signature": "RootNorms(R): RootStr -> [RngIntElt]"}
  - {"name": "CorootNorms", "signature": "CorootNorms(R): RootStr -> [RngIntElt]"}
  - {"name": "RootNorm", "signature": "RootNorm(R, r): RootStr, RngIntElt -> RngIntElt"}
  - {"name": "CorootNorm", "signature": "CorootNorm(R, r): RootStr, RngIntElt -> RngIntElt"}
  - {"name": "IsLongRoot", "signature": "IsLongRoot(R, r): RootStr, RngIntElt -> BoolElt"}
  - {"name": "IsShortRoot", "signature": "IsShortRoot(R, r): RootStr, RngIntElt -> BoolElt"}
  - {"name": "IsIndivisibleRoot", "signature": "IsIndivisibleRoot(R, r): RootStr, RngIntElt -> BoolElt"}
  - {"name": "RootClosure", "signature": "RootClosure(R, S): RootDtm, SetEnum[RngIntElt] -> SetEnum[RngIntElt]"}
  - {"name": "AdditiveOrder", "signature": "AdditiveOrder(R): RootStr -> SeqEnum"}
  - {"name": "IsAdditiveOrder", "signature": "IsAdditiveOrder(R, Q): RootStr, [RngIntElt] -> BoolElt"}
  - {"name": "WeightLattice", "signature": "WeightLattice(R): RootDtm -> Lat"}
  - {"name": "CoweightLattice", "signature": "CoweightLattice(R): RootDtm -> Lat"}
  - {"name": "FundamentalWeights", "signature": "FundamentalWeights(R): RootDtm -> Mtrx"}
  - {"name": "FundamentalCoweights", "signature": "FundamentalCoweights(R): RootDtm -> Mtrx"}
  - {"name": "IsDominant", "signature": "IsDominant(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt"}
  - {"name": "DominantWeight", "signature": "DominantWeight(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt"}
  - {"name": "WeightOrbit", "signature": "WeightOrbit(R, v): RootDtm, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]"}
examples:
  - "ex-f812ae"
  - "ex-ddfc7e"
  - "ex-b96105"
  - "ex-f22cf4"
  - "ex-a8cbef"
  - "ex-bec95e"
  - "ex-458120"
  - "ex-15650f"
  - "ex-1c59aa"
  - "ex-24f6a0"
  - "ex-28403f"
  - "ex-4bce9a"
---

<a id="roots-coroots-weights"></a>
<a id="sectrdroot"></a>
# Roots, Coroots, and Weights

The 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](https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/roots-coroots-weights.md#subsectrdrootweight) below).

<a id="access"></a>
<a id="subsectrdrootaccess"></a>
## Accessing Roots and Coroots

<a id="function-rootspace-rootstr"></a>
### `RootSpace(R): RootStr -> ModTupFld`

<a id="function-corootspace-rootstr"></a>
### `CorootSpace(R): RootStr -> ModTupFld`

The vector space containing the (co)roots of the root datum $R$, i.e. $X\otimes{\mathbb{Q}}$ (respectively, $Y\otimes{\mathbb{Q}}$).

<a id="function-fullrootlattice-rootdtm"></a>
### `FullRootLattice(R): RootDtm -> Lat, Map`

<a id="function-fullcorootlattice-rootdtm"></a>
### `FullCorootLattice(R): RootDtm -> Lat, Map`

The lattice containing the (co)roots of the root datum $R$, i.e. $X$ (respectively, $Y$). An inclusion map into the (co)root space of $R$ is returned as the second value.

<a id="function-rootlattice-rootdtm"></a>
### `RootLattice(R): RootDtm -> Lat, Map`

<a id="function-corootlattice-rootdtm"></a>
### `CorootLattice(R): RootDtm -> Lat, Map`

The lattice spanned by the (co)roots of the root datum $R$. An inclusion map into the (co)root space of $R$ is returned as the second value.

<a id="example-ex-f812ae"></a>
### `Example: Root Space and Root Lattices (ex-f812ae)`

The root space, full root lattice, and the root lattice of the standard root datum of type $A_2$:

```magma
> R := StandardRootDatum("A",2);
> V := RootSpace(R);
> FullRootLattice(R);
Standard Lattice of rank 3 and degree 3
Mapping from: Standard Lattice of rank 3 and degree 3 to ModTupFld: V
> RootLattice(R);
Lattice of rank 2 and degree 3
Basis:
( 1 -1  0)
( 0  1 -1)
Mapping from: Lattice of rank 2 and degree 3 to ModTupFld: V
```

<a id="function-isrootspace-modtupfld"></a>
### `IsRootSpace(V): ModTupFld -> BoolElt`

<a id="function-iscorootspace-modtupfld"></a>
### `IsCorootSpace(V): ModTupFld -> BoolElt`

Return `true` if, and only if, $V$ is the (co)root space of some root datum.

<a id="function-isinrootspace-modtupfldelt"></a>
### `IsInRootSpace(v): ModTupFldElt -> BoolElt`

<a id="function-iscorootspace-modtupfldelt"></a>
### `IsCorootSpace(v): ModTupFldElt -> BoolElt`

Return `true` if, and only if, $V$ is an element of the (co)root space of some root datum.

<a id="function-rootdatum-modtupfld"></a>
### `RootDatum(V): ModTupFld -> RootDtm`

If $V$ is the (co)root space of some root datum, this returns the datum.

<a id="example-ex-ddfc7e"></a>
### `Example: Recognising a Root Space (ex-ddfc7e)`

```magma
> R := RootDatum("a3");
> V := RootSpace(R);
> v := V.1;
> IsRootSpace(V);
true
> RootDatum(V);
R: Adjoint root datum of dimension 3 of type A3
> IsInRootSpace(v);
true
```

<a id="function-zerorootlattice-rootdtm"></a>
### `ZeroRootLattice(R): RootDtm -> Lat`

<a id="function-zerorootspace-rootdtm"></a>
### `ZeroRootSpace(R): RootDtm -> ModTupFld, Map`

For the given root datum $R$, return the lattice $X_0$ and the vector space $X_0\otimes{\mathbb{Q}}$, respectively (see Section [Extended Root Data](https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/introduction.md#subsectextrd)).

<a id="function-relativerootspace-rootdtm"></a>
### `RelativeRootSpace(R): RootDtm -> ModTupFld, Map`

For the given root datum $R$, return the vector space $\bar{X} = (X\otimes{\mathbb{Q}})/(X_0\otimes{\mathbb{Q}})$ containing the relative roots (see Section [Extended Root Data](https://docs.magma-maths.org/v2.30-1/LieTheory/RootData/introduction.md#subsectextrd)). The projection from $X\otimes{\mathbb{Q}}$ onto $\bar{X}$ is returned as second return value.

<a id="function-simpleroots-rootstr"></a>
### `SimpleRoots(R): RootStr -> Mtrx`

<a id="function-simplecoroots-rootstr"></a>
### `SimpleCoroots(R): RootStr -> Mtrx`

The simple (co)roots of the root datum $R$ as the rows of a matrix, i.e. $A$ (respectively, $B$).

<a id="example-ex-b96105"></a>
### `Example: Spaces and Lattices of a G2 Root Datum (ex-b96105)`

```magma
> R := RootDatum("G2");
> RootSpace(R);
Full Vector space of degree 2 over Rational Field
> FullRootLattice(R);
Standard Lattice of rank 2 and degree 2
Mapping from: Standard Lattice of rank 2 and degree 2 to Full Vector space of
degree 2 over Rational Field
> RootLattice(R);
Standard Lattice of rank 2 and degree 2
Mapping from: Standard Lattice of rank 2 and degree 2 to Full Vector space of
degree 2 over Rational Field
> CorootSpace(R);
Full Vector space of degree 2 over Rational Field
> SimpleRoots(R);
[1 0]
[0 1]
> SimpleCoroots(R);
[ 2 -3]
[-1  2]
> CartanMatrix(R);
[ 2 -1]
[-3  2]
> Rank(R) eq Dimension(R);
true
```

<a id="function-numberofpositiveroots-rootstr"></a>
### `NumberOfPositiveRoots(R): RootStr -> RngIntElt`

<a id="function-numposroots-rootstr"></a>
### `NumPosRoots(R): RootStr -> RngIntElt`

The number of positive roots of the root datum $R$. This is also the number of positive coroots. The total number of (co)roots is twice the number of positive (co)roots.

<a id="function-roots-rootstr"></a>
### `Roots(R): RootStr -> SetIndx`

<a id="function-coroots-rootstr"></a>
### `Coroots(R): RootStr -> SetIndx`

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

The indexed set of (co)roots of the root datum $R$, i.e. $\{@\,\alpha_1,\dots\alpha_{2N}\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}$).

<a id="function-positiveroots-rootstr"></a>
### `PositiveRoots(R): RootStr -> SetIndx`

<a id="function-positivecoroots-rootstr"></a>
### `PositiveCoroots(R): RootStr -> SetIndx`

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

The indexed set of positive (co)roots of the root datum $R$, i.e. $\{@\,\alpha_1,\dots\alpha_N\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}$).

<a id="function-root-rootstr-rngintelt"></a>
### `Root(R, r): RootStr, RngIntElt -> SetIndx`

<a id="function-coroot-rootstr-rngintelt"></a>
### `Coroot(R, r): RootStr, RngIntElt -> SetIndx`

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

The $r$th (co)root $\alpha_r$ (respectively, $\alpha_r^\star$) of the root datum $R$.

<a id="function-rootposition-rootstr"></a>
### `RootPosition(R, v): RootStr, . -> SetIndx`

<a id="function-corootposition-rootstr"></a>
### `CorootPosition(R, v): RootStr, . -> SetIndx`

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

If $v$ is a (co)root in the root datum $R$, 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`.

<a id="function-basischange-rootstr-any"></a>
### `BasisChange(R, v): RootStr, Any -> SeqEnum`

```magma
InBasis : MonStgElt                    Default: "Standard"
OutBasis: MonStgElt                    Default: "Standard"
Coroots : BoolElt                      Default: false
```

Changes the basis of the vector $v$ contained in the space spanned by the (co)roots of the root datum $R$. The vector $v$ is considered as an element of the root space by default. If the parameter `Coroots` is set to `true`, $v$ is considered as an element of the coroot space. The optional arguments `InBasis` and `OutBasis` may take the same values as the parameter `Basis` as described at the beginning of the current section.

<a id="example-ex-f22cf4"></a>
### `Example: Roots and Coroots of a Root Datum (ex-f22cf4)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> Roots(R);
{@
    (1 0 0),
    (0 1 0),
    (1 0 2),
    (1 1 0),
    (1 1 2),
    (2 1 2),
    (-1  0  0),
    (0 -1  0),
    (-1  0 -2),
    (-1 -1  0),
    (-1 -1 -2),
    (-2 -1 -2)
@}
> PositiveCoroots(R);
{@
    (2 -1 -1),
    (-1  2  0),
    (0 -1  1),
    (1  1 -1),
    (-1  1  1),
    (1 0 0)
@}
> #Roots(R) eq 2*NumPosRoots(R);
true
> Coroot(R, 4);
(1  1 -1)
> Coroot(R, 4 : Basis := "Root");
(1 1 0)
> CorootPosition(R, [1,1,-1]);
4
> CorootPosition(R, [1,1,0] : Basis := "Root");
4
> BasisChange(R, [1,0,0] : InBasis:="Root");
(1 0 0)
> BasisChange(R, [1,0,0] : InBasis:="Root", Coroots);
( 2 -1 -1)
```

<a id="function-isinrootspace-rootdtm-modtupfldelt"></a>
### `IsInRootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt`

<a id="function-isincorootspace-rootdtm-modtupfldelt"></a>
### `IsInCorootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt`

Returns `true` if and only if the vector $v$ is contained in the (co)root space of the root datum $R$.

<a id="function-highestroot-rootstr"></a>
### `HighestRoot(R): RootStr -> .`

<a id="function-highestcoroot-rootstr"></a>
### `HighestCoroot(R): RootStr -> .`

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

The unique (co)root of greatest height in the irreducible root datum $R$.

<a id="function-highestlongroot-rootstr"></a>
### `HighestLongRoot(R): RootStr -> .`

<a id="function-highestlongcoroot-rootstr"></a>
### `HighestLongCoroot(R): RootStr -> .`

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

The unique long (co)root of greatest height in the irreducible root datum $R$.

<a id="function-highestshortroot-rootstr"></a>
### `HighestShortRoot(R): RootStr -> .`

<a id="function-highestshortcoroot-rootstr"></a>
### `HighestShortCoroot(R): RootStr -> .`

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

The unique short (co)root of greatest height in the irreducible root datum $R$.

<a id="example-ex-a8cbef"></a>
### `Example: Highest Roots (ex-a8cbef)`

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

<a id="function-relativeroots-rootdtm"></a>
### `RelativeRoots(R): RootDtm -> SetIndx`

<a id="function-positiverelativeroots-rootdtm"></a>
### `PositiveRelativeRoots(R): RootDtm -> SetIndx`

<a id="function-negativerelativeroots-rootdtm"></a>
### `NegativeRelativeRoots(R): RootDtm -> SetIndx`

<a id="function-simplerelativeroots-rootdtm"></a>
### `SimpleRelativeRoots(R): RootDtm -> SetIndx`

The indexed set of all (resp. positive, negative, simple) relative roots of the root datum $R$. Note that the relative roots are returned in the order induced by the standard ordering on the (nonrelative) roots of $R$.

<a id="function-relativerootdatum-rootdtm"></a>
### `RelativeRootDatum(R): RootDtm -> RootDtm`

The relative root datum of the root datum $R$.

<a id="function-gammaorbitsrepresentatives-rootdtm-rngintelt"></a>
### `GammaOrbitsRepresentatives(R, delta): RootDtm, RngIntElt -> SeqEnum`

The preimage of a relative root $\delta$ is a disjoint union of $\Gamma$-orbits on the set of all roots of the root datum $R$. This intrinsic returns a sequence of representatives of these orbits.

<a id="example-ex-bec95e"></a>
### `Example: Two Twisted Root Data of Type E6 (ex-bec95e)`

We first consider the twisted root datum of type ${}^2E_6$, which is quasisplit:

```magma
> DynkinDiagram(RootDatum("E6"));

E6    1 - 3 - 4 - 5 - 6
              |
              2
>
> R := RootDatum("E6" : Twist:=2 ); R;
R: Twisted adjoint root datum of type 2E6,4
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R) eq OrbitsOnSimples(R);
true
> AnisotropicSubdatum(R);
Twisted toral root datum of dimension 6
[]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type F4
> _,pi := RelativeRootSpace(R);
> DynkinDiagram(RR);

F4    1 - 2 =>= 4 - 3
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [1,6, 3,5, 4, 2]];
[ 3, 3, 4, 4, 2, 1 ]
```

now one with distinguished orbits $\{2\}$ and $\{4\}$:

```magma
> R := RootDatum("E6" : Twist := <{{2},{4}},2> ); R;
R: Twisted adjoint root datum of type 2E6,2
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 }
]
> AnisotropicSubdatum(R);
Twisted root datum of type 2(A2 A2)4,0
[ 1, 3, 5, 6, 7, 11, 37, 39, 41, 42, 43, 47 ]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type G2
> DynkinDiagram(RR);

G2    2 =<= 1
         3
> _,pi := RelativeRootSpace(R);
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [2,4]];
[ 1, 2 ]
```

and now the one with distinguished orbits $\{2\}$ and $\{1,6\}$, which has a non-reduced relative root datum:

```magma
> R := RootDatum("E6" : Twist := <{{2},{1,6}},2> ); R;
R: Twisted adjoint root datum of dimension 6 of type 2E6,2
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 1, 6 }
]
> AnisotropicSubdatum(R);
Twisted root datum of type 2A3,0
[ 3, 4, 5, 9, 10, 15, 39, 40, 41, 45, 46, 51 ]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type BC2
> DynkinDiagram(RR);

BC2    1 =>= 2
> _,pi := RelativeRootSpace(R);
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [2, 1,6]];
[ 1, 2, 2 ]
```

Finally, the twisted root Datum of type ${}^6D_{4,1}$:

```magma
> T := RootDatum( "D4" : Twist:=<{{2}},6> );
> T;
T: Twisted adjoint root datum of dimension 4 of type 6D4,1
> RelativeRootDatum(T);
Adjoint root datum of type BC1
> GammaOrbitsRepresentatives(T,1);
[ 11, 5 ]
> GammaOrbitsRepresentatives(T,2);
[ 12 ]
```

<a id="function-coxeterform-rootdtm"></a>
### `CoxeterForm(R): RootDtm -> AlgMatElt`

<a id="function-dualcoxeterform-rootdtm"></a>
### `DualCoxeterForm(R): RootDtm -> AlgMatElt`

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

The matrix of an inner product on the (co)root space of the root datum $R$ which is invariant under the action of the (co)roots. The inner product is normalised so that the short roots in each irreducible component have length one.

<a id="rootrefl"></a>
<a id="subsectrdrootaction"></a>
## 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$.

<a id="function-simplereflectionmatrices-rootdtm"></a>
### `SimpleReflectionMatrices(R): RootDtm -> []`

<a id="function-simplecoreflectionmatrices-rootdtm"></a>
### `SimpleCoreflectionMatrices(R): RootDtm -> []`

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

The sequence of matrices giving the action of the simple (co)roots of the root datum $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_n}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_n}^\star$).

<a id="function-reflectionmatrices-rootdtm"></a>
### `ReflectionMatrices(R): RootDtm -> []`

<a id="function-coreflectionmatrices-rootdtm"></a>
### `CoreflectionMatrices(R): RootDtm -> []`

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

The sequence of matrices giving the action of the (co)roots of the root datum $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_{2N}}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_{2N}}^\star$).

<a id="function-reflectionmatrix-rootdtm-rngintelt"></a>
### `ReflectionMatrix(R, r): RootDtm, RngIntElt -> []`

<a id="function-coreflectionmatrix-rootdtm-rngintelt"></a>
### `CoreflectionMatrix(R, r): RootDtm, RngIntElt -> []`

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

The matrix giving the action of the $r$th (co)root of the root datum $R$ on the (co)root space, i.e. the matrix of $s_{\alpha_r}$ (respectively, $s_{\alpha_r}^\star$).

<a id="function-simplereflectionpermutations-rootdtm"></a>
### `SimpleReflectionPermutations(R): RootDtm -> []`

The sequence of permutations giving the action of the simple (co)roots of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutations-rootdtm"></a>
### `ReflectionPermutations(R): RootDtm -> []`

The sequence of permutations giving the action of the (co)roots of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutation-rootdtm-rngintelt"></a>
### `ReflectionPermutation(R, r): RootDtm, RngIntElt -> []`

The permutation giving the action of the $r$th (co)root of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionwords-rootdtm"></a>
### `ReflectionWords(R): RootDtm -> []`

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

<a id="function-reflectionword-rootdtm-rngintelt"></a>
### `ReflectionWord(R, r): RootDtm, RngIntElt -> []`

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

<a id="example-ex-458120"></a>
### `Example: Reflection Matrices, Permutations, and Words (ex-458120)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> mx := ReflectionMatrix(R, 4);
> perm := ReflectionPermutation(R, 4);
> wd := ReflectionWord(R, 4);
> RootPosition(R, Root(R,2) * mx) eq 2^perm;
true
> perm eq &*[ ReflectionPermutation(R, r) : r in wd ];
true
>
> mx := CoreflectionMatrix(R, 4);
> CorootPosition(R, Coroot(R,2) * mx) eq 2^perm;
true
```

<a id="ops-root-coroot"></a>
<a id="subsectrdrootop"></a>
## Operations and Properties for Root and Coroot Indices

<a id="function-sum-rootdtm-rngintelt-rngintelt"></a>
### `Sum(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

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

<a id="function-ispositive-rootstr-rngintelt"></a>
### `IsPositive(R, r): RootStr, RngIntElt -> BoolElt`

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

<a id="function-isnegative-rootstr-rngintelt"></a>
### `IsNegative(R, r): RootStr, RngIntElt -> BoolElt`

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

<a id="function-negative-rootstr-rngintelt"></a>
### `Negative(R, r): RootStr, RngIntElt -> RngIntElt`

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

<a id="function-leftstring-rootdtm-rngintelt-rngintelt"></a>
### `LeftString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

Indices in the root datum $R$ 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.

<a id="function-rightstring-rootdtm-rngintelt-rngintelt"></a>
### `RightString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

Indices in the root datum $R$ 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.

<a id="function-intrleftstringlength"></a>
### `LeftStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The largest $p$ such that $\alpha_s-p\alpha_r$ is a root of the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-intrrightstringlength"></a>
### `RightStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The largest $q$ such that $\alpha_s+q\alpha_r$ is a root of the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="example-ex-15650f"></a>
### `Example: Arithmetic with Root Indices (ex-15650f)`

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

<a id="function-rootheight-rootstr-rngintelt"></a>
### `RootHeight(R, r): RootStr, RngIntElt -> RngIntElt`

<a id="function-corootheight-rootstr-rngintelt"></a>
### `CorootHeight(R, r): RootStr, RngIntElt -> RngIntElt`

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

<a id="function-rootnorms-rootstr"></a>
### `RootNorms(R): RootStr -> [RngIntElt]`

<a id="function-corootnorms-rootstr"></a>
### `CorootNorms(R): RootStr -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the root datum $R$.

<a id="function-rootnorm-rootstr-rngintelt"></a>
### `RootNorm(R, r): RootStr, RngIntElt -> RngIntElt`

<a id="function-corootnorm-rootstr-rngintelt"></a>
### `CorootNorm(R, r): RootStr, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the root datum $R$.

<a id="function-islongroot-rootstr-rngintelt"></a>
### `IsLongRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root datum $R$ is long. This only makes sense for irreducible crystallographic root data. Note that for non-reduced root data, the roots which are not indivisible, are actually longer than the long ones.

<a id="function-isshortroot-rootstr-rngintelt"></a>
### `IsShortRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root datum $R$ is short. This only makes sense for irreducible crystallographic root data.

<a id="function-isindivisibleroot-rootstr-rngintelt"></a>
### `IsIndivisibleRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root system $R$ is indivisible.

<a id="example-ex-1c59aa"></a>
### `Example: Heights, Norms, and Root Strings (ex-1c59aa)`

Note that the Coxeter form is defined over the rationals. Since it is not possible to multiply a lattice element by a rational matrix, (co)roots must be coerced into a rational vector space first.

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

<a id="function-rootclosure-rootdtm-setenum-rngintelt"></a>
### `RootClosure(R, S): RootDtm, SetEnum[RngIntElt] -> SetEnum[RngIntElt]`

The closure in the root datum $R$ of the set $S$ of root indices. That is the indices of every root that can be written as a sum of roots with indices in $S$.

<a id="function-additiveorder-rootstr"></a>
### `AdditiveOrder(R): RootStr -> SeqEnum`

An additive order on the positive roots of the root datum $R$, 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 [[Pap94](https://docs.magma-maths.org/v2.30-1/references.md#cite-papi)]

<a id="function-isadditiveorder-rootstr-rngintelt"></a>
### `IsAdditiveOrder(R, Q): RootStr, [RngIntElt] -> BoolElt`

Returns `true` if, and only if, $Q$ gives an additive order on a set of positive roots of $R$. $Q$ must be a sequence of integers in the range $[1..N]$ with no gaps or repeats.

<a id="example-ex-24f6a0"></a>
### `Example: Additive Order on Positive Roots (ex-24f6a0)`

```magma
> R := RootDatum("A5");
> a := AdditiveOrder(R);
> Position(a, 2);
6
> Position(a, 3);
10
> Position(a, Sum(R, 2, 3));
7
```

<a id="subsectrdrootweight"></a>
<a id="id2"></a>
## Weights

<a id="function-weightlattice-rootdtm"></a>
### `WeightLattice(R): RootDtm -> Lat`

The weight lattice $\Lambda$ of the root datum $R$. i.e. the $\lambda$ in ${\mathbb{Q}}\Phi\le{\mathbb{Q}}\otimes X$ such that $\langle\lambda,\alpha^\star\rangle\in{\mathbb{Z}}$ for every coroot $\alpha^\star$.

<a id="function-coweightlattice-rootdtm"></a>
### `CoweightLattice(R): RootDtm -> Lat`

The coweight lattice $\Lambda^\star$ of the root datum $R$, i.e. the $\lambda^\star$ in ${\mathbb{Q}}\Phi^\star\le{\mathbb{Q}}\otimes Y$ such that $\langle\alpha,\lambda^\star\rangle\in{\mathbb{Z}}$ for every root $\alpha$.

<a id="function-fundamentalweights-rootdtm"></a>
### `FundamentalWeights(R): RootDtm -> Mtrx`

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

The fundamental weights $\lambda_1,\dots,\lambda_n$ of the root datum $R$ given as the rows of a matrix. This is the basis of the weight lattice $\Lambda$ dual to the simple coroots, i.e. $\langle\lambda_i,\alpha_j^\star\rangle=\delta_{ij}$.

<a id="function-fundamentalcoweights-rootdtm"></a>
### `FundamentalCoweights(R): RootDtm -> Mtrx`

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

The fundamental coweights $\lambda_1^\star,\dots,\lambda_n^\star$ of the root datum $R$ given as the rows of a matrix. This is the basis of the coweight lattice $\Lambda^\star$ dual to the simple roots, i.e. $\langle\alpha_i,\lambda_j^\star\rangle=\delta_{ij}$.

<a id="example-ex-28403f"></a>
### `Example: Weight Lattice of a Root Datum (ex-28403f)`

```magma
> R := RootDatum("E6");
> WeightLattice(R);
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(R);
[ 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]
```

<a id="function-isdominant-rootdtm"></a>
### `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.

<a id="function-dominantweight-rootdtm"></a>
### `DominantWeight(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

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

The unique dominant weight in the same $W$-orbit as the weight $v$, where $W$ is the Weyl group of the root datum $R$. The second value returned is a Weyl group element taking $v$ to the dominant weight. 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.

<a id="function-weightorbit-rootdtm"></a>
### `WeightOrbit(R, v): RootDtm, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]`

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

The $W$-orbit of the weight $v$ as an indexed set, where $W$ is the Weyl group of the root datum $R$. The first element in the orbit is always dominant. The second value returned is a sequence of Weyl group elements taking the weight to the corresponding element of the orbit. 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.

<a id="example-ex-4bce9a"></a>
### `Example: Dominant Weights and Weight Orbits (ex-4bce9a)`

```magma
> R := RootDatum("B3");
> DominantWeight(R, [1,-1,0] : Basis:="Weight");
(1 0 0)
[ 2, 3, 2, 1 ]
> #WeightOrbit(R, [1,-1,0] : Basis:="Weight");
6
```
