Introduction to Python

This part of the course will introduce the Python programming language in a two-week, four-lecture introductory course. Beginners without any programming experience as well as programmers who usually use other languages (C, C++, Fortran, Java, …) are encouraged to come; no prior knowledge of programming languages is required!

For the first two lectures we will mostly follow the book Learning Python. This book is available at our library. An earlier edition (with small differences, equivalent for all practical purposes) is available as an e-book. The second week will introduce some useful python libraries: numpy, scipy, matplotlib.

At the end of the first two weeks you will know enough about Python to use it for your grad class homework and your research.

Special meeting place: we will meet in 340 West Hall on Monday September 11 at 5 PM.

Please bring a laptop computer along to follow the exercises!

Syllabus (Dates & Location for Fall 2017)

  1. Monday September 11 5:00 – 6:30 PM: Welcome & Getting Started (hello.py). Location: 340 West Hall
  2. Tuesday September 12 5:00 – 6:30 PM: Numbers, Strings, Lists, Dictionaries, Tuples, Functions, Modules, Control flow. Location: 335 West Hall
  3. Wednesday September 13 5:00 – 6:30 PM: Useful Python libraries (part I): numpy, scipy, matplotlib. Location: 335 West Hall
  4. Thursday September 14 5:00 – 6:30 PM: Useful Python libraries (part 2): 3d plotting in matplotlib and exercises. Location: 335 West Hall

Installing Python / vpython

This mini course will only use python. If you also a statistical mechanics course, you may need vpython.

On OSX: Open the terminal application (/Applications/Utilities/Terminal.app) and type ‘python’. Python is already installed. To install vpython, please go to CATS and follow their instructions or download vpython directly from its main site.

On Windows: Please download vpython, located at: https://sharepoint.umich.edu/lsa/physics/physcomp/docs/Forms/AllItems.aspx, and follow the instructions (or download vpython from its main site)

If you get stuck please don’t hesitate to ask CATS or me for help!

Books

A good introductory python book is Learning Python by Mark Lutz (currently 4th edition). We have an e-book version of this book in the library. (access limited to seven concurrent users). Older e-book versions are also available here and here. Hardcopies are available at several locations on campus.
UMich Physics professor Mark Newman’s recent book Computational Physics with Python may be useful, too.
Shapiro Science Library has a collection of introductory books on programming and python on the fourth floor.