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

p. 10 (Example E2.1) The second note ① is a bit careless: int truncates a floating point number towards zero rather than "rounding down" in casting it to an integer. For example, int(-1.4) is -1, not -2.

p. 17 (Table 2.4) The list of Python 3 keywords is incomplete: in addition to those given, False, True, None, as and with are reserved keywords. The identifier print is no longer a keyword in Python 3 but it does refer to the print function and so should be avoided as a variable name.

p. 34 (E2.13) There is no space after Fortran in the string b, so this word will not get an exclamation mark after it as a result of c = b.replace(' ', '!\n'). This is correctly shown when the string literal c is echoed back at the command prompt, but the print(c) call following that incorrectly shows Fortran! as the fourth line of output.

p. 56 (P2.4.7) The file defining the list of protein lengths to use in the second part of this exercise on Benford's Law is called, not It can be downloaded from the online version of the exercise..

p. 76 (§2.7.4) "the it points to" $\rightarrow$ "the object it points to". This whole sentence should then read:

When a name is passed to a function, the "value" that is passed is, in fact, the object it points to.

p. 89 (P3.1.3) There is a missing minus sign in the exponential defining the Gaussian function, which should read $$ g(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left( -\frac{x^2}{2\sigma^2} \right). $$ [Thanks to Ivan Yeung for spotting this typo]

p. 151 The last format specifier in the print statement is incorrect. This line should read

print('The balance of account number {:d} is {:s}{:.2f}'
        .format(self.account_number, self.currency, self.balance))

p. 216 (P6.1.3) There is a missing minus sign in the exponential defining the Gaussian function, which should read $$ g(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left( -\frac{(x-\mu)^2}{2\sigma^2} \right) $$ [Thanks to Ivan Yeung for spotting this typo].

p. 218 (E6.6) The "missing data" entries in the blood pressure column should be -/- instead of - for Listing 6.4 on the following page to work properly. [Thanks to Stafford Baines for spotting this].

p. 232 (P6.3.2) np.hist should be np.histogram

p. 245 (P6.4.1) The exponent of time in the equation for $R(t)$ should be $+\frac{2}{5}$: $R(t) = CE^{\frac{1}{5}}\rho_\mathrm{air}^{-\frac{1}{5}}t^{\frac{2}{5}}$

p. 281 (§7.1.1) The code line:

line_quad, = ax.plot(x, x**2 / 2)

should read:

line_quad, = ax.plot(x, 1 + x**2 / 2)

p. 293 (Paragraph under "Error bars" subheading): The pyplot function referred to is called errorbar, not errorbars.

p. 318 (Listing 7.18) Following a change to the Matplotlib API in v1.5.1, the levels provided to Axes.contour must be in increasing order. To make the code in Example E7.18 work under versions v1.5.1 if the following line:

levels = list(-levels) + list(levels)

should be changed to:

levels = sorted(list(-levels) + list(levels))

p. 325 (Listing 7.23) The code line:

dt = dx2 * dx2 / (2 * D * (dx2 + dy2))

should be

dt = dx2 * dy2 / (2 * D * (dx2 + dy2))

(though it doesn't make any difference for the identical values of dx and dy chosen in this example).

p.347 (Example E8.9) The expression for the normalized Gaussian profile is missing a square in the exponent. It should be:

$$G(x;\sigma) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left(\frac{-x^2}{2\sigma^2}\right)$$

The accompanying code is correct. [Thanks to Chen Ying for spotting this].

p. 370 (Q8.2.2.e.) Compare this integral with the value of $2\pi I_0(z)$, not $I_0(z)/2\pi$.

p.371 (P8.2.4: The Brusselator) The second of the scaled differential equations should read $$ \frac{\mathrm{d}y}{\mathrm{d}t} = bx - x^2y $$ (note the minus sign).

p. 394 (Example E8.22) The function jac should return the transposed array of derivatives,

return np.array((-da, -de)).T

(i.e. remove the preceding line, return -da, -de.)

p. 396 (§8.4.3) The bracketing interval $[a,b]$ should be such that $\mathrm{sgn}[f(a)] = -\mathrm{sgn}[f(b)]$. That is, $f(a)$ and $f(b)$ should bracket the root and have opposite signs. It is not necessary, of course, that $f(a) = -f(b)$.

Minor typos

p. 66 (§2.6): to acheive $\rightarrow$ to achieve

p. 112 (§4.2.2) keys to to be copied $\rightarrow$ keys to be copied

p. 122 (§4.3.1) L9: acheived $\rightarrow$ achieved

p. 341 (Example E8.4) There should be no period after "1953".

p. 366 (top of the page): $\frac{\mathrm{d}x_2}{\mathrm{d}t_2}$ should be $\frac{\mathrm{d}x_2}{\mathrm{d}t}$

p. 368 "Drag consant" $\rightarrow$ "Drag constant"

p. 390 (§8.4.2) The function to be fit is $f(t) = Ae^{-t/\tau}\cos 2\pi\nu t$, so $\tau$ is positive.

p. 447 (Index): plt.errorbars $\rightarrow$ plt.errorbar