{ "metadata": { "name": "", "signature": "sha256:5db6a63df9cde699a2f6d05affe90130c8801de823e6caf99e620690139daf39" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "
\n", "For now, I'm going work directly from Schlosshauer chapter two, adding in\n", "examples from the Cugini paper as well as my own examples." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Note that my only operators are matrices for now. So I won't make\n", "the operator/matrix distinction at all." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The density operator of a pure state $|\\psi\\rangle$ is:\n", "
\n", "$$\n", "(2.11) \\;\\; \\rho = |\\psi\\rangle\\langle\\psi| \n", "$$\n", "
\n", "The off-diagonal terms are the \"interference\" terms, for the basis\n", "in which the expression is written. Below I'm writing things in the\n", "\"z\" or \"classical\" basis. So the off-diagonal terms represent the\n", "coherence or quantumness of the state in the classical basis.\n", "
\n", "The trace operation is:\n", "
\n", "$$\n", "(2.14) \\;\\; \\mathrm{Tr}(A) = \\sum_i\\langle\\phi_i|A|\\phi_i\\rangle\n", "$$\n", "
\n", "where $\\{\\phi_i\\}$ are a complete set of orthonormal\n", "basis vectors. The expression\n", "$\\langle\\phi_i|A|\\phi_i\\rangle$ picks out the $i$th row and column if\n", "$A$ is actually a matrix, so we're just adding up the main diagonal." ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Define the outer product operation:\n", "def OP(x,y): return( x*y.transpose().conjugate())\n", "\n", "# Define the trace operation:\n", "def Tr(M, basis, V=False):\n", " if V: Print('Trace operation:')\n", " result = 0\n", " for phi in basis:\n", " phi_bra = phi.transpose().conjugate()\n", " temp1 = megasimp(M*phi)\n", " temp = megasimp(phi_bra*M*phi)\n", " temp = temp[0] # Sympy gives a 1x1 matrix result\n", " if V: Print(r'$\\;\\;\\;\\; %s %s %s$' %(\\\n", " myltx(phi_bra),\\\n", " myltx(M),\\\n", " myltx(phi)))\n", " if V: Print(r'$\\;\\;\\;\\;\\;\\;\\;\\; = %s %s$' %(\\\n", " myltx(phi_bra),\\\n", " myltx(temp1)))\n", " if V: Print(r'$\\;\\;\\;\\;\\;\\;\\;\\; = %s$' %myltx(temp))\n", " result += temp\n", " if V: Print(r'$\\;\\;\\;\\; = %s$' %myltx(result))\n", " return(result)\n", "\n", "# Create a formatter for stuff like |00>\n", "fmt = sg_format_state(['0','1'], '').format\n", "\n", "# Create a two-bit basis\n", "b2bit = [TP(pZ,pZ), TP(pZ,mZ), TP(mZ,pZ), TP(mZ,mZ)]" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "
" ] }, { "cell_type": "code", "collapsed": false, "input": [ "a_11, a_12, a_21, a_22 = sy.var('a_11, a_12, a_21, a_22')\n", "A = mat(a_11, a_12, a_21, a_22)\n", "trace = Tr(A, [pZ, mZ], V=True)\n", "trace = Tr(A, [pX, mX], V=True)\n", "trace = Tr(A, [pY, mY], V=True)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psi = col(1,0)\n",
"psi = col(0,1)\n",
"psi = col(1/sqrt(2), 1/sqrt(2))\n",
"psi = col(frac(4,5), frac(3,5))\n",
"rho = OP(psi,psi)\n",
"trace = Tr(rho, [pZ, mZ])\n",
"Print(r'$\\psi=%s,\\;\\;\\;\\; \\rho=%s, \\;\\;\\;\\mathrm{Tr}(\\rho)=%s$'\n",
" %(fmt(psi), myltx(rho), myltx(trace)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"$\\psi=\\frac{4}{5}|0\\rangle+\\frac{3}{5}|1\\rangle,\\;\\;\\;\\; \\rho=\\left[\\begin{matrix}\\frac{16}{25} & \\frac{12}{25}\\\\\\frac{12}{25} & \\frac{9}{25}\\end{matrix}\\right], \\;\\;\\;\\mathrm{Tr}(\\rho)=1$"
],
"metadata": {},
"output_type": "display_data",
"text": [
" "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"s1 = col(1,0); s2 = col(0,1) # No interference\n",
"s1 = col(0,1)\n",
"s1 = col(1/sqrt(2), 1/sqrt(2))\n",
"#s2 = col(1/sqrt(2), 1/sqrt(2))\n",
"psi = TP( s1, s2 )\n",
"rho = OP(psi,psi)\n",
"trace = Tr(rho, b2bit)\n",
"Print(r'$\\psi=%s,\\;\\;\\;\\; \\rho=%s, \\;\\;\\;\\mathrm{Tr}(\\rho)=%s$'\n",
" %(fmt(psi), myltx(rho), myltx(trace)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"$\\psi=\\frac{1}{\\sqrt{2}}|01\\rangle+\\frac{1}{\\sqrt{2}}|11\\rangle,\\;\\;\\;\\; \\rho=\\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & \\frac{1}{2} & 0 & \\frac{1}{2}\\\\0 & 0 & 0 & 0\\\\0 & \\frac{1}{2} & 0 & \\frac{1}{2}\\end{matrix}\\right], \\;\\;\\;\\mathrm{Tr}(\\rho)=1$"
],
"metadata": {},
"output_type": "display_data",
"text": [
" "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"bell_1 = 1/sqrt(2)*TP(pZ,pZ) + 1/sqrt(2)*TP(mZ,mZ) # phi+\n",
"bell_2 = 1/sqrt(2)*TP(pZ,pZ) - 1/sqrt(2)*TP(mZ,mZ) # phi-\n",
"bell_3 = 1/sqrt(2)*TP(pZ,mZ) + 1/sqrt(2)*TP(mZ,pZ) # psi+ (Triplet)\n",
"bell_4 = 1/sqrt(2)*TP(pZ,mZ) - 1/sqrt(2)*TP(mZ,pZ) # psi- (Singlet)\n",
"bell = [bell_1, bell_2, bell_3, bell_4]\n",
"for psi in bell:\n",
" rho = OP(psi,psi)\n",
" trace = Tr(rho, b2bit)\n",
" Print(r'$\\psi=%s,\\;\\;\\;\\; \\rho=%s, \\;\\;\\;\\mathrm{Tr}(\\rho)=%s$'\n",
" %(fmt(psi), myltx(rho), myltx(trace)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"$\\psi=\\frac{1}{\\sqrt{2}}|00\\rangle+\\frac{1}{\\sqrt{2}}|11\\rangle,\\;\\;\\;\\; \\rho=\\left[\\begin{matrix}\\frac{1}{2} & 0 & 0 & \\frac{1}{2}\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\\\frac{1}{2} & 0 & 0 & \\frac{1}{2}\\end{matrix}\\right], \\;\\;\\;\\mathrm{Tr}(\\rho)=1$"
],
"metadata": {},
"output_type": "display_data",
"text": [
" \n",
"A mixed state can be viewed as a state chosen from a classical ensemble\n",
"of states, consisting of states $\\{\\psi_i\\}$ for which you know the\n",
"relative frequency of each state in the ensemble.\n",
" \n",
"The density matrix for a mixed state is simply the weighted sum of the\n",
"density matrices for the individual states:\n",
" \n",
"$$\n",
"(2.20) \\;\\; \\rho = \\sum_i p_i|\\psi_i\\rangle\\langle\\psi_i| \n",
"$$\n",
"where $p_i$ is the (classical) probability of drawing $\\psi_i$ from\n",
"the ensemble.\n",
" \n",
"For example, say you have a 50% chance of getting $|0\\rangle$ and a\n",
"50% chance of getting $|1\\rangle$. Then we have:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"zero = col(1,0); one = col(0,1)\n",
"rho = frac(1,2)*OP(zero,zero) + frac(1,2)*OP(one,one)\n",
"string = r'$\\psi$ is either $|0\\rangle$ or $|1\\rangle,\\;\\;\\;'\n",
"string += r'\\rho=%s,\\;\\;\\;'\n",
"string += r'\\mathrm{Tr}(\\rho)=%s$'\n",
"Print(string%(myltx(rho), myltx(trace)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"$\\psi$ is either $|0\\rangle$ or $|1\\rangle,\\;\\;\\;\\rho=\\left[\\begin{matrix}\\frac{1}{2} & 0\\\\0 & \\frac{1}{2}\\end{matrix}\\right],\\;\\;\\;\\mathrm{Tr}(\\rho)=1$"
],
"metadata": {},
"output_type": "display_data",
"text": [
" \n",
"$$\n",
"|0\\rangle = \\frac{1}{\\sqrt{2}}|+x\\rangle+\\frac{1}{\\sqrt{2}}|-x\\rangle\n",
"\\\\\n",
"|1\\rangle = \\frac{1}{\\sqrt{2}}|+x\\rangle-\\frac{1}{\\sqrt{2}}|-x\\rangle\n",
"$$"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"zero = col(1/sqrt(2), 1/sqrt(2))\n",
"one = col(1/sqrt(2), -1/sqrt(2))\n",
"rho = frac(1,2)*OP(zero,zero) + frac(1,2)*OP(one,one)\n",
"string = r'$\\psi$ is either $|0\\rangle$ or $|1\\rangle,\\;\\;\\;'\n",
"string += r'\\rho_x=%s,\\;\\;\\;'\n",
"string += r'\\mathrm{Tr}(\\rho)=%s$'\n",
"Print(string%(myltx(rho), myltx(trace)))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"$\\psi$ is either $|0\\rangle$ or $|1\\rangle,\\;\\;\\;\\rho_x=\\left[\\begin{matrix}\\frac{1}{2} & 0\\\\0 & \\frac{1}{2}\\end{matrix}\\right],\\;\\;\\;\\mathrm{Tr}(\\rho)=1$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"Product states:
\n",
"Maximally entangled states:
\n",
"
\n",
"\n",
"\n",
"^ 2.4.2 Mixed-State Density Matrices
\n",
"