Comparison of my two books on Python programming

I have written two books on Python programming:


Since the titles are similar, people often ask me what the differences between these books are. Python Scripting for Computational Science was written for researchers and students having traditional programming experience with specialized science codes in Fortran, C, or C++. The book explains primarily how Python can be used to efficiently automate the many administrative tasks encountered by computational scientist (preparing data files, running experiments, gluing programs, managing files and directories, communicating through network, equipping programs with command-line or graphical user interfaces, etc.). Administrative programs also often need to do some data analysis and numerical computations so NumPy/SciPy and coupling of Python with Fortran, C, and C++ are also important topics in this book.

A Primer on Scientific Programming with Python was written for teaching beginning students how to program computers, with emphasis on using the computer to solve mathematical problems from applied science. We use Python because this allows a continuous transition from Matlab-style "flat" programs to Java/C++-style object-oriented programs. The book does not cover administrative tasks with processes, files, user interfaces, etc., but focuses solely on numerical computing using examples from calculus, physics, biology, and finance. The goal is to teach a beginner the most important constructions in a programming language, how to think about programming, and how to use programming in combination with numerical methods as a powerful tool to attack mathematical problems.

The book emphasizes the use of a subset of Python and an additional package SciTools so that the transition to Matlab, which is widely used in later science courses, is as easy and smooth as possible (a key feature to get accept for using Python as the first language in science programs). In particular, we have an interface to visualization which is very close to Matlab with respect to syntax and functionality, but several alternative visualization packages (including Matlab, Matplotlib, Gnuplot, and Vtk) can be used as backend.

I have extensive experience with using both books in large courses at the University of Oslo. Although the Primer book is intended for beginners, it has become popular among professionals too, especially for seeing how Python is a good alternative to Matlab.