Views
9 months ago

numerical3j

{32} • Numerical

{32} • Numerical Methods Answers to exercises Exercise 1 For example, we could define ⎧ ⎨ −1 0 ≤ x < 1 2 f (x) = ⎩ 1 1 2 ≤ x ≤ 1

A guide for teachers – Years 11 and 12 • {33} Exercise 2 As each successive [a n ,b n ] has half the length of [a n−1 ,b n−1 ], the interval [a n ,b n ] is 1 2 n times the size of [a 0 ,b 0 ]. Thus b n−a n b−a = 1 2 . n Exercise 3 Suppose that f (a 0 ) is positive and f (b 0 ) is negative. We will prove by induction that for all non-negative integers n, f (a n ) is positive and f (b n ) is negative. The claim is clearly for n = 0. Now suppose the claim holds for n = k, so f (a k ) > 0 and f (b k ) < 0; we will prove the claim for n = k + 1, showing that f (a k+1 ) > 0 and f (b k+1 ) < 0. ( ) ( ) [ Bisecting [a k ,b k ], we consider f ak +b k 2 . If f ak +b k 2 is positive, then [a k+1 ,b k+1 ] = ak +b k 2 ,b k+1 ], ) < 0, then [a k+1 ,b k+1 ] = so f (a k+1 ) > 0 and f (b k+1 ) < 0 as claimed. Alternatively, if f [ a k , a k+b k 2 By induction, all f (a n ) > 0 and all f (b n ) < 0. ( ak +b k 2 ] , so f (a k+1 ) > 0 and f (b k+1 ) < 0 again. Either way, f (a k+1 ) > 0 and f (b k+1 ) < 0. One can prove, by a similar method, that if f (a 0 ) is negative and f (b 0 ) is positive, then for all non-negative integers n, f (a n ) is negative and f (b n ) is positive. Exercise 4 Let f (x) = ln x − 1, so we solve f (x) = 0 using the bisection method with [a 0 ,b 0 ] = [2,3]. We tabulate the calculation as follows. Step Sign Sign Midpoint Sign n a n f (a n ) b n f (b n ) 0 2 − 3 + 1 2 3 4 5 6 a n +b n 2 f ( an +b n 2 5 2 = 2.5 − 5 2 = 2.5 − 3 + 11 4 = 2.75 + 5 2 = 2.5 − 11 4 = 2.75 + 21 8 = 2.625 − 21 8 = 2.625 − 11 4 = 2.75 + 43 16 = 2.6875 − 43 16 = 2.6875 − 11 4 = 2.75 + 87 32 + 43 16 = 2.6875 − 87 32 = 2.71875 + 173 64 − 173 64 = 2.703125 − 87 32 = 2.71875 + ) Thus e ∈ [ 173 64 , 87 32] = [2.703125,.71875], and e has been calculated to within an accuracy of 87 32 − 173 64 = 1 64 = 0.015625 < 0.02. Exercise 5 There is just one solution. Let f (x) = cos x − x. We note f (0) = 1 and f (1) < 0, so there is