L 1
L 1
Autumn 2017
http://sam-dolan.staff.shef.ac.uk/mas212/
Course website:
http://sam-dolan.staff.shef.ac.uk/mas212
Pre-requisite: MAS115.
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.
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.
Syllabus (from 2016)
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 Jupyter 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.
Syllabus (from 2016)
I recommend:
“Learning Scientific Programming with Python”,
Christian Hill (Cambridge University Press, 2015).
ISBN 978-1-107-42822-5.
http://en.wikipedia.org/wiki/IPython
It has several advantages over the standard interpreter:
Tab completion
Object introspection and enhanced help
%magic commands
Jupyter Notebook
http://jupyter.org/notebook.html
Jupyter Notebook is . . .
. . . a web-based interactive computational environment where
you can combine code execution, text, mathematics, plots and
rich media into a single document.
Installing Jupyter Notebook
On your computer:
The simplest way is to get Jupyter Notebook is to install the Anaconda
distribution of Python 3:
http://continuum.io/downloads
Choose Python 3.6 version.
This comes with the most popular libraries for scientific computing.