Wednesday, August 30, 2017

A Few Updates

We have been busy working on A Student’s Guide to Python for Physical Modeling this summer. We are preparing an updated edition for Winter of 2018. We wanted to take this opportunity to alert readers to a few items that have changed since the publication of the first edition, back in 2015.

Python 3.6

The “latest version” of any software package is a moving target, and putting a version number in print ensures that it will be outdated at some point in the future. In the first edition, we used Python 3.4. The latest stable release of Python is version 3.6, and Python 3.7 is under development. Happily, all of the code samples in the book run with Python 3.6.

One change that came with Python 3.5 may be of interest to scientific programmers. Python introduced a new operator for matrix multiplication: the “@” symbol. NumPy recognizes this operator, and it can be used as shorthand for the np.dot() function. This may allow you to write simpler, more intuitive code, which usually leads to fewer errors.

x = np.random.random(3)
M = np.random.random((3,3))

x @ M == np.dot(x,M)
M @ x == np.dot(M,x)

If you want to explore the latest changes to Python, you can read about what’s new.

Goodbye, Continuum. Hello, Anaconda, Inc.

Continuum Analytics is no more. The company has changed its name to Anaconda, Inc. One significant result of this decision is that many of the Web links in the first edition — Appendix A (Installation) in particular — may no longer work in the future.

The new home page of Anaconda is now anaconda.com. This is where you can download the Anaconda distribution of Python and find all of the official Anaconda documentation. The old continuum.io links in the first edition will probably continue to work for some time, but if you find a broken link, you may need to search for the relevant material at anaconda.com instead.

The Anaconda distribution has evolved over time. Some of the instructions in Appendix A of the first edition for command line installation with the conda package manager are now unnecessary:

  • The Anaconda distribution now includes the mkl package by default.

  • The accelerate package has evolved into something beyond the scope of our book. You can read about it here.

  • Installing spyder with Miniconda is now even simpler. As of August 2017, we found no missing packages when installing spyder with the conda package manager. There is no need to install jinja2, docutils, or pyflakes separately.

Errata

Since publication of A Student’s Guide to Python for Physical Modeling, we have discovered a few errors. We have recently updated the Errata on this Web site. Happily, the list is short. All of these will be corrected in the upcoming revised edition. Thanks to all of the alert readers who brought these to our attention!

Updated Edition

Some readers may be wondering what will be changed in the updated edition. We did not feel the changes were substantial enough to justify calling the work a “second edition,” but we did put a lot of work into improving the text:

  • We corrected all known errors.

  • We made many changes merely to bring the content of the book up to date with the constantly changing content of the World Wide Web and open-source software packages.

  • We added an introduction to Jupyter notebooks. Our blog post provided an outline for the new material.

  • We added a discussion of 2D histograms.

  • We added a discussion of displaying data as images with plt.imshow.

Much of our effort went into reorganizing and rewriting the original material so that that it will be clearer and easier to follow. We hope that anyone who reads the two editions side by side will find much that is improved, even if there is not a lot that is new.