{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Chapter 7 - Angular Momentum and Rotation\n", "We'll use $\\hbar=1$ for numerical results, this is standard practice, but it is important to remember." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from numpy import sqrt, pi, exp, angle\n", "from qutip import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Our usual spin operators (spin-1/2)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "pz = basis(2,0)\n", "mz = basis(2,1)\n", "px = 1/sqrt(2)*(pz + mz)\n", "mx = 1/sqrt(2)*(pz - mz)\n", "py = 1/sqrt(2)*(pz + 1j*mz)\n", "my = 1/sqrt(2)*(pz - 1j*mz)\n", "Sx = 1/2.0*sigmax()\n", "Sy = 1/2.0*sigmay()\n", "Sz = 1/2.0*sigmaz()\n", "Splus = Sx + 1j*Sy\n", "Sminus = Sx - 1j*Sy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define the spin-1 operators. We use J just to keep them apart. Could be S instead." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "Jx = 1/sqrt(2)*Qobj([[0,1,0],[1,0,1],[0,1,0]])\n", "Jy = 1/sqrt(2)*Qobj([[0,-1j,0],[1j,0,-1j],[0,1j,0]])\n", "Jz = Qobj([[1,0,0],[0,0,0],[0,0,-1]])\n", "Jplus = Jx + 1j*Jy # raising operator\n", "Jminus = Jx - 1j*Jy # lowering operator" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [3]], shape = (3, 3), type = oper, isherm = True\\begin{equation*}\\left(\\begin{array}{*{11}c}1.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & -1.0\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [3]], shape = (3, 3), type = oper, isherm = True\n", "Qobj data =\n", "[[ 1. 0. 0.]\n", " [ 0. 0. 0.]\n", " [ 0. 0. -1.]]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Jz" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rotations of spin-1/2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To define an exponentiated operator, we apply the `.expm()` method to the argument. So to write the rotation operator: \n", "\n", "$$\\hat{R}_z(90^\\circ) = e^{-i\\frac{\\pi}{2}\\hat{S}_z}$$\n", "\n", "we do the following. It looks a little odd to read since you might expect the `exp` to come first, but looks like this:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "Rz90 = (-1j*pi/2*Sz).expm()" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False\\begin{equation*}\\left(\\begin{array}{*{11}c}(0.707-0.707j) & 0.0\\\\0.0 & (0.707+0.707j)\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False\n", "Qobj data =\n", "[[0.70710678-0.70710678j 0. +0.j ]\n", " [0. +0.j 0.70710678+0.70710678j]]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rz90" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}(0.500-0.500j)\\\\(0.500+0.500j)\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\n", "Qobj data =\n", "[[0.5-0.5j]\n", " [0.5+0.5j]]" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rz90*px" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Doesn't look like example 7.4 because it's not simplified. How to check:" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}(0.500-0.500j)\\\\(0.500+0.500j)\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\n", "Qobj data =\n", "[[0.5-0.5j]\n", " [0.5+0.5j]]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exp(-1j*pi/4)*py" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Yes, this agrees." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Can also use inner product:" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\\begin{equation*}\\left(\\begin{array}{*{11}c}(0.707-0.707j)\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n", "Qobj data =\n", "[[0.70710678-0.70710678j]]" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "py.dag()*Rz90*px" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.9999999999999999" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(py.dag()*Rz90*px).norm()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "angle(0.707 - 0.707j) == -pi/4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Find the spin-1 states (the eigenstates of the corresponding matrix)\n", "According to the postulates, the allowed values of an observable are the eigenvalues with corresponding eigenstates.\n", "\n", "We know the matrix representation of Jx, Jy, Jz in the Z-basis so we can find all 9 states (in the Z basis). Why nine? There are three possible values $\\hbar$, 0, $-\\hbar$ for each of three directions." ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "yevals, (yd,y0,yu) = Jy.eigenstates()\n", "zevals, (zd,z0,zu) = Jz.eigenstates()\n", "xevals, (xd,x0,xu) = Jx.eigenstates()\n", "\n", "# Fix the signs to match book:\n", "# (if first value of eigenstate is negative, flip all signs)\n", "states = [xd, x0, xu, yd, y0, yu, zd, z0, zu]\n", "states = [-s if s[0][0][0]<0 else s for s in states]\n", "# Python doesn't change the values in the list so we have \n", "# to replace the old values with the new ones:\n", "[xd, x0, xu, yd, y0, yu, zd, z0, zu] = states" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.500\\\\-0.707\\\\0.500\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\n", "Qobj data =\n", "[[ 0.5 ]\n", " [-0.70710678]\n", " [ 0.5 ]]" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xd" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [], "source": [ "Rz90 = (-1j*pi/2*Jz).expm()" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rz90*xu == -1j*yu" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}-0.500j\\\\0.707\\\\0.500j\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\n", "Qobj data =\n", "[[0. -0.5j]\n", " [0.70710678+0.j ]\n", " [0. +0.5j]]" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rz90*xu" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.500\\\\-0.707j\\\\-0.500\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\n", "Qobj data =\n", "[[ 0.5+0.j ]\n", " [ 0. -0.70710678j]\n", " [-0.5+0.j ]]" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "yd" ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(y0.dag()*Rz90*x0).norm()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7.10 A spin-1 particle is measured to have $S_y=\\hbar$. What is the probability that a subsequent measurement will yield $S_z=0$? $S_z=\\hbar$? $S_z=-\\hbar$?" ] }, { "cell_type": "code", "execution_count": 69, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4999999999999999" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(z0.dag()*yu).norm()**2" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.2500000000000002" ] }, "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(zu.dag()*yu).norm()**2" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.2500000000000001" ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(zd.dag()*yu).norm()**2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7.11 A spin-1 particle is measured to have $S_y=0$. What is the probability that a subsequent measurement will yield $S_x=-\\hbar$?" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4999999999999998" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(y0.dag()*xd).norm()**2" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4999999999999998" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(xd.dag()*y0).norm()**2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7.13 $|\\psi\\rangle = \\frac{1}{3}(2|1,1\\rangle - i|1,0\\rangle + 2|1,-1\\rangle)$ Calculate expectation values of $S^2$, $S_y$, and $S_z$." ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.667\\\\-0.333j\\\\0.667\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [1]], shape = (3, 1), type = ket\n", "Qobj data =\n", "[[0.66666667+0.j ]\n", " [0. -0.33333333j]\n", " [0.66666667+0.j ]]" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi = (1/3)*(2*zu -1j*z0 +2*zd)\n", "psi" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[3], [3]], shape = (3, 3), type = oper, isherm = True\\begin{equation*}\\left(\\begin{array}{*{11}c}2.000 & 0.0 & 0.0\\\\0.0 & 2.000 & 0.0\\\\0.0 & 0.0 & 2.000\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[3], [3]], shape = (3, 3), type = oper, isherm = True\n", "Qobj data =\n", "[[2. 0. 0.]\n", " [0. 2. 0.]\n", " [0. 0. 2.]]" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Jsquared = Jx*Jx + Jy*Jy + Jz*Jz\n", "Jsquared" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\\begin{equation*}\\left(\\begin{array}{*{11}c}2.000\\\\\\end{array}\\right)\\end{equation*}" ], "text/plain": [ "Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n", "Qobj data =\n", "[[2.]]" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi.dag()*Jsquared*psi" ] }, { "cell_type": "code", "execution_count": 56, "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": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi.dag()*Jy*psi" ] }, { "cell_type": "code", "execution_count": 57, "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": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "psi.dag()*Jz*psi" ] }, { "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.21.0" } }, "nbformat": 4, "nbformat_minor": 1 }