# Errata

## Errata for the First Edition

There are some errors/typos/bugs found from the 1st edition of the book. Below are the list of such errors either found by myself or fellow readers.

**Page 26**

Reporter: Marc Le Renard

The description length(a*)=a.b is only true if vector b is unit-sized, else a.b = length(a*) x length(b).

**Page 40**

Reporter: YangWC

From the equation 1.34, the range of the first \sum should be j < i not j > i.

**Page 41**

Reporter: YangWC

From the equation 1.36, the definition of conjugate between two vectors should have = 0 in the RHS.

**Page 44**

Reporter: Marc Le Renard

There should be `x.`

before `x`

, `y`

, `z`

in the `std::sin`

formula.

**Page 51 and 52**

Reporter: Yang Shixing

In Figure 1.25 and equation 1.49, F_z should be F_x.

**Page 90**

Reporter: Marc Le Renard

The y-position is clamped to 0 but in the code the y-position is clamped to -7.0.

**Page 94**

Reporter: Marc Le Renard

From Figure 1.51, the formula should be p = \rho g h + p_{atm} instead of p = p g h + p_{atm}

**Page 133**

Reporter: YangWC

From Equation 2.9, the formula should be p = \frac{\kappa}{\gamma}(\frac{\rho}{\rho_0}^\gamma - 1), not p = \frac{\kappa}{\gamma}(\frac{\rho}{\rho_0} - 1)^\gamma. The code in the same page is correct.

**Page 134**

Reporter: YangWC

From Equation 2.10, c_s should be c_s^2 and \gamma should be removed since itâ€™s already taken account in Equation 2.9. The code (line 8~9) also should be:

```
const double eosScale = targetDensity * square(_speedOfSound);
```

**Page 137**

Reporter: YangWC

From Equation 2.14, m should be m^2.

**Page 184**

There was a bug in the code. The fixed version is shown below:

```
auto u = velocity->uAccessor();
auto uPos = velocity->uPosition();
velocity->parallelForEachUIndex([&](size_t i, size_t j, size_t k) {
Vector3D pt = uPos(i, j, k);
if (isInsideSdf(_colliderSdf.sample(pt))) {
Vector3D colliderVel = collider()->velocityAt(pt);
Vector3D vel = velocity->sample(pt);
Vector3D g = _colliderSdf.gradient(pt);
if (g.lengthSquared() > 0.0) {
Vector3D n = g.normalized();
Vector3D velr = vel - colliderVel;
Vector3D velt = projectAndApplyFriction(
velr, n, collider()->frictionCoefficient());
Vector3D velp = velt + colliderVel;
uTemp(i, j, k) = velp.x;
} else {
uTemp(i, j, k) = colliderVel.x;
}
} else {
uTemp(i, j, k) = u(i, j, k);
}
});
u.parallelForEachIndex([&](size_t i, size_t j, size_t k) {
u(i, j, k) = uTemp(i, j, k);
});
```

**Page 202**

Reporter: YangWC

From Figure 3.17 (c), c should be 1/4 not 1/2.

**Page 209**

Reporter: YangWC

From Equation 3.36, the extra right bracket on the LHS should be removed.

**Page 210**

Reporter: YangWC

From Equation 3.43, f^n_3 should move to the RHS as correctly mentioned in the text.