#!/usr/bin/env python # coding: utf-8 # # Lab 2 - Quantum States # Useful for working examples and problems with photon quantum states. You may notice some similarity to the Jones Calculus ;-) # In[10]: import numpy as np from qutip import * # These are the polarization states: # In[11]: H = Qobj([[1],[0]]) V = Qobj([[0],[1]]) P45 = Qobj([[1/np.sqrt(2)],[1/np.sqrt(2)]]) M45 = Qobj([[1/np.sqrt(2)],[-1/np.sqrt(2)]]) R = Qobj([[1/np.sqrt(2)],[-1j/np.sqrt(2)]]) L = Qobj([[1/np.sqrt(2)],[1j/np.sqrt(2)]]) # In[12]: V # Devices: # # HWP - Half-wave plate axis at $\theta$ to the horizontal # # LP - Linear polarizer, axis at $\theta$ # # QWP - Quarter-wave plate, axis at $\theta$ # # Note, these are functions so you need to call them with a specific value of theta. # In[18]: def HWP(theta): return Qobj([[np.cos(2*theta),np.sin(2*theta)],[np.sin(2*theta),-np.cos(2*theta)]]).tidyup() # In[19]: def LP(theta): return Qobj([[np.cos(theta)**2,np.cos(theta)*np.sin(theta)],[np.sin(theta)*np.cos(theta),np.sin(theta)**2]]).tidyup() # In[20]: def QWP(theta): return Qobj([[np.cos(theta)**2 + 1j*np.sin(theta)**2, (1-1j)*np.sin(theta)*np.cos(theta)], [(1-1j)*np.sin(theta)*np.cos(theta), np.sin(theta)**2 + 1j*np.cos(theta)**2]]).tidyup() # In[22]: QWP(np.pi/4) # ## Example 1) Check that the $|H\rangle$ state is normalized # In[23]: H.dag()*H # To show more information on an object, use the question mark after the function or object: # In[25]: get_ipython().run_line_magic('pinfo', 'np.sin') # ### Example 2) Converting from ket to bra: # In[26]: psi = Qobj([[1+1j],[2-1j]]) psi # In[27]: psi.dag() # In[17]: psi.dag().dag() # the `.dag()` python method computes the "daggar" or the complex transpose. # ## 1) Is `psi` normalized? If not, find the normalization constant and confirm that constant normalizes `psi`. # ## 2) Verify that the $|V\rangle$ state is normalized # ## 3) Verify that the $|H\rangle$ and $|V\rangle$ states are orthogonal. Repeat for the other pairs of states. # ## 4) Calculate the horizontal component $c_H$ of the state $\psi = \frac{1}{\sqrt{5}}|H\rangle + \frac{2}{\sqrt{5}}|V\rangle$ # ## 5) Verify Eq. (3.18), $P(H||45\rangle)=\frac{1}{2},$ (which states "The probability that a photon prepared in the +45 state will leave a PA_HV in the Horizontal state is one half.") # ## 6) Demonstrate that a half-wave plate at 45-degrees converts $|H\rangle$ to $|V\rangle$ # ## 7) Re-create Figure 3.9 by plotting the probability P(+45) vs phase φ