Lab 6 · Lecture 6 · Root Finding and the Bisection Method
Bisection Lab
Step through bisection, check your own hand calculations with the solver, and write the method in Python and C.
Step through bisection. The band is the current bracket; the table is the iteration table you write by hand.
Type any equation f(x) = 0 in ordinary textbook notation (e.g. x^3 - 2x - 5, 3x + sin x - e^x, x log10(x) - 1.2), choose a method and press Run to tolerance. Use it to check your homework tables, not to replace working them out.
Bisection
Try this
The textbook program
Try this
Iteration count
Try this
Q1 Find a root of by bisection, correct to 2 decimal places.
Sign change: , . Midpoints: 2.5 (+5.625), 2.25 (+1.891), 2.125 (+0.346), 2.0625 (−0.351), 2.09375 (−0.009), 2.109375 (+0.167), 2.1015625 (+0.079). Root ≈ 2.09 (true 2.0945515).
Q2 Show that has a root in and find it by 5 bisection steps.
: , . Midpoints 0.5, 0.75, 0.625, 0.6875, 0.71875 → bracket [0.71875, 0.75]; root ≈ 0.734 (true 0.739085).
Q3 How many bisection steps are needed on for an error below ?
, so 17 steps.
Q4 State two advantages and two disadvantages of the bisection method.
Advantages: always converges with a valid bracket; known error bound and iteration count. Disadvantages: slow (linear); needs a sign change, so it cannot find double roots and can be fooled by discontinuities.
Q5 Why can bisection not find the root of ?
for all : there is no interval with , so no starting bracket exists.
Q6 Write a C program for bisection on with , .
See the "textbook program" in the Code tab: #define f(x), sign check, do-while loop with c = (a+b)/2, update a or b, stop when |b − a| ≤ tol, print the root (0.682327).