Doing Math with Python

Errata

Chapter 4

On page 97, in the section "Factorizing and Expanding Expressions", the expand function should be imported before we can use it via from sympy import expand.

Chapter 5

On page 132, in the section "Probability", the program should start with the import statment from sympy import FiniteSet. (Thanks to Dexter Edge)

On page 132, in the section "Probability," the code line above the one marked with a (3), which reads for num in s: should instead read: for num in space.

On page 139, in the code for simulating a fictional ATM, the statement probability = [1/6, 1/6, 1/3, 2/3] should be probability = [1/6, 1/6, 1/3, 1/3]. (Thanks to Luis Soares)

Chapter 6

On page 164 and 165, the transformation equations have some errors in the text (not in the program). The eequations should be:

Transformation 1

x1 = 0.85*x + 0.04*y

y1 = -0.04*x + 0.85*y + 1.6

Transformation 2

x1 = 0.2*x - 0.26*y

y1 = 0.23*x + 0.22*y + 1.6

Transformation 3

x1 = -0.15*x + 0.28*y

y1 = 0.26*x + 0.24*y + 0.44

Transformation 4

x1 = 0

y1 = 0.16*y

(Thanks to Dexter Edge, Toshiaki Kurokawa and Twitter @mkamimura)