## MAS212 Scientific Computing and Simulation

Note: Information for future academic years is provisional. Timetable information and teaching staff are especially likely to change, but other details may also be altered, some courses may not run at all, and other courses may be added.

 Semester 1, 2022/23 10 Credits Lecturer: Dr Sam Dolan Timetable Reading List Aims Outcomes Assessment Full Syllabus

The module further develops the studentsâ€™ skills in computer programming and independent investigation. The students will learn how to solve algebraic and differential equations using Python. The students will learn basic numerical methods, and methods to visualize and analyse numerical results. The students will apply the knowledge to explore the physical behaviours of model equations.

Prerequisites: MAS115 (Mathematical Investigation Skills)
Corequisites: MAS211 (Advanced Calculus and Linear Algebra); MAS222 (Differential Equations)

The following modules have this module as a prerequisite:

 MAS316 Mathematical modelling of natural systems MAS414 Mathematical Modelling of Natural Systems

## Aims

• To further develop the studentsâ€™ programming skill in the context of scientific computing;
• To further develop the studentsâ€™ independent investigation skills;
• To introduce the knowledge of scientific computing;
• To further develop the skills of data analysis.

## Learning outcomes

• To be able to use Python to investigate mathematical problems numerically.
• To learn basic numerical methods for solving ordinary differential equations and linear algebraic equations.
• To be able to implement basic numerical methods using Python.
• To be able to analyse the basic properties of the methods.

10 lectures, no tutorials, 10 practicals

## Assessment

2021/22: Three assessed assignments (25%+35%+30%). Two online tests (5% each).

## Full syllabus

The module in 2020/21 is being reconfigured for online delivery, and so the syllabus may differ slightly from previous years. The provisional weekly schedule in 2020/21 is:

1. Python essentials [revision and core language features]
2. Working with arrays [numpy, vectorization, broadcasting, and efficiency]
3. Presenting data [matplotlib for plots and figures]
4. Data analysis and statistics [using pandas]
5. Solving ordinary differential equations [using scipy.integrate.solve-ivp]
6. Numerical methods for ODEs [implicit and explicit methods]
7. Models and curve-fitting [linear regression; linear models; non-linear models]
8. Linear systems and stability [Gauss-Jordan elimination; Wilson's polynomial]
9. Partial differential equations [the heat equation and the Crank-Nicholson method]
10. Animations [with the matplotlib.animation module]
The syllabus in 2019/20 was:
• Week 1: The Python language. Revision: variables; data types; arithmetic; list construction, comprehension, indexing, slicing & manipulation; for & while loops; control flow (if-elif-else; strings; string formatting.
Introduction to IPython Notebook: Tab completion, getting help and %magic commands (e.g. %timeit).
• Week 2: Functions. Modules & scripts. Built-in modules (math, cmath, random, decimal, datetime, io, os). Simple file I/O and string processing. Debugging and testing. Workflow.
• Week 3: Introduction to numpy. Arrays (initialization, slicing). Basic linear algebra. Efficiency.
Introduction to matplotlib. Simple plotting.
Examples: (1) Estimating π by Monte Carlo integration; (2) the logistic map.
• Week 4: Introduction to scipy. Solving differential equations with odeint. Initial conditions. Time-domain plots. Phase plots. Critical points and limit cycles.
Examples: (1) Logistic equation; (2) Damped harmonic oscillator; (3) van der Pol oscillator; (4) Predator-prey equations.
• Week 5: Animation with matplotlib.animation.FuncAnimation. Saving an animation. Examples: (1) The logistic map (again); (2) Driven damped oscillator and resonance.
• Week 6: Elementary numerical methods: Runge-Kutta and Adams-Bashforth methods. Implementation for initial value problems.
• Week 7: Error, order and stability of numerical methods.
• Week 8: Fitting models to data. scipy.optimize.curve_fit. Least-squares method and linear algebra.
• Week 9: Linear algebra. Gaussian elimination; iterative methods; convergence; condition number.
• Week 10: Fourier series. Convergence and the Gibbs phenomenon.