Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lab 3: Operators

An overview of operator properties

import matplotlib.pyplot as plt
from numpy import sqrt,cos,sin,pi,arange
from qutip import *
H = 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 H|H\rangle state represented as a vector in the HV basis, so the P^H\hat{P}_H operator is the outer product HH|H\rangle\langle H|:

Ph = H*H.dag()
Ph

Same with the P^V\hat{P}_V operator:

Pv = V*V.dag()
Pv

1) Verify Eq. 4.38 for the HV basis states. Repeat for the 45, and ± basis

2) Represent the R^p(θ)\hat{R}_p(\theta) operator in the HV basis and verify your representation by operating on H|H\rangle and V|V\rangle states.

def Rp(theta):
    return Qobj([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]).tidyup()
Rp(pi/2)
V == Rp(pi/2)*H

3) Using your R^p(θ)\hat{R}_p(\theta) operator, verify the operator properties described in Sections 4.1 and 4.2. Specifically, verify Eqns. 4.5, 4.6, 4.7, 4.16, 4.18, 4.22, and 4.27

Example: 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.

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.data[0,0],b.data[0,0]],[c.data[0,0],d.data[0,0]]])
Shv45 = sim_transform(H,V,P45,M45)  # as found in Example 4.A.1, Eq. 4.A.10.
Shv45
Shv45 * L  # compare to Eq.

4) Represent P^H\hat{P}_H in the ±45 basis.

Check your answer against Eqns. 4.A.17 and 4.72

Shv45*Ph*Shv45.dag()