add read me
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
from sympy.liealgebras.cartan_matrix import CartanMatrix
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_CartanMatrix():
|
||||
c = CartanMatrix("A3")
|
||||
m = Matrix(3, 3, [2, -1, 0, -1, 2, -1, 0, -1, 2])
|
||||
assert c == m
|
||||
a = CartanMatrix(["G",2])
|
||||
mt = Matrix(2, 2, [2, -1, -3, 2])
|
||||
assert a == mt
|
||||
@@ -0,0 +1,12 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType, Standard_Cartan
|
||||
|
||||
def test_Standard_Cartan():
|
||||
c = CartanType("A4")
|
||||
assert c.rank() == 4
|
||||
assert c.series == "A"
|
||||
m = Standard_Cartan("A", 2)
|
||||
assert m.rank() == 2
|
||||
assert m.series == "A"
|
||||
b = CartanType("B12")
|
||||
assert b.rank() == 12
|
||||
assert b.series == "B"
|
||||
@@ -0,0 +1,9 @@
|
||||
from sympy.liealgebras.dynkin_diagram import DynkinDiagram
|
||||
|
||||
def test_DynkinDiagram():
|
||||
c = DynkinDiagram("A3")
|
||||
diag = "0---0---0\n1 2 3"
|
||||
assert c == diag
|
||||
ct = DynkinDiagram(["B", 3])
|
||||
diag2 = "0---0=>=0\n1 2 3"
|
||||
assert ct == diag2
|
||||
@@ -0,0 +1,18 @@
|
||||
from sympy.liealgebras.root_system import RootSystem
|
||||
from sympy.liealgebras.type_a import TypeA
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_root_system():
|
||||
c = RootSystem("A3")
|
||||
assert c.cartan_type == TypeA(3)
|
||||
assert c.simple_roots() == {1: [1, -1, 0, 0], 2: [0, 1, -1, 0], 3: [0, 0, 1, -1]}
|
||||
assert c.root_space() == "alpha[1] + alpha[2] + alpha[3]"
|
||||
assert c.cartan_matrix() == Matrix([[ 2, -1, 0], [-1, 2, -1], [ 0, -1, 2]])
|
||||
assert c.dynkin_diagram() == "0---0---0\n1 2 3"
|
||||
assert c.add_simple_roots(1, 2) == [1, 0, -1, 0]
|
||||
assert c.all_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], 7: [-1, 1, 0, 0], 8: [-1, 0, 1, 0],
|
||||
9: [-1, 0, 0, 1], 10: [0, -1, 1, 0],
|
||||
11: [0, -1, 0, 1], 12: [0, 0, -1, 1]}
|
||||
assert c.add_as_roots([1, 0, -1, 0], [0, 0, 1, -1]) == [1, 0, 0, -1]
|
||||
@@ -0,0 +1,17 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_type_A():
|
||||
c = CartanType("A3")
|
||||
m = Matrix(3, 3, [2, -1, 0, -1, 2, -1, 0, -1, 2])
|
||||
assert m == c.cartan_matrix()
|
||||
assert c.basis() == 8
|
||||
assert c.roots() == 12
|
||||
assert c.dimension() == 4
|
||||
assert c.simple_root(1) == [1, -1, 0, 0]
|
||||
assert c.highest_root() == [1, 0, 0, -1]
|
||||
assert c.lie_algebra() == "su(4)"
|
||||
diag = "0---0---0\n1 2 3"
|
||||
assert c.dynkin_diagram() == diag
|
||||
assert 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]}
|
||||
@@ -0,0 +1,17 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_type_B():
|
||||
c = CartanType("B3")
|
||||
m = Matrix(3, 3, [2, -1, 0, -1, 2, -2, 0, -1, 2])
|
||||
assert m == c.cartan_matrix()
|
||||
assert c.dimension() == 3
|
||||
assert c.roots() == 18
|
||||
assert c.simple_root(3) == [0, 0, 1]
|
||||
assert c.basis() == 3
|
||||
assert c.lie_algebra() == "so(6)"
|
||||
diag = "0---0=>=0\n1 2 3"
|
||||
assert c.dynkin_diagram() == diag
|
||||
assert c.positive_roots() == {1: [1, -1, 0], 2: [1, 1, 0], 3: [1, 0, -1],
|
||||
4: [1, 0, 1], 5: [0, 1, -1], 6: [0, 1, 1], 7: [1, 0, 0],
|
||||
8: [0, 1, 0], 9: [0, 0, 1]}
|
||||
@@ -0,0 +1,22 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_type_C():
|
||||
c = CartanType("C4")
|
||||
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2, -1, 0, 0, -2, 2])
|
||||
assert c.cartan_matrix() == m
|
||||
assert c.dimension() == 4
|
||||
assert c.simple_root(4) == [0, 0, 0, 2]
|
||||
assert c.roots() == 32
|
||||
assert c.basis() == 36
|
||||
assert c.lie_algebra() == "sp(8)"
|
||||
t = CartanType(['C', 3])
|
||||
assert t.dimension() == 3
|
||||
diag = "0---0---0=<=0\n1 2 3 4"
|
||||
assert c.dynkin_diagram() == diag
|
||||
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0],
|
||||
3: [1, 0, -1, 0], 4: [1, 0, 1, 0], 5: [1, 0, 0, -1],
|
||||
6: [1, 0, 0, 1], 7: [0, 1, -1, 0], 8: [0, 1, 1, 0],
|
||||
9: [0, 1, 0, -1], 10: [0, 1, 0, 1], 11: [0, 0, 1, -1],
|
||||
12: [0, 0, 1, 1], 13: [2, 0, 0, 0], 14: [0, 2, 0, 0], 15: [0, 0, 2, 0],
|
||||
16: [0, 0, 0, 2]}
|
||||
@@ -0,0 +1,19 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
|
||||
|
||||
def test_type_D():
|
||||
c = CartanType("D4")
|
||||
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -1, -1, 0, -1, 2, 0, 0, -1, 0, 2])
|
||||
assert c.cartan_matrix() == m
|
||||
assert c.basis() == 6
|
||||
assert c.lie_algebra() == "so(8)"
|
||||
assert c.roots() == 24
|
||||
assert c.simple_root(3) == [0, 0, 1, -1]
|
||||
diag = " 3\n 0\n |\n |\n0---0---0\n1 2 4"
|
||||
assert diag == c.dynkin_diagram()
|
||||
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0],
|
||||
3: [1, 0, -1, 0], 4: [1, 0, 1, 0], 5: [1, 0, 0, -1], 6: [1, 0, 0, 1],
|
||||
7: [0, 1, -1, 0], 8: [0, 1, 1, 0], 9: [0, 1, 0, -1], 10: [0, 1, 0, 1],
|
||||
11: [0, 0, 1, -1], 12: [0, 0, 1, 1]}
|
||||
@@ -0,0 +1,22 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
from sympy.core.backend import Rational
|
||||
|
||||
def test_type_E():
|
||||
c = CartanType("E6")
|
||||
m = Matrix(6, 6, [2, 0, -1, 0, 0, 0, 0, 2, 0, -1, 0, 0,
|
||||
-1, 0, 2, -1, 0, 0, 0, -1, -1, 2, -1, 0, 0, 0, 0,
|
||||
-1, 2, -1, 0, 0, 0, 0, -1, 2])
|
||||
assert c.cartan_matrix() == m
|
||||
assert c.dimension() == 8
|
||||
assert c.simple_root(6) == [0, 0, 0, -1, 1, 0, 0, 0]
|
||||
assert c.roots() == 72
|
||||
assert c.basis() == 78
|
||||
diag = " "*8 + "2\n" + " "*8 + "0\n" + " "*8 + "|\n" + " "*8 + "|\n"
|
||||
diag += "---".join("0" for i in range(1, 6))+"\n"
|
||||
diag += "1 " + " ".join(str(i) for i in range(3, 7))
|
||||
assert c.dynkin_diagram() == diag
|
||||
posroots = c.positive_roots()
|
||||
assert posroots[8] == [1, 0, 0, 0, 1, 0, 0, 0]
|
||||
assert posroots[21] == [Rational(1,2),Rational(1,2),Rational(1,2),Rational(1,2),
|
||||
Rational(1,2),Rational(-1,2),Rational(-1,2),Rational(1,2)]
|
||||
@@ -0,0 +1,24 @@
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
from sympy.core.backend import S
|
||||
|
||||
def test_type_F():
|
||||
c = CartanType("F4")
|
||||
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -2, 0, 0, -1, 2, -1, 0, 0, -1, 2])
|
||||
assert c.cartan_matrix() == m
|
||||
assert c.dimension() == 4
|
||||
assert c.simple_root(1) == [1, -1, 0, 0]
|
||||
assert c.simple_root(2) == [0, 1, -1, 0]
|
||||
assert c.simple_root(3) == [0, 0, 0, 1]
|
||||
assert c.simple_root(4) == [-S.Half, -S.Half, -S.Half, -S.Half]
|
||||
assert c.roots() == 48
|
||||
assert c.basis() == 52
|
||||
diag = "0---0=>=0---0\n" + " ".join(str(i) for i in range(1, 5))
|
||||
assert c.dynkin_diagram() == diag
|
||||
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0], 3: [1, 0, -1, 0],
|
||||
4: [1, 0, 1, 0], 5: [1, 0, 0, -1], 6: [1, 0, 0, 1], 7: [0, 1, -1, 0],
|
||||
8: [0, 1, 1, 0], 9: [0, 1, 0, -1], 10: [0, 1, 0, 1], 11: [0, 0, 1, -1],
|
||||
12: [0, 0, 1, 1], 13: [1, 0, 0, 0], 14: [0, 1, 0, 0], 15: [0, 0, 1, 0],
|
||||
16: [0, 0, 0, 1], 17: [S.Half, S.Half, S.Half, S.Half], 18: [S.Half, -S.Half, S.Half, S.Half],
|
||||
19: [S.Half, S.Half, -S.Half, S.Half], 20: [S.Half, S.Half, S.Half, -S.Half], 21: [S.Half, S.Half, -S.Half, -S.Half],
|
||||
22: [S.Half, -S.Half, S.Half, -S.Half], 23: [S.Half, -S.Half, -S.Half, S.Half], 24: [S.Half, -S.Half, -S.Half, -S.Half]}
|
||||
@@ -0,0 +1,16 @@
|
||||
# coding=utf-8
|
||||
from sympy.liealgebras.cartan_type import CartanType
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_type_G():
|
||||
c = CartanType("G2")
|
||||
m = Matrix(2, 2, [2, -1, -3, 2])
|
||||
assert c.cartan_matrix() == m
|
||||
assert c.simple_root(2) == [1, -2, 1]
|
||||
assert c.basis() == 14
|
||||
assert c.roots() == 12
|
||||
assert c.dimension() == 3
|
||||
diag = "0≡<≡0\n1 2"
|
||||
assert diag == c.dynkin_diagram()
|
||||
assert c.positive_roots() == {1: [0, 1, -1], 2: [1, -2, 1], 3: [1, -1, 0],
|
||||
4: [1, 0, 1], 5: [1, 1, -2], 6: [2, -1, -1]}
|
||||
@@ -0,0 +1,35 @@
|
||||
from sympy.liealgebras.weyl_group import WeylGroup
|
||||
from sympy.matrices import Matrix
|
||||
|
||||
def test_weyl_group():
|
||||
c = WeylGroup("A3")
|
||||
assert c.matrix_form('r1*r2') == Matrix([[0, 0, 1, 0], [1, 0, 0, 0],
|
||||
[0, 1, 0, 0], [0, 0, 0, 1]])
|
||||
assert c.generators() == ['r1', 'r2', 'r3']
|
||||
assert c.group_order() == 24.0
|
||||
assert c.group_name() == "S4: the symmetric group acting on 4 elements."
|
||||
assert c.coxeter_diagram() == "0---0---0\n1 2 3"
|
||||
assert c.element_order('r1*r2*r3') == 4
|
||||
assert c.element_order('r1*r3*r2*r3') == 3
|
||||
d = WeylGroup("B5")
|
||||
assert d.group_order() == 3840
|
||||
assert d.element_order('r1*r2*r4*r5') == 12
|
||||
assert d.matrix_form('r2*r3') == Matrix([[0, 0, 1, 0, 0], [1, 0, 0, 0, 0],
|
||||
[0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]])
|
||||
assert d.element_order('r1*r2*r1*r3*r5') == 6
|
||||
e = WeylGroup("D5")
|
||||
assert e.element_order('r2*r3*r5') == 4
|
||||
assert e.matrix_form('r2*r3*r5') == Matrix([[1, 0, 0, 0, 0], [0, 0, 0, 0, -1],
|
||||
[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, 0]])
|
||||
f = WeylGroup("G2")
|
||||
assert f.element_order('r1*r2*r1*r2') == 3
|
||||
assert f.element_order('r2*r1*r1*r2') == 1
|
||||
|
||||
assert f.matrix_form('r1*r2*r1*r2') == Matrix([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
|
||||
g = WeylGroup("F4")
|
||||
assert g.matrix_form('r2*r3') == Matrix([[1, 0, 0, 0], [0, 1, 0, 0],
|
||||
[0, 0, 0, -1], [0, 0, 1, 0]])
|
||||
|
||||
assert g.element_order('r2*r3') == 4
|
||||
h = WeylGroup("E6")
|
||||
assert h.group_order() == 51840
|
||||
Reference in New Issue
Block a user