Python

We will make extensive use of python in this course. You will need to have python installed on a computer you have regular access to. In addition to python, you will need three python extensions: numpy, scipy, and matplotlib. Python along with these three extensions is an incredibly powerful and flexible environment for doing science and mathematics.

Downloading: I think the easiest way to get python and extensions set up is download them all in one lump. (This is usually called a distribution rather than a lump.) I am not yet sure which distribution will be best, but I think we should try anaconda first. Here's how to do it

  1. Go to the anaconda download page.
  2. Select your operating system: windows, mac OSX, or linux.
  3. Choose Python 3.5.
  4. Follow the downloading and installation instructions. It is a large download: around 400 MB.

If anaconda doesn't work, there are lots of other options to try.

Using Python: Most of the time we will use python via IDLE, an integrated development environment (IDE) for python. Look for IDLE in your list of applications or wherever programs reside on your computer and launch it. A python shell will appear into which you can type commands. Usually you'll open a python file and write a program, save it, and run it.

If you want to do a quick test, try typing the following:

  from pylab import *
  x = randn(10000)
  hist(x,100)
  show()

This will generate a list of 10000 normally distributed variables and plot them in a histogram.

Getting Started: There are a vast number of tutorials for getting started with python. Here are some options:

If you find other good references, please let me know and/or post them on the discussion forum.

Troubleshooting: If you have trouble getting python installed and working on your computer, please post a query on the piazza discussion board. I use linux, and so I might not be able to provide mac- or windows-specific help. So mac and windows users will need to help each other out, and the discussion forum is probably the best way to faciliate this. Once python is successfully installed we'll all be able to help each other; python is the same on all operating systems