8.0 KB · commit a9602da
This method is based on Theorem 1.1 which states that if a function f(x) is continuous between a and b, and f(a) and f(b) are of opposite signs, then there exists at least one root between a and b. For definiteness, let f(a) be negative and f(b) be positive. Then the root lies between a and b and let its approximate value be given by x0=(a+b)/2. If f(x0)=0, we conclude that x0 is a root of the equation f(x)=0. Otherwise, the root lies either between x0 and b, or between x0 and a depending on whether f(x0) is negative or positive. We designate this new interval as [a1,b1] whose length is ∣b−a∣/2. As before, this is bisected at x1 and the new interval will be exactly half the length of the previous one. We repeat this process until the latest interval (which contains the root) is as small as desired, say ε. It is clear that the interval width is reduced by a factor of one-half at each step and at the end of the nth step, the new interval will be [an,bn] of length ∣b−a∣/2n. We then have 2n∣b−a∣≤ε, which gives on simplification n≥loge2loge(∣b−a∣/ε)(2.3) Equation (2.3) gives the number of iterations required to achieve an accuracy ε. For example, if ∣b−a∣=1 and ε=0.001, then it can be seen that n≥10(2.4)
The method is shown graphically in Fig. 2.1.
Figure 2.1 — Graphical representation of the bisection method.
In practical problems, the roots may not be exact so that condition (c) above is never satisfied. In such a case, we need to adopt a criterion for deciding when to terminate the computations.
A convenient criterion is to compute the percentage error εr defined by εr=xr′xr′−xr×100%(2.5) where xr′ is the new value of xr. The computations can be terminated when εr becomes less than a prescribed tolerance, say εp. In addition, the maximum number of iterations may also be specified in advance.
Hence the root lies between 1 and 1.5 and we obtain x1=21+1.5=1.25 We find f(x1)=−19/64, which is negative. We, therefore, conclude that the root lies between 1.25 and 1.5. It follows that x2=21.25+1.5=1.375 The procedure is repeated and the successive approximations are x3=1.3125,x4=1.34375,x5=1.328125, etc. ◀
Now, the tolerance ε1 is given by
ε1=x2x2−x1×100=0.750.25×100=33.33%since f(x2)=0.5878, the root lies between 0.5 and 0.75. Therefore, x3=20.5+0.75=0.625 also, ε2=0.6250.625−0.75×100=20%. Proceeding in this way, successive approximations and tolerances are obtained:
x4x6x8x10x12=0.5625,=0.5781,=0.5664,=0.5674,=0.5671,ε3ε5ε7ε9ε11=11.11%;=2.71%;=0.69%;=0.18%;=0.035%x5x7x9x11=0.5938,=0.5703,=0.5684,=0.5669,ε4ε6ε8ε10=5.26%;=1.37%;=0.35%;=0.09%;Since ε11=0.035%<0.05%, the required root is 0.567, correct to three decimal places. ◀