Lab for the Bisection Method
Module for the Bisection Method

  Check out the new Numerical Analysis Projects page.

Bisection Method. To find a root of the equation f(x) = 0 in the interval [a,b]. Proceed with the method only if f(x) is continuous and f(a) and f(b) have opposite signs.

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr1.gif]

Example. Find the solution to the equation [Graphics:bi.txtgr3.gif] in the interval [0,3].
Use the bisection method to compute a solution with an accuracy of [Graphics:bi.txtgr4.gif].
Solution. Since [Graphics:bi.txtgr5.gif] we will use 21 iterations.

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr6.gif]

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr7.gif]

Bisection[0.0, 3.0, 21]
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr8.gif]
 
 

Report to be handed in.

Computer Exercises

Exercise 1.
Find solutions to the equation [Graphics:bi.txtgr9.gif] on the intervals [0,1], [1.5, 2.5] and [3,4]. Use the bisection method to compute a solution with an accuracy of [Graphics:bi.txtgr10.gif]. Determine the number of iterations to use. Include a printout of iterations in your report.
Solution. Since [Graphics:bi.txtgr11.gif] you should use 23 iterations.

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr12.gif]

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr13.gif]

Bisection[0.0, 1.0, 23];
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr14.gif]
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr15.gif]
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr16.gif]
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr17.gif]
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr18.gif]

Exercise 2. Consider f(x) = tan(x) on the interval (0,3). Use the 20 iterations of the bisection method and see what happens. Explain the results that you obtained.

f[x_] = Tan[x]
    Bisection[0.0, 3.0, 20];
[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr19.gif]

The function 0 = tan(x) does not have a solution in the interval (0,3). However, it does have a vertical asymptote at x=[Graphics:bi.txtgr20.gif]. Since tan(x) has opposite signs on each side of x=[Graphics:bi.txtgr21.gif], the bisection method converges to [Graphics:bi.txtgr22.gif].

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr23.gif]

[Graphics:bi.txtgr2.gif][Graphics:bi.txtgr24.gif]

 

 

 

(c) John H. Mathews, 1998