--> Errata

#### List by Page No.List by Date

List by Page No.
p.13 P1.1.5 2010/09/19
In the example below the table of formulae, the divisor for calculating `Vol20` should be 12, not 4.
```    Vol20 = ((15 + 5*sqrt(5))/12)*E^3;
```
pp.17-19 Code fragments `%Solution1`, `%Solution2`, `%Solution3` 2011/08/31
In each fragment, the caluclation of `xc` should be done outside the `if` statement. The complete script `Eg1_2` given on page 20 is correct.
p.43 P2.2.7 2010/02/10
The given sine and cosine values are switched around. The correct values are
```    cos(pi/3)=1/2;  sin(pi/3)=sqrt(3)/2;  sin(2*pi/3)=sqrt(3)/2;
```
p.48-50 and `Eg3_1` 2012/02/13
The development of the program to calculate the "best" p/q is unnecessarily complicated. The variable `e0` for intermediate "best" error, the variable `p0` for intermediate "best" p, and the statements associated with these variables are not necessary. Just updating `err_pq`, `pBest`, and `qBest` directly everytime after finding a smaller error is all that is necessary. The resulting simpler code is posted on the Software page as `SimplerEg3_1.m`.
p.60 P3.2.6 2014/03/17
In the second last sentence, the final term in the sequence to display is B(m,r), not B(m,m).
p.60 P3.2.7 2014/03/17
Develop a program that prints t0, t1, ..., t26. Start at t0, not t1.
p.70 and `Eg4_1` 2014/03/17
The script comment and the title statement of the plot contain an error: the argument to the function `exp` should be -x/2, not x/2. The code for the calculation of the function value is correct though. The file `Eg4_1.m` posted on the Software page has been corrected.
p.71 Second last code fragment 2011/10/27
One of the vector indices shown is wrong for replacing the statement `x(2) = x(3) + x(4)`. The correct fragment should be
` i = 1;`
` x(i+1) = x(i+2) + x(i+3);`
and not `x(i) = x(i+2) + x(i+3)`
p.72 First code fragment 2011/10/27
The last statement should assign the value 30 to `x(4)`, not the value 35.
p.81 First code fragment 2011/10/27
In the second call to the `fill` function, there should be a comma to separate the arguments `y+1` and the color vector, like this:
`fill(x,y+1,[0.4 0.6 1.0])`
p.141 Second line on the page 2011/08/30
The built-in function used should be `all`, not `any`. That is, the value of `all(x < y)` is 1 if and only if ```x(k) < y(k) ``` for every subscript `k`.
p.142 P6.1.18 2014/10/02
The stopping condition of the game "Gap N" is the difference between the number of heads and the number of tails being N. However, the expression given below the example sequence was wrong. It should read    |#tails - #heads|    and not   |#tosses - # heads|.
p.181 Last sentence in Problem Statement section 2012/03/13
The deck sizes should be n = 2:2:60 (not 2:2:100) in order to match the code in `Eg8_1`.
p.189 Code block near the bottom of the page 2011/05/10
The boolean expression for the `if` statement should be
```    x(k+1) < x(k)
```
and not `x(k+1) < x(x)`.
p.241 Function `ShowRect` 2012/11/10
The vector arguments to the `plot` function should have length 5, not 4, since it is necessary to "wrap around" to the first vertex in order to draw a closed rectangle. The original code draws a sideways 'U' only, missing one edge of the rectangle. Here is the correct call to the `plot` function:
```     plot([R.left R.right R.right R.left R.left],...
[R.bot R.bot R.top R.top R.bot], 'k','Linewidth',2)
```
p.269 Code block near the top of the page 2010/01/24
The loop body is missing the statement  `s = C{k}`;   The loop should be
```   for k=1:length(C)
```
```      s = C{k};
```
```      P(k) = str2num(s(67:75));
Lat(k) = str2num(s(137:146));
Long(k) = str2num(s(147:157));
end
```
p.341 Last sentence before Figure 14.7 2014/03/03
The top node is the root node while the 81 (not 27) nodes across the bottom are leaf nodes.
p.342 P14.1.3 2011/05/10
Part (b) of the problem statement should read "... then the reverse of s is the concatenation of the reverse of s(2:n) and s(1) in that order.'' The subvector was incorrectly specified as s(1:n-1).

List by Date
p.142 P6.1.18 2014/10/02
The stopping condition of the game "Gap N" is the difference between the number of heads and the number of tails being N. However, the expression given below the example sequence was wrong. It should read    |#tails - #heads|    and not   |#tosses - # heads|.
p.60 P3.2.6 2014/03/17
In the second last sentence, the final term in the sequence to display is B(m,r), not B(m,m).
p.60 P3.2.7 2014/03/17
Develop a program that prints t0, t1, ..., t26. Start at t0, not t1.
p.70 and `Eg4_1` 2014/03/17
The script comment and the title statement of the plot contain an error: the argument to the function `exp` should be -x/2, not x/2. The code for the calculation of the function value is correct though. The file `Eg4_1.m` posted on the Software page has been corrected.
p.341 Last sentence before Figure 14.7 2014/03/03
The top node is the root node while the 81 (not 27) nodes across the bottom are leaf nodes.
p.241 Function `ShowRect` 2012/11/10
The vector arguments to the `plot` function should have length 5, not 4, since it is necessary to "wrap around" to the first vertex in order to draw a closed rectangle. The original code draws a sideways 'U' only, missing one edge of the rectangle. Here is the correct call to the `plot` function:
```     plot([R.left R.right R.right R.left R.left],...
[R.bot R.bot R.top R.top R.bot], 'k','Linewidth',2)
```
p.181 Last sentence in Problem Statement section 2012/03/13
The deck sizes should be n = 2:2:60 (not 2:2:100) in order to match the code in `Eg8_1`.
p.48-50 and `Eg3_1` 2012/02/13
The development of the program to calculate the "best" p/q is unnecessarily complicated. The variable `e0` for intermediate "best" error, the variable `p0` for intermediate "best" p, and the statements associated with these variables are not necessary. Just updating `err_pq`, `pBest`, and `qBest` directly everytime after finding a smaller error is all that is necessary. The resulting simpler code is posted on the Software page as `SimplerEg3_1.m`.
p.81 First code fragment 2011/10/27
In the second call to the `fill` function, there should be a comma to separate the arguments `y+1` and the color vector, like this:
`fill(x,y+1,[0.4 0.6 1.0])`
p.71 Second last code fragment 2011/10/27
One of the vector indices shown is wrong for replacing the statement `x(2) = x(3) + x(4)`. The correct fragment should be
` i = 1;`
` x(i+1) = x(i+2) + x(i+3);`
and not `x(i) = x(i+2) + x(i+3)`
p.72 First code fragment 2011/10/27
The last statement should assign the value 30 to `x(4)`, not the value 35.
pp.17-19 Code fragments `%Solution1`, `%Solution2`, `%Solution3` 2011/08/31
In each fragment, the caluclation of `xc` should be done outside the `if` statement. The complete script `Eg1_2` given on page 20 is correct.
p.141 Second line on the page 2011/08/30
The built-in function used should be `all`, not `any`. That is, the value of `all(x < y)` is 1 if and only if ```x(k) < y(k) ``` for every subscript `k`.
p.342 P14.1.3 2011/05/10
Part (b) of the problem statement should read "... then the reverse of s is the concatenation of the reverse of s(2:n) and s(1) in that order.'' The subvector was incorrectly specified as s(1:n-1).
p.189 Code block near the bottom of the page 2011/05/10
The boolean expression for the `if` statement should be
```    x(k+1) < x(k)
```
and not `x(k+1) < x(x)`.
p.13 P1.1.5 2010/09/19
In the example below the table of formulae, the divisor for calculating `Vol20` should be 12, not 4.
```    Vol20 = ((15 + 5*sqrt(5))/12)*E^3;
```
p.43 P2.2.7 2010/02/10
The given sine and cosine values are switched around. The correct values are
```    cos(pi/3)=1/2;  sin(pi/3)=sqrt(3)/2;  sin(2*pi/3)=sqrt(3)/2;
```
p.269 Code block near the top of the page 2010/01/24
The loop body is missing the statement  `s = C{k}`;   The loop should be
```   for k=1:length(C)
```
```      s = C{k};
```
```      P(k) = str2num(s(67:75));
Lat(k) = str2num(s(137:146));
Long(k) = str2num(s(147:157));
end
```