phy-521/presentation/Entanglement.ipynb
2020-12-23 16:45:08 -05:00

388 lines
50 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# EPR Paradox Example\n",
"\n",
"# A neutral pi meson (pi0) decays into an electron/positron (e-/e+) \n",
"# pair.\n",
"\n",
"# pi0 --> e+ + e- (electron-positron pair)\n",
"# pi0 has angular momentum l = s = 0\n",
"\n",
"# Align electron and positron detectors in opposite directions.\n",
"\n",
"# | pi0 |\n",
"# |e- <------ ------> e+|\n",
"\n",
"# Where hbar = 1, the measurement of the spin in some direction is \n",
"# +/-1 with spin state [1 0] (up) or [0 1] (down).\n",
"\n",
"# The Pauli exclusion principle with conserved angular momentum 0\n",
"# dictates this system must be in the singlet state \n",
"# chi = [1/sqrt(2) (|up+>|down-> - |down+>|up->)].\n",
"\n",
"# In this state, if the positron is measured to have spin [1 0], the \n",
"# electron must have spin [0 1], or vice versa. There is an equal \n",
"# probability to find either state during the first measurement.\n",
"\n",
"# This view is consistent with the realist view. The realist view could \n",
"# hold that the electron and position had those angular momenta \n",
"# from creation.\n",
"\n",
"# EPR assumes influences cannot propagate faster than the speed of \n",
"# light. \"Wave function collapse\" is apparently instantaneous, however.\n",
"\n",
"\n",
"import numpy as np\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.patches as mpatches\n",
"%matplotlib inline "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEXCAYAAACu1P9TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAHGBJREFUeJzt3XucHGWd7/HP5LIh2RATWBeDhsUDIQT0EFZcRBAGEAmrBOSAEVgPCR4xB9AX3na5ygQXFFnY5SasslnYFT3gbSG6XAQZiCQkrlyOEXI5CiYkXGMCSQgJSeb88atmairVM92dmXSG5/N+vfrV0089Vf30TPW3qp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5lPiC5Q+bbyVWwrOIkU4/AjYAB2fT98zq/1X2eixxncPrxAoNsH9WZ6/sdRvxRXoCOA2YSAylfZG4VqJeD9D13khQ/qV6Frgh+6x/T5zbObOB91Pfc9103VQvm0eMUMr7Np1fqvHEivep3PQW4Dd0vZJ5GZ0Xo50O/BcwG/hsVvZ5Yi+soi17j9Zc2X5Z2Uca+Bzt1PalKl59/W3ii6btj+um66ZdOr1oELF3c0eh/Ce5n99PfInyh6QdwA/peog7C/hQ9vOhwEPZI1/2y8L7bKDrXc0qF729q9YP0ICflLzetY/fU/Vz3XTdBAz83vRnRN/mi4Xy/OvRRB/o64U6LxD9p4Oz17+k80v2IeILlf+iHZK9zltdeL0he96htuY3pNpnLfYNq7lcN103gdrulqnavEwcEv95oTz/+jniquId6PrF2oW4NuGN7PUsYCfikHf37PVm4l9MHpUts/il6k3riCuo88ruaFrtsz7X6y3S1nDddN0E3MPvTRuBx4DjC+Un5H6eRxwmn5QrawFOpOuX5DfESIfzicPfFcRtpOcT/0pydfZefeVZuv4vAyjvbz2h5PVy7Cvd3rhuum6qDxxP7O18i1gJLyX+yUt+JMR3gVeIEQMTiZEQ64n/HJY3M7esimspPyHVRgx9K9pMYyMT/jqb9yrgw9nn+D1bnhhbCtxIfNbKSIizGng/9T3XTddN9YGziJVtLfBT4jB3E51fqqF0jnV+nS3HOlf8bTbfJ3Nln8jKLizUvZgt+yyh8S8VxP2RlhDD9P4NODZ77+JY5+/ROdb54gbfS9uG66akuu1OfKn+usntkIp2x3WzKvvwJSkRBr4a1dHsBkhVuG5KkiRJkiRJkiRJkiRJkiSpL/1/3StWYRo1uZsAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020bd208>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# If information about the measurement of the wave function propagated\n",
"# at a finite speed, the particles could conceivably be measured such\n",
"# that both are equally likely to hold either spin up or spin down.\n",
"\n",
"# What would happen if the measurements were uncorrelated?\n",
"\n",
"plt.hist(np.random.randint(0,2,1000),bins=4)\n",
"plt.hist(np.random.randint(3,5,1000),bins=4)\n",
"elepatch = mpatches.Patch(color='blue', label='e-')\n",
"pospatch = mpatches.Patch(color='orange', label='e+')\n",
"#plt.legend(handles=[elepatch,pospatch])\n",
"plt.text(0.5,565,\"e-\",size=20)\n",
"plt.text(3.5,565,\"e+\",size=20)\n",
"\n",
"plt.suptitle(\"Uncorrelated Spins\",fontsize=20)\n",
"plt.ylim([400,600])\n",
"plt.xlim([-1,5])\n",
"plt.xticks([0.125,0.85,3.125,3.85],[\"down\",\"up\",\"down\",\"up\"])\n",
"plt.tick_params(axis='both',labelsize=15)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020419e8>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEXCAYAAACu1P9TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAHv9JREFUeJzt3Xl8JVWZ8PFf7AaaHugFUGS1EWRXcHQcYV4hiIq8bA4qzeISdVheHJdXxQFkCa4sgqjoICjgNsMmLoDsEEABaVGQrbEHCA00sqaBXqBpyPzxnGvqVuom994kvZ3f9/PJJ7mnTlWdW7l56tRzTlVAkiRJkiRJkiRJkiRJkiRJkprWCzy4tBsxCnoZ+fuYBrwCnD3SxgyjK+3no2O8HzXpVUu7ASuwzYHvAncBzwIvAo8ClwAfB1Zeek1bIfUQwaWR/vS1LPga0dYTmqh7Rqr7mfR6NN/HSLfTSbTt2CG2vywdd2lMHAO8TPwx/A44FfgKcCZwXyqfsdRat2LqIY55Ixulr2XBNKKtc4DxQ9T7B+A5YAEwJZWNxvuYRnwGzxrhdjrTdo5psHwSsGn6Lq2QjiT+CHqBf2pQZxfg6iXVoEz0MHTAX9ZcQXxO/nWIOp9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NNj+NUQgOpsYlN2KmKY5t7TtmcRg4XuIHuQD6Xt5APBY4j+qnUWcqN5IpFvOYCBl0Uirg4nPEgH9GCKV00/M2JnLwAyjU4mZKZcQs5HWTXXK8+LLx7LKVcR7u4o4rvek/WxLnHyOHOJ93Ef8Ts4lBpJvI65QtiLGGw5sox3/RRzbPxM9/ncQ/yRpLtANfBt4HXAjcWLclBi033uY7Utain5K9Fi/Viqvujv0nUQ+fiFxOX8a9Y/f6EzbKs7S+RAx53sBcBMx0FmefbMREWjmUj8Pv1wPokf/F2J65GxiamBxYkIX1Y8FqdrWcDYmerzziNkxXyBOOk8U6uxIzMN/AfgTkVZp5k7bTgYfq5WJYDqLeH+PESfl4lz8od7HZ4C7UlueSPstztxpth0TiPsfavcDPEAc56IDiA7CAuLkfDPw2QbtkiRJkiRJkiRJkiRJkiRJkiRJkiRJkqQx9r+4IPaoHSoqGQAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f2202041dd8>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020419e8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# How many violations of angular momentum would be measured?\n",
"\n",
"# From running several simulations, it's evident a violation in the \n",
"# conservation of angular momentum would be measured half of the time.\n",
"# We can conclude that the information that the entangled particles are in\n",
"# orthogonal spin states is instantaneously agreed once a measurement\n",
"# is made.\n",
"\n",
"violations = 0\n",
"\n",
"for trial in range(0,1000):\n",
" elespin = np.random.randint(0,2)\n",
" posspin = np.random.randint(0,2)\n",
" if elespin == 0:\n",
" elespin = np.matrix('0 1')\n",
" else:\n",
" elespin = np.matrix('1 0')\n",
" if posspin == 0:\n",
" posspin = np.matrix('0 1')\n",
" else:\n",
" posspin = np.matrix('1 0')\n",
" \n",
" elespin.transpose()\n",
" posspin.transpose()\n",
" chi_squared = elespin*np.matrix('1; 0')*posspin*np.matrix('0; 1') - posspin*np.matrix('1; 0')*elespin*np.matrix('0; 1')\n",
" \n",
" if chi_squared == 0:\n",
" violations = violations + 1\n",
"\n",
"zeroes = np.zeros(violations,dtype=int)\n",
"ones = np.full((1000-violations),1,dtype=int)\n",
"result = np.concatenate((ones,zeroes))\n",
"\n",
"plt.ylim([400,600])\n",
"plt.xlim([-1,2])\n",
"plt.xticks([0.125,0.85],[\"violation\",\"adherence\"])\n",
"plt.tick_params(axis='both',labelsize=15)\n",
"plt.suptitle(\"Conservation Violations\",fontsize=20)\n",
"plt.hist([result],bins=4)\n",
"plt.figure()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020737f0>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAEXCAYAAACwHc/gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAGx1JREFUeJzt3XucXVV99/HPkHCLXAOIRYEgKCAIqGgNChxALBQordJIQSVeqdoKVbEFwYzPQy0V+1BFreCjRJ9iFajcpQKag9xELiKKEFEycgl3EkJIAEnm+eO3DrNnzz4z+8ycmclKPu/Xa15zzt7r7L3Onn2+e+211klAkiRJkiRJkiRJkiRJkiRJE2QlMK+D8o30mjkdvKY3vWafDl6jajOIY3lOafnctHybCa7PWPQBC8a4jRlUH49um532c8w472eNttZkV2CSrUw/w+mj/Qe9fxT7HM1rViWzmZgAGC/l499fsWwG4/8e/znt419rlD07lT0uPa+q82iNdTsNhm+g9NPd+qrCmh7kUO8EqyqzE/DeLtclJ6vLB/NEYGdgYWFZf+n3ePhG2v57gKnDlHsJcCTwLPDttGx/4IBxrNtotDtWFxLH96IJrMsaxyAfvd8CD0x2JTRmDxN/yxcKy3pKv8dDH3A18DLgsGHKHQlsAPw3sDgtW8DYu1a6rd2xWkIc3yUTWJc1jkE+eu36yLcEvgk8AiwDfsHILfc3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OJd8uPdxHPDrVJdH036LM1nq1mM9Yv5+az77vcRxLjqauPAvIy66NwLHt6mXJEmSJEmSJEmSJEmSJEmSJEmSJEmStBr6/953KDDWlBGMAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f2201ef4358>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020737f0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Bell's Experiment took this a step further, to rule out locality \n",
"# completely. Establish the detectors to \"float\" such that they \n",
"# measure the components of the spins of the electron and positron \n",
"# along a unit vector a or b, with angles phi_a and phi_b, \n",
"# respectively. Compute a product P of the spins in units of hbar/2. \n",
"# This will give +/-1. \n",
"\n",
"# / pi0 \\\n",
"# /e- <------ ------> e+\\\n",
"\n",
"# QM predicts P(a,b) = -a dot b, the expectation value of the product \n",
"# of the spins.\n",
"\n",
"# In 1964, Bell derived the Bell inequality for a local hidden variable\n",
"# theory: abs(P(a,b) - P(a,c)) <= 1 + P(b,c)\n",
"\n",
"# For any local hidden variable theory, the Bell inequality must hold. \n",
"# It introduces a third unit vector c, which is any other unit vector \n",
"# than a or b.\n",
"\n",
"# Does the quantum mechanical prediction violate the Bell inequality?\n",
"# Testing several detector configurations in a plane, systematically \n",
"# from 0 to pi, we determine whether the QM prediction is consistent \n",
"# with a local hidden variable theory.\n",
"\n",
"violations = 0\n",
"trials = 0\n",
"for step_a in range(0,6):\n",
" for step_b in range (0,6):\n",
" phi_a = step_a/6*np.pi\n",
" phi_b = step_b/6*np.pi\n",
" phi_c = phi_a - 0.5*phi_b\n",
" P_ab = -1 * np.cos(phi_a - phi_b)\n",
" P_ac = -1 * np.cos(phi_a - phi_c)\n",
" P_bc = -1 * np.cos(phi_b - phi_c)\n",
" \n",
" bell_lhs = np.abs(P_ab - P_ac)\n",
" bell_rhs = 1 + P_bc\n",
" \n",
" if bell_lhs > bell_rhs:\n",
" violations = violations + 1\n",
" \n",
" trials = trials + 1\n",
" \n",
"zeroes = np.zeros(violations,dtype=int)\n",
"ones = np.full((trials-violations),1,dtype=int)\n",
"result = np.concatenate((ones,zeroes))\n",
"\n",
"plt.ylim([trials/2-10,trials/2+10])\n",
"plt.xlim([-1,2])\n",
"plt.xticks([0.125,0.85],[\"violation\",\"adherence\"])\n",
"plt.tick_params(axis='both',labelsize=15)\n",
"plt.suptitle(\"Hidden Locality Violations\",fontsize=20)\n",
"plt.hist([result],bins=4)\n",
"plt.figure()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f220202b080>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAEXCAYAAACwHc/gAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAHBRJREFUeJzt3XmYHVWd//F3SMKSYV9EUQRG0CgIqAwjKEyzCQ4yOoIBQSQugOsPRkXZNImjyIjzQ0EZwFHijMyAIBAWUUBpZImAKIhIIgJhS9gTkpBAMOn543suXV1d1V23t+Qk79fz3Of2rfXcuvd+6tSpU9UgSZIkSZIkSZIkSZIkSZKkEbQMuL6N6TvSPJPamGdymmf3NuZRtS2JbXleafjUNPy1I1yewZgFPDjIZWxJ9fYYahPTeo4Y5vWsslZb3gVYASxLj77Mov6H3jWAdQ5knhXJREYmAIZLeft3VQzbkuF/j19P6/i3BtOem6Y9Jr2uKvNADXY5HfRdQeliaMurEoM8NPmCVU0zHvjwEJclJyvLD/ME4I3A7MKwrtLzcPh+Wv7hwJg+pvsb4BDgBeBHadiewF7DWLaBqNtWlxLb97IRLMsqxSAfnD8Djy7vQmjQHic+y78Who0qPQ+HWcB1wCuBA/qY7hBgbeCnwLw07EEG37Qy1Oq21Xxi+84fwbKsUgzywalrI98U+AHwBLAI+D3919zfBvwcWAA8B1wLvL2fecYT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qL9CNKl0ET1Y5tHd4+bbRE+NK4neOZulacr9usvbssq1xHu7ltiuf0rr2ZHYqZzYx/uYSXwmFxAnYO8gjii2JdrzjxxAOf6H2La/J2rouxH/WGYeMBn4DrAFcCOxw3s9cbL7/f0sX9Iw+G+ihvn10vCqqxH3JNq7FxOH1d+l5y0aOtKyir1WPkT0WV4E3EKcICz3RtmKCJB59OxHXp4Oogb+B6Ib4MNEF7jiyfqJVN86ompZ/XkdUUNdSPQW+QKxM3myMM0/EP3IXwB+RzRvNLmys4Pe22p1IiTvI97fHGJnW+xL3tf7OAb4YyrLk2m9xZ4sTcuxJtF/v9Wf/QFiOxcdRuz4FxE73enAsTXlkiRJkiRJkiRJkiRJkiRJkiRJkiRJklYy/weVV3rGmFwA0QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f22020bdb38>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<matplotlib.figure.Figure at 0x7f220202b080>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# It is seen that the QM prediction disagrees with a local hidden \n",
"# variable theory in a significant number of configurations.\n",
"\n",
"# On average, for random orientations between 0 and pi, how often? \n",
"# After running several trials, it appears to be about half of the, \n",
"# which is what one would expect from the quantum mechanical\n",
"# prediction.\n",
"\n",
"violations = 0\n",
"trials = 0\n",
"for rand_a in range(0,10):\n",
" for rand_b in range (0,10):\n",
" phi_a = np.random.rand(1)*np.pi\n",
" phi_b = np.random.rand(1)*np.pi\n",
" phi_c = phi_a - 0.5*phi_b\n",
" P_ab = -1 * np.cos(phi_a - phi_b)\n",
" P_ac = -1 * np.cos(phi_a - phi_c)\n",
" P_bc = -1 * np.cos(phi_b - phi_c)\n",
" \n",
" bell_lhs = np.abs(P_ab - P_ac)\n",
" bell_rhs = 1 + P_bc\n",
" \n",
" if bell_lhs > bell_rhs:\n",
" violations = violations + 1\n",
" \n",
" trials = trials + 1\n",
"\n",
"zeroes = np.zeros(violations,dtype=int)\n",
"ones = np.full((trials-violations),1,dtype=int)\n",
"result = np.concatenate((ones,zeroes))\n",
"\n",
"plt.ylim([trials/2-10,trials/2+10])\n",
"plt.xlim([-1,2])\n",
"plt.xticks([0.125,0.85],[\"violation\",\"adherence\"])\n",
"plt.tick_params(axis='both',labelsize=15)\n",
"plt.suptitle(\"Hidden Locality Violations\",fontsize=20)\n",
"plt.hist([result],bins=4)\n",
"plt.figure()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# The prediction (Bell's inequality) made by assuming a local hidden\n",
"# variable is violated by a significant number of the possibile \n",
"# bborientations. This simulation cannot determine which theory is\n",
"# correct, but the QM prediction has been confirmed through experiment.\n",
"# No hidden local variable holds actionable information about the \n",
"# state. Entangled states retain their entanglement in a non-local \n",
"# nature."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}