Last active
July 28, 2023 04:53
-
-
Save arvsrao/dd53f7ff7b73ba41ae581417e2f3fdc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import Matrix | |
from sympy.abc import a,b | |
from sympy.physics.quantum import TensorProduct | |
A = Matrix([[a, -b, 0], | |
[b, a, 0], | |
[0, 0, 1]]) | |
#Embedding into tensor space. | |
E = Matrix([[1, 0, 0, 0, 0, 0], | |
[0, 1, 0, 0, 0, 0], | |
[0, 0, 0, 1, 0, 0], | |
[0, 0, 0, 0, 0, 0], | |
[0, 0, 1, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 1, 0], | |
[0, 0, 0, 0, 0, 1]]) | |
#Project from tensor space back into the space where variables commute. | |
S = Matrix([[1, 0, 0, 0, 0, 0], | |
[0, 1, 0, 0, 0, 0], | |
[0, 0, 0, 1, 0, 0], | |
[0, 1, 0, 0, 0, 0], | |
[0, 0, 1, 0, 0, 0], | |
[0, 0, 0, 0, 1, 0], | |
[0, 0, 0, 1, 0, 0], | |
[0, 0, 0, 0, 1, 0], | |
[0, 0, 0, 0, 0, 1]]) | |
PTwoRepN = S.transpose() * TensorProduct(A,A) * E | |
S3 = Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], | |
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], | |
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]]) | |
E3 = Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]]) | |
PRepN = S3.transpose() * TensorProduct(A, PTwoRepN) * E3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment