BSc Physics with Astrophysics

Year of entry: 2024

Course unit details:
Computational Physics

Course unit fact file
Unit code PHYS20762
Credit rating 10
Unit level Level 2
Teaching period(s) Semester 2
Available as a free choice unit? No


Computational Physics


Unit title Unit code Requirement type Description
Introduction to Programming for Physicists PHYS20161 Pre-Requisite Compulsory


To give an introduction to the techniques of computational physics and dynamic high-level scripting programming languages.

Learning outcomes

On completion successful students will be able to:
1. Write programs using dynamic high-level scripting programming languages and carry out data analysis in them.
2. Use classical numerical methods (Euler and higher order) to find solutions of ordinary differential equations.
3. Use Monte Carlo techniques and associated statistical methods.
4. Use numerical solutions to analyse the behaviour of a physical system (such as a driven oscillator).


1. Use of high-level scripting language for data analysis.
a) Definitions of variables and arrays; scalar and array operations; built in and user-defined functions;
b) Working with data sets: file input / output. Data visualization and plotting;
c) Revision of error analysis: X2 analysis, errors on fitting coefficients, propagation of errors;
Project 1 is formative, but will not directly contribute to your final mark.
2. Numerical methods and the solution of ordinary differential equations
a) Introduction to numerical computing; errors in numerical methods.
b) Numerical methods for solving ordinary differential equations; Euler’s method; higher order methods, symplectic methods;
c) Implementation of numerical methods.
d) The linear driven damped oscillator; phase space; conserved quantities; sources of simulation error.
Project 2 will constitute 50% of the final mark.
3. The Monte Carlo method and its applications.
a) Introduction to Monte Carlo methods; Monte Carlo integration; classical problems;
b) Pseudorandom sampling; methods of generating samples with given probability density;
c) Applications of Monte Carlo methods;
d) Statistical errors.
Project 3
Will constitute 50% of the final mark.

Assessment methods

You will carry out 3 short projects (as an individual, not in a pair or group). You must PASS projects 1 (receive more than 40%) to be allowed to submit projects 2 and 3. The final two projects contribute 50% each to the final mark, respectively. 

Feedback methods

Feedback will be given orally by demonstrators during lab sessions and additional written feedback  will be provided with the mark for each project. 

Recommended reading

Learning Scientific Programming with Python

Hill, Christian 2015

Titus, A.B. Introduction to Numerical Programming: A Practical Guide for Scientists and Engineers
Garcia, A.L. Numerical Methods for Physics (Prentice Hall 1994)

Study hours

Scheduled activity hours
Practical classes & workshops 36
Independent study hours
Independent study 64

Teaching staff

Staff member Role
Saeed Bahramy Unit coordinator
Draga Pihler-Puzovic Unit coordinator

Additional notes

All material for the unit, such as videos, example scripts and notes, is available online via Blackboard.

* Tutorial = online classes

Return to course details