COMPUTER PROBLEMS 1.1

1 (a) There is a root in \([2,3]\) (see Exercise 1.1.1). Use the textbook's Program 1.1, bisect.py. Six correct decimal places corresponds to error tolerances \(5\times 10^{-7}\), according to Def. 1.3. The calling sequence
f=lambda x: x**3-9;
xc=bisect(f,2,3,5e-7)
returns the approximate root \(2.080083\).

1 (b) Similar to (a), on interval \([1,2]\). The commands

f=lambda x:3*x**3+x**2-x-5
xc=bisect(f,1,2,5e-7)
return the approximate root \(1.169726\).

1 (c) Similar to (a), on interval \([6,7]\). The commands

f=lambda x: np.cos(x)**2+6-x
xc=bisect(f,6,7,5e-7)
return the approximate root \(6.776092\).
3 (a) Plots for parts (a) - (c), from left to right, are:





In part (a), it is clear from the graph that there is a root in each of the three intervals \([-2,-1]\), \([-1,0]\), and \([1,2]\). The commands

f=lambda x: 2*x**3-6*x-1
bisect(f,-2,-1,5e-7)
yield the first approximate root \(-1.641783\). Repeating for the next two intervals gives the approximate roots \(-0.168254\) and \(1.810038\).

3(b) There are roots in \([-2,-1]\), \([-0.5,0.5]\), and \([0.5, 1.5]\). Using bisect as in part (a) yields the approximate roots \(-1.023482\), \(0.163823\), and \(0.788942\).

3(c) There are roots in \([-1.7,-0.7]\), \([-0.7,0.3]\), and \([0.3,1.3]\). Using bisect as in part (a) yields the approximate roots \(-0.818094\), \(0\), and \(0.506308\).


5 (a) There is a root in the interval \([1,2]\). Eight decimal place accuracy implies an error tolerance of \(5\times 10^{-9}\). The commands
f = lambda x: x**3-2
bisect(f,1,2,5e-9)
yield the approximate cube root \(1.25992105\) in 27 steps.

5 (b) There is a root in the interval \([1,2]\). Using bisect as in (a) gives the approximate cube root \(1.44224957\) in 27 steps.

5 (c) There is a root in the interval \([1,2]\). Using bisect as in (a) gives the approximate cube root \(1.70997595\) in 27 steps.


7 Trial and error, or a plot of \(f(x)=\det(A)-1000\), shows that \(f(-18)f(-17)<0\) and \(f(9)f(10)<0\). Applying bisect to \(f(x)\) yields the roots \(-17.188498\) and \(9.708299\). The backward errors of the roots are \(|f(-17.188498)|=0.0018\) and \(|f(9.708299)|=0.00014\).
9 The desired height is the root of the function \(f(H)=\pi{H^2}(1-\frac{1}{3}H)-1\). Using
H = lambda x: pi*H**2*(1-H/3)-1
>> bisect(H,0,1,0.001)
gives the solution \(636\) mm.