## Autumn Quarter 2005

Class meets MWF 10:30-11:20 in Hinds 561.

### Announcements

I have posted an updated Problem Set 4 solution, with more detail on the answers to the simpler parts of Problem 1 (but that in info. is in the "Prob2...." answer sheet.

Our last class will be this Friday at 10:30. I'm planning to give out the exam at 10:30 Monday morning, due noon the following Wednesday. Please drop by class Friday to find out details about getting the exam. If anybody wants to do the exam over the weekend instead, that's also fine with me.

Problem set 4 and 5 answers have been posted.

I have posted a sample script on integration of 1D and 2D ordinary differential equations. It is based on Wednesday's lecture.

Problem set 6 has been posted. Read the above sample script first.

Problem Set 3 answers have been posted (Broken link fixed). Problem set 5 has been posted.

I have posted an updated version of the Python introduction, which has an improved discussion of overloading non-commutative operations, and of when you need to use,e.g. __rmul__ instead of __mul__. That information will be useful for those of you wanting to do a really complete implementation of polynomial arithmetic (Problem Set 4).

I have updated the function orbitDiagram to allow the user to specify the interval within which periodic orbits will be looked for. For example, orbitDiagram(f,1.,2.,[0.,math.pi]) will look for periodic orbits in the interval [0,pi]. Previously, the interval was hard-wired to be [0.,1.]. Thanks to Chris Seagle for the suggestion.

I have started a Python Resources page, with detailed instructions about saving and converting graphics files, moving files from one computer to another, and so forth. See the link under "Frequently Asked Questions" below.

### Course Description

This course provides an introduction to mathematical and computational techniques, including programming implementations, needed to analyze the kind of systems commonly arising in the physical sciences. There will be a particular emphasis on examples drawn from geosciences. No prior programming experience is required; the course will begin with a self-contained introduction to object-oriented programming with the Python programming language. Other topics to be covered include: Discrete dynamical systems and the onset of chaos; Numerical evaluation of definite integrals; Steepest descent and other asymptotic methods for definite integrals; Introduction to differential equations; First order linear and nonlinear differential equations; existence and uniqueness issues; Second order linear differential equations; Numerical solution of ordinary differential equations; Nonlinear planar O.D.E. and limit cycles; Forced nonlinear oscillators and chaos (Numerical explorations); The Lorentz attractor. Introduction to data analysis-- reading and writing netCDF data files.

The computer exercises in this course are built around the Python programming language, but there will be a limited introduction to Matlab as well, and Matlab variants of selected exercises will be offered.

The first three lectures of the course, covering elementary Python programming, will be optional for students who took Geosci 232 in Spring 2005, since it duplicates material covered there. GEOS2100, or an equivalent introduction to Python, will be considered a prerequisite to Geosci232 for Winter Quarter 2006, since programming methods will no longer be taught as part of 232.

Instructor: Raymond T. Pierrehumbert (r t p 1 @ g e o s c i.u c h i c a g o.e d u))

• My own introduction to Python is here.(Updated 11/10/2005)
• The entire Dive into Python book is available online here. It has a good discussion of how to install and run Python on your own computer. It is also a good general reference on the Python language.
• The online version of Numerical Recipes in c is here. We will be using parts of Chapter 4 (integration) and Chapter 16 (Numerical solution of ordinary differential equations). This book is written for the c language rather than Python, but the description of the algorithms is language-independent
• A few other general Python resources are collected here.
• The introductory material on differential equations is covered in Norman Lebovitz's textbook, a draft of which can be found online here. See especially Chapters 1 and 2. This book is a bit like an updated and improved version of Birkhoff and Rota's textbook, which I also like. Birkhoff and Rota is the text used in the U. of Chicago Math Dept. differential equation course, (but regrettably, hardly anywhere else). There are several copies of Birkhoff and Rota in the Math Dept. library (Eckhart).

• Sample scripts used in class are found here:
• The TA for the course is Jonathan Mitchell, (email m i t c h @ o d d j o b . uchicago.edu)

• Check the Python Resources page for instructions on common tasks
• idle gives me funny error messages when I try to start it. What do these mean?
• How do I get the sample scripts from my web browser into my idle editor window?

## Problem sets:

#### Syllabus

(based on 1-hour lectures)

All topics covered will make use of Python for implemenation of algorithms and for exploratory work. There will also be some limited introduction to use of Matlab.

Lecture/Topic

1-2 Basic Python programming. Variables, operations, lists, loops, functions, conditionals. Use of IDLE. Importing modules

3-4 Advanced Python topics. Objects and their uses. Init method. Arguments to the creator. Callable objects Overloading operations (elementary examples). Defining indexing methods for objects.

5-7 One dimensional discrete dynamical systems. (also use of Curve() and plot(...) utilities)

8 Newton's method, analyzed as a discrete dynamical system

9-10 Numerical evaluation of definite integrals (Trapezoidal rule;Romberg extrap.)

11 Arrays in Python: The Numeric module

12 What is an O.D.E. First order ODE. Examples.

13-15 First order ODE solution methods. Separation of variables. General solution to linear problem. Finite time blow-up. Equilibria, stability, and attractor basins. Existence and uniqueness.

16-17 Second order linear O.D.E. General results, non-constant coeffs. Wronskians. Greens functions for inhomogeneous problem. Solution basis for constant coefficient case. Generalization to higher order

18-19 Numerical solution of ODE initial value problem. Formal derivation of Euler and midpoint method. Convergence and stabiity. Schematic derivation of Runge-Kutta. Implementation in Python

20-21 Nonlinear planar autonomous O.D.E. Stability of fixed points. Limit cycles Numerical explorations.

22 Forced nonlinear oscillators and chaos. Poincare sections. Numerical exploration

23 Autonomous chaotic systems. The Lorentz attractor

24-25 Introduction to Matlab

26-28 netCDF files in Python and Matlab. Data analysis (based on 3-D atmospheric data set)

29-30 (Held open to allow for previous lectures going overtime)

Extra topics to try to fit in: (1) Asymptotic methods for definite integrals. Asymptotic series (integration by parts). Steepest descent. (2) Fourier transforms. Formulation. Numerical evaluation; use of FFT in 1D. (3) Root finding. Bisection. Newton's method.