{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 8 - Two-photon States" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from qutip import *\n", "from numpy import sqrt" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "H = basis(2,0)\n", "V = basis(2,1)\n", "p45 = 1/sqrt(2)*(H + V)\n", "m45 = 1/sqrt(2)*(H - V)\n", "R = 1/sqrt(2)*(H - 1j*V)\n", "L = 1/sqrt(2)*(H + 1j*V)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "hh = tensor(H,H)\n", "hv = tensor(H,V)\n", "vh = tensor(V,H)\n", "vv = tensor(V,V)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.0\\\\0.0\\\\0.0\\\\1.0\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket\n", "Qobj data =\n", "[[ 0.]\n", " [ 0.]\n", " [ 0.]\n", " [ 1.]]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vv" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\\begin{equation*}\\left(\\begin{array}{*{11}c}0.0\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n", "Qobj data =\n", "[[ 0.]]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Show these are all orthogonal:\n", "hh.dag()*hv" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\\begin{equation*}\\left(\\begin{array}{*{11}c}0.0\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n", "Qobj data =\n", "[[ 0.]]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vh.dag()*hv" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True\\begin{equation*}\\left(\\begin{array}{*{11}c}1.0 & 0.0\\\\0.0 & 1.0\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True\n", "Qobj data =\n", "[[ 1. 0.]\n", " [ 0. 1.]]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "qeye(2)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n", "True\n", "True\n" ] } ], "source": [ "# Example 8.1\n", "Phv = H*H.dag() - V*V.dag() # polarization measurement\n", "ps_hv = tensor(Phv,qeye(2))\n", "pi_hv = tensor(qeye(2),Phv)\n", "psi_hv = tensor(Phv,Phv)\n", "\n", "print(ps_hv*tensor(V,p45) == -tensor(V,p45))\n", "\n", "print(pi_hv*tensor(V,p45) == tensor(V,m45))\n", "\n", "print(psi_hv*tensor(V,p45) == -tensor(V,m45))" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.2499999999999999" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Example 8.2\n", "Pvh = tensor(V,H)*tensor(V,H).dag()\n", "expect(Pvh,tensor(R,p45))" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4999999999999998" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Example 8.3\n", "Phi = tensor(qeye(2),H)*tensor(qeye(2),H).dag()\n", "expect(Phi,tensor(R,p45))" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.5" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Example 8.4\n", "state = tensor(R,p45)\n", "expect(Pvh,state) / expect(Phi,state)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Entangled states" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "phip = 1/sqrt(2)*(tensor(H,H) + tensor(V,V))\n", "Phs = tensor(H,qeye(2))*tensor(H,qeye(2)).dag() \n", "Phi = tensor(qeye(2),H)*tensor(qeye(2),H).dag()\n", "Phshi = tensor(H,H)*tensor(H,H).dag()\n", "\n", "expect(Phshi,phip)/ expect(Phi,phip)" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [ "P_45s45i = tensor(p45,p45)*tensor(p45,p45).dag()\n", "P_45i = tensor(qeye(2),p45)*tensor(qeye(2),p45).dag()" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.9999999999999997" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expect(P_45s45i,phip)/expect(P_45i,phip)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Delete me, this is scratch work from review session" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.671\\\\0.224j\\\\-0.224j\\\\0.671\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2, 2], [1, 1]], shape = (4, 1), type = ket\n", "Qobj data =\n", "[[0.67082039+0.j ]\n", " [0. +0.2236068j]\n", " [0. -0.2236068j]\n", " [0.67082039+0.j ]]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi = 1/sqrt(5)*tensor(L,R) + 2/sqrt(5)*tensor(R,L)\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\\begin{equation*}\\left(\\begin{array}{*{11}c}0.450\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n", "Qobj data =\n", "[[0.45]]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi.dag()*tensor(H,H)*tensor(H,H).dag()*psi" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.45" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "9/20" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernel_info": { "name": "python3" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" }, "nteract": { "version": "0.15.0" } }, "nbformat": 4, "nbformat_minor": 2 }