Python
- Python is a standard, interpreted computer language which can be downloaded and run on your PC. For this course, version 3.7 of Python available from Anaconda is recommended: https://www.anaconda.com/distribution/. The Anaconda distribution will automatically install all of the libraries necessary for mathematical operations (sin, cosh, definite integrals, etc.) as well as libraries for plotting graphs.
- The use of a Jupyter notebook for each assignement is recommended. These can be viewed and edited in your web brower and this system is also provided in the Anaconda distribution above. (For example, the Anaconda Navagator has a link which starts up a Jupyter notebook manager.)
- Once you have Python and Jupyter installed on your laptop, you can try out the example files listed below by
- Going to the Jupyter window in your browser which lists Jupyter notebooks to open.
- Clicking on the "upload" button on the right-hand side.
- Copying the web address given in the links below (or the pdf problem assignment)
- Uploading and opening the notebook
- References which may be useful include:
Jupyter notebooks for problem sets
- Schrodinger.ipynb is a Jupyter notebook which gives a simple example of a numerical solution to the free Schrodinger equation. It uses the simplest integration scheme in which the values of \psi(x_n) and d(\psi)/dx(x_n) are used to obtain the values at the next position, x_(n+1). This example includes a function V(x) for the potential, but V(x) is the trivial function '0'. This file also implements a second, leapfrog integration method that can be used if line 17 is commented out (preceded with a # character) and the # is removed from line 18. For the leapfrog integrator one views the values of d(\psi(x_n))/dx as corresponding to points in space lying between those for \psi(x_n) and \psi(x_(n+1)). If d(\psi)/dx(x_n) is used to obtain the value of psi(x_(n+1)) from psi(x_n), then psi(x_n+1) and V(x_(n+1)) are used to obtain the value of d(psi(x_(n+1)) from d(\psi)/dx(x_n), then this small change reduces the errors from order [x_(n+1)-x_n] to order [x_(n+1)-x_n]^2 as can be dramatically seen if you change the step size Dx to a large value, e.g. 0.5. This example should help you setup the solution to problem 21 in problem set #6
- WKB.ipynb is a Jupyter notebook containing the WKB solution of a wave passing over a barrier. This is more complex than the Schrodinger solution example using functions, entering the program in a series of Jupyter cells and using the quad scipy integration routine. This is intended to serve as a starting point for problem 30 in problem set #9.
- larmor.ipynb is a Jupyter notebook which evaluates the rotation of the spin of a spin-1/2 particle in a constant magnetic field. If you download this file and open it as a Jupyter notebook it will create a graph of the time dependence of the three components of the particle's spin. It uses various array handling routines in numpy to work with the spin-1/2 state as a two-component vector and the rotation operator as a 2x2 complex matrix. The syntax is somewhat laborious and may seem like overkill for a two-dimensional problem. However, it would not be difficult to change the example to work with a much larger spin. This is intended to serve as a starting point for problem that will be assigned later.