TL is a tool for performing Termeley-Lieb calculus in Python. There are no other libraries required.
This project was initially developed during a course on Lie algebras for calculating Jones-Wenzl projectors in .
But this library can be used for general calculations.
At the top right of this page, there is a green button labelled Code. Press it and choose the option Download ZIP. You can now place the zip anywhere you want to have the TL library available. Unzip the folder into your project directory. Assuming your project directory is called My Project and you already have a file called main.py, then your file sturcture should look like:
My Project/
├── main.py
└── TL/
├── examples.py
└── [...]
In your main.py you can now import TL via:
from TL import *cd into your project directory.
Then run
$ git clone git@github.com:hexaron/TL.git
In your project directory create a main.py. In your main.py you can now import TL via:
from TL import *Find many examples in the TL/examples.py file.
Put the following into your main.py using your favorite editor:
from TL.tl import TL
# Get `U_2` in TL_4
U_2 = TL.U(4, 2)
# Print the string diagram of `U_2`
print(U_2)
U_1 = TL.U(4, 1)
# Print the composition of `U_1` and `U_2`
# (read right to left as usual)
print(U_1 * U_2)
# Print the tensor product of `U_1` and `U_2`
# (resulting in an element of TL_8)
print(U_1 & U_2)Running main.py now produces the following output:
0 1 2 3
| | \_/
| |
| |
1 * | |
| |
| | _
| | / \
7 6 5 4
0 1 2 3
| \_/ |
| /
| /
1 * | /
| /
| / _
| | / \
7 6 5 4
0 1 2 3 4 5 6 7
| \_/ | | | \_/
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
1 * | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| _ | | | _
| / \ | | | / \
1514131211109 8