Resources for A Primer on Scientific Programming with Python

Resources for A Primer on Scientific Programming with Python

Hans Petter Langtangen (hpl at simula.no)

The 4th edition

All programs from the book

On Unix/Linux or Mac, download the tarfile book-examples-4th.tar.gz for the 4th edition and pack it out by

tar xvzf book-examples-4th.tar.gz

On Windows, download book-examples-4th.zip for the 4th edition and pack it out by

unzip book-examples-4th.zip

or double click on the file icon.

The result is a folder (directory) tree src with subfolders containing the program examples for different chapters in the book (formulas, looplist, etc., as explained in the introduction to each chapter).

You can also directly access the latest version of the example files at GitHub, see the src directory (to download a file, click the Raw button on the right first to get the pure text file in the browser and then right-click to download). To copy the whole repository to your computer, run

git clone https://github.com/hplgit/scipro-primer.git

Erratalist

Here is a PDF file or an HTML file with an errata list for the 4th edition of the book. If you find any typo or error, please report it to the author.

Software installation

There are several ways to access Python, either on your computer or in the cloud. Appendix H.1 in the book gives an overview of recommended technologies and how to use them to get the software you need for working with the book.

SciTools. The package SciTools is freqently referred to and used in the book. You may want to install SciTools directly from its Mercurial version control repository. This makes it easy to upgrade the package at any time. SciTools is hosted at Googlecode. Make sure you have the Mercurial (hg) version control system on your computer (if not, do sudo pip install mercurial on Linux or Mac, and pip install mercurial in a Windows Command Prompt or Power Shell window). Get the SciTools source code and install it by

hg clone https://langtangen@code.google.com/p/scitools/
cd scitools
sudo python setup.py install

Whenever you want to upgrade the package, just go to the scitools folder and run the commands

hg pull
hg update
sudo python setup.py install

Software installation on Ubuntu

If you have an Ubuntu installation, Python is already there. The minimum extra packages are installed by this command:

sudo apt-get install python-matplotlib python-scipy python-gnuplot gnuplot gnuplot-x11 python-scitools

A comprehensive installation with lots of useful packages can be performed by a Bash script. Download this file (install_rich.sh) and run it by bash install_rich.sh.

Slides

There is a slide collection from lectures based on the book.


The 3rd edition

All programs from the book

On Unix/Linux or Mac, download the tarfile book-examples-3rd.tar.gz for the 3rd edition and pack it out by

tar xvzf book-examples-3rd.tar.gz

On Windows, download book-examples-3rd.zip for the 3rd edition and pack it out by

unzip book-examples-3rd.zip

or double click on the file icon.

The result is a folder (directory) tree src with subfolders containing the program examples for different chapters in the book (formulas, looplist, etc., as explained in the introduction to each chapter).

You can also directly access the latest version of the example files at GitHub, see the src-3rd directory (to download a file, click the Raw button on the right first to get the pure text file in the browser and then right-click to download). To copy the whole repository to your computer, run

git clone https://github.com/hplgit/scipro-primer.git

Software installation

The old software description is not a bit outdated, so we refer to the new one that appears in the 4th edition.

You may want to install SciTools directly from its Mercurial version control repository. This makes it easy to upgrade the package at any time. SciTools is hosted at Googlecode. Make sure you have the Mercurial (hg) version control system on your computer (if not, do sudo pip install mercurial on Linux or Mac, and pip install mercurial in a Windows Command Prompt or Power Shell window). Get the SciTools source code and install it by

hg clone https://langtangen@code.google.com/p/scitools/
cd scitools
sudo python setup.py install

Whenever you want to upgrade the package, just go to the scitools folder and run the commands

hg pull
hg update
sudo python setup.py install

Software installation on Ubuntu

If you have an Ubuntu installation, Python is already there. The minimum extra packages are installed by this command:

sudo apt-get install python-matplotlib python-scipy python-gnuplot gnuplot gnuplot-x11 python-scitools

A comprehensive installation with lots of useful packages can be performed by a Bash script. Download this file (install_rich.sh) and run it by bash install_rich.sh.

Erratalist

There is a PDF file with an errata list for the 3rd edition of the book.

Slides

There is a slide collection from lectures based on the 3rd edition of the book.

The 1st and 2nd edition

The resource page for the first two editions is located elsewhere.