Lab 3: Operators
An overview of operator properties
import matplotlib.pyplot as plt
from numpy import sqrt,cos,sin,arange,pi
from qutip import *
%matplotlib inlineH = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqrt(2)],[-1/sqrt(2)]])
R = Qobj([[1/sqrt(2)],[-1j/sqrt(2)]])
L = Qobj([[1/sqrt(2)],[1j/sqrt(2)]])Example 1: the outer product and the projection operator¶
We already have the state represented as a vector in the HV basis, so the operator is the outer product (a ket then a bra):
HPh = H*H.dag()
PhSame with the operator:
Pv = V*V.dag()
PvExample 2: Verify Eq. 4.38 for the HV basis states. Repeat for the ±45, and LR basis¶
identity(2)Ph + Pv == identity(2)P45*P45.dag()M45*M45.dag()P45*P45.dag() + M45*M45.dag()L*L.dag()R*R.dag()L*L.dag() + R*R.dag()Example 3: Represent the operator in the HV basis and verify your representation by operating on and states. Use the following template function definition.¶
def Rp(theta):
return Qobj([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]).tidyup()Rp(pi/2)V==Rp(pi/2)*H# Solution Goes Here1) Using the operator, verify the operator properties described in Sections 4.1 and 4.2. Specifically, verify Eqns. 4.6, 4.7, 4.16, 4.18, 4.22, and 4.27¶
# Solution Goes HereExample: the similarity transform¶
The following defines a function that creates a similarity transform matrix. It takes the two old basis vectors and the two new basis vectors as arguments. To apply the transform, simply multiply the matrix onto the state vector or ooperator matrix. Following the examples below, explore this transform.
def sim_transform(o_basis1, o_basis2, n_basis1, n_basis2):
a = n_basis1.dag()*o_basis1
b = n_basis1.dag()*o_basis2
c = n_basis2.dag()*o_basis1
d = n_basis2.dag()*o_basis2
return Qobj([[a,b],[c,d]])We can define a similarity transform that converts from
Shv45 = sim_transform(H,V,P45,M45) # as found in Example 4.A.1, Eq. 4.A.10.
Shv45Shv45 * H # compare to Eq. 4.A.124) Use the similarity transform to represent in the ±45 basis¶
5) Represent in the ±45 basis.¶
Check your answer against Eqns. 4.A.17 and 4.72
6) Represent in the ±45 basis.¶