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], }
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
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]
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)"
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(3) == [0, 0, 0, 1] assert c.simple_root(4) == [-0.5, -0.5, -0.5, -0.5] assert c.roots() == 48 assert c.basis() == 52
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()
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
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)"
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()
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]
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
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
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]}
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
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]}
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]}
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]}
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(1) / 2, -S(1) / 2, -S(1) / 2, -S(1) / 2] 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(1) / 2, S(1) / 2, S(1) / 2, S(1) / 2], 18: [S(1) / 2, S(-1) / 2, S(1) / 2, S(1) / 2], 19: [S(1) / 2, S(1) / 2, S(-1) / 2, S(1) / 2], 20: [S(1) / 2, S(1) / 2, S(1) / 2, S(-1) / 2], 21: [S(1) / 2, S(1) / 2, S(-1) / 2, S(-1) / 2], 22: [S(1) / 2, S(-1) / 2, S(1) / 2, S(-1) / 2], 23: [S(1) / 2, S(-1) / 2, S(-1) / 2, S(1) / 2], 24: [S(1) / 2, S(-1) / 2, S(-1) / 2, S(-1) / 2] }
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(3) == [0, 0, 0, 1] assert c.simple_root(4) == [-0.5, -0.5, -0.5, -0.5] assert c.roots() == 48 assert c.basis() == 52 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: [1/2, 1/2, 1/2, 1/2], 18: [1/2, -1/2, 1/2, 1/2], 19: [1/2, 1/2, -1/2, 1/2], 20: [1/2, 1/2, 1/2, -1/2], 21: [1/2, 1/2, -1/2, -1/2], 22: [1/2, -1/2, 1/2, -1/2], 23: [1/2, -1/2, -1/2, 1/2], 24: [1/2, -1/2, -1/2, -1/2]}
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(3) == [0, 0, 0, 1] assert c.simple_root(4) == [-0.5, -0.5, -0.5, -0.5] 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: [1/2, 1/2, 1/2, 1/2], 18: [1/2, -1/2, 1/2, 1/2], 19: [1/2, 1/2, -1/2, 1/2], 20: [1/2, 1/2, 1/2, -1/2], 21: [1/2, 1/2, -1/2, -1/2], 22: [1/2, -1/2, 1/2, -1/2], 23: [1/2, -1/2, -1/2, 1/2], 24: [1/2, -1/2, -1/2, -1/2]}
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]}
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], }
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] }
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] }