# A Primer on Scientific Programming with Python

###### Hans Petter Langtangen
Publisher:
Springer
Publication Date:
2011
Number of Pages:
699
Format:
Hardcover
Edition:
2
Series:
Texts in Computational Science and Engineering 6
Price:
59.95
ISBN:
9783642183652
Category:
Textbook
BLL Rating:

The Basic Library List Committee suggests that undergraduate mathematics libraries consider this book for acquisition.

[Reviewed by
John D. Cook
, on
09/3/2011
]

A Primer on Scientific Programming with Python simultaneously introduces us to the Python programming language and its use in scientific computing. The emphasis from the beginning is on practical computation. The first chapter the book introduces the numpy numerical library and the IPython shell, topics often mentioned at the end of other books, if they are mentioned at all. Including these tools early on is appropriate given the book’s purpose. For someone primarily interested in scientific computing, these tools are more fundamental than some of the less common features of the Python language.

Langtangen’s Primer is truly a textbook, not just a technical monograph that the publisher says could be used as a textbook. In some ways it feels more like a college psychology textbook than a typical programming book. It is a hardback book with slightly glossy paper and baby blue highlighting around code samples. It has frequent headings, exercises, etc. In short, it goes to great effort to be easy to study. On the other hand, some more experienced programmers may prefer a faster-paced book.

The Primer focuses on scientific programming but not numerical analysis per se. The emphasis is on the implementation and use of numerical algorithms rather than their theoretical derivations.

The reader will learn good Python programming style from the Primer. The book will often present a direct solution using only the most basic language features and follow it by a more elegant, more idiomatic solution.

One of the strengths of this book is that it includes material that is not often described in books. Those who use Python for scientific programming eventually discover libraries such as numpy, matplotlib, and scitools, though these are not often covered in books on Python. In addition to purely mathematical computation, the book covers peripheral tasks that are often necessary such as automating grabbing web pages, parsing CSV files, and processing command line arguments.

Those of us who have learned scientific programming in Python “on the streets” could be a little jealous of students who have the opportunity to take a course out of Lantangen’s Primer.

John D. Cook is a research statistician at M. D. Anderson Cancer Center and blogs daily at The Endeavour.

Computing with Formulas.- Loops and Lists.- Functions and Branching.- Input Data and Error Handling.- Array Computing and Curve Plotting.- Files, Strings and Dictionaries.- Introduction to Classes.- Random Numbers and Simple Games.- Object-Oriented Programming.- Sequences and Difference Equations.- Introduction to Discrete Calculus.- Introduction to Differential Equations.- A Complete Differential Equation Project.- Programming of Differential Equations.- Debugging.- Technical Topics.- Bibliography.- Index