PHYM004 Computational Physics and Modelling 2017-18
Dr C.D.H. Williams
Delivery Weeks: T1:01-11
Level: 7 (NQF)
Credits: 15 NICATS / 7.5 ECTS
Enrolment: 20 students (approx)


This continuously assessed module is delivered as two threads running in parallel. The first develops students' skills in scientific computer programming. The second explores how mathematical descriptions of physical systems can be evaluated and investigated numerically.

The lectures will use language and examples that assume a working knowledge of C (e.g. as provided by PHY2027 Scientific Programming in C) and Octave (e.g. as provided by PHY1028 IT and Electronics Skills).

Module Aims

Computational physics is a subdiscipline lying between expeimental and theoretical physics. Scientists use its techniques to investigate systems that are inaccessible to experiment and/or intractable using the standard methods of theoretical techniques. Students taking this module will develop both their programming skills and their knowledge of a range of computer algorithms of relevance to the simulation and modelling of physical systems.

Other fields have adopted the methodologies discussed in this module. Many computer games, for example, use 'physics engines' make their virtual world behave in a realistic manner. The finance industry employs computational physicists to model the financial markets and the global economy using analagous techniques.

Intended Learning Outcomes (ILOs)

A student who has passed this module should be able to:

Syllabus Plan

Thread 1: Programming for Physicists

  1. The Programmer's Toolkit
    1. Languages: Imperative, functional, constraint; high and low level
    2. Divide and conquer: using pipes and scripting as glue
    3. Useful software libraries for science
  2. Simple Data Types
    1. Characters
    2. Integers: unsigned and signed
    3. Floating Point Numbers
    4. Pointers: names and values
  3. Functions, Procedures and Objects
    1. Variables and scope
  4. Memory
    1. The stack; the heap; allocators; reference counting; garbage collection
    2. Hierarchy: registers, processor cache, random access memory (RAM), disk
  5. Data structures
    1. Arrays, character strings, linked lists, queues, stacks, trees, hash tables
  6. Input and output
    1. Command Line Interface (CLI) vs Graphical User Interface (GUI)
    2. Exchange formats for data: plain text, binary, FITS, XML
    3. Graphics and visualisation: Gnuplot, POV-Ray, etc.
  7. Algorithms
    1. Classification, Big-O notation
    2. Discrete Fourier transform (DFT), fast Fourier transform (FFT)
    3. Quicksort vs Mergesort
    4. Fused multiply add (FMA), Kahan summation
  8. High performance code
    1. Code profiling and manual optimisation
    2. Optimisations performed by compilers
    3. Code examples that run (a) quickly, (b) slowly
  9. Parallel Programming
  10. Program Design and Maintenance
    1. Anticipated usage and user community
    2. Version control, documentation, release strategy, ethics, licences
    3. Code quality: assert statements, compiler warnings, static analysis, crash reports, bug tracking, test driven development, code reviews
    4. Single processor vs multi-processor

Thread 2: Numerical Methods with Physical Applications

  1. Numerical Errors
    1. Error Propagation: rounding errors; forwards error analysis; backwards error analysis;
    2. The IEEE-754 standard: precision, exceptions, rounding
  2. Interpolation, Differentiation and Integration
    Lagrange polylominals, Runge's phenomenon; Gaussian quadrature, Newton-Cotes forumulae, Richardson extrapolation; Romberg's method
  3. Solution of Nonlinear Equations
    Bisection methods, Secant Method, Newton's method, Brent's method, coincident roots and deflation
  4. Matrix Algebra
    Simple matrix problems; sparse matrices; systems of equations and matrix inversion; error propation; direct vs indirect methods; matrix eigenvalue problems
  5. Ordinary Differential Equations
    1. Reduction of order-N equation to a set of N order-1 coupled ODEs
    2. Methods: forward Euler, backwards Euler, trapezoidal, higher-order methods
    3. Consistency, zero-stability, convergence, A-stability
    4. Step-size control, stiff equations
    5. Classical 1-, 2-, 3-, and N-body problems
  6. Boundary Value Problems
    1. Types of boundary condition: Dirichlet, Neumann, mixed
    2. Methods: shooting, multiple shooting, finite difference, finite element
    3. Poisson's equation
  7. Partial Differential Equations
    1. The diffusion equation
    2. The wave equation
    3. Particle in cell methods
  8. Monte Carlo Methods and Simulation
    1. Random number generation
      1. Speed and quality of pseudo random number generators
      2. Uniform distribution
      3. Arbitrary distributions: inversion method, acceptance-rejection method
      4. Gaussian distributions: Box-Muller method
      5. Sub-random sequences
    2. Error estimates
    3. Variance reduction
    4. Percolation
    5. Magnetic systems
  9. Function Minimisation and Maximisation
    1. Levenberg-Marquardt method
    2. Nelder-Mead (Simplex) method
    3. Constraints
    4. Genetic algorithms
    5. Simulated annealing
    6. Curve fitting
  10. Case Study - Spice 3f5

Advanced Topics (If Time Permits)

  1. The Quantum One-Body Problem
  2. The Quantum N-Body Problem
    1. Quantum Chemistry Methods
    2. Exact Methods
  3. Molecular Dynamics
  4. Electronic Structure
    1. Variational methods
    2. Hartree-Fock theory
    3. Density functional theory
  5. Polymers and Neurons
  6. Quantum Monte Carlo Methods
    1. Systems of Fermions
    2. Bose-Einstein Condensation
    3. Diffusion Monte Carlo
  7. Quantum Field Theory

Learning and Teaching

Learning Activities and Teaching Methods

Description Study time KIS type
22×1-hour lectures 22 hours SLT
5×6-hour self-study packages 30 hours GIS
4×7.5-hour problem sets 30 hours GIS
Project 1 15 hours GIS
Project 2 30 hours GIS
Reading, private study and revision 23 hours GIS


Weight Form Size When ILOS assessed Feedback
0% Guided self-study 5×6-hour packages Fortnightly 1-11 Discussion in class
40% 4 × Problems sets 7.5 hours per set Deadline2 Weeks T1:03, T1:06, T1:11, X001 1-11 Written and solutions discussed in problems classes.
20% Project 1 15 hours work Deadline week T1:09, (Monday) 1-11 Written and verbal
40% Project 2 30 hours work Deadline week T2:02 1-11 Written and verbal


The following list is offered as an indication of the type & level of information that students are expected to consult. Further guidance will be provided by the Module Instructor(s).

Core text:

Supplementary texts:


Further Information

Prior Knowledge Requirements

Pre-requisite Modules Stage 1 'IT Skills', Mathematics with Physical Applications (PHY2025) and Scientific Programming in C (PHY2027)
Co-requisite Modules N/A


Re-assessment is not available except when required by referral or deferral.

Original form of assessment Form of re-assessment ILOs re-assessed Time scale for re-assessment
Whole module Project 3 (100%) 1-11 August/September assessment period

Notes: See Physics Assessment Conventions.

KIS Data Summary

Learning activities and teaching methods
SLT - scheduled learning & teaching activities 22 hrs
GIS - guided independent study 128 hrs
PLS - placement/study abroad 0 hrs
Total 150 hrs
Summative assessment
Coursework 100%
Written exams 0%
Practical exams 0%
Total 100%


IoP Accreditation Checklist
  • N/A this is an optional module
Availability MPhys and PGRS only
Distance learning NO
Keywords Physics; Computational physics; Computer programming; Numerical analysis; Simulation; Monte Carlo methods.
Created 01-Sep-13
Revised 28-Sep-13