Lie Algebra#

class sympy.liealgebras.root_system.RootSystem(cartantype)[source]#

Represent the root system of a simple Lie algebra

Every simple Lie algebra has a unique root system. To find the root system, we first consider the Cartan subalgebra of g, which is the maximal abelian subalgebra, and consider the adjoint action of g on this subalgebra. There is a root system associated with this action. Now, a root system over a vector space V is a set of finite vectors Phi (called roots), which satisfy:

  1. The roots span V

  2. The only scalar multiples of x in Phi are x and -x

  3. For every x in Phi, the set Phi is closed under reflection through the hyperplane perpendicular to x.

  4. If x and y are roots in Phi, then the projection of y onto the line through x is a half-integral multiple of x.

Now, there is a subset of Phi, which we will call Delta, such that: 1. Delta is a basis of V 2. Each root x in Phi can be written x = sum k_y y for y in Delta

The elements of Delta are called the simple roots. Therefore, we see that the simple roots span the root space of a given simple Lie algebra.

References

[R599]

Lie Algebras and Representation Theory - Humphreys

add_as_roots(root1, root2)[source]#

Add two roots together if and only if their sum is also a root

It takes as input two vectors which should be roots. It then computes their sum and checks if it is in the list of all possible roots. If it is, it returns the sum. Otherwise it returns a string saying that the sum is not a root.

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> c.add_as_roots([1, 0, -1, 0], [0, 0, 1, -1])
[1, 0, 0, -1]
>>> c.add_as_roots([1, -1, 0, 0], [0, 0, -1, 1])
'The sum of these two roots is not a root'
add_simple_roots(root1, root2)[source]#

Add two simple roots together

The function takes as input two integers, root1 and root2. It then uses these integers as keys in the dictionary of simple roots, and gets the corresponding simple roots, and then adds them together.

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> newroot = c.add_simple_roots(1, 2)
>>> newroot
[1, 0, -1, 0]
all_roots()[source]#

Generate all the roots of a given root system

The result is a dictionary where the keys are integer numbers. It generates the roots by getting the dictionary of all positive roots from the bases classes, and then taking each root, and multiplying it by -1 and adding it to the dictionary. In this way all the negative roots are generated.

cartan_matrix()[source]#

Cartan matrix of Lie algebra associated with this root system

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> c.cartan_matrix()
Matrix([
    [ 2, -1,  0],
    [-1,  2, -1],
    [ 0, -1,  2]])
dynkin_diagram()[source]#

Dynkin diagram of the Lie algebra associated with this root system

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> print(c.dynkin_diagram())
0---0---0
1   2   3
root_space()[source]#

Return the span of the simple roots

The root space is the vector space spanned by the simple roots, i.e. it is a vector space with a distinguished basis, the simple roots. This method returns a string that represents the root space as the span of the simple roots, alpha[1],…., alpha[n].

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> c.root_space()
'alpha[1] + alpha[2] + alpha[3]'
simple_roots()[source]#

Generate the simple roots of the Lie algebra

The rank of the Lie algebra determines the number of simple roots that it has. This method obtains the rank of the Lie algebra, and then uses the simple_root method from the Lie algebra classes to generate all the simple roots.

Examples

>>> from sympy.liealgebras.root_system import RootSystem
>>> c = RootSystem("A3")
>>> roots = c.simple_roots()
>>> roots
{1: [1, -1, 0, 0], 2: [0, 1, -1, 0], 3: [0, 0, 1, -1]}
class sympy.liealgebras.type_a.TypeA(n)[source]#

This class contains the information about the A series of simple Lie algebras. ====

basic_root(i, j)[source]#

This is a method just to generate roots with a 1 iin the ith position and a -1 in the jth position.

basis()[source]#

Returns the number of independent generators of A_n

cartan_matrix()[source]#

Returns the Cartan matrix for A_n. The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('A4')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -1],
[ 0,  0, -1,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A4")
>>> c.dimension()
5
highest_root()[source]#

Returns the highest weight root for A_n

lie_algebra()[source]#

Returns the Lie algebra associated with A_n

positive_roots()[source]#

This method generates all the positive roots of A_n. This is half of all of the roots of A_n; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots for A_n

simple_root(i)[source]#

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

In A_n the ith simple root is the root which has a 1 in the ith position, a -1 in the (i+1)th position, and zeroes elsewhere.

This method returns the ith simple root for the A series.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A4")
>>> c.simple_root(1)
[1, -1, 0, 0, 0]
class sympy.liealgebras.type_b.TypeB(n)[source]#
basic_root(i, j)[source]#

This is a method just to generate roots with a 1 iin the ith position and a -1 in the jth position.

basis()[source]#

Returns the number of independent generators of B_n

cartan_matrix()[source]#

Returns the Cartan matrix for B_n. The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('B4')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -2],
[ 0,  0, -1,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("B3")
>>> c.dimension()
3
lie_algebra()[source]#

Returns the Lie algebra associated with B_n

positive_roots()[source]#

This method generates all the positive roots of A_n. This is half of all of the roots of B_n; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots for B_n”

simple_root(i)[source]#

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

In B_n the first n-1 simple roots are the same as the roots in A_(n-1) (a 1 in the ith position, a -1 in the (i+1)th position, and zeroes elsewhere). The n-th simple root is the root with a 1 in the nth position and zeroes elsewhere.

This method returns the ith simple root for the B series.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("B3")
>>> c.simple_root(2)
[0, 1, -1]
class sympy.liealgebras.type_c.TypeC(n)[source]#
basic_root(i, j)[source]#

Generate roots with 1 in ith position and a -1 in jth position

basis()[source]#

Returns the number of independent generators of C_n

cartan_matrix()[source]#

The Cartan matrix for C_n

The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('C4')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -1],
[ 0,  0, -2,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("C3")
>>> c.dimension()
3
lie_algebra()[source]#

Returns the Lie algebra associated with C_n”

positive_roots()[source]#

Generates all the positive roots of A_n

This is half of all of the roots of C_n; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots for C_n”

simple_root(i)[source]#

The ith simple root for the C series

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

In C_n, the first n-1 simple roots are the same as the roots in A_(n-1) (a 1 in the ith position, a -1 in the (i+1)th position, and zeroes elsewhere). The nth simple root is the root in which there is a 2 in the nth position and zeroes elsewhere.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("C3")
>>> c.simple_root(2)
[0, 1, -1]
class sympy.liealgebras.type_d.TypeD(n)[source]#
basic_root(i, j)[source]#

This is a method just to generate roots with a 1 iin the ith position and a -1 in the jth position.

basis()[source]#

Returns the number of independent generators of D_n

cartan_matrix()[source]#

Returns the Cartan matrix for D_n. The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('D4')
>>> c.cartan_matrix()
    Matrix([
    [ 2, -1,  0,  0],
    [-1,  2, -1, -1],
    [ 0, -1,  2,  0],
    [ 0, -1,  0,  2]])
dimension()[source]#

Dmension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("D4")
>>> c.dimension()
4
lie_algebra()[source]#

Returns the Lie algebra associated with D_n”

positive_roots()[source]#

This method generates all the positive roots of A_n. This is half of all of the roots of D_n by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots for D_n”

simple_root(i)[source]#

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

In D_n, the first n-1 simple roots are the same as the roots in A_(n-1) (a 1 in the ith position, a -1 in the (i+1)th position, and zeroes elsewhere). The nth simple root is the root in which there 1s in the nth and (n-1)th positions, and zeroes elsewhere.

This method returns the ith simple root for the D series.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("D4")
>>> c.simple_root(2)
[0, 1, -1, 0]
class sympy.liealgebras.type_e.TypeE(n)[source]#
basic_root(i, j)[source]#

This is a method just to generate roots with a -1 in the ith position and a 1 in the jth position.

basis()[source]#

Returns the number of independent generators of E_n

cartan_matrix()[source]#

Returns the Cartan matrix for G_2 The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('A4')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -1],
[ 0,  0, -1,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("E6")
>>> c.dimension()
8
positive_roots()[source]#

This method generates all the positive roots of A_n. This is half of all of the roots of E_n; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots of E_n

simple_root(i)[source]#

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

This method returns the ith simple root for E_n.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("E6")
>>> c.simple_root(2)
[1, 1, 0, 0, 0, 0, 0, 0]
class sympy.liealgebras.type_f.TypeF(n)[source]#
basic_root(i, j)[source]#

Generate roots with 1 in ith position and -1 in jth position

basis()[source]#

Returns the number of independent generators of F_4

cartan_matrix()[source]#

The Cartan matrix for F_4

The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType('A4')
>>> c.cartan_matrix()
Matrix([
[ 2, -1,  0,  0],
[-1,  2, -1,  0],
[ 0, -1,  2, -1],
[ 0,  0, -1,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("F4")
>>> c.dimension()
4
positive_roots()[source]#

Generate all the positive roots of A_n

This is half of all of the roots of F_4; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots for F_4

simple_root(i)[source]#

The ith simple root of F_4

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("F4")
>>> c.simple_root(3)
[0, 0, 0, 1]
class sympy.liealgebras.type_g.TypeG(n)[source]#
basis()[source]#

Returns the number of independent generators of G_2

cartan_matrix()[source]#

The Cartan matrix for G_2

The Cartan matrix matrix for a Lie algebra is generated by assigning an ordering to the simple roots, (alpha[1], …., alpha[l]). Then the ijth entry of the Cartan matrix is (<alpha[i],alpha[j]>).

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("G2")
>>> c.cartan_matrix()
Matrix([
    [ 2, -1],
    [-3,  2]])
dimension()[source]#

Dimension of the vector space V underlying the Lie algebra

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("G2")
>>> c.dimension()
3
positive_roots()[source]#

Generate all the positive roots of A_n

This is half of all of the roots of A_n; by multiplying all the positive roots by -1 we get the negative roots.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("A3")
>>> c.positive_roots()
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
        5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
roots()[source]#

Returns the total number of roots of G_2”

simple_root(i)[source]#

The ith simple root of G_2

Every lie algebra has a unique root system. Given a root system Q, there is a subset of the roots such that an element of Q is called a simple root if it cannot be written as the sum of two elements in Q. If we let D denote the set of simple roots, then it is clear that every element of Q can be written as a linear combination of elements of D with all coefficients non-negative.

Examples

>>> from sympy.liealgebras.cartan_type import CartanType
>>> c = CartanType("G2")
>>> c.simple_root(1)
[0, 1, -1]
class sympy.liealgebras.weyl_group.WeylGroup(cartantype)[source]#

For each semisimple Lie group, we have a Weyl group. It is a subgroup of the isometry group of the root system. Specifically, it’s the subgroup that is generated by reflections through the hyperplanes orthogonal to the roots. Therefore, Weyl groups are reflection groups, and so a Weyl group is a finite Coxeter group.

coxeter_diagram()[source]#

This method returns the Coxeter diagram corresponding to a Weyl group. The Coxeter diagram can be obtained from a Lie algebra’s Dynkin diagram by deleting all arrows; the Coxeter diagram is the undirected graph. The vertices of the Coxeter diagram represent the generating reflections of the Weyl group, \(s_i\). An edge is drawn between \(s_i\) and \(s_j\) if the order \(m(i, j)\) of \(s_is_j\) is greater than two. If there is one edge, the order \(m(i, j)\) is 3. If there are two edges, the order \(m(i, j)\) is 4, and if there are three edges, the order \(m(i, j)\) is 6.

Examples

>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> c = WeylGroup("B3")
>>> print(c.coxeter_diagram())
0---0===0
1   2   3
delete_doubles(reflections)[source]#

This is a helper method for determining the order of an element in the Weyl group of G2. It takes a Weyl element and if repeated simple reflections in it, it deletes them.

element_order(weylelt)[source]#

This method returns the order of a given Weyl group element, which should be specified by the user in the form of products of the generating reflections, i.e. of the form r1*r2 etc.

For types A-F, this method current works by taking the matrix form of the specified element, and then finding what power of the matrix is the identity. It then returns this power.

Examples

>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> b = WeylGroup("B4")
>>> b.element_order('r1*r4*r2')
4
generators()[source]#

This method creates the generating reflections of the Weyl group for a given Lie algebra. For a Lie algebra of rank n, there are n different generating reflections. This function returns them as a list.

Examples

>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> c = WeylGroup("F4")
>>> c.generators()
['r1', 'r2', 'r3', 'r4']
group_name()[source]#

This method returns some general information about the Weyl group for a given Lie algebra. It returns the name of the group and the elements it acts on, if relevant.

group_order()[source]#

This method returns the order of the Weyl group. For types A, B, C, D, and E the order depends on the rank of the Lie algebra. For types F and G, the order is fixed.

Examples

>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> c = WeylGroup("D4")
>>> c.group_order()
192.0
matrix_form(weylelt)[source]#

This method takes input from the user in the form of products of the generating reflections, and returns the matrix corresponding to the element of the Weyl group. Since each element of the Weyl group is a reflection of some type, there is a corresponding matrix representation. This method uses the standard representation for all the generating reflections.

Examples

>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> f = WeylGroup("F4")
>>> f.matrix_form('r2*r3')
Matrix([
[1, 0, 0,  0],
[0, 1, 0,  0],
[0, 0, 0, -1],
[0, 0, 1,  0]])
class sympy.liealgebras.cartan_type.CartanType_generator[source]#

Constructor for actually creating things

class sympy.liealgebras.cartan_type.Standard_Cartan(series, n)[source]#

Concrete base class for Cartan types such as A4, etc

rank()[source]#

Returns the rank of the Lie algebra

series()[source]#

Returns the type of the Lie algebra

sympy.liealgebras.dynkin_diagram.DynkinDiagram(t)[source]#

Display the Dynkin diagram of a given Lie algebra

Works by generating the CartanType for the input, t, and then returning the Dynkin diagram method from the individual classes.

Examples

>>> from sympy.liealgebras.dynkin_diagram import DynkinDiagram
>>> print(DynkinDiagram("A3"))
0---0---0
1   2   3
>>> print(DynkinDiagram("B4"))
0---0---0=>=0
1   2   3   4
sympy.liealgebras.cartan_matrix.CartanMatrix(ct)[source]#

Access the Cartan matrix of a specific Lie algebra

Examples

>>> from sympy.liealgebras.cartan_matrix import CartanMatrix
>>> CartanMatrix("A2")
Matrix([
[ 2, -1],
[-1,  2]])
>>> CartanMatrix(['C', 3])
Matrix([
[ 2, -1,  0],
[-1,  2, -1],
[ 0, -2,  2]])

This method works by returning the Cartan matrix which corresponds to Cartan type t.