Course outline

Feedback

Please fill out the feedback form before 12th March.

These are the materials for the Part II Physics course Computational Physics, taught in Lent Term 2023 at the University of Cambridge.

1 Schedule

The course of eight Lectures will take place at 10.00 on Mondays and Fridays in the Pippard Lecture Theatre. After the lectures there will be four computing exercises to be completed in the last four weeks of full Lent term; one per week. The exercises count for 0.2 units or further work, or roughly 2% of your final mark for the year. Thus each exercise should only take you a few hours.

The schedule is as follows

  • First lecture: Monday 23th January
  • Last lecture: Friday 17th February
  • First exercise: Friday 17th February – Friday 24th February
  • Second exercise: Friday 24th February – Friday 3rd March
  • Third exercise: Friday 3rd March – Friday 10th March
  • Fourth exercise: Friday 10th March – Friday 17th March (last day of full Lent term)

1.1 Computing Project

Additionally, you may choose to offer a Computational Physics project for one unit of further work. This involves choosing a problem from the project list. You will analyse the problem, write and test Python code to investigate it, then write up your work in a report. 

Students may start their project work once the project list is published by 17th February. The deadline for submission of the project report is 16:00 on the first Monday of Full Easter term (1st May 2023).

2 Prerequisites

This course assumes a basic knowledge of the Python language, including variables, control flow, and writing and using functions, at the level of last year’s IB course (which had an excellent handout).

If you want an absolute bare bones intro to Python try the first half of this tutorial (which then goes on to introduce NumPy).

3 Learning outcomes

In this course you will learn

  1. About the Python scientific stack (based on the NumPy library)
  2. Its use in implementing some common algorithms in computational physics.
  3. Basic ideas of computational complexity used in the analysis of algorithms

4 Outline

Here’s a list of topics that I’d like to cover. We make not have time for all of them.

  1. Setup. Running Python. Notebooks. Language overview
  2. NumPy and friends
  3. Floating point and all that
  4. Soving differential equations with SciPy
  5. Monte Carlo methods
  6. Introduction to algorithms and complexity
  7. The fast Fourier transform
  8. Automatic differentiation
  9. Linear algebra with NumPy

4.1 These notes…

…were prepared using Quarto. Each chapter should be thought of as a Jupyter notebook (actually, they are Jupyter notebooks), so you’ll probably only see import numpy as np once in each chapter, for example.

The code used to generate this site is in this GitHub repo. Please use issues to submit any typos and discussions to discuss the content.

In several places I’ve used examples from an earlier version of the course by David Buscher.