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: will meet in 335 West Hall.

Please bring a laptop computer along to follow the exercises!

Syllabus (Dates & Location for Fall 2016)

  1. Monday September 12 5:30 - 7 PM: Welcome & Getting Started (hello.py). Location: 335 West Hall
  2. Tuesday September 13 5:30 - 7 PM: Numbers, Strings, Lists, Dictionaries, Tuples, Functions, Modules, Control flow. Location: 335 West Hall
  3. Wednesday September 14 5:30 - 7 PM: Useful Python libraries (part I): numpy, scipy, matplotlib. Location: 335 West Hall
  4. Thursday September 15 5:30 - 7 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 the CATS sharepoint site: https://sharepoint.umich.edu/lsa/physics/physcomp/docs/Forms/AllItems.aspx and follow the instructions there 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.