Views
1 week ago

numerical3j

{6} • Numerical

{6} • Numerical Methods Alternatively, f ( 1 2 ) could be negative. In this case, f (x) changes sign between f ( 1 2 ) (which is negative) and f (1) (which is positive). So there must be a solution between 1 2 and 1. There could be other solutions as well, but there’s certainly one between 1 2 and 1. You’ve narrowed down your search area to [ 1 2 ,1], as shown. x y ??? y = f (x) 0 1 2 3 4 1 Search area Either way, your search area has been narrowed down from [0,1], an interval of length 1, to a smaller interval, of length 1 2 . You now continue searching. You take x to be in the middle of your new search area. If your search area is now [0, 1 2 ], you try x = 1 4 . If your search area is now [ 1 2 ,1], you try x = 3 4 . If you find f = 0 at this point, you have a solution! If you don’t, you narrow down your search area by half again. Proceeding in this way, you’ll either find a solution, or get very close to one. How close? As close as you like. However closely you want to approximate a solution, you’ll be able to do it with the bisection algorithm. For instance, suppose that your equation f (x) = 0 had a solution precisely at x = 1 π ∼ 0.3183. (You don’t know that of course; you’re trying to find the solution!) You’d first narrow down the interval from [0,1] to [0, 1 2 ]; then to [ 1 4 , 1 2 ] = [0.25,0.5]; then to [ 1 4 , 3 8 ] = [0.25,0.375]; then to [ 5 y 0 1 4 1 π 5 16 3 8 16 , 3 8 ] = [0.3125,0.375]; and so on. See the figure below. y = f (x) x 1 2 1 Search area 5 Search area 4 Search area 2 Search area 3 Search area 1

A guide for teachers – Years 11 and 12 • {7} Having described the idea of the bisection method, we’ll next discuss the theory behind it more rigorously. Intermediate value theorem The bisection method relies upon an important theorem: the intermediate value theorem. This theorem is a very intuitive one. If you’re on one side of a river, and later you’re on the other side of the river, then you must have crossed the river! Consider a function f : [0,1] → R and its graph y = f (x). If f (0) < 0, then the graph lies below the x-axis at x = 0. If f (1) > 0, then the graph lies above the x-axis at x = 1. (Portions of the graph must appear as shown below.) So between x = 0 and x = 1, the graph must cross the x-axis. y y = f (x) 0 1 x But beware! If f is discontinuous, the graph y = f (x) could jump over the x-axis! y y = f (x) 0 1 x Exercise 1 Find an example, with an explicit formula, of a function f : [0,1] → R such that f (0) < 0, f (1) > 0, and for all x ∈ [0,1], f (x) ≠ 0. Nonetheless, provided we stick with continuous functions, the graph must “cross the river" of the x-axis. That is, there must be an x ∈ [0,1] such that f (x) = 0. Now, although we described the left endpoint being below the river (i.e. f (0) < 0) and the right endpoint being above the river (i.e. f (1) > 0), it could be the other way around, and the same conclusion would hold. If f (0) > 0 and f (1) < 0, there still must be a solution x ∈ [0,1] to f (x) = 0.