PHYM004 
Computational Physics and Modelling 
202021 

Dr C.D.H. Williams 


Delivery Weeks: 
T1:0111, T2:0109


Level: 
7 (NQF) 

Credits: 
15 NICATS / 7.5 ECTS 

Enrolment: 
19 students (approx) 

Description
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:

Module Specific Skills and Knowledge:
 construct and evaluate mathematical and numerical models of common physical systems and processes;
 write and document wellstructured scientific computer code of good quality;
 write scientific code that can import and export data in a range of formats, e.g.
suitable for visualisation by thirdparty applications;
 use mathematics to obtain a computational advantage in the evaluation of solutions;
 critically evaluate the success or otherwise of numerical approaches to solving problems;
 use profiling tools to identify performance bottlenecks;

Discipline Specific Skills and Knowledge:
 use computational methods to model physical systems;
 identify problems that are amenable to computer solution and investigation;

Personal and Key Transferable / Employment Skills and Knowledge:
 undertake cooperative learning by discussing the contents of the module amongst themselves;
 write clear and concise descriptions of complicated processes;
 balance workload and work independently in order to meet deadlines.
Syllabus Plan
Thread 1: Programming for Physicists

The Programmer's Toolkit
 Languages: Imperative, functional, constraint; high and low level
 Divide and conquer: using pipes and scripting as glue
 Useful software libraries for science

Simple Data Types
 Characters
 Integers: unsigned and signed
 Floating Point Numbers
 Pointers: names and values

Functions, Procedures and Objects
 Variables and scope

Memory
 The stack; the heap; allocators; reference counting; garbage collection
 Hierarchy: registers, processor cache, random access memory (RAM), disk

Data structures
 Arrays, character strings, linked lists, queues, stacks, trees, hash tables

Input and output
 Command Line Interface (CLI) vs Graphical User Interface (GUI)
 Exchange formats for data: plain text, binary, FITS, XML
 Graphics and visualisation: Gnuplot, POVRay, etc.

Algorithms
 Classification, BigO notation
 Discrete Fourier transform (DFT), fast Fourier transform (FFT)
 Quicksort vs Mergesort
 Fused multiply add (FMA), Kahan summation

High performance code
 Code profiling and manual optimisation
 Optimisations performed by compilers
 Code examples that run (a) quickly, (b) slowly

Parallel Programming

Program Design and Maintenance
 Anticipated usage and user community
 Version control, documentation, release strategy, ethics, licences
 Code quality: assert statements, compiler warnings, static analysis, crash reports,
bug tracking, test driven development, code reviews
 Single processor vs multiprocessor
Thread 2: Numerical Methods with Physical Applications

Numerical Errors
 Error Propagation: rounding errors; forwards error analysis; backwards error analysis;
 The IEEE754 standard: precision, exceptions, rounding

Interpolation, Differentiation and Integration
Lagrange polylominals, Runge's phenomenon; Gaussian quadrature, NewtonCotes forumulae,
Richardson extrapolation; Romberg's method

Solution of Nonlinear Equations
Bisection methods, Secant Method, Newton's method, Brent's method, coincident roots and deflation

Matrix Algebra
Simple matrix problems; sparse matrices; systems of equations and matrix inversion;
error propation; direct vs indirect methods; matrix eigenvalue problems

Ordinary Differential Equations
 Reduction of orderN equation to a set of N order1 coupled ODEs
 Methods: forward Euler, backwards Euler, trapezoidal, higherorder methods
 Consistency, zerostability, convergence, Astability
 Stepsize control, stiff equations
 Classical 1, 2, 3, and Nbody problems

Boundary Value Problems
 Types of boundary condition: Dirichlet, Neumann, mixed
 Methods: shooting, multiple shooting, finite difference, finite element
 Poisson's equation

Partial Differential Equations
 The diffusion equation
 The wave equation
 Particle in cell methods

Monte Carlo Methods and Simulation
 Random number generation
 Speed and quality of pseudo random number generators
 Uniform distribution
 Arbitrary distributions: inversion method, acceptancerejection method
 Gaussian distributions: BoxMuller method
 Subrandom sequences
 Error estimates
 Variance reduction
 Percolation
 Magnetic systems

Function Minimisation and Maximisation
 LevenbergMarquardt method
 NelderMead (Simplex) method
 Constraints
 Genetic algorithms
 Simulated annealing
 Curve fitting

Case Study  Spice 3f5
Advanced Topics (If Time Permits)

The Quantum OneBody Problem

The Quantum NBody Problem
 Quantum Chemistry Methods
 Exact Methods

Molecular Dynamics

Electronic Structure
 Variational methods
 HartreeFock theory
 Density functional theory

Polymers and Neurons

Quantum Monte Carlo Methods
 Systems of Fermions
 BoseEinstein Condensation
 Diffusion Monte Carlo
 Quantum Field Theory
Learning and Teaching
Learning Activities and Teaching Methods
Description 
Study time 
KIS type 
22×1hour lectures 
22 hours

SLT 
5×4hour selfstudy packages 
20 hours

GIS 
Reading, private study and revision 
12 hours

GIS 
Programming / Debugging Exercise 
15 hours

GIS 
Project 1 
25 hours

GIS 
Numerical programming 'takehome' exam 
6 hours

GIS 
Project 2 
50 hours

GIS 
Assessment
Weight 
Form 
Size 
When 
ILOS assessed 
Feedback 
0% 
Guided selfstudy 
5×4hour packages 
Fortnightly 
15,8,9,11 
Discussion in class 
15% 
Programming / Debugging Exercise 
15 hours 
Deadline Week T1:06 (Friday) 
25,10,11 
Written and class discussion. 
25% 
Project 1 
25 hours work 
Deadline week T1:12 (Friday) 
111 
Written and verbal 
10% 
Numerical programming 'takehome' exam 
6 hours work 
Deadline week T2:02 (Friday) 
15 
Written and class discussion. 
50% 
Project 2 
50 hours work 
Deadline week T2:09 (Friday) 
111 
Written and verbal 
Resources
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:

Atkinson K.E. (1989), An Introduction to Numerical Analysis (2^{nd} edition), John Wiley, ISBN 9780471500230 (UL: 519.4 ATK)

DeVries P.L. and Hasbun J.E. (2010), A First Course in Computational Physics, Jones and Bartlett (UL: 530 DEV )

Giordano N.J. and Nakanishi H. (2006), Computational Physics (2^{nd} edition), Pearson, ISBN 9780131469907 (UL: 530.158 GIO)

Press W.H., Teukolsky S.A., Wetterling W.T. and Flannery B.P. (2007), Numerical Recipes (3^{rd} edition), Cambridge University Press, ISBN 9780521880688 (UL: 518.0285 PRE/X)

Thijssen J. (2007), Computational Physics (2^{nd} edition), Cambridge, ISBN 9780521833462 (UL: 530 THI)
ELE:
Further Information
Prior Knowledge Requirements
Prerequisite Modules 
Stage 1 'IT Skills', Mathematics with Physical Applications (PHY2025) and Scientific Programming in C (PHY2027) 
Corequisite Modules 
N/A 
Reassessment
Reassessment is not available except when required by referral or deferral.
Original form of assessment 
Form of reassessment 
ILOs reassessed 
Time scale for reassessment 
Whole module 
Project 3 (100%) 
111 
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 
90% 
Written exams 
0% 
Practical exams 
10% 
Total 
100% 

Miscellaneous
IoP Accreditation Checklist 
 N/A this is an optional module

Availability 
MPhys only 
Distance learning 
NO 
Keywords 
Physics; Computational physics; Computer programming; Numerical analysis; Simulation; Monte Carlo methods. 
Created 
01Sep13 
Revised 
28Jun19 