In [1]:
from sympy.physics.quantum import *
from sympy.physics.quantum.cartesian import *
from sympy.physics.quantum.operator import *
from sympy.physics.quantum.state import *
from sympy import *
from sympy.core.relational import *
from sympy.physics.units import degree
from sympy.abc import a, b, x, y, z, t, alpha, n, theta, h, f, lamda, i, k, w, u, d, beta, r, psi, o, l, c, gamma, phi, j, p
In [2]:
M1 = Operator('M_1')
M2 = Operator('M_2')
momentumOperator = HermitianOperator('P')
positionOperator = HermitianOperator('x')
A = Operator('A')
B = Operator('B')
sigma_x = HermitianOperator('sigma_x')
sigma_y = HermitianOperator('sigma_y')
sigma_z = HermitianOperator('sigma_z')
In [3]:
commutatorOfM1_M2 = Eq(Commutator(M1, M2), 0)
display(commutatorOfM1_M2)
In [4]:
commutatorOfMomentumOperator_PositionOperator = Unequality(Eq(Commutator(momentumOperator,
positionOperator),
I * hbar),
0,
evaluate = False)
display(commutatorOfMomentumOperator_PositionOperator)
In [5]:
commutatorOfA_B = Eq(Commutator(A, B), A * B - B * A)
display(commutatorOfA_B)
In [6]:
commutatorOfB_A = Eq(Commutator(B, A), B * A - A * B)
display(commutatorOfB_A)
In [7]:
sigma_xExpanded = Matrix([[0, 1],[1, 0]])
display(sigma_xExpanded)
In [8]:
sigma_yExpanded = Matrix([[0, -I],[I, 0]])
display(sigma_yExpanded)
In [9]:
sigma_zExpanded = Matrix([[1, 0],[0, -1]])
display(sigma_zExpanded)
In [10]:
commutatorOfSigma_z_sigma_x = Eq(Commutator(sigma_z, sigma_x), sigma_z * sigma_x - sigma_x * sigma_z)
display(commutatorOfSigma_z_sigma_x)
In [11]:
commutatorOfSigma_z_sigma_x = Eq(Commutator(sigma_z, sigma_x),
Add(MatMul(sigma_zExpanded, sigma_xExpanded),
MatMul(MatMul(-1, sigma_xExpanded),
sigma_zExpanded),
evaluate = False),
evaluate = False)
display(commutatorOfSigma_z_sigma_x)
In [12]:
commutatorOfSigma_z_sigma_x = Eq(Commutator(sigma_z, sigma_x),
MatMul(2 * i,
Add(sigma_zExpanded * sigma_xExpanded,
MatMul(-1, sigma_xExpanded) * sigma_zExpanded)*-I/2),
evaluate = False)
display(commutatorOfSigma_z_sigma_x)
In [13]:
commutatorOfSigma_z_sigma_x = Unequality(Eq(Commutator(sigma_z, sigma_x),
2 * I* sigma_y),
0,
evaluate = False)
display(commutatorOfSigma_z_sigma_x)
In [14]:
commutatorOfSigma_z_sigma_y = Eq(Commutator(sigma_z, sigma_y), sigma_z * sigma_y - sigma_y * sigma_z)
display(commutatorOfSigma_z_sigma_y)
In [15]:
commutatorOfSigma_z_sigma_y = Eq(Commutator(sigma_z, sigma_y),
Add(MatMul(sigma_zExpanded, sigma_yExpanded),
MatMul(MatMul(-1, sigma_yExpanded),
sigma_zExpanded),
evaluate = False),
evaluate = False)
display(commutatorOfSigma_z_sigma_y)
In [16]:
commutatorOfSigma_z_sigma_y = Eq(Commutator(sigma_z, sigma_y),
MatMul(-2 * i,
Add(sigma_zExpanded * sigma_yExpanded,
MatMul(-1, sigma_yExpanded) * sigma_zExpanded)*I/2),
evaluate = False)
display(commutatorOfSigma_z_sigma_y)
In [17]:
commutatorOfSigma_z_sigma_y = Unequality(Eq(Commutator(sigma_z, sigma_y),
-2 * I* sigma_x),
0,
evaluate = False)
display(commutatorOfSigma_z_sigma_y)
In [18]:
commutatorOfSigma_x_sigma_y = Eq(Commutator(sigma_x, sigma_y), sigma_x * sigma_y - sigma_y * sigma_x)
display(commutatorOfSigma_x_sigma_y)
In [19]:
commutatorOfSigma_x_sigma_y = Eq(Commutator(sigma_x, sigma_y),
Add(MatMul(sigma_xExpanded, sigma_yExpanded),
MatMul(MatMul(-1, sigma_yExpanded),
sigma_xExpanded),
evaluate = False),
evaluate = False)
display(commutatorOfSigma_x_sigma_y)
In [20]:
commutatorOfSigma_x_sigma_y = Eq(Commutator(sigma_x, sigma_y),
MatMul(2 * i,
Add(sigma_xExpanded * sigma_yExpanded,
-sigma_yExpanded * sigma_xExpanded)*-I/2),
evaluate = False)
display(commutatorOfSigma_x_sigma_y)
In [21]:
commutatorOfSigma_x_sigma_y = Unequality(Eq(Commutator(sigma_x, sigma_y),
2 * I* sigma_z),
0,
evaluate = False)
display(commutatorOfSigma_x_sigma_y)
In [ ]: