12.04.2018 Views

numerical3j

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

{8} • Numerical Methods<br />

There’s nothing special about the interval [0,1] either. We could replace [0,1] with any<br />

interval [a,b]. Provided f is positive at one end and negative at the other end, then f (x) =<br />

0 must have a solution in [a,b].<br />

Finally, there’s also nothing special about the value 0. For any real number value c, if<br />

f < c at one end of the interval [a,b], and f > c at the other end, then there must exist an<br />

x ∈ [a,b] such that f (x) = c.<br />

We summarise this discussion with a statement of the intermediate value theorem.<br />

Theorem (Intermediate Value Theorem)<br />

Let f : [a,b] → R be a continuous function, and c be a real number.<br />

a If f (a) < c and f (b) > c, then there exists an x ∈ [a,b] such that f (x) = c.<br />

b If f (a) > c and f (b) < c, then there exists an x ∈ [a,b] such that f (x) = c.<br />

Note that the intermediate value theorem doesn’t say anything about how many times<br />

f (x) takes the value c. There might be many values of x in the interval [a,b] such that<br />

f (x) = c. All the theorem says is that there is at least one.<br />

If you’re on one side of the river, and later you’re on the other side of the river, then you<br />

must have crossed the river — you might have crossed it many times, but you certainly<br />

crossed it at least once!<br />

Bisection algorithm<br />

We now describe the bisection algorithm in detail. Suppose we have a continuous function<br />

f : [a,b] → R, and we want to solve f (x) = 0. (To solve for some other value of f , i.e.<br />

f (x) = c, you can rearrange the equation to f (x) − c = 0.)<br />

We assume f (a) and f (b) are both nonzero — otherwise we already have a solution! We<br />

also assume f (a) and f (b) have opposite signs. The intermediate value theorem then<br />

ensures that f (x) = 0 has a solution for some x ∈ [a,b].<br />

As we have seen, the idea is to look at the value of f (x) at the midpoint a+b<br />

2<br />

of the interval<br />

[a,b], i.e. the average (or mean) of a and b.<br />

If f ( a+b<br />

2<br />

a+b<br />

) = 0, then we have a solution, and we can stop. Otherwise, f (<br />

2<br />

) is either<br />

) and f (b), the intermediate<br />

positive or negative. Depending on the signs of f (a), f ( a+b<br />

2<br />

value theorem will tell us that one or the other of the intervals<br />

[<br />

a, a + b<br />

2<br />

]<br />

or<br />

[ a + b<br />

2 ,b ]<br />

contains a solution. We call this interval [a 1 ,b 1 ].

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!