Syllabus: MTH 271, Winter 2016

Mathematical Computing (using Python)

Instructor: Jay Gopalakrishnan
Times: Tue, Thu: 14:00-15:50
Venue: NH96 computer lab
Office hours: NH309, Tue 16:00-17:00

Course Objective

This course aims to teach scientific programming using examples from mathematical computing. Analysis of errors in computation, stability of algorithms, and basics of numerical and symbolic computations are among the topics covered.

Context for this Python-based offering

Mathematical scientists are increasingly favoring the python programming language for its abundant free open-source modules and for its expressive clean syntax.

Note that the course catalog entry mentions that this course will be taught using Matlab. MTH 271 has traditionally been taught using Matlab. However, in this experimental section of MTH 271, we learn scientific programming using python. We will not use Matlab. (Students wanting to learn Matlab should register for another section of this course offered later.)

Textbook

A Primer on Scientific Programming with Python by Hans Petter Langtangen, Fourth Edition, 2014.

Access to this textbook is required for this course. Students may use the copies of the book in library reserves or purchase a personal copy from the university bookstore or elsewhere. However, not that the course will not follow the textbook verbatim. The significant deviations from the text will be highlighted as we proceed with the course. The student should regard the textbook as one of the many learning resources for this course. For many students, this is the first sophomoric course which does not follow a textbook closely. Hence, to emphasize, it is important to follow the class activities closely rather than the textbook.

Prerequisites

In addition to the official prerequisite courses MTH 253 and MTH 261, students are required to have a personal laptop or other computing environment(s) where they are able to install new software as needed (which typically requires administrator privileges). All software we use in this course is freely available without any need for purchase, thanks to community-developed open source codes.

The lab will provide a computer for each student. But this shared resource is usually not appropriate for saving intermediate work and maintaining the continuity of learning. Students are therefore expected to bring their laptop to class.

This course is not designed for students who are already experienced python programmers. Students who have programming experience in other languages, but want to learn python, are welcome. Students who have never programmed before are certainly welcome.

Topical outline

Programming constructs in Python 3 are introduced when needed for a scientific task. Each topical unit has a mathematical or scientific concept (marked Science below), and a set of python language features (marked Python).

Science Trajectory of a ball derived from Newton's laws
Python introduction to ipython, importing modules sympy, math, difference between symbolic and numerical implementations, roundoff errors
Science Summing a series
Python loops, list comprehension, test functions, pytest
Science Numerical differentiation
Python def functions, scope, nested functions
Science Download atmospheric CO\(_2\) data from NOAA and visualize
Python file input and output, urllib, matplotlib
Science Numerical integration
Python designing tests, strings to commands, sys, exec, eval
Science Numerical root finding
Python creating modules, exception handling, lambda functions
Science Vectorization and modern architectures
Python numpy, timeit, array structures, integer and boolean indexing
Science Orthogonalizing a sequence of vectors and numerical stability
Python introduction to numpy.linalg, built-in dense matrix facilties
Science Echelon forms of matrices, solvability of linear systems
Python slicing, tuple swap, names and bindings, deep copy
Science Matrix factorizations
Python introduction to scipy.linalg, recursion and its cost in python
Science The DNA of yeast: download DNA, analyze, nucleotide frequencies
Python strings, dictionaries (hash maps)
Science Numerical interpolation
Python creating and evaluating polynomials, animations using matplotlib
Science Uncertainty quantification
Python classes, overloading, magic methods, interval arithmetic
Science Solving ordinary differential equations
Python abstraction in programming, base and derived classes

Further topics may be added depending on the time remaining, the motivation of the students, and the interests of the class.

Learning methods

Unlike traditional mathematics courses, every class session in this course is a hands-on workshop. The instructor will design a collection of activities for each class. Students are expected to familiarize themsleves with the appropriate book chapter before coming to class. Teaching technique is example-based, with specific scientific questions leading to programming tasks. Class time is used largely for algorithmically understanding a scientific task and the python constructs required to implement it on the computer.

Resources

Students should read the initial resources page and download a virtual machine as instructed there. As we proceed with this course, all further materials will be posted on the D2L page for this course. Students are required to login to the course D2L page and ensure that all emails sent to their D2L account are receivable.

Evaluation of learning

Grades are determined by quizzes. Please see the evaluation page for details on quiz dates, expectations on work submitted, code documentation, etc. This is a completely paperless course (code printouts are not acceptable submissions). All work must be turned in electronically in the appropriate D2L folders.

Author: Jay Gopalakrishnan

Last updated: 2016-02-29 Mon 08:01