Winter 2014

Time: | Tuesday and Thursday, 10-11:30am |

Room: | 1250 USB |

Instructor: | Mark Newman |

Office: | 322 West Hall |

Office hours: | Mondays 1:30-3:30pm |

Email: | mejn@umich.edu |

**Quick links:**

The use of computers in physics has grown enormously over the last half century, to the point where they play a central role in virtually every new physics discovery. From particle physics and astrophysics to quantum computing and biophysics, calculations on computers have become an indispensable tool of scientists today.

This course gives an introduction to the solution of physics problems using computers. Assuming no previous computer programming experience, the course will introduce the basic ideas and programming skills of computational physics and students will develop their own computer software to solve problems in quantum mechanics, atomic physics, astrophysics, condensed matter, nonlinear dynamics and chaos, biophysics, and other areas.

Calculus, linear algebra, and physics up to 390 will be required to understand the material. No previous programming experience is required. The course will make use of the Python programming language, and will begin with an introduction to programming in Python.

The course will require you to do a fair amount of programming work on your own time. One of the advantages of the Python programming language is that it is available for free, which means that if you have a computer you can download a copy of Python and work on your own computer. You can find instructions for installing Python in Appendix A of the textbook or on the web here. Most people should install version 3 of Python, which is the most recent version, but you can also use version 2 if you wish. (Some Mac users, particular those with older Macs, have reported that version 2 works better with their computers.) If you use version 2, then for compatibility you need to include the following line at the start of each program you write:

from __future__ import division,print_functionNote that there are

`future`

and another two after it. For further details about
Python versions, see Appendix B in the textbook, or look here.
If you have difficulty installing Python on your computer, technical support is available from the physics Computing Support office on the second floor of Randall Lab.

If you do not own your own computer or you do but you prefer not to use it,
computers are also available in the Physics Department's Physics Authorized
Users Lab (PAUL) on the second floor of Randall Lab (vertically above the
Physics Help Room, which is on the first floor, and next to the Computing
and Technology Support office). Both Windows and Mac computers are
available in PAUL, but *only the PCs* have the Python programming
language installed, so you should choose a PC if you're going to work
there. PAUL also provides printers that you can use to print out material
to be handed in. Even if you use your own computer for doing homework you
can still use the PAUL printers for printing it.

There will be weekly graded **problem sets** consisting mainly of
programming challenges. Classroom time will be spent primarily on learning
the principles and techniques behind computational physics methods; the
homeworks are your chance to put those principles into action. A typical
exercise will describe a physics problem that can be solved using a method
studied in class and ask you to write a program to solve it and present
your results.

**Collaboration is allowed** when doing exercises, but you must write
your own programs and turn in your own work. Direct copying from others is
not allowed. You may use example programs from the textbook as a starting
point for your work, but copying from any other source, including books or
the Internet, is not allowed.

There will be four **take-home midterms** during the semester, which
will consist of programming challenges similar to those on the homeworks.
The exams differ from the homeworks in that **collaboration is not
allowed**. All exam problems must be solved without consulting others or
copying from any source, except again that you may use programs from the
textbook as a starting point. The dates of the midterms are listed on the
schedule below. There will be no other homework in the weeks when there
are midterms. There will be **no final exam** for this course.

The **course grade** will be 40% on the homeworks and 15% on each of the
midterms.

There will be **reading assignments** for each lecture. The assignments
are listed on the schedule below. Students are expected to do the reading
for each lecture in a timely manner.

The textbook for the course is *Computational Physics*, M. Newman
(Createspace Independent Publishing, 2012, ISBN 1480145513). You want the
"revised and expanded" edition (with the red cover). It's available at the
campus bookstore or you can buy it from
Amazon.

I know of no other textbooks on computational physics using Python, but there are several good books that make use of other languages. If you want a second opinion on a particular topic you might like to consult one of the following:

*Computational Physics*, Rubin H. Landau, Manuel J. Paez, and Cristian C. Bordeianu (Wiley-VCH, Weinheim, 2007).*Numerical Methods for Physics*, 2nd Edition, Alejandro L. Garcia (Prentice Hall, Upper Saddle River, NJ, 2000).*A First Course in Computational Physics*, Paul L. DeVries and Javier E. Hasbun (Jones & Bartlett, Burlington, MA, 2010).

*Numerical Recipes: The Art of Scientific Computing*, William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery, 3rd Edition (Cambridge University Press, Cambridge, 2007).

- Homework 1 - Basic physics programming
- Homework 2 - Loops, lists, and graphics
- Homework 3 - Numerical error, integration
- Homework 4 - Numerical differentiation, linear algebra
- Homework 5 - Eigenvalues, nonlinear equations
- Homework 6 - Fourier transforms, differential equations
- Homework 7 - Ordinary differential equations
- Homework 8 - Partial differential equations

There are a bunch of programs and data files that you'll need for doing the homework. I've assembled everything you'll need into a single zip file which you can download from here. You should grab a copy of this file and unzip it into a convenient folder on your computer, so that you have all the files ready when you need them. Throughout the textbook and in the homeworks, where it mentions files in the "on-line resources", this is what it is referring to. The same resources can also be found on the textbook web site here.

Other files:

`house.txt`

– data file for a picture of a house`signal.txt`

– data file for Midterm 3

Date | Topic | Reading | Downloads | Notes |
---|---|---|---|---|

Thursday, Jan. 9 | Orientation and Introduction to Python | Chapter 1 | Info sheet | |

Tuesday, Jan. 14 | Basic programming | 2.1, 2.2 | Homework 1 | Homework 1 handed out |

Thursday, Jan. 16 | Loops and lists | 2.3, 2.4 | ||

Tuesday, Jan. 21 | For-loops and functions | 2.5-2.7 | Homework 2 | Homework 1 due, Homework 2 handed out |

Thursday, Jan. 23 | Graphics | Chapter 3 | ||

Tuesday, Jan. 28 | No class | Inclement weather | ||

Thursday, Jan. 30 | Speed and accuracy | Chapter 4 | Homework 3 | Homework 2 due, Homework 3 handed out |

Tuesday, Feb. 4 | Numerical integration | 5.1, 5.2 | ||

Thursday, Feb. 6 | Adaptive integration methods | 5.3, 5.4 | ||

Tuesday, Feb. 11 | No class | |||

Thursday, Feb. 13 | Gaussian quadrature | 5.5-5.9 | Homework 3 due, Midterm 1 handed out
| |

Tuesday, Feb. 18 | Numerical differentiation | 5.10 | Homework 4 | Midterm 1 due, Homework 4 handed out |

Thursday, Feb. 20 | Linear algebra | 6.1, 6.2 | ||

Tuesday, Feb. 25 | Nonlinear equations | 6.3 | Homework 5 | Homework 4 due, Homework 5 handed out |

Thursday, Feb. 27 | Maxima and minima | 6.4 | ||

Mar. 4, Mar. 6 | No class | Winter Break | ||

Tuesday, Mar. 11 | Fourier methods | 7.1-7.3 | Homework 5 due, Midterm 2 handed out
| |

Thursday, Mar. 13 | The fast Fourier transform | 7.4 | Midterm 2 due | |

Tuesday, Mar. 18 | Ordinary differential equations | 8.1-8.3 | Homework 6 | Homework 6 handed out |

Thursday, Mar. 20 | Adaptive methods for ODEs | 8.4 | ||

Tuesday, Mar. 25 | Leapfrog and Bulirsch-Stoer methods | 8.5 | Homework 7 | Homework 6 due, Homework 7 handed out |

Thursday, Mar. 27 | Boundary value problems | 8.6 | ||

Tuesday, Apr. 1 | Partial differential equations | 9.1 | Homework 7 due, Midterm 3 handed out
| |

Thursday, Apr. 3 | Forward time methods | 9.2 | Midterm 3 due | |

Tuesday, Apr. 8 | Spectral methods | 9.3 | Homework 8 | Homework 8 handed out |

Thursday, Apr. 10 | Random processes | 10.1 | ||

Tuesday, Apr. 15 | Monte Carlo integration | 10.2 | Homework 8 due | |

Thursday, Apr. 17 | Monte Carlo simulation | 10.3 | Midterm 4 handed out
| |

Tuesday, Apr. 22 | Simulated annealing | 10.4 | Midterm 4 due |