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 open-source 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 object-oriented features and libraries for generic programming. Despite these choices, much of the material we’ll cover will be language- and platform-agnostic.

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.

Non-Linux 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:

    xcode-select --install
    
  • If you want LaTeX, browse to the MacTeX web page and download the MacTeX-2017 (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 re-open the Terminal.app. If necessary, clean up any old installation with

    rm -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 up-to-date:

    brew update
    brew doctor
    brew upgrade
    
  • I recommend installing non-Apple 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 AquaTerm-1.1.1.dmg and run installer. For XQuartz, browse to its macosforge page, download XQuartz-2.7.9.dmg, and run installer. Quit Terminall.app and relaunch. Finally, to get gnuplot, execute

    brew install --cairo --latex --pdf --tests --with-aquaterm --with-x11 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 Ubuntu-flavoured 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) ISBN-10:0521532760

  • Introductory Computational Physics, A. Klein and A. Godunov, Cambridge University Press (2006) ISBN-10:0521828627

  • Practical Guide to Computer Simulations, A. K. Hartmann, World Scientific (2009) ISBN-10:981283415X

  • An Introduction to Computer Simulation Methods: Applications to Physical Systems, H. Gould and J. Tobochnik, 2nd Ed. (TrueBasic), Addison-Wesley (1995) ISBN-10:0201506041; 3rd Ed. (Java), Addison-Wesley (2006) ISBN-10:0805377581

  • Computational Physics, N. J. Giordano and H. Nakanishi, Pearson Prentice Hall (2006) ISBN-10:0131469908

  • Computational Physics: Fortran Version, S. E. Koonin and D. Meredith, Westview Press (1998) ISBN-10:0201386232

  • Computational Physics, J. M. Thijssen, Cambridge University Press (1999) ISBN-10: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) ISBN-10: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) ISBN-10:0521880688

  • Mathematics and Physics for Programmers, D. Kodicek, Cengage Learning (2005) ISBN-10:1584503300

  • Introduction to Algorithms, T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, 3rd Ed., The MIT Press (2009) ISBN-10:0262033844

Lectures

  1. Computational physics; the C++ programming language — pdf
  2. Discretization — pdf
  3. Cellular automata — pdf
  4. Self-organized criticality — pdf
  5. Floating-point numbers — pdf
  6. Integration, differentiation, and root finding — pdf
  7. Ordinary differential equations — pdf
  8. Boundary-value problems — pdf
  9. Chaos — pdf
  10. N-body simulations — pdf
  11. Strongly typed, compiled languages; object-oriented and generic programming; C++ class definitions
  12. Multiple time scales, holonomic constraints — pdf
  13. Wave motion and spectral methods — pdf
  14. Quantum mechanics; matrices — pdf (slides) : pdf (handout)
  15. Schrödinger equation in higher dimensions, many-body quantum problems, matrix mechanics, power method, variational principle — pdf
  16. Random processes and probability distributions — pdf (slides) : tgz (demo)
  17. Random walks — pdf
  18. Ising model — pdf

Exercises

  1. Columnar data; Lissajous figures; Mandelbrot set — pdf (instructions) : tgz (source) : tgz (solutions)
  2. Curve fitting in gnuplot; simple combinatorics; selection rules; angular momentum summation — pdf (instructions) : tgz (source) : tgz (solutions)
  3. John Conway’s Game of Life; the Hardy, Pomeau and de Pazzis (HPP) model — pdf (instructions) : tgz (source) : tgz (solutions)
  4. Kinetic growth model; Deposition Diffusion and Aggregation (DDA) model — pdf (instructions) : tgz (source)
  5. Quadrature; integration and time evolution — pdf (instructions) : tgz (source) : tgz (solutions)
  6. Kepler’s equations, root finding via Newton-Raphson — pdf (instructions) : tgz (source) : tgz (solutions)
  7. Laplace and Poisson equations, relaxation methods — pdf (instructions) : tgz (source) : tgz (solutions)
  8. Lorentz attractor, chaos — pdf (instructions) : tgz (source)
  9. Monotomic and diatomic Lennard-Jones gas — pdf (instructions) : tgz (source)
  10. Wave equation, stability of finite-difference methods for PDEs — pdf (instructions) : tgz (source)
  11. C++ streams, convergence of series expansions, numerical estimates of π — pdf (instructions) : tgz (source) : tgz (solutions)
  12. Linear algebra with C arrays — pdf (instructions) : tgz (source) : tgz (solutions)
  13. Matrix mechanics with LAPACK — pdf (instructions) : tgz (source) : tgz (solutions)
  14. Random number generation — pdf (instructions) : tgz (source)
  15. Enumeration of self-avoiding walks — pdf (instructions) : tgz (source) : tgz (solutions)
  16. Optimal packing of granular material — pdf (instructions) : tgz (source)
  17. Percolation — pdf (instructions) : tgz (source) : tgz (solutions)
  18. Monte Carlo simulation of the Ising model — pdf (instructions) : tgz (source) : tgz (solutions)

Assignments

  1. Lattice gas automata: due Tuesday, September 19 — pdf (instructions) : tgz (source)
  2. Gravitational N-body simulations: due Tuesday, October 10 — pdf (instructions) : tgz (source)
  3. Dynamics of a quantum wave packet: due Tuesday, November 14 — pdf (instructions) : tgz (source)

Exam

  • Take-home final examination : due Thursday, December 7 — tgz (instructions + source)