Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.  
							See raw diff
- ckpts/universal/global_step80/zero/11.mlp.dense_h_to_4h.weight/exp_avg.pt +3 -0
 - ckpts/universal/global_step80/zero/11.mlp.dense_h_to_4h.weight/fp32.pt +3 -0
 - ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/exp_avg.pt +3 -0
 - ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/exp_avg_sq.pt +3 -0
 - ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/fp32.pt +3 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__init__.py +3 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/__init__.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_matrix.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_type.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/dynkin_diagram.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/root_system.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_a.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_b.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_c.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_d.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_e.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_f.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_g.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/weyl_group.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/cartan_matrix.py +25 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/cartan_type.py +73 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__init__.py +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/__init__.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_matrix.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_type.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_dynkin_diagram.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_root_system.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_A.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_B.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_C.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_D.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_E.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_F.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_G.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_weyl_group.cpython-310.pyc +0 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_matrix.py +10 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_cartan_type.py +12 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_dynkin_diagram.py +9 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_root_system.py +18 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_A.py +17 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_B.py +17 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_C.py +22 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_D.py +19 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_E.py +19 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_F.py +24 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_type_G.py +16 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/tests/test_weyl_group.py +35 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/type_b.py +172 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/type_c.py +171 -0
 - venv/lib/python3.10/site-packages/sympy/liealgebras/type_d.py +175 -0
 
    	
        ckpts/universal/global_step80/zero/11.mlp.dense_h_to_4h.weight/exp_avg.pt
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:aaa96c7a3d45d98f2333735e41c9892d74e78dbd0640cda0b31f78334e1db866
         
     | 
| 3 | 
         
            +
            size 33555612
         
     | 
    	
        ckpts/universal/global_step80/zero/11.mlp.dense_h_to_4h.weight/fp32.pt
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:61a7aedfce35c129dbc3f286586b7221f7f2f95322a1bbd29755f54d381efeca
         
     | 
| 3 | 
         
            +
            size 33555533
         
     | 
    	
        ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/exp_avg.pt
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:9f93d927de1898973cb8449f1dd99431dd02132485aef105585f0985205b0c24
         
     | 
| 3 | 
         
            +
            size 9372
         
     | 
    	
        ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/exp_avg_sq.pt
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:d39adbcaf379e1e4475e2f4bb1262bbd91a94b917d584c4e2532dc4e0fb998bc
         
     | 
| 3 | 
         
            +
            size 9387
         
     | 
    	
        ckpts/universal/global_step80/zero/28.final_rmsnorm.weight/fp32.pt
    ADDED
    
    | 
         @@ -0,0 +1,3 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            version https://git-lfs.github.com/spec/v1
         
     | 
| 2 | 
         
            +
            oid sha256:4ebbcf3acf60567cdbbf88756e15ad70609d2193ade148e3302ba430fbf15b08
         
     | 
| 3 | 
         
            +
            size 9293
         
     | 
    	
        venv/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']
         
     | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/__init__.cpython-310.pyc
    ADDED
    
    | 
         Binary file (271 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_matrix.cpython-310.pyc
    ADDED
    
    | 
         Binary file (784 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/cartan_type.cpython-310.pyc
    ADDED
    
    | 
         Binary file (2.21 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/dynkin_diagram.cpython-310.pyc
    ADDED
    
    | 
         Binary file (796 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/root_system.cpython-310.pyc
    ADDED
    
    | 
         Binary file (7.81 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_a.cpython-310.pyc
    ADDED
    
    | 
         Binary file (5.47 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_b.cpython-310.pyc
    ADDED
    
    | 
         Binary file (5.45 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_c.cpython-310.pyc
    ADDED
    
    | 
         Binary file (5.33 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_d.cpython-310.pyc
    ADDED
    
    | 
         Binary file (5.63 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_e.cpython-310.pyc
    ADDED
    
    | 
         Binary file (7.12 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_f.cpython-310.pyc
    ADDED
    
    | 
         Binary file (4.9 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/type_g.cpython-310.pyc
    ADDED
    
    | 
         Binary file (3.8 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/__pycache__/weyl_group.cpython-310.pyc
    ADDED
    
    | 
         Binary file (10.7 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/cartan_matrix.py
    ADDED
    
    | 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
| 
         | 
|
| 1 | 
         
            +
            from .cartan_type import CartanType
         
     | 
| 2 | 
         
            +
             
     | 
| 3 | 
         
            +
            def CartanMatrix(ct):
         
     | 
| 4 | 
         
            +
                """Access the Cartan matrix of a specific Lie algebra
         
     | 
| 5 | 
         
            +
             
     | 
| 6 | 
         
            +
                Examples
         
     | 
| 7 | 
         
            +
                ========
         
     | 
| 8 | 
         
            +
             
     | 
| 9 | 
         
            +
                >>> from sympy.liealgebras.cartan_matrix import CartanMatrix
         
     | 
| 10 | 
         
            +
                >>> CartanMatrix("A2")
         
     | 
| 11 | 
         
            +
                Matrix([
         
     | 
| 12 | 
         
            +
                [ 2, -1],
         
     | 
| 13 | 
         
            +
                [-1,  2]])
         
     | 
| 14 | 
         
            +
             
     | 
| 15 | 
         
            +
                >>> CartanMatrix(['C', 3])
         
     | 
| 16 | 
         
            +
                Matrix([
         
     | 
| 17 | 
         
            +
                [ 2, -1,  0],
         
     | 
| 18 | 
         
            +
                [-1,  2, -1],
         
     | 
| 19 | 
         
            +
                [ 0, -2,  2]])
         
     | 
| 20 | 
         
            +
             
     | 
| 21 | 
         
            +
                This method works by returning the Cartan matrix
         
     | 
| 22 | 
         
            +
                which corresponds to Cartan type t.
         
     | 
| 23 | 
         
            +
                """
         
     | 
| 24 | 
         
            +
             
     | 
| 25 | 
         
            +
                return CartanType(ct).cartan_matrix()
         
     | 
    	
        venv/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
         
     | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__init__.py
    ADDED
    
    | 
         
            File without changes
         
     | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/__init__.cpython-310.pyc
    ADDED
    
    | 
         Binary file (191 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_matrix.cpython-310.pyc
    ADDED
    
    | 
         Binary file (615 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_cartan_type.cpython-310.pyc
    ADDED
    
    | 
         Binary file (593 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_dynkin_diagram.cpython-310.pyc
    ADDED
    
    | 
         Binary file (518 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_root_system.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.37 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_A.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.05 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_B.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.06 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_C.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.52 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_D.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.24 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_E.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.39 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_F.cpython-310.pyc
    ADDED
    
    | 
         Binary file (2 kB). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_type_G.cpython-310.pyc
    ADDED
    
    | 
         Binary file (916 Bytes). View file 
     | 
| 
         | 
    	
        venv/lib/python3.10/site-packages/sympy/liealgebras/tests/__pycache__/test_weyl_group.cpython-310.pyc
    ADDED
    
    | 
         Binary file (1.72 kB). View file 
     | 
| 
         | 
    	
        venv/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
         
     | 
    	
        venv/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"
         
     | 
    	
        venv/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
         
     | 
    	
        venv/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]
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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]
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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]}
         
     | 
    	
        venv/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
         
     | 
    	
        venv/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
         
     | 
    	
        venv/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
         
     | 
    	
        venv/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
         
     |