Menu:

Code and Programming Resources

This page collects code related to the text (listings, figures, etc.)

Contents

Why Python?

Python is the main programming language used in the text. Python is a general purpose programming language used in a variety of application domains

Chosen by people who know a good programming language when they see it

Advantages:

Here's a nice page on the advantages of Python over Matlab

Don't speak Python? Try these lectures, or the tutorials listed here

Listings

The following table contains Python listings from the text. You can find lots of additional code on similar topics in my lecture series

MATLAB equivalents are also provided.

Python MATLAB
Listing 2.1 polyclass0.py polyclass0.m
Listing 2.2 polyclass.py polyclass.m
Listing 4.1 quadmap1.py quadmap1.m
Listing 4.2 ds.py ds.m
Listing 4.3 testds.py testds.m
Listing 4.4 genfinitemc.py mc.m
Listing 4.5 testgenfinitemc.py testmc.m
Listing 4.6 fphamilton.py fphamilton.m
Listing 5.1 kurtzbellman.py kurtzbellman.m
Listing 5.2 kurtzvsigma.py kurtzvsigma.m
Listing 5.3 p2srs.py p2srs.m
Listing 6.1 srs.py srs.m
Listing 6.2 testsrs.py testsrs.m
Listing 6.3 ecdf.py ecdf.m
Listing 6.4 lininterp.py lininterp.m
Listing 6.5 fvi.py fvi.m
Listing 6.6 fpi.py fpi.m
Listing 6.7 cpdynam.py cpdynam.m
Listing 8.1 ar1.py ar1.m



Figures

Here's code for some of the figures in the text that were created using Python. For the figures I used a mix of Python with Matplotlib and PyX, Xfig for hand-drawn vector graphics, and R for some of the older graphs. PyX produces nice PDF output and integrates well with LaTeX, but the code is a bit hard to read, and the programs may not port well to Windows or Mac OS. Nevertheless, I've put the code here in case some readers find it useful.

Code file
Figure 1.2 fig1point2.py
Figure 1.4 fig1point4.py
Figure 1.5 fig1point5.py
Figure 4.1 fig4point1.py
Figure 4.3 fig4point3.py
Figure 4.6 fig4point6.py
Figure 4.7 fig4point7.py
Figure 6.4 fig6point4.py
Figure 6.13 fig6point13.py