Python for Scientists (2nd edition)

Python is a young flexible scripting language of growing popularity for scientific computing. As the language is still evolving, also the books introducing the language do evolve along. John M. Stewart retired as a member of the Relativity and Gravitation group from the Department of Applied Mathematics and Theoretical Physics at the University of Cambridge in 2010. After his retirement he started working on his book introducing Python for Scientists of which the first edition appeared in 2014 which was reviewed here earlier. He passed away shortly after he finished this revised second edition.

Since the first edition has been reviewed in some detail, it suffices here to discuss the differences. The basic structure and concept is retained, except for a new extra chapter 7 in which the new native Python computer algebra system (CAS) SymPy is discussed. Maple and Mathematica are the most widespread such systems. The SymPy library has similar possibilities like combinatorics, calculus, linear algebra, orthogonal polynomials and special functions, and solving differential equations. Although it is still developing and expanding, it is already a viable alternative for the topics mentioned. Combined with the plotting possibilities, and the graphical interface this is an important instrument for educational as well as for research purposes.

For the rest the text is mainly the same as it was in the first edition. The chapter about plotting is slightly extended. Where it had before 2D and 3D plotting sections, now the 3D discussion is extended and discusses multidimensional plotting. Another novelty is that the users interface to Python was a command-line driven IPython which used basically a text terminal with pop-up graphics, it has now the possibility to handle notebooks which, like Maple and Mathematica notebooks, use a graphical browser to interact and which allows to mix the maple commands with text that can be introduced with section headers and a LaTeX kind of typesetting for the formulas. Instead of text oriented version of IPython, one has to open the IPython notebook with another tool called Jupyter. This does not influence the code snippets of the previous edition, but it is a much nicer users interface. Most of the snippets that are given in this book are now made available online in the form of an elementary notebook in txt format or as a pdf file.

In other words, this second edition is just a logical evolution, following the evolution of Python, while retaining its original concept and quality, Requiring only an increase from 220 to 257 pages, I still think the conciseness of the book is a major asset. It provides just enough to get you started with the language if you are already familiar with some computer programming or with a system like Maple or Mathematica. You might consider switching to Python to use it in either your design of scientific software, or, now with the nice notebook flexibility available, you might want to use it as a tool in teaching calculus or numerical analysis. It allows to generate on online interactive version of your course.

The dynamism in the evolution and the succession of Python releases is a blessing and a curse. A blessing because with every release, the possibilities and the quality does increase, but also a curse because there is no standard for the language yet, and therefore it is not guaranteed that what works in some release will still work in the next one. As a consequence, one usually has to install different versions. This is done in a protected environment (basically confining a Python version to a directory) generated by a command virtualenv env. The necessary libraries are then installed there using the proper version dependency. This is achieved by using some command like for example pip install jupyter to install the Jupyter module. Stewart gives some explanation about the installation of Python, but that is rather minimal. There is nothing about virtual environments and pip install's. Also installing some packages on a computer where you do not have admin permission, can be problematic. Fortunately Python, its environment and all its satellite modules are well documented on the internet, and it is all open software. So you might need some external help to get started, but once you have an operational Python system, this book is still and excellent starting point to put you on the tracks to master the language and enjoy the marvels of the latest version of Python.

Reviewer: 
Adhemar Bultheel
Book details

This is the second edition of the book for which the first edition was reviewed here, three years ago. The text has been rewritten to better reflect the IPython notebook style with graphical interface using Jupyter and a new chapter is added about SymPy (a library for symbolic mathematics). The number of code snippets has also been increased and most of them are now available online in an elementary form.

Author:  Publisher: 
Published: 
2017
ISBN: 
9781108120241 (pbk)
Price: 
€ 29.99 (pbk)
Pages: 
271
Categorisation