Home | Publications | Research Summary | Teaching | Journals | Collaborators |

## Computational Physics—PHYS 7411

The use of computers in understanding physics has experienced tremendous growth over many years now, and it is an essential component in new physics discoveries. This course introduces solving physics problems with computers. We do not assume any previous programming experience and will use the popular programming language Python in order to focus on the content of computational physics programs and to make use of powerful numerical libraries that come packaged with Python. Students will develop their own computer programs to solve problems in a variety of areas of physics. The textbook for the course is Computational Physics, M. Newman (Createspace Independent Publishing, 2012, ISBN 1480145513).

Course SyllabusCourse hours: MW 8:00am-9:20am in 262 Nicholson Hall

Office hours: M 9:30-11:30am or by appointment in 447 Nicholson Hall

### Homeworks

Homework 5, due by 3pm Mon. 13 April 2015

Homework 4, due by 3pm Mon. 30 March 2015, Files: pitch.txt, blur.txt

Homework 3, due by 3pm Fri. 13 March 2015

Homework 2, due by class Mon. 23 February 2015, Files: sunspots.txt, millikan.txt

Homework 1, due by class Wed. 4 February 2015

### Lectures

- Gauss-Seidel method
- initial value problems
- forward time centered space (FTCS) method
- numerical stability analysis

- boundary value problems
- shooting method
- partial differential equations
- method of finite differences

- leap frog method and energy conservation
- Verlet method
- modified midpoint method
- Bulirsch-Stoer method

- solving simultaneous ordinary differential equations
- adaptive step size Runge-Kutta
- leap frog method

- fast Fourier transform
- solving ordinary differential equations
- Euler method
- Runge-Kutta method

- Fourier series and transforms
- discrete Fourier transform
- 2D discrete Fourier transform
- discrete cosine transform

- continuing with semidefinite programming
- primal and dual
- weak duality
- examples
- strong duality (Slater conditions)
- Reading material: notes of John Watrous

- secant method and rate of convergence
- Newton's method for multiple variables
- finding optima - golden ratio search
- Gauss-Newton method
- introduction to semidefinite programming

- solving nonlinear equations
- relaxation method (fixed-point iteration) and rate of convergence
- Newton's method and rate of convergence

- LU decomposition
- calculating matrix inverses, solving banded matrices
- computing eigenvalues and eigenvectors
- QR decomposition and QR algorithm

- higher order derivatives
- interpolation
- solving linear systems of equations with Gaussian elimination

- choosing an integration method
- computing integrals for infinite ranges
- multiple integrals
- numerical derivatives and errors

- higher-order integration methods
- Gaussian quadrature

- adaptive integration
- Romberg integration

- 3D plotting in Python with visual package
- integral approximation and error
- Files: 0-sphere.py, 1-spheres.py, 2-more-spheres.py, 3-revolve.py, 4-trapezoidal.png, 4-trapezoidal.py, 5-simpson.png, 5-simpson.py

- more plotting in Python - wave interference and Mandelbrot set
- numerical accuracy and speed
- Files: 1-ripples.py, Mandelbrot set, 2-factorial-function.py, 3-error.py, 4-qsho.py, 5-matrix-multiply.py

- for loops, range
- plotting
- Files: 1-simple-for.py, 2-range-for.py, 3-sum-for.py, 4-sum-file.py, 5-emission-lines.py, 6-factorial-function.py, 7-cylindrical.py, 8-user-map.py, 9-prime-factors.py, 10-simple-plot.py, 11-simple-x-y-plot.py, 12-plot-sin.py, 13-plot-from-file.py, 14-plot-calculate.py, 15-plot-styles.py, 16-scatter.py, 17-density.py, 18-gray-density.py, circular.txt, stars.txt, values-1.txt, values.txt

- manipulating lists and arrays
- intro to for loops
- Files: 1-list-sqrt.py, 2-list-avg.py, 3-log-map.py, 4-create-array.py, 5-load-array.py, 6-arith-array.py, 7-mult-array.py, 8-matrix-mult-array.py, 9-array-size-shape.py, 10-means-arith-geo.py, 11-alt-geo-mean.py, 12-slicing.py, 13-simple-for.py, 14-range-for.py, values.txt

- arithmetic, python modifiers, multiple assignment
- importing packages such as math, log, exp, etc.
- built-in functions, comments
- controlling program flow with if, while, break
- Files: 1-dropped.py, 2-polar.py, 3-if-statement.py, 4-if-else-statement.py, 5-if-elif-else-statement.py, 6-while.py, 7-while-break.py, 8-evenodd.py, 9-fibonacci.py

### Python Resources

- Official Python web site
- SciPy stack - numerical libraries for scientific computing
- VPython - visualization tools

*Last modified: April 12, 2015.*