Algebra#
Lie Algebra Base#
- class liesym.LieAlgebra(series: str, rank: int, simple_roots: list[Matrix])[source]#
The base class for all lie algebras. The methods and properties in this class are basis independent and apply in a general sense. In order to write down the roots as matricies and vectors, we choose a representation.
- Attributes:
- cartan_matrix
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- cocartan_matrix
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
dimensionAlgebra dimension
- metric_tensor
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
n_pos_rootsTotal number of positive roots in the algebra
n_rootsTotal number of roots in the algebra
- omega_matrix
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
rankAlgebra rank
- reflection_matricies
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
seriesAlgebra series type
Methods
adjoint_rep([basis])Returns the adjoint irrep.
conjugate(irrep[, basis])Finds the conjugate irrep.
dim(irrep[, basis])Returns the dimension of the weight, root or irreducible representations.
dim_name(irrep[, basis])Returns a sympy formatted symbol for the irrep.
dynkin_index([irrep, basis])Calculates the dynkin index of an arbitrary irrep.
fundamental_weights([basis])Returns the fundamental weights of the algebra.
Gets all irreps by dimension and max dynkin digit.
irrep_lookup(dim[, max_dynkin_digit, basis])Returns the irrep matrix for the dimension.
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representations
orbit(weight[, stabilizers, basis, weight_basis])Returns the orbit of the weight or root by reflecting it a plane.
positive_roots([basis])Returns the postive roots of the algebra.
quadratic_casimir([irrep, basis])Returns the quadratic casimir for an arbitrary irreducible representation, $R$.
root_system([basis])Returns the entire rootsystem of the algebra.
simple_roots([basis])Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra.
tensor_product_decomposition(*weights[, basis])Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights.
to_alpha(x[, basis])Rotates to alpha basis
to_omega(x[, basis])Rotates to omega basis
to_ortho(x[, basis])Rotates to orthogonal basis
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix[source]#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix[source]#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int[source]#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol[source]#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
Algebra dimension
Abstract
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic[source]#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix][source]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, *, max_dd: int = 3, with_symbols: Literal[True], basis: BASIS = 'omega') List[Tuple[Matrix, NumericSymbol]][source]#
- get_irrep_by_dim(dim: int, *, max_dd: int = 3, with_symbols: Literal[False] = False, basis: BASIS = 'omega') List[Matrix]
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix[source]#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: sympy.Matrix) int[source]#
Returns the max Dynkin Digit for the representations
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
Total number of positive roots in the algebra
Abstract
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix][source]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix][source]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic[source]#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix][source]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix][source]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix][source]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix[source]#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix[source]#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix[source]#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
A Series#
- class liesym.A(n: int, simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie algebra of type A. The dynkin diagram for this algebra is
- Attributes:
dimensionThe dimension of the simple Lie algebra A series is one greater than the rank of the algebra.
n_pos_rootsThe number of positive roots for the simple Lie algebra A is
Methods
dim_name(irrep[, basis])Returns a sympy formatted symbol for the irrep.
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: MutableDenseMatrix, basis='omega') NumericSymbol[source]#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature
- property dimension: int#
The dimension of the simple Lie algebra A series is one greater than the rank of the algebra.
\[n + 1\]
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
The number of positive roots for the simple Lie algebra A is defined as
\[n(n + 1) / 2\]
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
B Series#
- class liesym.B(n: int, simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type B. The dynkin diagram for this algebra is
- Attributes:
dimensionThe dimension of the simple Lie algebra B series is equal to the rank of the algebra.
n_pos_rootsThe number of positive roots for the simple Lie algebra B is
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
The dimension of the simple Lie algebra B series is equal to the rank of the algebra.
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
The number of positive roots for the simple Lie algebra B is defined as
\[n^2\]
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
C Series#
- class liesym.C(n: int, simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type C. The dynkin diagram for this algebra is
- Attributes:
dimensionThe dimension of the simple Lie algebra C series is equal to the rank of the algebra.
n_pos_rootsThe number of positive roots for the simple Lie algebra C is
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
The dimension of the simple Lie algebra C series is equal to the rank of the algebra.
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
The number of positive roots for the simple Lie algebra C is defined as
\[n^2\]
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
D Series#
- class liesym.D(n: int, simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type D. The dynkin diagram for this algebra is
- Attributes:
dimensionThe dimension of the simple Lie algebra D series is equal to the rank of the algebra.
n_pos_rootsThe number of roots for the simple Lie algebra D is
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
The dimension of the simple Lie algebra D series is equal to the rank of the algebra.
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
The number of roots for the simple Lie algebra D is defined as
\[n(n-1)\]
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
E Series#
- class liesym.E(n: int, simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type E. There are only three defined for type E.
- Attributes:
dimensionAlgebra dimension
n_pos_rootsTotal number of positive roots in the algebra
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
Algebra dimension
Abstract
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
Total number of positive roots in the algebra
Abstract
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
G2 Series#
- class liesym.G2(simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type G2. The dynkin diagram for this algebra is
- Attributes:
dimensionAlgebra dimension
n_pos_rootsTotal number of positive roots in the algebra
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
Algebra dimension
Abstract
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
Total number of positive roots in the algebra
Abstract
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.
F4 Series#
- class liesym.F4(simple_roots: List[MutableDenseMatrix] | None = None)[source]#
The compact lie group of type F4. The dynkin diagram for this algebra is
- Attributes:
dimensionAlgebra dimension
n_pos_rootsTotal number of positive roots in the algebra
Methods
max_dynkin_digit(irrep)Returns the max Dynkin Digit for the representation
- adjoint_rep(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') sympy.Matrix#
Returns the adjoint irrep. This is the highest weight of the root system.
- property cartan_matrix: sympy.Matrix#
For a given simple Lie algebra the elements \(a_{ij}\) can be generated by
\[a_{ji} = 2 \langle\alpha_i, \alpha_j\rangle / \langle\alpha_j, \alpha_j\rangle\]where \(a_i\) is the i’th simple root and \(\langle,\rangle\) is the scalar product.
- Sources:
- Returns:
Matrix: Cartan Matrix as a Sympy object
- property cocartan_matrix: sympy.Matrix#
The cocartan matrix rows are generated from the coroots of the algebra such that multiplication by a simple root will generate a row of the cartan matrix.
- Returns:
Matrix: Cocartan Matrix as a Sympy object
- conjugate(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Finds the conjugate irrep. If it is the same as the original irrep, you have a Real Irrep, otherwise it’s a Complex Irrep.
Examples
from liesym import A,D from sympy import Matrix SU4 = A(3) irrep_20 = Matrix([[0,1,1]]) irrep_20bar = Matrix([[1,1,0]]) assert irrep_20 == SU4.conjugate(irrep_20bar) SO10 = D(5) irrep_10 = Matrix([[1, 0, 0, 0, 0]]) assert irrep_10 == SO10.conjugate(irrep_10)
- dim(irrep: sympy.Matrix, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') int#
Returns the dimension of the weight, root or irreducible representations. This follows Weyl’s dimension formula:
\[dim(w) = \prod_{\alpha\in\Delta^{+}} \frac{\langle \alpha, w + \rho\rangle}{\langle\alpha,\rho\rangle}\]where \(\Delta^{+}\) are the positive roots and \(rho\) is the sum of the positive roots: [1] * rank.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> assert a2.dim(Matrix([[1,0]])) == 3
- dim_name(irrep: sympy.Matrix, basis='omega') NumericSymbol#
Returns a sympy formatted symbol for the irrep. This is commonly used in physics literature. Returns a NumericSymbol object that is a simple extension of Symbol.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> assert str(a3.dim_name(Matrix([[1, 1, 0]]))) == '\\bar{20}'
- property dimension: int#
Algebra dimension
Abstract
- dynkin_index(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Calculates the dynkin index of an arbitrary irrep. This is also called in literature second-order index, \(I_2(R)\). If no irrep is passed, basis and rep default to the algebra’s adjoint rep. For arbitrary irrep, \(R\), the dynkin index, \(I_2(R)\) can be calculated as:
\[I_2(R) = \frac{Dim(R)}{Dim(adj)}c(R)\]where the \(dim\) is the dimension formula, \(adj\) is the adjoint irrep and \(c\) is the quadratic casimir (Liealgebra.casimir).
- fundamental_weights(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the fundamental weights of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- get_irrep_by_dim(dim: int, max_dd: int = 3, with_symbols: bool = False, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') List[Tuple[sympy.Matrix, NumericSymbol]] | List[sympy.Matrix]#
Gets all irreps by dimension and max dynkin digit. max_dd is . This algorithm brute forces searches by using itertools.product which can become expensive for large so searching max_dd > 3 will be very expensive
- Args:
dim (int): Dimension to query max_dd (int, optional): The max dynkin digit to use. Defaults to 3. with_symbols (bool, optional): Returns list of tuples of rep and latex fmt. Defaults to False. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”.
- Returns:
list[Union[Matrix, Tuple[Matrix,NumericSymbol]]]: If with_symbols=True will return a list of tuples.
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a3 = A(3) >>> expected = a3.get_irrep_by_dim(20) >>> result = [ ... Matrix([[1, 1, 0]]), ... Matrix([[0, 1, 1]]), ... Matrix([[0, 2, 0]]), ... Matrix([[3, 0, 0]]), ... Matrix([[0, 0, 3]])] >>> assert expected == result >>> a3.get_irrep_by_dim(20, with_symbols=True) [(Matrix([[1, 1, 0]]), \bar{20}), (Matrix([[0, 1, 1]]), 20), (Matrix([[0, 2, 0]]), 20^{\prime}), (Matrix([[3, 0, 0]]), \bar{20}^{\prime \prime}), (Matrix([[0, 0, 3]]), 20^{\prime \prime})]
- irrep_lookup(dim: Any, max_dynkin_digit=5, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Matrix#
Returns the irrep matrix for the dimension.
- Args:
dim (Any): Can either be any sympy object.
- Raises:
KeyError: Dim not found
- Returns:
Matrix: Returns irrep in Omega basis
Examples
>>> from liesym import A >>> A3 = A(3) >>> A3.irrep_lookup(r"\bar{4}") Matrix([[0, 0, 1]]) >>> A3.irrep_lookup("4") Matrix([[1, 0, 0]])
- max_dynkin_digit(irrep: MutableDenseMatrix) int[source]#
Returns the max Dynkin Digit for the representation
- property metric_tensor: sympy.Matrix#
Also known as the quadratic form, the metric tensor serves as the metrix for the inner product of two roots or weights when they are not in the orthogonal basis.
- Returns:
Matrix: Metric Tensor as a Sympy object
- property n_pos_roots: int#
Total number of positive roots in the algebra
Abstract
- property n_roots: int#
Total number of roots in the algebra
- property omega_matrix: sympy.Matrix#
The rows of the omega matrix are the fundamental weights of the algebra.
- Returns:
Matrix: Omega Matrix as a Sympy object
- orbit(weight: sympy.Matrix, stabilizers: Sequence[int] | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'ortho', weight_basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the orbit of the weight or root by reflecting it a plane. A stabilizer may be passed to calculate the orbit using the Orbit-Stabilizer theorem.
Basis: Ortho
- Args:
weight (Matrix): A Matrix of shape (1, rank) stabilizer (Iterable of ints, optional): Per Orbit-Stabilizer theorem, integer iterable of simple root indexes. Defaults to None. basis (“ortho” | “omega” | “alpha”, optional): Basis to return orbit in, Defaults to “ortho”. weight_basis (“ortho” | “omega” | “alpha”, optional): Basis of weight, this will be a fallback if weight is not annotated. Defaults to “ortho”.
Sources: - https://en.wikipedia.org/wiki/Coadjoint_representation#Coadjoint_orbit - https://en.wikipedia.org/wiki/Group_action#Orbits_and_stabilizers
- positive_roots(basis: Literal['ortho', 'omega', 'alpha'] = 'ortho') List[sympy.Matrix]#
Returns the postive roots of the algebra. They are sorted first by their distance from the highest root and then by tuple ordering (convention).
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return result in. Defaults to “ortho”.
- Returns:
list[Matrix]: list of Sympy Matrices
- quadratic_casimir(irrep: sympy.Matrix | None = None, basis: Literal['ortho', 'omega', 'alpha'] = 'omega') sympy.Basic#
Returns the quadratic casimir for an arbitrary irreducible representation, \(R\).
\[\frac{1}{2}<R | R + \rho>\]- Args:
irrep (Matrix): Irreducible representation basis (str, optional): Basis of irrep. Defaults to “omega”.
- Returns:
Basic: Rational number
- property rank: int#
Algebra rank
- property reflection_matricies: List[sympy.Matrix]#
Returns a list of reflection matrices built from rotations about each simple root.
- Returns:
list[Matrix]: list of Sympy Matrices
- root_system(basis: BASIS = 'omega') list[Matrix]#
Returns the entire rootsystem of the algebra. This includes the positive, negative and zeros of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of ordered roots.
- property series: str#
Algebra series type
- simple_roots(basis: BASIS = 'ortho') list[Matrix]#
Returns a list of Sympy matrix (1,dimension) objects representing a chosen basis of the algebra. simple_roots define the entire representation of the algebra.
- Args:
basis (“ortho” | “omega” | “alpha”, optional): Basis to return simple roots in. Defaults to “ortho”.
- tensor_product_decomposition(*weights: Matrix, basis: BASIS = 'omega') list[Matrix]#
Returns the tensor product between irreducible representations as a the tensor sum of the irreducible representations of their highest weights. This algorithm is based on Klimky’s formula.
- Args:
weights (Matrix: tuple[Matrix, …]): Fundamental weights to take the tensor product between basis (“ortho” | “omega” | “alpha”, optional): Basis of incoming weights and result. If not set, will implicitly set. Defaults to ‘omega’.
- Returns:
list[Matrix]: list of weights decomposed from the tensor product
Examples
>>> from liesym import A >>> from sympy import Matrix >>> a2 = A(2) >>> results = a2.tensor_product_decomposition([Matrix([[1,0]]), Matrix([[1,0]])]) >>> print(results) [Matrix([[0, 1]]), Matrix([[2, 0]])]
- to_alpha(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to alpha basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in alpha basis.
- to_omega(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to omega basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in omega basis.
- to_ortho(x: sympy.Matrix, basis=None) sympy.Matrix#
Rotates to orthogonal basis
- Args:
x (Matrix): Matrix to be rotated basis (optional): If basis attribute is not set on x define it here. Defaults to None.
- Raises:
ValueError: If no x.basis is set and None is passed to basis kwarg.
- Returns:
Matrix: Matrix in orthogonal basis.


