The bisection method

From testwiki
Revision as of 22:52, 14 January 2022 by imported>Mykola7 (Undid edits by Meekrab2012 (talk) to last version by Dave Braunschweig)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:S

Template:Center topTemplate:FontTemplate:Center bottom
Template:Navigation bar

The bisection method is based on the theorem of existence of roots for continuous functions, which guarantees the existence of at least one root α of the function f in the interval [a,b] if f(a) and f(b) have opposite sign. If in [a,b] the function f is also monotone, that is f(x)>0x[a,b], then the root of the function is unique. Once established the existence of the solution, the algorithm defines a sequence xk as the sequence of the mid-points of the intervals of decreasing width which satisfy the hypothesis of the roots theorem.

Roots Theorem

The theorema of existence of roots for continuous function (or Bolzano's theorem) states

Let f:[a,b] be a continuous function such that f(a)f(b)<0.

Then there exists at least one point x in the open interval (a,b) such that f(x)=0.

The proof can be found here .

Bisection algorithm

Given fC0([a,b]) such that the hypothesis of the roots theorem are satisfied and given a tolerance ϵ

  1. xk=a+b2,k1;
  2. if ek=|bxk|ϵ:esci;
  3. if f(xk)=0: break;
    else if f(a)f(xk)>0: a=xk;
    else :b=xk;
  4. go to step 1;

In the first step we define the new value of the sequence: the new mid-point. In the second step we do a control on the tolerance: if the error is less than the given tolerance we accept xk as a root of f. The third step consists in the evaluation of the function in xk: if f(xk)=0 we have found the solution; else ,since we divided the interval in two, we need to find out on which side is the root. To this aim we use the hypothesis of the roots theorem, that is, we seek the new interval such that the function has opposite signs at the boundaries and we re-define the interval moving a or b in xk. Eventually, if we have not yet found a good approximation of the solution, we go back to the starting point.

convergence of bisection method and then the root of convergence of f(x)=0in this method

At each iteration the interval k=[ak,bk] is divided into halves, where with ak and bk we indicate the extrema of the interval at iteration k0. Obviously 0=[a,b]. We indicate with |k|=meas(k) the length of the interval k. In particular we have

|k|=|k1|2=|k2|22=...=|0|2k=ba2k.

Note that αk,k0, that means

ek|k|.

From this we have that limkek=0, since limk12k=0. For this reason we obtain

limkxk=α,

which proves the global convergence of the method.

The convergence of the bisection method is very slow. Although the error, in general, does not decrease monotonically, the average rate of convergence is 1/2 and so, slightly changing the definition of order of convergence, it is possible to say that the method converges linearly with rate 1/2. Don't get confused by the fact that, on some books or other references, sometimes, the error is written as ek=ba2k+1. This is due to the fact that the sequence is defined for k0 instead of k1.

Example

Consider the function f(x)=cosx in [0,3π]. In this interval the function has 3 roots: α1=π2, α2=3π2 and α3=5π2.

Theoretically the bisection method converges with only one iteration to α2. In practice, nonetheless, the method converges to α1 or to α3. In fact, since the finite representation of real numbers on the calculator, x13π2 and depending on the approximation of the calculator f(x1) could be positive or negative, but never zero. In this way the bisection algorithm, in this case, is excluding automatically the root α2 at the first iteration, since the error is still large (e1=α2).

Suppose that the algorithm converges to α1 and let's see how many iterations are required to satisfy the relation 1010. In practice, we need to impose

ek3π2k1010,

and so, solving this inequality, we have

klog2(31010π)36.46,

and, since k is a natural number, we find k37.

References

Template:Reflist

Other resources on the bisection method

Look on the resources about rootfinding for nonlinear equations page.