{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "

A Quantum Bead on a Circle

\n", "\n", "A bead represented as the wave packet\n", "$$\n", " \\psi(\\phi,0) = e^{-ik_0\\phi} e^{-8*(\\phi-\\pi)^2}\n", "$$\n", "slides frictionlessly on circle. \n", "With $\\phi$ as the only spatial coordinate, and with periodic boundary conditions, the time-dependent Schrodinger equation becomes\n", "$$\n", "\\frac{1}{b^2} \\frac{\\partial^2\\psi}{\\partial\\phi^2} = i \\frac{\\partial \\psi}{\\partial t}.\n", "$$\n", "Here the wave function is complex $\\psi(\\phi,t) = R(\\phi,t) + i I(\\phi,t)$." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "deletable": true, "editable": true, "scrolled": true }, "outputs": [], "source": [ "\"\" \"From COMPUTATIONAL PHYSICS\" & \"COMPUTER PROBLEMS in PHYSICS\",\n", " \" by RH Landau, MJ Paez, and CC Bordeianu (deceased).\n", " \" Copyright R Landau, Oregon State Unv, MJ Paez, Univ Antioquia,\n", " \" C Bordeianu, Univ Bucharest, 2020.\n", " \" Please respect copyright & acknowledge our work. \"\"\n", "\n", "# QMbeadOnCircle.ipynb: a quantum bead slides on a frictionless circle\n", "\n", "%matplotlib notebook\n", "\n", "from numpy import *\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import matplotlib.animation as animation\n", "\n", "dt = 0.0005 \n", "k0 = 0.1 # wave packet wave vector\n", "xmax = 2*pi # maximum phi value 2pi\n", "b = 4 # radius of circle\n", "b2 = b**2.\n", "nmax = 201 # for arrays\n", "dx = 2*pi/(nmax-1)\n", "dx2 = dx*dx\n", "fc = dt/dx2/b2 # factor\n", "R = np.zeros((nmax,2), float) # Real part wave function\n", "I = np.zeros((nmax,2), float) # Imaginary part wave function\n", "xx = np.arange(0,xmax+dx,dx) # values for the x axis\n", "\n", "def initial(): # Gaussian wave packet \n", " R[ : ,0] = exp(-8*(xx-pi)**2) * cos(k0*xx) # Re I\n", " I[ : ,0] = exp(-8*(xx-pi)**2) * sin(k0*xx) # Im I \n", " \n", "initial()\n", "fig = plt.figure() \n", "ax = fig.add_subplot(111, autoscale_on = False,xlim = (0,2*pi),ylim = (0,1.5))\n", "ax.grid() \n", "plt.title(\"Bead on circle with periodic boundary conds.: $\\psi(0,t) = \\psi(2\\pi,t)$\")\n", "plt.xlabel(\"angle $0\\leq \\phi\\leq 2\\pi $\")\n", "plt.ylabel(\"$\\psi^2 = R^2+I^2$\")\n", "line, = ax.plot(xx, R[ :,0]**2+ I[ :,0]**2) # plot first lin\n", "\n", "def animate(dum): # this is the animation\n", " xx = arange(0,xmax+dx,dx)\n", " for i in range (1,nmax-1): R[i+1,1] = R[i,0] -fc*(I[i+1,0]+I[i-1,0]-2*I[i,0]) \n", " for i in range (1,nmax-1): I[i+1,1] = I[i,0] + fc*(R[i+1,1]+ R[i-1,1]-2*R[i,1])\n", " R[0,1] = R[200,0] -fc*(I[0,0]+I[199,0]-2*I[200,0]) # for boundary Cond \n", " R[1,1] = R[0,0] -fc*(I[1,0]+I[200,0]-2*I[0,0]) \n", " I[0,1] = I[200,0] + fc*(R[0,1]+ R[199,1]-2*R[200,1]) # for boundary cond \n", " line.set_data(xx,R[ : ,-1]**2+I[ : ,-1]**2) #plot new line \n", " for i in range (0,nmax): # new R is now old R\n", " R[i,0] = R[i,1]\n", " I[i,0] = I[i,1]\n", " '''\n", " R[200,1] = R[0,0] # for periodic boundary conditions\n", " I[200,1] = I[0,0]\n", " R[0,1] = R[200,0]\n", " I[0,1] = I[200,0] \n", " '''\n", " return line,\n", "ani = animation.FuncAnimation(fig, animate) # call the animation \n", "plt.show() " ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }