# MAS212 Scientific Computing and Simulation (2015/16)

## Lecturer: Dr Sam Dolan

This is the course web page for MAS212 (Scientific Computing and Simulation) which will be updated as the module progresses in Semester 1, 2015. For official course information, including timetabling, please consult the list of current modules.

## Course Information

MAS212 is a 10-credit, Level 2, first-semester module which covers various techniques in scientific computing, and their implementation in Python. The course is intended to follow on from MAS115 Mathematical Investigation Skills

## Software and setup

We will be using the Anaconda distribution of Python (version 3.4), which includes IPython Notebook and Spyder. To install and configure on a Managed Desktop machine, please follow this link: For installation in other contexts, please follow the link below:

## Online Resources

A range of interesting written material is available on the web, including:

## Notebooks

In this course we will use IPython notebooks to combine code, text, plots and media. To view a notebook, click on the link on the left. (Alternatively, copy-and-paste the notebook's URL in to the box at nbviewer.ipython.org).

To interact and modify the notebook, right-click on the link on the right (.ipynb) and download to your ipython notebook directory.

TitleDescriptionnotebook
Curve_Fit_Example Shows how to (a) generate a data set with simulated noise; (b) save and then re-load the data; (c) fit the data to a simple model using scipy.optimize.curve_fit(). .ipynb
ODE_Example Shows how to (a) solve a first-order single-variable ODE using scipy.integrate.odeint, and plot; (b) solve a second-order equation by writing as a pair of first-order equations; (c) solve predator-prey equations. .ipynb
Media_Example Shows how to load and interact with various media: data, images, web pages, YouTube videos and maps. .ipynb
Fern The Barnsley Fern: an image of a fern with self-similar (fractal) properties, generated by iterating certain affine transformations. .ipynb

## Lectures and Lab Classes

(Draft / subject to revision)
Week Lectures Computer labs
1 Lab Class 1: Getting started
2 Lecture 2: standard library + numpy.
Class test (2015)
(HTML version)
3 Lecture 3: matplotlib.
Lab Class 3: Plotting
4 Lecture 4: ODEs and scipy.integrate.
Lab Class 4: Solving ODEs numerically
5 Lecture 5: Animations with matplotlib.animate.FuncAnimation.
Lab Class 5: Animations Codes 1,4,5 by J Vanderplas
6 Lecture 6: Numerical methods for ODEs.
Lab Class 6: Numerical methods for ODEs: (a) explicit methods
7 Lecture 7: Explicit and implicit methods.
Lab Class 7: The LCR circuit
8 Lecture 8: Curve fitting.
Lab Class 8: Fitting Data
9 Lecture 9: Conditioning.
Lab Class 9: Ill-conditioned problems.
poly_example.py
10 Lecture 10: Discrete Fourier Transforms.
Lab Class 10: The DFT and hidden signals.

## Class Tests

A short video here shows how to take the test on the managed desktop machines.

(2015) Class Test with answers .ipynb
.html
Marker's notes
--
(2014) Class Test .ipynb
.html
--
(2014) Class Test with answers .ipynb
.html
--
(Mock) Class Test .ipynb
.html
--
(Mock) Class Test with answers .ipynb
.html
--

To attempt a test, right click on ".ipynb" link, save the file in your notebooks directory, and then open the notebook. To view a test, left click on the ".html" link. Completed tests will be submitted here.

## Assignments

(Draft / subject to revision)
# Title Summary Due Feedback
1 Wordsearch Use Python to find hidden words in the rows, columns or diagonals of a grid of letters. Mon 19th Oct (23:59pm). Example code
Feedback points
2 The van der Pol oscillator Investigating the behaviour of a non-linear second order differential equation Mon 23rd Nov (23:59pm) Report (.pdf)
Source (.tex)
Code (.ipynb)
3 Numerical methods for ODEs Investigating accuracy, stability and stiffness. Fri 4th Dec (23:59pm)
4 Video Project Key documents: Other:
Mon 14th Dec (Video)
Fri 18th Dec (Report)