I agree with KeithF that the figure on page 8 is not the same as that on page 9 which is 33.42.
Also, on page 35, I am not sure if this is another error:
For the bisection method, right near the end of the algorithm, it says "The final value of x3 approximates the root, and it is in error by not more than |x1 - x2|/2".
My understanding of the algorithm is that the last iteration of the loop would still set either x1 or x2 equal to x3.
To simplify, say you have an initial interval [0, 1] and you only run 1 iteration. Let's assume that the true value of the root is 0.1.
So you have, in the one and only iteration, x3 = (x1 + x2)/2 = (0 + 1)/2 = 0.5
Since the root is 0.1 you'd have that f(x3)*f(x1) < 0 so you'd set x2 = x3 for the next iteration. This makes sense as the new interval is [0.0, 0.5]
However, we've assumed 1 iteration for simplicity, in the code we'd have that |x1 - x2| < 2*tolerance so the loop would stop.
So at the end you have:
x1 = 0.0 (not changed by single iteration in the loop)
x2 = 0.5 (set to be equal to x3 for next loop that never happens)
x3 = 0.5 (halfway between two starting values)
|x1 - x2|/2 = |0 - 0.5|/2 = 0.25
Now the actual absolute error is |root - x3| = |0.1 - 0.5| = 0.4 > 0.25, contradicting the text book.
Also, this appears to be inconsistent with page 37 which gives
error = |(b-a)/(2^n)| = |(1.0 - 0.0)/(2^1)| = 0.5.
Have I missed something? Doesn't this indicate that perhaps the line should read "The final value of x3 approximates the root, and it is in error by not more than
|x1 - x2|".
Lecturers, or fellow students, please advise!
With best wishes from London,
Richard