# Errata

Corrections and clarifications to the text of the printed version of 2nd edition of the book appear here.

p. 41 (P2.3.2) The comment in the definition of the constant $G$ indicates incorrect units:

G = 6.6743e-11 # J/K


should be

G = 6.6743e-11 # Nm^2/kg^2


p. 90 (E3.2) There is a missing minus sign in the inequality defining the plot range for the sinc function, which should be $-20 \le x \le 20$.

p. 125 (P.4.2.2) In the traditional formulation of Zipf's law, the constant $C$ is defined through $\log C = \log(w_1)$, instead of $C = \log(w_1)$.

p. 125 (P4.2.4) The Morse code example translating to 'PYTHON 3' in this exercise should be: '.--. -.-- - .... --- -. / ...--'. Thanks to Alisa Crowe for pointing out this typo.

p.162 (Example E4.19, Listing 4.8) The linspace function lives in the numpy package, not the pyplot module:

r = plt.linspace(0,200,1000)


should be replaced with

r = np.linspace(0,200,1000)


and NumPy imported at the start of the program with

import numpy as np


p. 309 (Example E7.6) In the second call to plt.errorbar one of the arguments escaped the close parenthesis:

... mfc='k', mec='k'), capsize=3


... mfc='k', mec='k', capsize=3)


p. 345 (Example E7.24) This comment line in Listing 7.25 is incorrect:

# Initial conditions - ring of inner radius r, width dr centred at (cx,cy) (mm)


# Initial conditions - circle of radius r centred at (cx,cy) (mm)


p.366 (Example E8.4) The import

import matplotlib.pyplot as plt


is not necessary in this code example.

p.368 (Example E8.5) The linspace function lives in the numpy package, not the pyplot module. The following lines:

ax = plt.linspace(-5, 5, 1000)
ax2 = plt.linspace(1, 6, 6)


should be replaced with

ax = np.linspace(-5, 5, 1000)
ax2 = np.linspace(1, 6, 6)


p.385 (Example E8.14) The lambda function defining the lower limit of the $z$ integral should take arguments x, y, not x, vy (though since this lower limit is a constant (0), neither argument is used and the code will run correctly as it is.

p.400 (Example E8.18) The term $-mg$ in the formula for $\dot{u}_4$ should be simply $-g$ in the text before Listing 8.14. The code is correct.

p.469 The description of the thresh argument to the pandas.dropna function is incorrect: a row or column is not dropped if it contains at least thresh NaN values; rather, it is dropped if it does not contain at least that number of non-NaN values. By coincidence, this is the same thing for the example given, but the difference can be seen by dropping rows:

In [x]: df
Out[x]:
A    B    C     D
0  1.1  NaN  NaN  10.3
1  0.8  NaN  3.6   2.9
2  1.2  2.5  1.6   2.7
3  NaN  NaN  NaN   NaN
4  NaN  NaN  3.6   5.3

In [x]: df.dropna(thresh=3, axis=0)
Out[x]:
A    B    C    D
1  0.8  NaN  3.6  2.9
2  1.2  2.5  1.6  2.7


Rows 0, 3 and 4 are dropped because they contain fewer than thresh=3 valid entries.

Many thanks to Andre Nepomuceno for pointing this out.

p.479 (P9.4.2) The value for the reference viscosity to use is $\eta_0 = 1.869 \times 10^{-5}\;\mathrm{kg\,m^{-1}\,s^{-1}}$.

### Minor typos

p. 267 (E6.16): tranformation $\rightarrow$ transformation

p. 286 (P6.6.3): bactrium $\rightarrow$ bacterium