Finding Roots with the Bisection Method Idea: Start with points xleft and xright with different signs (so there is a root between them!). Take the midpoint and choose which half of the interval to keep using the sign at the midpoint. Specifically: Start with xleft and xright where f(xleft) and f(xright) have different signs. Set xnew = (xleft + xright)/2 if sign(f(xleft)) == sign(f(xnew)) xleft = xnew; else xright = xnew; end Repeat this until the estimated error is below epsilon (our desired accuracy of the solution) We halve the error at each iteration, since our interval shrinks by a factor of 1/2. This means the method has a linear convergence rate! Look over bisection function Note: sign(val) is 1 if val > 0, 0 if val == 0, -1 if val < 0 error function - displays provided message (in red) and stops execution Example: Apply bisection method to f(x) = 6 - 2x^2 Know the roots are at +/-sqrt(3), just for example Plot to find a starting interval Set up and run bisection Takes quite a few iterations, but finds a good approximation