Skip to main content

PX150 Physics Programming Workshop

Lecturer: Michal Kreps and Richard West

Weighting: 6 CATS

This module introduces the Python programming language. It is quick to learn and encourages good programming style. Python is an interpreted language, which makes it flexible and easy to share. It allows easy interfacing with modules, which have been compiled from C or Fortran sources. It is widely used throughout physics and there are many downloadable free-to-user codes available. The module also looks at visualisation of data.

Aim

To introduce scientific programming with the help of the Python programming language, a language widely used by physicists.

Objectives:

At the end of the module you should

  • Be able to write python programs
  • Be able to formulate and solve simple maths and physics problems involving differential equations, linear algebra and integration, using python
  • Be able to use scientific and graphical libraries
  • Have an understanding of good software design
  • Be able to present your results graphically.

Syllabus:

A brief introduction to python. Simple maths and physics on the computer. Data/File Input/Output and control in Python. Loops, conditions and lists. Analysis of simple physics data;
Arrays and computer graphics. Plotting curves and working with vectors and matrices. Functions: Algorithms and software design; tests, error handling and modules;
Random numbers and computer simulations; Maths on the computer; Differential equations, integration, linear algebra

Commitment: 5 Lectures + 5 2-hour workshops

Assessment:
Practical assignments

This module has a home page.

Recommended Text:
Python documentation
Scientific Python
H.P. Langtangen, A Primer on scientific programming with Python, Springer e-books (2012):

Leads to: Programming work in later years