Advanced Topics in Physics II — Computational Physics
Phys 750 — Fall 2017 
Department of Physics & Astronomy 
Instructor  Dr. Kevin Beach 
Office:  206 Lewis Hall 
Email:  kbeach@olemiss.edu 
Website:  https://www.phy.olemiss.edu/~kbeach 
More details provided in the syllabus.
Introduction
This course will emphasize standard opensource tools available under GNU/Linux. Linux is a popular (and free) variant of the Unix operating system that is widely used in the scientific community. Students will be expected to achieve basic proficiency with the BASH shell, make, gnuplot, and the GNU Compiler Collection (GCC). The language of instruction will be C++, a superset of C that includes objectoriented features and libraries for generic programming. Despite these choices, much of the material we’ll cover will be language and platformagnostic.
Students will be expected to compose exercise and assignment codes in C++. It should be straightforward for students to pick up the small portion of the language we will be using, especially if they are already familiar with C or Fortran 95. There will be some language instruction during the lectures. Nonetheless, students will be primarily responsible for picking up C++ on their own.
NonLinux Programming Environments
MacOS
MacOS is based on BSD Unix. The BASH shell is already included (via the Terminal.app
), and it’s possible to install any standard Unix tools that are missing.

First install the command line developer tools from Xcode:
xcodeselect install

If you want LaTeX, browse to the MacTeX web page and download the MacTeX2017 (
MacTeX.pkg
) installer. Launch/Applications/TeX/TeXShop.app
and/Applications/TeX/LaTeXiT.app
and check for updates. 
Install Homebrew, which is a UNIX package manager for MacOS. First add
export PATH="/usr/local/bin:$PATH"
to~/.bash_profile
, then quit and reopen theTerminal.app
. If necessary, clean up any old installation withrm rf /usr/local/Cellar /usr/local/.git && brew cleanup
If the directories don’t exist, create them and change permissions from group wheel to group admin:
sudo makedir /usr/local sudo makedir /usr/local/lib sudo chown R :admin /usr/local sudo chown R :admin /usr/local/lib
Browse to brew.sh and follow the installation instructions there; it currently asks for
/usr/bin/ruby e "$(curl fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Make sure everything is uptodate:
brew update brew doctor brew upgrade

I recommend installing nonApple Ruby and git:
brew install ruby brew install git

For gnuplot, you need either AquaTerm or XQuartz. For AquaTerm, browse to its SourceForce page, download
AquaTerm1.1.1.dmg
and run installer. For XQuartz, browse to its macosforge page, downloadXQuartz2.7.9.dmg
, and run installer. QuitTerminall.app
and relaunch. Finally, to get gnuplot, executebrew install cairo latex pdf tests withaquaterm withx11 gnuplot
Windows
Students can also do the course work under Windows 10, provided that they install the Windows Subsystem for Linux. These instructions explain how to get an Ubuntuflavoured BASH shell along with the standard toolchain, including gcc, make, and gnuplot. The X Windows sytem is required, however, for rendering graphics. Here’s a tutorial for setting up Xming. Thanks to Kevin Lin for finding these links.
Learning Resourses
To get started with C++ (or simply to refresh your memory), check out these online tutorials; you may also find this more comprehensive language reference to be useful.
Project Euler has many interesting numerical problems that you should be able to solve with a short C++ program. These are great practice problems.
I also recommend this quick introduction to UNIX and its command line tools.
Book list
There is no required textbook for this course, but many of the lecture topics are covered in greater detail elsewhere, and you may be interested in browsing through some of the following:

Computational Physics, T. Pang, 2nd Ed., Cambridge University Press (2010) ISBN10:0521532760

Introductory Computational Physics, A. Klein and A. Godunov, Cambridge University Press (2006) ISBN10:0521828627

Practical Guide to Computer Simulations, A. K. Hartmann, World Scientific (2009) ISBN10:981283415X

An Introduction to Computer Simulation Methods: Applications to Physical Systems, H. Gould and J. Tobochnik, 2nd Ed. (TrueBasic), AddisonWesley (1995) ISBN10:0201506041; 3rd Ed. (Java), AddisonWesley (2006) ISBN10:0805377581

Computational Physics, N. J. Giordano and H. Nakanishi, Pearson Prentice Hall (2006) ISBN10:0131469908

Computational Physics: Fortran Version, S. E. Koonin and D. Meredith, Westview Press (1998) ISBN10:0201386232

Computational Physics, J. M. Thijssen, Cambridge University Press (1999) ISBN10:0521575885
And here are some good books related to scientific computation more generally:

A First Course in Numerical Analysis, A. Ralston and P. Rabinowitz, 2nd Ed., Dover Publications (2001) ISBN10:048641454X

Numerical Recipes: The Art of Scientic Computing, W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, 3rd Ed., Cambridge University Press (2007) ISBN10:0521880688

Mathematics and Physics for Programmers, D. Kodicek, Cengage Learning (2005) ISBN10:1584503300

Introduction to Algorithms, T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, 3rd Ed., The MIT Press (2009) ISBN10:0262033844
Lectures
 Computational physics; the C++ programming language — pdf
 Discretization — pdf
 Cellular automata — pdf
 Selforganized criticality — pdf
 Floatingpoint numbers — pdf
 Integration, differentiation, and root finding — pdf
 Ordinary differential equations — pdf
 Boundaryvalue problems — pdf
 Chaos — pdf
 Nbody simulations — pdf
 Strongly typed, compiled languages; objectoriented and generic programming; C++ class definitions
 Multiple time scales, holonomic constraints — pdf
 Wave motion and spectral methods — pdf
 Quantum mechanics; matrices — pdf (slides) : pdf (handout)
 Schrödinger equation in higher dimensions, manybody quantum problems, matrix mechanics, power method, variational principle — pdf
 Random processes and probability distributions — pdf (slides) : tgz (demo)
 Random walks — pdf
 Ising model — pdf
Exercises
 Columnar data; Lissajous figures; Mandelbrot set — pdf (instructions) : tgz (source) : tgz (solutions)
 Curve fitting in gnuplot; simple combinatorics; selection rules; angular momentum summation — pdf (instructions) : tgz (source) : tgz (solutions)
 John Conway’s Game of Life; the Hardy, Pomeau and de Pazzis (HPP) model — pdf (instructions) : tgz (source) : tgz (solutions)
 Kinetic growth model; Deposition Diffusion and Aggregation (DDA) model — pdf (instructions) : tgz (source)
 Quadrature; integration and time evolution — pdf (instructions) : tgz (source) : tgz (solutions)
 Kepler’s equations, root finding via NewtonRaphson — pdf (instructions) : tgz (source) : tgz (solutions)
 Laplace and Poisson equations, relaxation methods — pdf (instructions) : tgz (source) : tgz (solutions)
 Lorentz attractor, chaos — pdf (instructions) : tgz (source)
 Monotomic and diatomic LennardJones gas — pdf (instructions) : tgz (source)
 Wave equation, stability of finitedifference methods for PDEs — pdf (instructions) : tgz (source)
 C++ streams, convergence of series expansions, numerical estimates of π — pdf (instructions) : tgz (source) : tgz (solutions)
 Linear algebra with C arrays — pdf (instructions) : tgz (source) : tgz (solutions)
 Matrix mechanics with LAPACK — pdf (instructions) : tgz (source) : tgz (solutions)
 Random number generation — pdf (instructions) : tgz (source)
 Enumeration of selfavoiding walks — pdf (instructions) : tgz (source) : tgz (solutions)
 Optimal packing of granular material — pdf (instructions) : tgz (source)
 Percolation — pdf (instructions) : tgz (source) : tgz (solutions)
 Monte Carlo simulation of the Ising model — pdf (instructions) : tgz (source) : tgz (solutions)
Assignments
 Lattice gas automata: due Tuesday, September 19 — pdf (instructions) : tgz (source)
 Gravitational Nbody simulations: due Tuesday, October 10 — pdf (instructions) : tgz (source)
 Dynamics of a quantum wave packet: due Tuesday, November 14 — pdf (instructions) : tgz (source)
Exam
 Takehome final examination : due Thursday, December 7 — tgz (instructions + source)