BSc Physics with Theoretical Physics

Year of entry: 2022

Course unit details:
Introduction to Programming for Physicists

Course unit fact file
Unit code PHYS20161
Credit rating 10
Unit level Level 2
Teaching period(s) Semester 1
Offered by Department of Physics & Astronomy
Available as a free choice unit? No


Introduction to Programming for Physicists


The aim of the course is to give a practical introduction to computer programming for physicists assuming little or no previous programming experience.

Learning outcomes

‘This course unit detail provides the framework for delivery in 21/22 and may be subject to change due to any additional Covid-19 impact.  Please see Blackboard / course unit related emails for any further updates.’

On completion successful students will:

  1. Be able to write programs in Python to aid them in practical situations they will face in their degree course and future work in physics or in other fields.
  2. Implement basic programming theory to write efficient code.



Elements of Programming – (3 weeks)

  1. Introduction to Phython
  2. Variable types and lists
  3. Operators
  4. Input / output
  5. Conditional expressions
  6. Loops
  7. Introduction to debugging, testing and errors
  8. Functions


Basic Python libraries and validation – (2 weeks)

  1. Python Modules
  2. Introduction to math and numpy
  3. Numpy arrays, built-in functions and indexing


Introduction to algorithms and visualisation – (3 weeks)

  1. Algorithms and their uses
  2. Basic manipulation and visualisation of data
  3. Read and write files
  4. Data validation
  5. Root finding
  6. Basic optimization algorithms


Introduction to scientific programming libraries – (3 weeks)

  1. Advanced uses of numpy and matplotlib
  2. Introduction to scipy
  3. Using inbuilt functions


Assessment methods

Weekly programming tasks continually assessed in the laboratory sessions by demonstrators and a final task assessed by the lecturer.

Feedback methods

Feedback is offered orally by demonstrators in the lab, automated responses in the quizzes, and specific written comments for each assignment.

Recommended reading

Hill, C. Learning scientific programming with python (Cambridge Uni. press)

Study hours

Scheduled activity hours
Lectures 10
Practical classes & workshops 33
Independent study hours
Independent study 57

Teaching staff

Staff member Role
Clive Dickinson Unit coordinator
Lloyd Cawthorne Unit coordinator

Additional notes

Note: Laboratory facilities are not available for resits.  A student who has failed may be permitted to submit further assessments, based on laboratory work already carried out, in order to pass the course unit.

Return to course details