Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__init__.py +3 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/__init__.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_matrix.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_type.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/dynkin_diagram.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/root_system.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_a.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_b.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_c.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_d.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_e.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_f.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_g.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/cartan_type.py +73 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/dynkin_diagram.py +24 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__init__.py +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/__init__.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_matrix.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_type.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_dynkin_diagram.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_root_system.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_A.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_B.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_C.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_D.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_E.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_F.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_G.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_weyl_group.cpython-310.pyc +0 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_matrix.py +10 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_type.py +12 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_dynkin_diagram.py +9 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_root_system.py +18 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_A.py +17 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_B.py +17 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_C.py +22 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_D.py +19 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_E.py +19 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_F.py +24 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_G.py +16 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_weyl_group.py +35 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_a.py +166 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_b.py +172 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_c.py +171 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_d.py +175 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_e.py +287 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_f.py +162 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_g.py +111 -0
- env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/weyl_group.py +403 -0
- env-llmeval/lib/python3.10/site-packages/sympy/matrices/__init__.py +71 -0
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__init__.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
|
3 |
+
__all__ = ['CartanType']
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (268 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_matrix.cpython-310.pyc
ADDED
Binary file (781 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_type.cpython-310.pyc
ADDED
Binary file (2.2 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/dynkin_diagram.cpython-310.pyc
ADDED
Binary file (793 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/root_system.cpython-310.pyc
ADDED
Binary file (7.81 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_a.cpython-310.pyc
ADDED
Binary file (5.47 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_b.cpython-310.pyc
ADDED
Binary file (5.45 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_c.cpython-310.pyc
ADDED
Binary file (5.33 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_d.cpython-310.pyc
ADDED
Binary file (5.63 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_e.cpython-310.pyc
ADDED
Binary file (7.12 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_f.cpython-310.pyc
ADDED
Binary file (4.9 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_g.cpython-310.pyc
ADDED
Binary file (3.79 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/cartan_type.py
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.core import Atom, Basic
|
2 |
+
|
3 |
+
|
4 |
+
class CartanType_generator():
|
5 |
+
"""
|
6 |
+
Constructor for actually creating things
|
7 |
+
"""
|
8 |
+
def __call__(self, *args):
|
9 |
+
c = args[0]
|
10 |
+
if isinstance(c, list):
|
11 |
+
letter, n = c[0], int(c[1])
|
12 |
+
elif isinstance(c, str):
|
13 |
+
letter, n = c[0], int(c[1:])
|
14 |
+
else:
|
15 |
+
raise TypeError("Argument must be a string (e.g. 'A3') or a list (e.g. ['A', 3])")
|
16 |
+
|
17 |
+
if n < 0:
|
18 |
+
raise ValueError("Lie algebra rank cannot be negative")
|
19 |
+
if letter == "A":
|
20 |
+
from . import type_a
|
21 |
+
return type_a.TypeA(n)
|
22 |
+
if letter == "B":
|
23 |
+
from . import type_b
|
24 |
+
return type_b.TypeB(n)
|
25 |
+
|
26 |
+
if letter == "C":
|
27 |
+
from . import type_c
|
28 |
+
return type_c.TypeC(n)
|
29 |
+
|
30 |
+
if letter == "D":
|
31 |
+
from . import type_d
|
32 |
+
return type_d.TypeD(n)
|
33 |
+
|
34 |
+
if letter == "E":
|
35 |
+
if n >= 6 and n <= 8:
|
36 |
+
from . import type_e
|
37 |
+
return type_e.TypeE(n)
|
38 |
+
|
39 |
+
if letter == "F":
|
40 |
+
if n == 4:
|
41 |
+
from . import type_f
|
42 |
+
return type_f.TypeF(n)
|
43 |
+
|
44 |
+
if letter == "G":
|
45 |
+
if n == 2:
|
46 |
+
from . import type_g
|
47 |
+
return type_g.TypeG(n)
|
48 |
+
|
49 |
+
CartanType = CartanType_generator()
|
50 |
+
|
51 |
+
|
52 |
+
class Standard_Cartan(Atom):
|
53 |
+
"""
|
54 |
+
Concrete base class for Cartan types such as A4, etc
|
55 |
+
"""
|
56 |
+
|
57 |
+
def __new__(cls, series, n):
|
58 |
+
obj = Basic.__new__(cls)
|
59 |
+
obj.n = n
|
60 |
+
obj.series = series
|
61 |
+
return obj
|
62 |
+
|
63 |
+
def rank(self):
|
64 |
+
"""
|
65 |
+
Returns the rank of the Lie algebra
|
66 |
+
"""
|
67 |
+
return self.n
|
68 |
+
|
69 |
+
def series(self):
|
70 |
+
"""
|
71 |
+
Returns the type of the Lie algebra
|
72 |
+
"""
|
73 |
+
return self.series
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/dynkin_diagram.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import CartanType
|
2 |
+
|
3 |
+
|
4 |
+
def DynkinDiagram(t):
|
5 |
+
"""Display the Dynkin diagram of a given Lie algebra
|
6 |
+
|
7 |
+
Works by generating the CartanType for the input, t, and then returning the
|
8 |
+
Dynkin diagram method from the individual classes.
|
9 |
+
|
10 |
+
Examples
|
11 |
+
========
|
12 |
+
|
13 |
+
>>> from sympy.liealgebras.dynkin_diagram import DynkinDiagram
|
14 |
+
>>> print(DynkinDiagram("A3"))
|
15 |
+
0---0---0
|
16 |
+
1 2 3
|
17 |
+
|
18 |
+
>>> print(DynkinDiagram("B4"))
|
19 |
+
0---0---0=>=0
|
20 |
+
1 2 3 4
|
21 |
+
|
22 |
+
"""
|
23 |
+
|
24 |
+
return CartanType(t).dynkin_diagram()
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__init__.py
ADDED
File without changes
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (188 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_matrix.cpython-310.pyc
ADDED
Binary file (612 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_type.cpython-310.pyc
ADDED
Binary file (590 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_dynkin_diagram.cpython-310.pyc
ADDED
Binary file (515 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_root_system.cpython-310.pyc
ADDED
Binary file (1.37 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_A.cpython-310.pyc
ADDED
Binary file (1.05 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_B.cpython-310.pyc
ADDED
Binary file (1.05 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_C.cpython-310.pyc
ADDED
Binary file (1.52 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_D.cpython-310.pyc
ADDED
Binary file (1.24 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_E.cpython-310.pyc
ADDED
Binary file (1.39 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_F.cpython-310.pyc
ADDED
Binary file (2 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_G.cpython-310.pyc
ADDED
Binary file (913 Bytes). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_weyl_group.cpython-310.pyc
ADDED
Binary file (1.71 kB). View file
|
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_matrix.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_matrix import CartanMatrix
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_CartanMatrix():
|
5 |
+
c = CartanMatrix("A3")
|
6 |
+
m = Matrix(3, 3, [2, -1, 0, -1, 2, -1, 0, -1, 2])
|
7 |
+
assert c == m
|
8 |
+
a = CartanMatrix(["G",2])
|
9 |
+
mt = Matrix(2, 2, [2, -1, -3, 2])
|
10 |
+
assert a == mt
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_type.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType, Standard_Cartan
|
2 |
+
|
3 |
+
def test_Standard_Cartan():
|
4 |
+
c = CartanType("A4")
|
5 |
+
assert c.rank() == 4
|
6 |
+
assert c.series == "A"
|
7 |
+
m = Standard_Cartan("A", 2)
|
8 |
+
assert m.rank() == 2
|
9 |
+
assert m.series == "A"
|
10 |
+
b = CartanType("B12")
|
11 |
+
assert b.rank() == 12
|
12 |
+
assert b.series == "B"
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_dynkin_diagram.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.dynkin_diagram import DynkinDiagram
|
2 |
+
|
3 |
+
def test_DynkinDiagram():
|
4 |
+
c = DynkinDiagram("A3")
|
5 |
+
diag = "0---0---0\n1 2 3"
|
6 |
+
assert c == diag
|
7 |
+
ct = DynkinDiagram(["B", 3])
|
8 |
+
diag2 = "0---0=>=0\n1 2 3"
|
9 |
+
assert ct == diag2
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_root_system.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.root_system import RootSystem
|
2 |
+
from sympy.liealgebras.type_a import TypeA
|
3 |
+
from sympy.matrices import Matrix
|
4 |
+
|
5 |
+
def test_root_system():
|
6 |
+
c = RootSystem("A3")
|
7 |
+
assert c.cartan_type == TypeA(3)
|
8 |
+
assert c.simple_roots() == {1: [1, -1, 0, 0], 2: [0, 1, -1, 0], 3: [0, 0, 1, -1]}
|
9 |
+
assert c.root_space() == "alpha[1] + alpha[2] + alpha[3]"
|
10 |
+
assert c.cartan_matrix() == Matrix([[ 2, -1, 0], [-1, 2, -1], [ 0, -1, 2]])
|
11 |
+
assert c.dynkin_diagram() == "0---0---0\n1 2 3"
|
12 |
+
assert c.add_simple_roots(1, 2) == [1, 0, -1, 0]
|
13 |
+
assert c.all_roots() == {1: [1, -1, 0, 0], 2: [1, 0, -1, 0],
|
14 |
+
3: [1, 0, 0, -1], 4: [0, 1, -1, 0], 5: [0, 1, 0, -1],
|
15 |
+
6: [0, 0, 1, -1], 7: [-1, 1, 0, 0], 8: [-1, 0, 1, 0],
|
16 |
+
9: [-1, 0, 0, 1], 10: [0, -1, 1, 0],
|
17 |
+
11: [0, -1, 0, 1], 12: [0, 0, -1, 1]}
|
18 |
+
assert c.add_as_roots([1, 0, -1, 0], [0, 0, 1, -1]) == [1, 0, 0, -1]
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_A.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_type_A():
|
5 |
+
c = CartanType("A3")
|
6 |
+
m = Matrix(3, 3, [2, -1, 0, -1, 2, -1, 0, -1, 2])
|
7 |
+
assert m == c.cartan_matrix()
|
8 |
+
assert c.basis() == 8
|
9 |
+
assert c.roots() == 12
|
10 |
+
assert c.dimension() == 4
|
11 |
+
assert c.simple_root(1) == [1, -1, 0, 0]
|
12 |
+
assert c.highest_root() == [1, 0, 0, -1]
|
13 |
+
assert c.lie_algebra() == "su(4)"
|
14 |
+
diag = "0---0---0\n1 2 3"
|
15 |
+
assert c.dynkin_diagram() == diag
|
16 |
+
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 0, -1, 0],
|
17 |
+
3: [1, 0, 0, -1], 4: [0, 1, -1, 0], 5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_B.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_type_B():
|
5 |
+
c = CartanType("B3")
|
6 |
+
m = Matrix(3, 3, [2, -1, 0, -1, 2, -2, 0, -1, 2])
|
7 |
+
assert m == c.cartan_matrix()
|
8 |
+
assert c.dimension() == 3
|
9 |
+
assert c.roots() == 18
|
10 |
+
assert c.simple_root(3) == [0, 0, 1]
|
11 |
+
assert c.basis() == 3
|
12 |
+
assert c.lie_algebra() == "so(6)"
|
13 |
+
diag = "0---0=>=0\n1 2 3"
|
14 |
+
assert c.dynkin_diagram() == diag
|
15 |
+
assert c.positive_roots() == {1: [1, -1, 0], 2: [1, 1, 0], 3: [1, 0, -1],
|
16 |
+
4: [1, 0, 1], 5: [0, 1, -1], 6: [0, 1, 1], 7: [1, 0, 0],
|
17 |
+
8: [0, 1, 0], 9: [0, 0, 1]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_C.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_type_C():
|
5 |
+
c = CartanType("C4")
|
6 |
+
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -1, 0, 0, -1, 2, -1, 0, 0, -2, 2])
|
7 |
+
assert c.cartan_matrix() == m
|
8 |
+
assert c.dimension() == 4
|
9 |
+
assert c.simple_root(4) == [0, 0, 0, 2]
|
10 |
+
assert c.roots() == 32
|
11 |
+
assert c.basis() == 36
|
12 |
+
assert c.lie_algebra() == "sp(8)"
|
13 |
+
t = CartanType(['C', 3])
|
14 |
+
assert t.dimension() == 3
|
15 |
+
diag = "0---0---0=<=0\n1 2 3 4"
|
16 |
+
assert c.dynkin_diagram() == diag
|
17 |
+
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0],
|
18 |
+
3: [1, 0, -1, 0], 4: [1, 0, 1, 0], 5: [1, 0, 0, -1],
|
19 |
+
6: [1, 0, 0, 1], 7: [0, 1, -1, 0], 8: [0, 1, 1, 0],
|
20 |
+
9: [0, 1, 0, -1], 10: [0, 1, 0, 1], 11: [0, 0, 1, -1],
|
21 |
+
12: [0, 0, 1, 1], 13: [2, 0, 0, 0], 14: [0, 2, 0, 0], 15: [0, 0, 2, 0],
|
22 |
+
16: [0, 0, 0, 2]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_D.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
def test_type_D():
|
7 |
+
c = CartanType("D4")
|
8 |
+
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -1, -1, 0, -1, 2, 0, 0, -1, 0, 2])
|
9 |
+
assert c.cartan_matrix() == m
|
10 |
+
assert c.basis() == 6
|
11 |
+
assert c.lie_algebra() == "so(8)"
|
12 |
+
assert c.roots() == 24
|
13 |
+
assert c.simple_root(3) == [0, 0, 1, -1]
|
14 |
+
diag = " 3\n 0\n |\n |\n0---0---0\n1 2 4"
|
15 |
+
assert diag == c.dynkin_diagram()
|
16 |
+
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0],
|
17 |
+
3: [1, 0, -1, 0], 4: [1, 0, 1, 0], 5: [1, 0, 0, -1], 6: [1, 0, 0, 1],
|
18 |
+
7: [0, 1, -1, 0], 8: [0, 1, 1, 0], 9: [0, 1, 0, -1], 10: [0, 1, 0, 1],
|
19 |
+
11: [0, 0, 1, -1], 12: [0, 0, 1, 1]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_E.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_type_E():
|
5 |
+
c = CartanType("E6")
|
6 |
+
m = Matrix(6, 6, [2, 0, -1, 0, 0, 0, 0, 2, 0, -1, 0, 0,
|
7 |
+
-1, 0, 2, -1, 0, 0, 0, -1, -1, 2, -1, 0, 0, 0, 0,
|
8 |
+
-1, 2, -1, 0, 0, 0, 0, -1, 2])
|
9 |
+
assert c.cartan_matrix() == m
|
10 |
+
assert c.dimension() == 8
|
11 |
+
assert c.simple_root(6) == [0, 0, 0, -1, 1, 0, 0, 0]
|
12 |
+
assert c.roots() == 72
|
13 |
+
assert c.basis() == 78
|
14 |
+
diag = " "*8 + "2\n" + " "*8 + "0\n" + " "*8 + "|\n" + " "*8 + "|\n"
|
15 |
+
diag += "---".join("0" for i in range(1, 6))+"\n"
|
16 |
+
diag += "1 " + " ".join(str(i) for i in range(3, 7))
|
17 |
+
assert c.dynkin_diagram() == diag
|
18 |
+
posroots = c.positive_roots()
|
19 |
+
assert posroots[8] == [1, 0, 0, 0, 1, 0, 0, 0]
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_F.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import CartanType
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
from sympy.core.backend import S
|
4 |
+
|
5 |
+
def test_type_F():
|
6 |
+
c = CartanType("F4")
|
7 |
+
m = Matrix(4, 4, [2, -1, 0, 0, -1, 2, -2, 0, 0, -1, 2, -1, 0, 0, -1, 2])
|
8 |
+
assert c.cartan_matrix() == m
|
9 |
+
assert c.dimension() == 4
|
10 |
+
assert c.simple_root(1) == [1, -1, 0, 0]
|
11 |
+
assert c.simple_root(2) == [0, 1, -1, 0]
|
12 |
+
assert c.simple_root(3) == [0, 0, 0, 1]
|
13 |
+
assert c.simple_root(4) == [-S.Half, -S.Half, -S.Half, -S.Half]
|
14 |
+
assert c.roots() == 48
|
15 |
+
assert c.basis() == 52
|
16 |
+
diag = "0---0=>=0---0\n" + " ".join(str(i) for i in range(1, 5))
|
17 |
+
assert c.dynkin_diagram() == diag
|
18 |
+
assert c.positive_roots() == {1: [1, -1, 0, 0], 2: [1, 1, 0, 0], 3: [1, 0, -1, 0],
|
19 |
+
4: [1, 0, 1, 0], 5: [1, 0, 0, -1], 6: [1, 0, 0, 1], 7: [0, 1, -1, 0],
|
20 |
+
8: [0, 1, 1, 0], 9: [0, 1, 0, -1], 10: [0, 1, 0, 1], 11: [0, 0, 1, -1],
|
21 |
+
12: [0, 0, 1, 1], 13: [1, 0, 0, 0], 14: [0, 1, 0, 0], 15: [0, 0, 1, 0],
|
22 |
+
16: [0, 0, 0, 1], 17: [S.Half, S.Half, S.Half, S.Half], 18: [S.Half, -S.Half, S.Half, S.Half],
|
23 |
+
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],
|
24 |
+
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]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_G.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
from sympy.liealgebras.cartan_type import CartanType
|
3 |
+
from sympy.matrices import Matrix
|
4 |
+
|
5 |
+
def test_type_G():
|
6 |
+
c = CartanType("G2")
|
7 |
+
m = Matrix(2, 2, [2, -1, -3, 2])
|
8 |
+
assert c.cartan_matrix() == m
|
9 |
+
assert c.simple_root(2) == [1, -2, 1]
|
10 |
+
assert c.basis() == 14
|
11 |
+
assert c.roots() == 12
|
12 |
+
assert c.dimension() == 3
|
13 |
+
diag = "0≡<≡0\n1 2"
|
14 |
+
assert diag == c.dynkin_diagram()
|
15 |
+
assert c.positive_roots() == {1: [0, 1, -1], 2: [1, -2, 1], 3: [1, -1, 0],
|
16 |
+
4: [1, 0, 1], 5: [1, 1, -2], 6: [2, -1, -1]}
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/tests/test_weyl_group.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.weyl_group import WeylGroup
|
2 |
+
from sympy.matrices import Matrix
|
3 |
+
|
4 |
+
def test_weyl_group():
|
5 |
+
c = WeylGroup("A3")
|
6 |
+
assert c.matrix_form('r1*r2') == Matrix([[0, 0, 1, 0], [1, 0, 0, 0],
|
7 |
+
[0, 1, 0, 0], [0, 0, 0, 1]])
|
8 |
+
assert c.generators() == ['r1', 'r2', 'r3']
|
9 |
+
assert c.group_order() == 24.0
|
10 |
+
assert c.group_name() == "S4: the symmetric group acting on 4 elements."
|
11 |
+
assert c.coxeter_diagram() == "0---0---0\n1 2 3"
|
12 |
+
assert c.element_order('r1*r2*r3') == 4
|
13 |
+
assert c.element_order('r1*r3*r2*r3') == 3
|
14 |
+
d = WeylGroup("B5")
|
15 |
+
assert d.group_order() == 3840
|
16 |
+
assert d.element_order('r1*r2*r4*r5') == 12
|
17 |
+
assert d.matrix_form('r2*r3') == Matrix([[0, 0, 1, 0, 0], [1, 0, 0, 0, 0],
|
18 |
+
[0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]])
|
19 |
+
assert d.element_order('r1*r2*r1*r3*r5') == 6
|
20 |
+
e = WeylGroup("D5")
|
21 |
+
assert e.element_order('r2*r3*r5') == 4
|
22 |
+
assert e.matrix_form('r2*r3*r5') == Matrix([[1, 0, 0, 0, 0], [0, 0, 0, 0, -1],
|
23 |
+
[0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, 0]])
|
24 |
+
f = WeylGroup("G2")
|
25 |
+
assert f.element_order('r1*r2*r1*r2') == 3
|
26 |
+
assert f.element_order('r2*r1*r1*r2') == 1
|
27 |
+
|
28 |
+
assert f.matrix_form('r1*r2*r1*r2') == Matrix([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
|
29 |
+
g = WeylGroup("F4")
|
30 |
+
assert g.matrix_form('r2*r3') == Matrix([[1, 0, 0, 0], [0, 1, 0, 0],
|
31 |
+
[0, 0, 0, -1], [0, 0, 1, 0]])
|
32 |
+
|
33 |
+
assert g.element_order('r2*r3') == 4
|
34 |
+
h = WeylGroup("E6")
|
35 |
+
assert h.group_order() == 51840
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_a.py
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sympy.liealgebras.cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import eye
|
3 |
+
|
4 |
+
|
5 |
+
class TypeA(Standard_Cartan):
|
6 |
+
"""
|
7 |
+
This class contains the information about
|
8 |
+
the A series of simple Lie algebras.
|
9 |
+
====
|
10 |
+
"""
|
11 |
+
|
12 |
+
def __new__(cls, n):
|
13 |
+
if n < 1:
|
14 |
+
raise ValueError("n cannot be less than 1")
|
15 |
+
return Standard_Cartan.__new__(cls, "A", n)
|
16 |
+
|
17 |
+
|
18 |
+
def dimension(self):
|
19 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
20 |
+
|
21 |
+
Examples
|
22 |
+
========
|
23 |
+
|
24 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
25 |
+
>>> c = CartanType("A4")
|
26 |
+
>>> c.dimension()
|
27 |
+
5
|
28 |
+
"""
|
29 |
+
return self.n+1
|
30 |
+
|
31 |
+
|
32 |
+
def basic_root(self, i, j):
|
33 |
+
"""
|
34 |
+
This is a method just to generate roots
|
35 |
+
with a 1 iin the ith position and a -1
|
36 |
+
in the jth position.
|
37 |
+
|
38 |
+
"""
|
39 |
+
|
40 |
+
n = self.n
|
41 |
+
root = [0]*(n+1)
|
42 |
+
root[i] = 1
|
43 |
+
root[j] = -1
|
44 |
+
return root
|
45 |
+
|
46 |
+
def simple_root(self, i):
|
47 |
+
"""
|
48 |
+
Every lie algebra has a unique root system.
|
49 |
+
Given a root system Q, there is a subset of the
|
50 |
+
roots such that an element of Q is called a
|
51 |
+
simple root if it cannot be written as the sum
|
52 |
+
of two elements in Q. If we let D denote the
|
53 |
+
set of simple roots, then it is clear that every
|
54 |
+
element of Q can be written as a linear combination
|
55 |
+
of elements of D with all coefficients non-negative.
|
56 |
+
|
57 |
+
In A_n the ith simple root is the root which has a 1
|
58 |
+
in the ith position, a -1 in the (i+1)th position,
|
59 |
+
and zeroes elsewhere.
|
60 |
+
|
61 |
+
This method returns the ith simple root for the A series.
|
62 |
+
|
63 |
+
Examples
|
64 |
+
========
|
65 |
+
|
66 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
67 |
+
>>> c = CartanType("A4")
|
68 |
+
>>> c.simple_root(1)
|
69 |
+
[1, -1, 0, 0, 0]
|
70 |
+
|
71 |
+
"""
|
72 |
+
|
73 |
+
return self.basic_root(i-1, i)
|
74 |
+
|
75 |
+
def positive_roots(self):
|
76 |
+
"""
|
77 |
+
This method generates all the positive roots of
|
78 |
+
A_n. This is half of all of the roots of A_n;
|
79 |
+
by multiplying all the positive roots by -1 we
|
80 |
+
get the negative roots.
|
81 |
+
|
82 |
+
Examples
|
83 |
+
========
|
84 |
+
|
85 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
86 |
+
>>> c = CartanType("A3")
|
87 |
+
>>> c.positive_roots()
|
88 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
89 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
90 |
+
"""
|
91 |
+
|
92 |
+
n = self.n
|
93 |
+
posroots = {}
|
94 |
+
k = 0
|
95 |
+
for i in range(0, n):
|
96 |
+
for j in range(i+1, n+1):
|
97 |
+
k += 1
|
98 |
+
posroots[k] = self.basic_root(i, j)
|
99 |
+
return posroots
|
100 |
+
|
101 |
+
def highest_root(self):
|
102 |
+
"""
|
103 |
+
Returns the highest weight root for A_n
|
104 |
+
"""
|
105 |
+
|
106 |
+
return self.basic_root(0, self.n)
|
107 |
+
|
108 |
+
def roots(self):
|
109 |
+
"""
|
110 |
+
Returns the total number of roots for A_n
|
111 |
+
"""
|
112 |
+
n = self.n
|
113 |
+
return n*(n+1)
|
114 |
+
|
115 |
+
def cartan_matrix(self):
|
116 |
+
"""
|
117 |
+
Returns the Cartan matrix for A_n.
|
118 |
+
The Cartan matrix matrix for a Lie algebra is
|
119 |
+
generated by assigning an ordering to the simple
|
120 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
121 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
122 |
+
|
123 |
+
Examples
|
124 |
+
========
|
125 |
+
|
126 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
127 |
+
>>> c = CartanType('A4')
|
128 |
+
>>> c.cartan_matrix()
|
129 |
+
Matrix([
|
130 |
+
[ 2, -1, 0, 0],
|
131 |
+
[-1, 2, -1, 0],
|
132 |
+
[ 0, -1, 2, -1],
|
133 |
+
[ 0, 0, -1, 2]])
|
134 |
+
|
135 |
+
"""
|
136 |
+
|
137 |
+
n = self.n
|
138 |
+
m = 2 * eye(n)
|
139 |
+
i = 1
|
140 |
+
while i < n-1:
|
141 |
+
m[i, i+1] = -1
|
142 |
+
m[i, i-1] = -1
|
143 |
+
i += 1
|
144 |
+
m[0,1] = -1
|
145 |
+
m[n-1, n-2] = -1
|
146 |
+
return m
|
147 |
+
|
148 |
+
def basis(self):
|
149 |
+
"""
|
150 |
+
Returns the number of independent generators of A_n
|
151 |
+
"""
|
152 |
+
n = self.n
|
153 |
+
return n**2 - 1
|
154 |
+
|
155 |
+
def lie_algebra(self):
|
156 |
+
"""
|
157 |
+
Returns the Lie algebra associated with A_n
|
158 |
+
"""
|
159 |
+
n = self.n
|
160 |
+
return "su(" + str(n + 1) + ")"
|
161 |
+
|
162 |
+
def dynkin_diagram(self):
|
163 |
+
n = self.n
|
164 |
+
diag = "---".join("0" for i in range(1, n+1)) + "\n"
|
165 |
+
diag += " ".join(str(i) for i in range(1, n+1))
|
166 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_b.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import eye
|
3 |
+
|
4 |
+
class TypeB(Standard_Cartan):
|
5 |
+
|
6 |
+
def __new__(cls, n):
|
7 |
+
if n < 2:
|
8 |
+
raise ValueError("n cannot be less than 2")
|
9 |
+
return Standard_Cartan.__new__(cls, "B", n)
|
10 |
+
|
11 |
+
def dimension(self):
|
12 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
13 |
+
|
14 |
+
Examples
|
15 |
+
========
|
16 |
+
|
17 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
18 |
+
>>> c = CartanType("B3")
|
19 |
+
>>> c.dimension()
|
20 |
+
3
|
21 |
+
"""
|
22 |
+
|
23 |
+
return self.n
|
24 |
+
|
25 |
+
def basic_root(self, i, j):
|
26 |
+
"""
|
27 |
+
This is a method just to generate roots
|
28 |
+
with a 1 iin the ith position and a -1
|
29 |
+
in the jth position.
|
30 |
+
|
31 |
+
"""
|
32 |
+
root = [0]*self.n
|
33 |
+
root[i] = 1
|
34 |
+
root[j] = -1
|
35 |
+
return root
|
36 |
+
|
37 |
+
def simple_root(self, i):
|
38 |
+
"""
|
39 |
+
Every lie algebra has a unique root system.
|
40 |
+
Given a root system Q, there is a subset of the
|
41 |
+
roots such that an element of Q is called a
|
42 |
+
simple root if it cannot be written as the sum
|
43 |
+
of two elements in Q. If we let D denote the
|
44 |
+
set of simple roots, then it is clear that every
|
45 |
+
element of Q can be written as a linear combination
|
46 |
+
of elements of D with all coefficients non-negative.
|
47 |
+
|
48 |
+
In B_n the first n-1 simple roots are the same as the
|
49 |
+
roots in A_(n-1) (a 1 in the ith position, a -1 in
|
50 |
+
the (i+1)th position, and zeroes elsewhere). The n-th
|
51 |
+
simple root is the root with a 1 in the nth position
|
52 |
+
and zeroes elsewhere.
|
53 |
+
|
54 |
+
This method returns the ith simple root for the B series.
|
55 |
+
|
56 |
+
Examples
|
57 |
+
========
|
58 |
+
|
59 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
60 |
+
>>> c = CartanType("B3")
|
61 |
+
>>> c.simple_root(2)
|
62 |
+
[0, 1, -1]
|
63 |
+
|
64 |
+
"""
|
65 |
+
n = self.n
|
66 |
+
if i < n:
|
67 |
+
return self.basic_root(i-1, i)
|
68 |
+
else:
|
69 |
+
root = [0]*self.n
|
70 |
+
root[n-1] = 1
|
71 |
+
return root
|
72 |
+
|
73 |
+
def positive_roots(self):
|
74 |
+
"""
|
75 |
+
This method generates all the positive roots of
|
76 |
+
A_n. This is half of all of the roots of B_n;
|
77 |
+
by multiplying all the positive roots by -1 we
|
78 |
+
get the negative roots.
|
79 |
+
|
80 |
+
Examples
|
81 |
+
========
|
82 |
+
|
83 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
84 |
+
>>> c = CartanType("A3")
|
85 |
+
>>> c.positive_roots()
|
86 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
87 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
88 |
+
"""
|
89 |
+
|
90 |
+
n = self.n
|
91 |
+
posroots = {}
|
92 |
+
k = 0
|
93 |
+
for i in range(0, n-1):
|
94 |
+
for j in range(i+1, n):
|
95 |
+
k += 1
|
96 |
+
posroots[k] = self.basic_root(i, j)
|
97 |
+
k += 1
|
98 |
+
root = self.basic_root(i, j)
|
99 |
+
root[j] = 1
|
100 |
+
posroots[k] = root
|
101 |
+
|
102 |
+
for i in range(0, n):
|
103 |
+
k += 1
|
104 |
+
root = [0]*n
|
105 |
+
root[i] = 1
|
106 |
+
posroots[k] = root
|
107 |
+
|
108 |
+
return posroots
|
109 |
+
|
110 |
+
def roots(self):
|
111 |
+
"""
|
112 |
+
Returns the total number of roots for B_n"
|
113 |
+
"""
|
114 |
+
|
115 |
+
n = self.n
|
116 |
+
return 2*(n**2)
|
117 |
+
|
118 |
+
def cartan_matrix(self):
|
119 |
+
"""
|
120 |
+
Returns the Cartan matrix for B_n.
|
121 |
+
The Cartan matrix matrix for a Lie algebra is
|
122 |
+
generated by assigning an ordering to the simple
|
123 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
124 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
125 |
+
|
126 |
+
Examples
|
127 |
+
========
|
128 |
+
|
129 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
130 |
+
>>> c = CartanType('B4')
|
131 |
+
>>> c.cartan_matrix()
|
132 |
+
Matrix([
|
133 |
+
[ 2, -1, 0, 0],
|
134 |
+
[-1, 2, -1, 0],
|
135 |
+
[ 0, -1, 2, -2],
|
136 |
+
[ 0, 0, -1, 2]])
|
137 |
+
|
138 |
+
"""
|
139 |
+
|
140 |
+
n = self.n
|
141 |
+
m = 2* eye(n)
|
142 |
+
i = 1
|
143 |
+
while i < n-1:
|
144 |
+
m[i, i+1] = -1
|
145 |
+
m[i, i-1] = -1
|
146 |
+
i += 1
|
147 |
+
m[0, 1] = -1
|
148 |
+
m[n-2, n-1] = -2
|
149 |
+
m[n-1, n-2] = -1
|
150 |
+
return m
|
151 |
+
|
152 |
+
def basis(self):
|
153 |
+
"""
|
154 |
+
Returns the number of independent generators of B_n
|
155 |
+
"""
|
156 |
+
|
157 |
+
n = self.n
|
158 |
+
return (n**2 - n)/2
|
159 |
+
|
160 |
+
def lie_algebra(self):
|
161 |
+
"""
|
162 |
+
Returns the Lie algebra associated with B_n
|
163 |
+
"""
|
164 |
+
|
165 |
+
n = self.n
|
166 |
+
return "so(" + str(2*n) + ")"
|
167 |
+
|
168 |
+
def dynkin_diagram(self):
|
169 |
+
n = self.n
|
170 |
+
diag = "---".join("0" for i in range(1, n)) + "=>=0\n"
|
171 |
+
diag += " ".join(str(i) for i in range(1, n+1))
|
172 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_c.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import eye
|
3 |
+
|
4 |
+
class TypeC(Standard_Cartan):
|
5 |
+
|
6 |
+
def __new__(cls, n):
|
7 |
+
if n < 3:
|
8 |
+
raise ValueError("n cannot be less than 3")
|
9 |
+
return Standard_Cartan.__new__(cls, "C", n)
|
10 |
+
|
11 |
+
|
12 |
+
def dimension(self):
|
13 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
14 |
+
|
15 |
+
Examples
|
16 |
+
========
|
17 |
+
|
18 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
19 |
+
>>> c = CartanType("C3")
|
20 |
+
>>> c.dimension()
|
21 |
+
3
|
22 |
+
"""
|
23 |
+
n = self.n
|
24 |
+
return n
|
25 |
+
|
26 |
+
def basic_root(self, i, j):
|
27 |
+
"""Generate roots with 1 in ith position and a -1 in jth position
|
28 |
+
"""
|
29 |
+
n = self.n
|
30 |
+
root = [0]*n
|
31 |
+
root[i] = 1
|
32 |
+
root[j] = -1
|
33 |
+
return root
|
34 |
+
|
35 |
+
def simple_root(self, i):
|
36 |
+
"""The ith simple root for the C series
|
37 |
+
|
38 |
+
Every lie algebra has a unique root system.
|
39 |
+
Given a root system Q, there is a subset of the
|
40 |
+
roots such that an element of Q is called a
|
41 |
+
simple root if it cannot be written as the sum
|
42 |
+
of two elements in Q. If we let D denote the
|
43 |
+
set of simple roots, then it is clear that every
|
44 |
+
element of Q can be written as a linear combination
|
45 |
+
of elements of D with all coefficients non-negative.
|
46 |
+
|
47 |
+
In C_n, the first n-1 simple roots are the same as
|
48 |
+
the roots in A_(n-1) (a 1 in the ith position, a -1
|
49 |
+
in the (i+1)th position, and zeroes elsewhere). The
|
50 |
+
nth simple root is the root in which there is a 2 in
|
51 |
+
the nth position and zeroes elsewhere.
|
52 |
+
|
53 |
+
Examples
|
54 |
+
========
|
55 |
+
|
56 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
57 |
+
>>> c = CartanType("C3")
|
58 |
+
>>> c.simple_root(2)
|
59 |
+
[0, 1, -1]
|
60 |
+
|
61 |
+
"""
|
62 |
+
|
63 |
+
n = self.n
|
64 |
+
if i < n:
|
65 |
+
return self.basic_root(i-1,i)
|
66 |
+
else:
|
67 |
+
root = [0]*self.n
|
68 |
+
root[n-1] = 2
|
69 |
+
return root
|
70 |
+
|
71 |
+
|
72 |
+
def positive_roots(self):
|
73 |
+
"""Generates all the positive roots of A_n
|
74 |
+
|
75 |
+
This is half of all of the roots of C_n; by multiplying all the
|
76 |
+
positive roots by -1 we get the negative roots.
|
77 |
+
|
78 |
+
Examples
|
79 |
+
========
|
80 |
+
|
81 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
82 |
+
>>> c = CartanType("A3")
|
83 |
+
>>> c.positive_roots()
|
84 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
85 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
86 |
+
|
87 |
+
"""
|
88 |
+
|
89 |
+
n = self.n
|
90 |
+
posroots = {}
|
91 |
+
k = 0
|
92 |
+
for i in range(0, n-1):
|
93 |
+
for j in range(i+1, n):
|
94 |
+
k += 1
|
95 |
+
posroots[k] = self.basic_root(i, j)
|
96 |
+
k += 1
|
97 |
+
root = self.basic_root(i, j)
|
98 |
+
root[j] = 1
|
99 |
+
posroots[k] = root
|
100 |
+
|
101 |
+
for i in range(0, n):
|
102 |
+
k += 1
|
103 |
+
root = [0]*n
|
104 |
+
root[i] = 2
|
105 |
+
posroots[k] = root
|
106 |
+
|
107 |
+
return posroots
|
108 |
+
|
109 |
+
def roots(self):
|
110 |
+
"""
|
111 |
+
Returns the total number of roots for C_n"
|
112 |
+
"""
|
113 |
+
|
114 |
+
n = self.n
|
115 |
+
return 2*(n**2)
|
116 |
+
|
117 |
+
def cartan_matrix(self):
|
118 |
+
"""The Cartan matrix for C_n
|
119 |
+
|
120 |
+
The Cartan matrix matrix for a Lie algebra is
|
121 |
+
generated by assigning an ordering to the simple
|
122 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
123 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
124 |
+
|
125 |
+
Examples
|
126 |
+
========
|
127 |
+
|
128 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
129 |
+
>>> c = CartanType('C4')
|
130 |
+
>>> c.cartan_matrix()
|
131 |
+
Matrix([
|
132 |
+
[ 2, -1, 0, 0],
|
133 |
+
[-1, 2, -1, 0],
|
134 |
+
[ 0, -1, 2, -1],
|
135 |
+
[ 0, 0, -2, 2]])
|
136 |
+
|
137 |
+
"""
|
138 |
+
|
139 |
+
n = self.n
|
140 |
+
m = 2 * eye(n)
|
141 |
+
i = 1
|
142 |
+
while i < n-1:
|
143 |
+
m[i, i+1] = -1
|
144 |
+
m[i, i-1] = -1
|
145 |
+
i += 1
|
146 |
+
m[0,1] = -1
|
147 |
+
m[n-1, n-2] = -2
|
148 |
+
return m
|
149 |
+
|
150 |
+
|
151 |
+
def basis(self):
|
152 |
+
"""
|
153 |
+
Returns the number of independent generators of C_n
|
154 |
+
"""
|
155 |
+
|
156 |
+
n = self.n
|
157 |
+
return n*(2*n + 1)
|
158 |
+
|
159 |
+
def lie_algebra(self):
|
160 |
+
"""
|
161 |
+
Returns the Lie algebra associated with C_n"
|
162 |
+
"""
|
163 |
+
|
164 |
+
n = self.n
|
165 |
+
return "sp(" + str(2*n) + ")"
|
166 |
+
|
167 |
+
def dynkin_diagram(self):
|
168 |
+
n = self.n
|
169 |
+
diag = "---".join("0" for i in range(1, n)) + "=<=0\n"
|
170 |
+
diag += " ".join(str(i) for i in range(1, n+1))
|
171 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_d.py
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import eye
|
3 |
+
|
4 |
+
class TypeD(Standard_Cartan):
|
5 |
+
|
6 |
+
def __new__(cls, n):
|
7 |
+
if n < 3:
|
8 |
+
raise ValueError("n cannot be less than 3")
|
9 |
+
return Standard_Cartan.__new__(cls, "D", n)
|
10 |
+
|
11 |
+
|
12 |
+
def dimension(self):
|
13 |
+
"""Dmension of the vector space V underlying the Lie algebra
|
14 |
+
|
15 |
+
Examples
|
16 |
+
========
|
17 |
+
|
18 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
19 |
+
>>> c = CartanType("D4")
|
20 |
+
>>> c.dimension()
|
21 |
+
4
|
22 |
+
"""
|
23 |
+
|
24 |
+
return self.n
|
25 |
+
|
26 |
+
def basic_root(self, i, j):
|
27 |
+
"""
|
28 |
+
This is a method just to generate roots
|
29 |
+
with a 1 iin the ith position and a -1
|
30 |
+
in the jth position.
|
31 |
+
|
32 |
+
"""
|
33 |
+
|
34 |
+
n = self.n
|
35 |
+
root = [0]*n
|
36 |
+
root[i] = 1
|
37 |
+
root[j] = -1
|
38 |
+
return root
|
39 |
+
|
40 |
+
def simple_root(self, i):
|
41 |
+
"""
|
42 |
+
Every lie algebra has a unique root system.
|
43 |
+
Given a root system Q, there is a subset of the
|
44 |
+
roots such that an element of Q is called a
|
45 |
+
simple root if it cannot be written as the sum
|
46 |
+
of two elements in Q. If we let D denote the
|
47 |
+
set of simple roots, then it is clear that every
|
48 |
+
element of Q can be written as a linear combination
|
49 |
+
of elements of D with all coefficients non-negative.
|
50 |
+
|
51 |
+
In D_n, the first n-1 simple roots are the same as
|
52 |
+
the roots in A_(n-1) (a 1 in the ith position, a -1
|
53 |
+
in the (i+1)th position, and zeroes elsewhere).
|
54 |
+
The nth simple root is the root in which there 1s in
|
55 |
+
the nth and (n-1)th positions, and zeroes elsewhere.
|
56 |
+
|
57 |
+
This method returns the ith simple root for the D series.
|
58 |
+
|
59 |
+
Examples
|
60 |
+
========
|
61 |
+
|
62 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
63 |
+
>>> c = CartanType("D4")
|
64 |
+
>>> c.simple_root(2)
|
65 |
+
[0, 1, -1, 0]
|
66 |
+
|
67 |
+
"""
|
68 |
+
|
69 |
+
n = self.n
|
70 |
+
if i < n:
|
71 |
+
return self.basic_root(i-1, i)
|
72 |
+
else:
|
73 |
+
root = [0]*n
|
74 |
+
root[n-2] = 1
|
75 |
+
root[n-1] = 1
|
76 |
+
return root
|
77 |
+
|
78 |
+
|
79 |
+
def positive_roots(self):
|
80 |
+
"""
|
81 |
+
This method generates all the positive roots of
|
82 |
+
A_n. This is half of all of the roots of D_n
|
83 |
+
by multiplying all the positive roots by -1 we
|
84 |
+
get the negative roots.
|
85 |
+
|
86 |
+
Examples
|
87 |
+
========
|
88 |
+
|
89 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
90 |
+
>>> c = CartanType("A3")
|
91 |
+
>>> c.positive_roots()
|
92 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
93 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
94 |
+
"""
|
95 |
+
|
96 |
+
n = self.n
|
97 |
+
posroots = {}
|
98 |
+
k = 0
|
99 |
+
for i in range(0, n-1):
|
100 |
+
for j in range(i+1, n):
|
101 |
+
k += 1
|
102 |
+
posroots[k] = self.basic_root(i, j)
|
103 |
+
k += 1
|
104 |
+
root = self.basic_root(i, j)
|
105 |
+
root[j] = 1
|
106 |
+
posroots[k] = root
|
107 |
+
return posroots
|
108 |
+
|
109 |
+
def roots(self):
|
110 |
+
"""
|
111 |
+
Returns the total number of roots for D_n"
|
112 |
+
"""
|
113 |
+
|
114 |
+
n = self.n
|
115 |
+
return 2*n*(n-1)
|
116 |
+
|
117 |
+
def cartan_matrix(self):
|
118 |
+
"""
|
119 |
+
Returns the Cartan matrix for D_n.
|
120 |
+
The Cartan matrix matrix for a Lie algebra is
|
121 |
+
generated by assigning an ordering to the simple
|
122 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
123 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
124 |
+
|
125 |
+
Examples
|
126 |
+
========
|
127 |
+
|
128 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
129 |
+
>>> c = CartanType('D4')
|
130 |
+
>>> c.cartan_matrix()
|
131 |
+
Matrix([
|
132 |
+
[ 2, -1, 0, 0],
|
133 |
+
[-1, 2, -1, -1],
|
134 |
+
[ 0, -1, 2, 0],
|
135 |
+
[ 0, -1, 0, 2]])
|
136 |
+
|
137 |
+
"""
|
138 |
+
|
139 |
+
n = self.n
|
140 |
+
m = 2*eye(n)
|
141 |
+
i = 1
|
142 |
+
while i < n-2:
|
143 |
+
m[i,i+1] = -1
|
144 |
+
m[i,i-1] = -1
|
145 |
+
i += 1
|
146 |
+
m[n-2, n-3] = -1
|
147 |
+
m[n-3, n-1] = -1
|
148 |
+
m[n-1, n-3] = -1
|
149 |
+
m[0, 1] = -1
|
150 |
+
return m
|
151 |
+
|
152 |
+
def basis(self):
|
153 |
+
"""
|
154 |
+
Returns the number of independent generators of D_n
|
155 |
+
"""
|
156 |
+
n = self.n
|
157 |
+
return n*(n-1)/2
|
158 |
+
|
159 |
+
def lie_algebra(self):
|
160 |
+
"""
|
161 |
+
Returns the Lie algebra associated with D_n"
|
162 |
+
"""
|
163 |
+
|
164 |
+
n = self.n
|
165 |
+
return "so(" + str(2*n) + ")"
|
166 |
+
|
167 |
+
def dynkin_diagram(self):
|
168 |
+
n = self.n
|
169 |
+
diag = " "*4*(n-3) + str(n-1) + "\n"
|
170 |
+
diag += " "*4*(n-3) + "0\n"
|
171 |
+
diag += " "*4*(n-3) +"|\n"
|
172 |
+
diag += " "*4*(n-3) + "|\n"
|
173 |
+
diag += "---".join("0" for i in range(1,n)) + "\n"
|
174 |
+
diag += " ".join(str(i) for i in range(1, n-1)) + " "+str(n)
|
175 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_e.py
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import eye, Rational
|
3 |
+
|
4 |
+
|
5 |
+
class TypeE(Standard_Cartan):
|
6 |
+
|
7 |
+
def __new__(cls, n):
|
8 |
+
if n < 6 or n > 8:
|
9 |
+
raise ValueError("Invalid value of n")
|
10 |
+
return Standard_Cartan.__new__(cls, "E", n)
|
11 |
+
|
12 |
+
def dimension(self):
|
13 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
14 |
+
|
15 |
+
Examples
|
16 |
+
========
|
17 |
+
|
18 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
19 |
+
>>> c = CartanType("E6")
|
20 |
+
>>> c.dimension()
|
21 |
+
8
|
22 |
+
"""
|
23 |
+
|
24 |
+
return 8
|
25 |
+
|
26 |
+
def basic_root(self, i, j):
|
27 |
+
"""
|
28 |
+
This is a method just to generate roots
|
29 |
+
with a -1 in the ith position and a 1
|
30 |
+
in the jth position.
|
31 |
+
|
32 |
+
"""
|
33 |
+
|
34 |
+
root = [0]*8
|
35 |
+
root[i] = -1
|
36 |
+
root[j] = 1
|
37 |
+
return root
|
38 |
+
|
39 |
+
def simple_root(self, i):
|
40 |
+
"""
|
41 |
+
Every lie algebra has a unique root system.
|
42 |
+
Given a root system Q, there is a subset of the
|
43 |
+
roots such that an element of Q is called a
|
44 |
+
simple root if it cannot be written as the sum
|
45 |
+
of two elements in Q. If we let D denote the
|
46 |
+
set of simple roots, then it is clear that every
|
47 |
+
element of Q can be written as a linear combination
|
48 |
+
of elements of D with all coefficients non-negative.
|
49 |
+
|
50 |
+
This method returns the ith simple root for E_n.
|
51 |
+
|
52 |
+
Examples
|
53 |
+
========
|
54 |
+
|
55 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
56 |
+
>>> c = CartanType("E6")
|
57 |
+
>>> c.simple_root(2)
|
58 |
+
[1, 1, 0, 0, 0, 0, 0, 0]
|
59 |
+
"""
|
60 |
+
n = self.n
|
61 |
+
if i == 1:
|
62 |
+
root = [-0.5]*8
|
63 |
+
root[0] = 0.5
|
64 |
+
root[7] = 0.5
|
65 |
+
return root
|
66 |
+
elif i == 2:
|
67 |
+
root = [0]*8
|
68 |
+
root[1] = 1
|
69 |
+
root[0] = 1
|
70 |
+
return root
|
71 |
+
else:
|
72 |
+
if i in (7, 8) and n == 6:
|
73 |
+
raise ValueError("E6 only has six simple roots!")
|
74 |
+
if i == 8 and n == 7:
|
75 |
+
raise ValueError("E7 has only 7 simple roots!")
|
76 |
+
|
77 |
+
return self.basic_root(i - 3, i - 2)
|
78 |
+
|
79 |
+
def positive_roots(self):
|
80 |
+
"""
|
81 |
+
This method generates all the positive roots of
|
82 |
+
A_n. This is half of all of the roots of E_n;
|
83 |
+
by multiplying all the positive roots by -1 we
|
84 |
+
get the negative roots.
|
85 |
+
|
86 |
+
Examples
|
87 |
+
========
|
88 |
+
|
89 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
90 |
+
>>> c = CartanType("A3")
|
91 |
+
>>> c.positive_roots()
|
92 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
93 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
94 |
+
"""
|
95 |
+
n = self.n
|
96 |
+
if n == 6:
|
97 |
+
posroots = {}
|
98 |
+
k = 0
|
99 |
+
for i in range(n-1):
|
100 |
+
for j in range(i+1, n-1):
|
101 |
+
k += 1
|
102 |
+
root = self.basic_root(i, j)
|
103 |
+
posroots[k] = root
|
104 |
+
k += 1
|
105 |
+
root = self.basic_root(i, j)
|
106 |
+
root[i] = 1
|
107 |
+
posroots[k] = root
|
108 |
+
|
109 |
+
root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
|
110 |
+
Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
|
111 |
+
for a in range(0, 2):
|
112 |
+
for b in range(0, 2):
|
113 |
+
for c in range(0, 2):
|
114 |
+
for d in range(0, 2):
|
115 |
+
for e in range(0, 2):
|
116 |
+
if (a + b + c + d + e)%2 == 0:
|
117 |
+
k += 1
|
118 |
+
if a == 1:
|
119 |
+
root[0] = Rational(-1, 2)
|
120 |
+
if b == 1:
|
121 |
+
root[1] = Rational(-1, 2)
|
122 |
+
if c == 1:
|
123 |
+
root[2] = Rational(-1, 2)
|
124 |
+
if d == 1:
|
125 |
+
root[3] = Rational(-1, 2)
|
126 |
+
if e == 1:
|
127 |
+
root[4] = Rational(-1, 2)
|
128 |
+
posroots[k] = root
|
129 |
+
|
130 |
+
return posroots
|
131 |
+
if n == 7:
|
132 |
+
posroots = {}
|
133 |
+
k = 0
|
134 |
+
for i in range(n-1):
|
135 |
+
for j in range(i+1, n-1):
|
136 |
+
k += 1
|
137 |
+
root = self.basic_root(i, j)
|
138 |
+
posroots[k] = root
|
139 |
+
k += 1
|
140 |
+
root = self.basic_root(i, j)
|
141 |
+
root[i] = 1
|
142 |
+
posroots[k] = root
|
143 |
+
|
144 |
+
k += 1
|
145 |
+
posroots[k] = [0, 0, 0, 0, 0, 1, 1, 0]
|
146 |
+
root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
|
147 |
+
Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
|
148 |
+
for a in range(0, 2):
|
149 |
+
for b in range(0, 2):
|
150 |
+
for c in range(0, 2):
|
151 |
+
for d in range(0, 2):
|
152 |
+
for e in range(0, 2):
|
153 |
+
for f in range(0, 2):
|
154 |
+
if (a + b + c + d + e + f)%2 == 0:
|
155 |
+
k += 1
|
156 |
+
if a == 1:
|
157 |
+
root[0] = Rational(-1, 2)
|
158 |
+
if b == 1:
|
159 |
+
root[1] = Rational(-1, 2)
|
160 |
+
if c == 1:
|
161 |
+
root[2] = Rational(-1, 2)
|
162 |
+
if d == 1:
|
163 |
+
root[3] = Rational(-1, 2)
|
164 |
+
if e == 1:
|
165 |
+
root[4] = Rational(-1, 2)
|
166 |
+
if f == 1:
|
167 |
+
root[5] = Rational(1, 2)
|
168 |
+
posroots[k] = root
|
169 |
+
|
170 |
+
return posroots
|
171 |
+
if n == 8:
|
172 |
+
posroots = {}
|
173 |
+
k = 0
|
174 |
+
for i in range(n):
|
175 |
+
for j in range(i+1, n):
|
176 |
+
k += 1
|
177 |
+
root = self.basic_root(i, j)
|
178 |
+
posroots[k] = root
|
179 |
+
k += 1
|
180 |
+
root = self.basic_root(i, j)
|
181 |
+
root[i] = 1
|
182 |
+
posroots[k] = root
|
183 |
+
|
184 |
+
root = [Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2),
|
185 |
+
Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
|
186 |
+
for a in range(0, 2):
|
187 |
+
for b in range(0, 2):
|
188 |
+
for c in range(0, 2):
|
189 |
+
for d in range(0, 2):
|
190 |
+
for e in range(0, 2):
|
191 |
+
for f in range(0, 2):
|
192 |
+
for g in range(0, 2):
|
193 |
+
if (a + b + c + d + e + f + g)%2 == 0:
|
194 |
+
k += 1
|
195 |
+
if a == 1:
|
196 |
+
root[0] = Rational(-1, 2)
|
197 |
+
if b == 1:
|
198 |
+
root[1] = Rational(-1, 2)
|
199 |
+
if c == 1:
|
200 |
+
root[2] = Rational(-1, 2)
|
201 |
+
if d == 1:
|
202 |
+
root[3] = Rational(-1, 2)
|
203 |
+
if e == 1:
|
204 |
+
root[4] = Rational(-1, 2)
|
205 |
+
if f == 1:
|
206 |
+
root[5] = Rational(1, 2)
|
207 |
+
if g == 1:
|
208 |
+
root[6] = Rational(1, 2)
|
209 |
+
posroots[k] = root
|
210 |
+
|
211 |
+
return posroots
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
def roots(self):
|
216 |
+
"""
|
217 |
+
Returns the total number of roots of E_n
|
218 |
+
"""
|
219 |
+
|
220 |
+
n = self.n
|
221 |
+
if n == 6:
|
222 |
+
return 72
|
223 |
+
if n == 7:
|
224 |
+
return 126
|
225 |
+
if n == 8:
|
226 |
+
return 240
|
227 |
+
|
228 |
+
|
229 |
+
def cartan_matrix(self):
|
230 |
+
"""
|
231 |
+
Returns the Cartan matrix for G_2
|
232 |
+
The Cartan matrix matrix for a Lie algebra is
|
233 |
+
generated by assigning an ordering to the simple
|
234 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
235 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
236 |
+
|
237 |
+
Examples
|
238 |
+
========
|
239 |
+
|
240 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
241 |
+
>>> c = CartanType('A4')
|
242 |
+
>>> c.cartan_matrix()
|
243 |
+
Matrix([
|
244 |
+
[ 2, -1, 0, 0],
|
245 |
+
[-1, 2, -1, 0],
|
246 |
+
[ 0, -1, 2, -1],
|
247 |
+
[ 0, 0, -1, 2]])
|
248 |
+
|
249 |
+
|
250 |
+
"""
|
251 |
+
|
252 |
+
n = self.n
|
253 |
+
m = 2*eye(n)
|
254 |
+
i = 3
|
255 |
+
while i < n-1:
|
256 |
+
m[i, i+1] = -1
|
257 |
+
m[i, i-1] = -1
|
258 |
+
i += 1
|
259 |
+
m[0, 2] = m[2, 0] = -1
|
260 |
+
m[1, 3] = m[3, 1] = -1
|
261 |
+
m[2, 3] = -1
|
262 |
+
m[n-1, n-2] = -1
|
263 |
+
return m
|
264 |
+
|
265 |
+
|
266 |
+
def basis(self):
|
267 |
+
"""
|
268 |
+
Returns the number of independent generators of E_n
|
269 |
+
"""
|
270 |
+
|
271 |
+
n = self.n
|
272 |
+
if n == 6:
|
273 |
+
return 78
|
274 |
+
if n == 7:
|
275 |
+
return 133
|
276 |
+
if n == 8:
|
277 |
+
return 248
|
278 |
+
|
279 |
+
def dynkin_diagram(self):
|
280 |
+
n = self.n
|
281 |
+
diag = " "*8 + str(2) + "\n"
|
282 |
+
diag += " "*8 + "0\n"
|
283 |
+
diag += " "*8 + "|\n"
|
284 |
+
diag += " "*8 + "|\n"
|
285 |
+
diag += "---".join("0" for i in range(1, n)) + "\n"
|
286 |
+
diag += "1 " + " ".join(str(i) for i in range(3, n+1))
|
287 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_f.py
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .cartan_type import Standard_Cartan
|
2 |
+
from sympy.core.backend import Matrix, Rational
|
3 |
+
|
4 |
+
|
5 |
+
class TypeF(Standard_Cartan):
|
6 |
+
|
7 |
+
def __new__(cls, n):
|
8 |
+
if n != 4:
|
9 |
+
raise ValueError("n should be 4")
|
10 |
+
return Standard_Cartan.__new__(cls, "F", 4)
|
11 |
+
|
12 |
+
def dimension(self):
|
13 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
14 |
+
|
15 |
+
Examples
|
16 |
+
========
|
17 |
+
|
18 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
19 |
+
>>> c = CartanType("F4")
|
20 |
+
>>> c.dimension()
|
21 |
+
4
|
22 |
+
"""
|
23 |
+
|
24 |
+
return 4
|
25 |
+
|
26 |
+
|
27 |
+
def basic_root(self, i, j):
|
28 |
+
"""Generate roots with 1 in ith position and -1 in jth position
|
29 |
+
|
30 |
+
"""
|
31 |
+
|
32 |
+
n = self.n
|
33 |
+
root = [0]*n
|
34 |
+
root[i] = 1
|
35 |
+
root[j] = -1
|
36 |
+
return root
|
37 |
+
|
38 |
+
def simple_root(self, i):
|
39 |
+
"""The ith simple root of F_4
|
40 |
+
|
41 |
+
Every lie algebra has a unique root system.
|
42 |
+
Given a root system Q, there is a subset of the
|
43 |
+
roots such that an element of Q is called a
|
44 |
+
simple root if it cannot be written as the sum
|
45 |
+
of two elements in Q. If we let D denote the
|
46 |
+
set of simple roots, then it is clear that every
|
47 |
+
element of Q can be written as a linear combination
|
48 |
+
of elements of D with all coefficients non-negative.
|
49 |
+
|
50 |
+
Examples
|
51 |
+
========
|
52 |
+
|
53 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
54 |
+
>>> c = CartanType("F4")
|
55 |
+
>>> c.simple_root(3)
|
56 |
+
[0, 0, 0, 1]
|
57 |
+
|
58 |
+
"""
|
59 |
+
|
60 |
+
if i < 3:
|
61 |
+
return self.basic_root(i-1, i)
|
62 |
+
if i == 3:
|
63 |
+
root = [0]*4
|
64 |
+
root[3] = 1
|
65 |
+
return root
|
66 |
+
if i == 4:
|
67 |
+
root = [Rational(-1, 2)]*4
|
68 |
+
return root
|
69 |
+
|
70 |
+
def positive_roots(self):
|
71 |
+
"""Generate all the positive roots of A_n
|
72 |
+
|
73 |
+
This is half of all of the roots of F_4; by multiplying all the
|
74 |
+
positive roots by -1 we get the negative roots.
|
75 |
+
|
76 |
+
Examples
|
77 |
+
========
|
78 |
+
|
79 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
80 |
+
>>> c = CartanType("A3")
|
81 |
+
>>> c.positive_roots()
|
82 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
83 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
84 |
+
|
85 |
+
"""
|
86 |
+
|
87 |
+
n = self.n
|
88 |
+
posroots = {}
|
89 |
+
k = 0
|
90 |
+
for i in range(0, n-1):
|
91 |
+
for j in range(i+1, n):
|
92 |
+
k += 1
|
93 |
+
posroots[k] = self.basic_root(i, j)
|
94 |
+
k += 1
|
95 |
+
root = self.basic_root(i, j)
|
96 |
+
root[j] = 1
|
97 |
+
posroots[k] = root
|
98 |
+
|
99 |
+
for i in range(0, n):
|
100 |
+
k += 1
|
101 |
+
root = [0]*n
|
102 |
+
root[i] = 1
|
103 |
+
posroots[k] = root
|
104 |
+
|
105 |
+
k += 1
|
106 |
+
root = [Rational(1, 2)]*n
|
107 |
+
posroots[k] = root
|
108 |
+
for i in range(1, 4):
|
109 |
+
k += 1
|
110 |
+
root = [Rational(1, 2)]*n
|
111 |
+
root[i] = Rational(-1, 2)
|
112 |
+
posroots[k] = root
|
113 |
+
|
114 |
+
posroots[k+1] = [Rational(1, 2), Rational(1, 2), Rational(-1, 2), Rational(-1, 2)]
|
115 |
+
posroots[k+2] = [Rational(1, 2), Rational(-1, 2), Rational(1, 2), Rational(-1, 2)]
|
116 |
+
posroots[k+3] = [Rational(1, 2), Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]
|
117 |
+
posroots[k+4] = [Rational(1, 2), Rational(-1, 2), Rational(-1, 2), Rational(-1, 2)]
|
118 |
+
|
119 |
+
return posroots
|
120 |
+
|
121 |
+
|
122 |
+
def roots(self):
|
123 |
+
"""
|
124 |
+
Returns the total number of roots for F_4
|
125 |
+
"""
|
126 |
+
return 48
|
127 |
+
|
128 |
+
def cartan_matrix(self):
|
129 |
+
"""The Cartan matrix for F_4
|
130 |
+
|
131 |
+
The Cartan matrix matrix for a Lie algebra is
|
132 |
+
generated by assigning an ordering to the simple
|
133 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
134 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
135 |
+
|
136 |
+
Examples
|
137 |
+
========
|
138 |
+
|
139 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
140 |
+
>>> c = CartanType('A4')
|
141 |
+
>>> c.cartan_matrix()
|
142 |
+
Matrix([
|
143 |
+
[ 2, -1, 0, 0],
|
144 |
+
[-1, 2, -1, 0],
|
145 |
+
[ 0, -1, 2, -1],
|
146 |
+
[ 0, 0, -1, 2]])
|
147 |
+
"""
|
148 |
+
|
149 |
+
m = Matrix( 4, 4, [2, -1, 0, 0, -1, 2, -2, 0, 0,
|
150 |
+
-1, 2, -1, 0, 0, -1, 2])
|
151 |
+
return m
|
152 |
+
|
153 |
+
def basis(self):
|
154 |
+
"""
|
155 |
+
Returns the number of independent generators of F_4
|
156 |
+
"""
|
157 |
+
return 52
|
158 |
+
|
159 |
+
def dynkin_diagram(self):
|
160 |
+
diag = "0---0=>=0---0\n"
|
161 |
+
diag += " ".join(str(i) for i in range(1, 5))
|
162 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/type_g.py
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
|
3 |
+
from .cartan_type import Standard_Cartan
|
4 |
+
from sympy.core.backend import Matrix
|
5 |
+
|
6 |
+
class TypeG(Standard_Cartan):
|
7 |
+
|
8 |
+
def __new__(cls, n):
|
9 |
+
if n != 2:
|
10 |
+
raise ValueError("n should be 2")
|
11 |
+
return Standard_Cartan.__new__(cls, "G", 2)
|
12 |
+
|
13 |
+
|
14 |
+
def dimension(self):
|
15 |
+
"""Dimension of the vector space V underlying the Lie algebra
|
16 |
+
|
17 |
+
Examples
|
18 |
+
========
|
19 |
+
|
20 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
21 |
+
>>> c = CartanType("G2")
|
22 |
+
>>> c.dimension()
|
23 |
+
3
|
24 |
+
"""
|
25 |
+
return 3
|
26 |
+
|
27 |
+
def simple_root(self, i):
|
28 |
+
"""The ith simple root of G_2
|
29 |
+
|
30 |
+
Every lie algebra has a unique root system.
|
31 |
+
Given a root system Q, there is a subset of the
|
32 |
+
roots such that an element of Q is called a
|
33 |
+
simple root if it cannot be written as the sum
|
34 |
+
of two elements in Q. If we let D denote the
|
35 |
+
set of simple roots, then it is clear that every
|
36 |
+
element of Q can be written as a linear combination
|
37 |
+
of elements of D with all coefficients non-negative.
|
38 |
+
|
39 |
+
Examples
|
40 |
+
========
|
41 |
+
|
42 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
43 |
+
>>> c = CartanType("G2")
|
44 |
+
>>> c.simple_root(1)
|
45 |
+
[0, 1, -1]
|
46 |
+
|
47 |
+
"""
|
48 |
+
if i == 1:
|
49 |
+
return [0, 1, -1]
|
50 |
+
else:
|
51 |
+
return [1, -2, 1]
|
52 |
+
|
53 |
+
def positive_roots(self):
|
54 |
+
"""Generate all the positive roots of A_n
|
55 |
+
|
56 |
+
This is half of all of the roots of A_n; by multiplying all the
|
57 |
+
positive roots by -1 we get the negative roots.
|
58 |
+
|
59 |
+
Examples
|
60 |
+
========
|
61 |
+
|
62 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
63 |
+
>>> c = CartanType("A3")
|
64 |
+
>>> c.positive_roots()
|
65 |
+
{1: [1, -1, 0, 0], 2: [1, 0, -1, 0], 3: [1, 0, 0, -1], 4: [0, 1, -1, 0],
|
66 |
+
5: [0, 1, 0, -1], 6: [0, 0, 1, -1]}
|
67 |
+
|
68 |
+
"""
|
69 |
+
|
70 |
+
roots = {1: [0, 1, -1], 2: [1, -2, 1], 3: [1, -1, 0], 4: [1, 0, 1],
|
71 |
+
5: [1, 1, -2], 6: [2, -1, -1]}
|
72 |
+
return roots
|
73 |
+
|
74 |
+
def roots(self):
|
75 |
+
"""
|
76 |
+
Returns the total number of roots of G_2"
|
77 |
+
"""
|
78 |
+
return 12
|
79 |
+
|
80 |
+
def cartan_matrix(self):
|
81 |
+
"""The Cartan matrix for G_2
|
82 |
+
|
83 |
+
The Cartan matrix matrix for a Lie algebra is
|
84 |
+
generated by assigning an ordering to the simple
|
85 |
+
roots, (alpha[1], ...., alpha[l]). Then the ijth
|
86 |
+
entry of the Cartan matrix is (<alpha[i],alpha[j]>).
|
87 |
+
|
88 |
+
Examples
|
89 |
+
========
|
90 |
+
|
91 |
+
>>> from sympy.liealgebras.cartan_type import CartanType
|
92 |
+
>>> c = CartanType("G2")
|
93 |
+
>>> c.cartan_matrix()
|
94 |
+
Matrix([
|
95 |
+
[ 2, -1],
|
96 |
+
[-3, 2]])
|
97 |
+
|
98 |
+
"""
|
99 |
+
|
100 |
+
m = Matrix( 2, 2, [2, -1, -3, 2])
|
101 |
+
return m
|
102 |
+
|
103 |
+
def basis(self):
|
104 |
+
"""
|
105 |
+
Returns the number of independent generators of G_2
|
106 |
+
"""
|
107 |
+
return 14
|
108 |
+
|
109 |
+
def dynkin_diagram(self):
|
110 |
+
diag = "0≡<≡0\n1 2"
|
111 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/liealgebras/weyl_group.py
ADDED
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
|
3 |
+
from .cartan_type import CartanType
|
4 |
+
from mpmath import fac
|
5 |
+
from sympy.core.backend import Matrix, eye, Rational, igcd
|
6 |
+
from sympy.core.basic import Atom
|
7 |
+
|
8 |
+
class WeylGroup(Atom):
|
9 |
+
|
10 |
+
"""
|
11 |
+
For each semisimple Lie group, we have a Weyl group. It is a subgroup of
|
12 |
+
the isometry group of the root system. Specifically, it's the subgroup
|
13 |
+
that is generated by reflections through the hyperplanes orthogonal to
|
14 |
+
the roots. Therefore, Weyl groups are reflection groups, and so a Weyl
|
15 |
+
group is a finite Coxeter group.
|
16 |
+
|
17 |
+
"""
|
18 |
+
|
19 |
+
def __new__(cls, cartantype):
|
20 |
+
obj = Atom.__new__(cls)
|
21 |
+
obj.cartan_type = CartanType(cartantype)
|
22 |
+
return obj
|
23 |
+
|
24 |
+
def generators(self):
|
25 |
+
"""
|
26 |
+
This method creates the generating reflections of the Weyl group for
|
27 |
+
a given Lie algebra. For a Lie algebra of rank n, there are n
|
28 |
+
different generating reflections. This function returns them as
|
29 |
+
a list.
|
30 |
+
|
31 |
+
Examples
|
32 |
+
========
|
33 |
+
|
34 |
+
>>> from sympy.liealgebras.weyl_group import WeylGroup
|
35 |
+
>>> c = WeylGroup("F4")
|
36 |
+
>>> c.generators()
|
37 |
+
['r1', 'r2', 'r3', 'r4']
|
38 |
+
"""
|
39 |
+
n = self.cartan_type.rank()
|
40 |
+
generators = []
|
41 |
+
for i in range(1, n+1):
|
42 |
+
reflection = "r"+str(i)
|
43 |
+
generators.append(reflection)
|
44 |
+
return generators
|
45 |
+
|
46 |
+
def group_order(self):
|
47 |
+
"""
|
48 |
+
This method returns the order of the Weyl group.
|
49 |
+
For types A, B, C, D, and E the order depends on
|
50 |
+
the rank of the Lie algebra. For types F and G,
|
51 |
+
the order is fixed.
|
52 |
+
|
53 |
+
Examples
|
54 |
+
========
|
55 |
+
|
56 |
+
>>> from sympy.liealgebras.weyl_group import WeylGroup
|
57 |
+
>>> c = WeylGroup("D4")
|
58 |
+
>>> c.group_order()
|
59 |
+
192.0
|
60 |
+
"""
|
61 |
+
n = self.cartan_type.rank()
|
62 |
+
if self.cartan_type.series == "A":
|
63 |
+
return fac(n+1)
|
64 |
+
|
65 |
+
if self.cartan_type.series in ("B", "C"):
|
66 |
+
return fac(n)*(2**n)
|
67 |
+
|
68 |
+
if self.cartan_type.series == "D":
|
69 |
+
return fac(n)*(2**(n-1))
|
70 |
+
|
71 |
+
if self.cartan_type.series == "E":
|
72 |
+
if n == 6:
|
73 |
+
return 51840
|
74 |
+
if n == 7:
|
75 |
+
return 2903040
|
76 |
+
if n == 8:
|
77 |
+
return 696729600
|
78 |
+
if self.cartan_type.series == "F":
|
79 |
+
return 1152
|
80 |
+
|
81 |
+
if self.cartan_type.series == "G":
|
82 |
+
return 12
|
83 |
+
|
84 |
+
def group_name(self):
|
85 |
+
"""
|
86 |
+
This method returns some general information about the Weyl group for
|
87 |
+
a given Lie algebra. It returns the name of the group and the elements
|
88 |
+
it acts on, if relevant.
|
89 |
+
"""
|
90 |
+
n = self.cartan_type.rank()
|
91 |
+
if self.cartan_type.series == "A":
|
92 |
+
return "S"+str(n+1) + ": the symmetric group acting on " + str(n+1) + " elements."
|
93 |
+
|
94 |
+
if self.cartan_type.series in ("B", "C"):
|
95 |
+
return "The hyperoctahedral group acting on " + str(2*n) + " elements."
|
96 |
+
|
97 |
+
if self.cartan_type.series == "D":
|
98 |
+
return "The symmetry group of the " + str(n) + "-dimensional demihypercube."
|
99 |
+
|
100 |
+
if self.cartan_type.series == "E":
|
101 |
+
if n == 6:
|
102 |
+
return "The symmetry group of the 6-polytope."
|
103 |
+
|
104 |
+
if n == 7:
|
105 |
+
return "The symmetry group of the 7-polytope."
|
106 |
+
|
107 |
+
if n == 8:
|
108 |
+
return "The symmetry group of the 8-polytope."
|
109 |
+
|
110 |
+
if self.cartan_type.series == "F":
|
111 |
+
return "The symmetry group of the 24-cell, or icositetrachoron."
|
112 |
+
|
113 |
+
if self.cartan_type.series == "G":
|
114 |
+
return "D6, the dihedral group of order 12, and symmetry group of the hexagon."
|
115 |
+
|
116 |
+
def element_order(self, weylelt):
|
117 |
+
"""
|
118 |
+
This method returns the order of a given Weyl group element, which should
|
119 |
+
be specified by the user in the form of products of the generating
|
120 |
+
reflections, i.e. of the form r1*r2 etc.
|
121 |
+
|
122 |
+
For types A-F, this method current works by taking the matrix form of
|
123 |
+
the specified element, and then finding what power of the matrix is the
|
124 |
+
identity. It then returns this power.
|
125 |
+
|
126 |
+
Examples
|
127 |
+
========
|
128 |
+
|
129 |
+
>>> from sympy.liealgebras.weyl_group import WeylGroup
|
130 |
+
>>> b = WeylGroup("B4")
|
131 |
+
>>> b.element_order('r1*r4*r2')
|
132 |
+
4
|
133 |
+
"""
|
134 |
+
n = self.cartan_type.rank()
|
135 |
+
if self.cartan_type.series == "A":
|
136 |
+
a = self.matrix_form(weylelt)
|
137 |
+
order = 1
|
138 |
+
while a != eye(n+1):
|
139 |
+
a *= self.matrix_form(weylelt)
|
140 |
+
order += 1
|
141 |
+
return order
|
142 |
+
|
143 |
+
if self.cartan_type.series == "D":
|
144 |
+
a = self.matrix_form(weylelt)
|
145 |
+
order = 1
|
146 |
+
while a != eye(n):
|
147 |
+
a *= self.matrix_form(weylelt)
|
148 |
+
order += 1
|
149 |
+
return order
|
150 |
+
|
151 |
+
if self.cartan_type.series == "E":
|
152 |
+
a = self.matrix_form(weylelt)
|
153 |
+
order = 1
|
154 |
+
while a != eye(8):
|
155 |
+
a *= self.matrix_form(weylelt)
|
156 |
+
order += 1
|
157 |
+
return order
|
158 |
+
|
159 |
+
if self.cartan_type.series == "G":
|
160 |
+
elts = list(weylelt)
|
161 |
+
reflections = elts[1::3]
|
162 |
+
m = self.delete_doubles(reflections)
|
163 |
+
while self.delete_doubles(m) != m:
|
164 |
+
m = self.delete_doubles(m)
|
165 |
+
reflections = m
|
166 |
+
if len(reflections) % 2 == 1:
|
167 |
+
return 2
|
168 |
+
|
169 |
+
elif len(reflections) == 0:
|
170 |
+
return 1
|
171 |
+
|
172 |
+
else:
|
173 |
+
if len(reflections) == 1:
|
174 |
+
return 2
|
175 |
+
else:
|
176 |
+
m = len(reflections) // 2
|
177 |
+
lcm = (6 * m)/ igcd(m, 6)
|
178 |
+
order = lcm / m
|
179 |
+
return order
|
180 |
+
|
181 |
+
|
182 |
+
if self.cartan_type.series == 'F':
|
183 |
+
a = self.matrix_form(weylelt)
|
184 |
+
order = 1
|
185 |
+
while a != eye(4):
|
186 |
+
a *= self.matrix_form(weylelt)
|
187 |
+
order += 1
|
188 |
+
return order
|
189 |
+
|
190 |
+
|
191 |
+
if self.cartan_type.series in ("B", "C"):
|
192 |
+
a = self.matrix_form(weylelt)
|
193 |
+
order = 1
|
194 |
+
while a != eye(n):
|
195 |
+
a *= self.matrix_form(weylelt)
|
196 |
+
order += 1
|
197 |
+
return order
|
198 |
+
|
199 |
+
def delete_doubles(self, reflections):
|
200 |
+
"""
|
201 |
+
This is a helper method for determining the order of an element in the
|
202 |
+
Weyl group of G2. It takes a Weyl element and if repeated simple reflections
|
203 |
+
in it, it deletes them.
|
204 |
+
"""
|
205 |
+
counter = 0
|
206 |
+
copy = list(reflections)
|
207 |
+
for elt in copy:
|
208 |
+
if counter < len(copy)-1:
|
209 |
+
if copy[counter + 1] == elt:
|
210 |
+
del copy[counter]
|
211 |
+
del copy[counter]
|
212 |
+
counter += 1
|
213 |
+
|
214 |
+
|
215 |
+
return copy
|
216 |
+
|
217 |
+
|
218 |
+
def matrix_form(self, weylelt):
|
219 |
+
"""
|
220 |
+
This method takes input from the user in the form of products of the
|
221 |
+
generating reflections, and returns the matrix corresponding to the
|
222 |
+
element of the Weyl group. Since each element of the Weyl group is
|
223 |
+
a reflection of some type, there is a corresponding matrix representation.
|
224 |
+
This method uses the standard representation for all the generating
|
225 |
+
reflections.
|
226 |
+
|
227 |
+
Examples
|
228 |
+
========
|
229 |
+
|
230 |
+
>>> from sympy.liealgebras.weyl_group import WeylGroup
|
231 |
+
>>> f = WeylGroup("F4")
|
232 |
+
>>> f.matrix_form('r2*r3')
|
233 |
+
Matrix([
|
234 |
+
[1, 0, 0, 0],
|
235 |
+
[0, 1, 0, 0],
|
236 |
+
[0, 0, 0, -1],
|
237 |
+
[0, 0, 1, 0]])
|
238 |
+
|
239 |
+
"""
|
240 |
+
elts = list(weylelt)
|
241 |
+
reflections = elts[1::3]
|
242 |
+
n = self.cartan_type.rank()
|
243 |
+
if self.cartan_type.series == 'A':
|
244 |
+
matrixform = eye(n+1)
|
245 |
+
for elt in reflections:
|
246 |
+
a = int(elt)
|
247 |
+
mat = eye(n+1)
|
248 |
+
mat[a-1, a-1] = 0
|
249 |
+
mat[a-1, a] = 1
|
250 |
+
mat[a, a-1] = 1
|
251 |
+
mat[a, a] = 0
|
252 |
+
matrixform *= mat
|
253 |
+
return matrixform
|
254 |
+
|
255 |
+
if self.cartan_type.series == 'D':
|
256 |
+
matrixform = eye(n)
|
257 |
+
for elt in reflections:
|
258 |
+
a = int(elt)
|
259 |
+
mat = eye(n)
|
260 |
+
if a < n:
|
261 |
+
mat[a-1, a-1] = 0
|
262 |
+
mat[a-1, a] = 1
|
263 |
+
mat[a, a-1] = 1
|
264 |
+
mat[a, a] = 0
|
265 |
+
matrixform *= mat
|
266 |
+
else:
|
267 |
+
mat[n-2, n-1] = -1
|
268 |
+
mat[n-2, n-2] = 0
|
269 |
+
mat[n-1, n-2] = -1
|
270 |
+
mat[n-1, n-1] = 0
|
271 |
+
matrixform *= mat
|
272 |
+
return matrixform
|
273 |
+
|
274 |
+
if self.cartan_type.series == 'G':
|
275 |
+
matrixform = eye(3)
|
276 |
+
for elt in reflections:
|
277 |
+
a = int(elt)
|
278 |
+
if a == 1:
|
279 |
+
gen1 = Matrix([[1, 0, 0], [0, 0, 1], [0, 1, 0]])
|
280 |
+
matrixform *= gen1
|
281 |
+
else:
|
282 |
+
gen2 = Matrix([[Rational(2, 3), Rational(2, 3), Rational(-1, 3)],
|
283 |
+
[Rational(2, 3), Rational(-1, 3), Rational(2, 3)],
|
284 |
+
[Rational(-1, 3), Rational(2, 3), Rational(2, 3)]])
|
285 |
+
matrixform *= gen2
|
286 |
+
return matrixform
|
287 |
+
|
288 |
+
if self.cartan_type.series == 'F':
|
289 |
+
matrixform = eye(4)
|
290 |
+
for elt in reflections:
|
291 |
+
a = int(elt)
|
292 |
+
if a == 1:
|
293 |
+
mat = Matrix([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])
|
294 |
+
matrixform *= mat
|
295 |
+
elif a == 2:
|
296 |
+
mat = Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])
|
297 |
+
matrixform *= mat
|
298 |
+
elif a == 3:
|
299 |
+
mat = Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, -1]])
|
300 |
+
matrixform *= mat
|
301 |
+
else:
|
302 |
+
|
303 |
+
mat = Matrix([[Rational(1, 2), Rational(1, 2), Rational(1, 2), Rational(1, 2)],
|
304 |
+
[Rational(1, 2), Rational(1, 2), Rational(-1, 2), Rational(-1, 2)],
|
305 |
+
[Rational(1, 2), Rational(-1, 2), Rational(1, 2), Rational(-1, 2)],
|
306 |
+
[Rational(1, 2), Rational(-1, 2), Rational(-1, 2), Rational(1, 2)]])
|
307 |
+
matrixform *= mat
|
308 |
+
return matrixform
|
309 |
+
|
310 |
+
if self.cartan_type.series == 'E':
|
311 |
+
matrixform = eye(8)
|
312 |
+
for elt in reflections:
|
313 |
+
a = int(elt)
|
314 |
+
if a == 1:
|
315 |
+
mat = Matrix([[Rational(3, 4), Rational(1, 4), Rational(1, 4), Rational(1, 4),
|
316 |
+
Rational(1, 4), Rational(1, 4), Rational(1, 4), Rational(-1, 4)],
|
317 |
+
[Rational(1, 4), Rational(3, 4), Rational(-1, 4), Rational(-1, 4),
|
318 |
+
Rational(-1, 4), Rational(-1, 4), Rational(1, 4), Rational(-1, 4)],
|
319 |
+
[Rational(1, 4), Rational(-1, 4), Rational(3, 4), Rational(-1, 4),
|
320 |
+
Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
|
321 |
+
[Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(3, 4),
|
322 |
+
Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
|
323 |
+
[Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
|
324 |
+
Rational(3, 4), Rational(-1, 4), Rational(-1, 4), Rational(1, 4)],
|
325 |
+
[Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
|
326 |
+
Rational(-1, 4), Rational(3, 4), Rational(-1, 4), Rational(1, 4)],
|
327 |
+
[Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
|
328 |
+
Rational(-1, 4), Rational(-1, 4), Rational(-3, 4), Rational(1, 4)],
|
329 |
+
[Rational(1, 4), Rational(-1, 4), Rational(-1, 4), Rational(-1, 4),
|
330 |
+
Rational(-1, 4), Rational(-1, 4), Rational(-1, 4), Rational(3, 4)]])
|
331 |
+
matrixform *= mat
|
332 |
+
elif a == 2:
|
333 |
+
mat = eye(8)
|
334 |
+
mat[0, 0] = 0
|
335 |
+
mat[0, 1] = -1
|
336 |
+
mat[1, 0] = -1
|
337 |
+
mat[1, 1] = 0
|
338 |
+
matrixform *= mat
|
339 |
+
else:
|
340 |
+
mat = eye(8)
|
341 |
+
mat[a-3, a-3] = 0
|
342 |
+
mat[a-3, a-2] = 1
|
343 |
+
mat[a-2, a-3] = 1
|
344 |
+
mat[a-2, a-2] = 0
|
345 |
+
matrixform *= mat
|
346 |
+
return matrixform
|
347 |
+
|
348 |
+
|
349 |
+
if self.cartan_type.series in ("B", "C"):
|
350 |
+
matrixform = eye(n)
|
351 |
+
for elt in reflections:
|
352 |
+
a = int(elt)
|
353 |
+
mat = eye(n)
|
354 |
+
if a == 1:
|
355 |
+
mat[0, 0] = -1
|
356 |
+
matrixform *= mat
|
357 |
+
else:
|
358 |
+
mat[a - 2, a - 2] = 0
|
359 |
+
mat[a-2, a-1] = 1
|
360 |
+
mat[a - 1, a - 2] = 1
|
361 |
+
mat[a -1, a - 1] = 0
|
362 |
+
matrixform *= mat
|
363 |
+
return matrixform
|
364 |
+
|
365 |
+
|
366 |
+
|
367 |
+
def coxeter_diagram(self):
|
368 |
+
"""
|
369 |
+
This method returns the Coxeter diagram corresponding to a Weyl group.
|
370 |
+
The Coxeter diagram can be obtained from a Lie algebra's Dynkin diagram
|
371 |
+
by deleting all arrows; the Coxeter diagram is the undirected graph.
|
372 |
+
The vertices of the Coxeter diagram represent the generating reflections
|
373 |
+
of the Weyl group, $s_i$. An edge is drawn between $s_i$ and $s_j$ if the order
|
374 |
+
$m(i, j)$ of $s_is_j$ is greater than two. If there is one edge, the order
|
375 |
+
$m(i, j)$ is 3. If there are two edges, the order $m(i, j)$ is 4, and if there
|
376 |
+
are three edges, the order $m(i, j)$ is 6.
|
377 |
+
|
378 |
+
Examples
|
379 |
+
========
|
380 |
+
|
381 |
+
>>> from sympy.liealgebras.weyl_group import WeylGroup
|
382 |
+
>>> c = WeylGroup("B3")
|
383 |
+
>>> print(c.coxeter_diagram())
|
384 |
+
0---0===0
|
385 |
+
1 2 3
|
386 |
+
"""
|
387 |
+
n = self.cartan_type.rank()
|
388 |
+
if self.cartan_type.series in ("A", "D", "E"):
|
389 |
+
return self.cartan_type.dynkin_diagram()
|
390 |
+
|
391 |
+
if self.cartan_type.series in ("B", "C"):
|
392 |
+
diag = "---".join("0" for i in range(1, n)) + "===0\n"
|
393 |
+
diag += " ".join(str(i) for i in range(1, n+1))
|
394 |
+
return diag
|
395 |
+
|
396 |
+
if self.cartan_type.series == "F":
|
397 |
+
diag = "0---0===0---0\n"
|
398 |
+
diag += " ".join(str(i) for i in range(1, 5))
|
399 |
+
return diag
|
400 |
+
|
401 |
+
if self.cartan_type.series == "G":
|
402 |
+
diag = "0≡≡≡0\n1 2"
|
403 |
+
return diag
|
env-llmeval/lib/python3.10/site-packages/sympy/matrices/__init__.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""A module that handles matrices.
|
2 |
+
|
3 |
+
Includes functions for fast creating matrices like zero, one/eye, random
|
4 |
+
matrix, etc.
|
5 |
+
"""
|
6 |
+
from .common import ShapeError, NonSquareMatrixError, MatrixKind
|
7 |
+
from .dense import (
|
8 |
+
GramSchmidt, casoratian, diag, eye, hessian, jordan_cell,
|
9 |
+
list2numpy, matrix2numpy, matrix_multiply_elementwise, ones,
|
10 |
+
randMatrix, rot_axis1, rot_axis2, rot_axis3, rot_ccw_axis1,
|
11 |
+
rot_ccw_axis2, rot_ccw_axis3, rot_givens,
|
12 |
+
symarray, wronskian, zeros)
|
13 |
+
from .dense import MutableDenseMatrix
|
14 |
+
from .matrices import DeferredVector, MatrixBase
|
15 |
+
|
16 |
+
MutableMatrix = MutableDenseMatrix
|
17 |
+
Matrix = MutableMatrix
|
18 |
+
|
19 |
+
from .sparse import MutableSparseMatrix
|
20 |
+
from .sparsetools import banded
|
21 |
+
from .immutable import ImmutableDenseMatrix, ImmutableSparseMatrix
|
22 |
+
|
23 |
+
ImmutableMatrix = ImmutableDenseMatrix
|
24 |
+
SparseMatrix = MutableSparseMatrix
|
25 |
+
|
26 |
+
from .expressions import (
|
27 |
+
MatrixSlice, BlockDiagMatrix, BlockMatrix, FunctionMatrix, Identity,
|
28 |
+
Inverse, MatAdd, MatMul, MatPow, MatrixExpr, MatrixSymbol, Trace,
|
29 |
+
Transpose, ZeroMatrix, OneMatrix, blockcut, block_collapse, matrix_symbols, Adjoint,
|
30 |
+
hadamard_product, HadamardProduct, HadamardPower, Determinant, det,
|
31 |
+
diagonalize_vector, DiagMatrix, DiagonalMatrix, DiagonalOf, trace,
|
32 |
+
DotProduct, kronecker_product, KroneckerProduct,
|
33 |
+
PermutationMatrix, MatrixPermute, MatrixSet, Permanent, per)
|
34 |
+
|
35 |
+
from .utilities import dotprodsimp
|
36 |
+
|
37 |
+
__all__ = [
|
38 |
+
'ShapeError', 'NonSquareMatrixError', 'MatrixKind',
|
39 |
+
|
40 |
+
'GramSchmidt', 'casoratian', 'diag', 'eye', 'hessian', 'jordan_cell',
|
41 |
+
'list2numpy', 'matrix2numpy', 'matrix_multiply_elementwise', 'ones',
|
42 |
+
'randMatrix', 'rot_axis1', 'rot_axis2', 'rot_axis3', 'symarray',
|
43 |
+
'wronskian', 'zeros', 'rot_ccw_axis1', 'rot_ccw_axis2', 'rot_ccw_axis3',
|
44 |
+
'rot_givens',
|
45 |
+
|
46 |
+
'MutableDenseMatrix',
|
47 |
+
|
48 |
+
'DeferredVector', 'MatrixBase',
|
49 |
+
|
50 |
+
'Matrix', 'MutableMatrix',
|
51 |
+
|
52 |
+
'MutableSparseMatrix',
|
53 |
+
|
54 |
+
'banded',
|
55 |
+
|
56 |
+
'ImmutableDenseMatrix', 'ImmutableSparseMatrix',
|
57 |
+
|
58 |
+
'ImmutableMatrix', 'SparseMatrix',
|
59 |
+
|
60 |
+
'MatrixSlice', 'BlockDiagMatrix', 'BlockMatrix', 'FunctionMatrix',
|
61 |
+
'Identity', 'Inverse', 'MatAdd', 'MatMul', 'MatPow', 'MatrixExpr',
|
62 |
+
'MatrixSymbol', 'Trace', 'Transpose', 'ZeroMatrix', 'OneMatrix',
|
63 |
+
'blockcut', 'block_collapse', 'matrix_symbols', 'Adjoint',
|
64 |
+
'hadamard_product', 'HadamardProduct', 'HadamardPower', 'Determinant',
|
65 |
+
'det', 'diagonalize_vector', 'DiagMatrix', 'DiagonalMatrix',
|
66 |
+
'DiagonalOf', 'trace', 'DotProduct', 'kronecker_product',
|
67 |
+
'KroneckerProduct', 'PermutationMatrix', 'MatrixPermute', 'MatrixSet',
|
68 |
+
'Permanent', 'per',
|
69 |
+
|
70 |
+
'dotprodsimp',
|
71 |
+
]
|