Path: blob/master/activities/bisection-performance.ipynb
934 views
Task 3
This homework is an activity intended to explore the bisection method and compare its computational performance and convergence with a modification called trisection.
Due to: May 24
Bisection, Trisection and Quadsection

As mentioned in class, bisection is a very simple and basic algorithm that finds roots of functions and exploits the intermediate value theorem.
The error of this method is obtained by means of a geometric analysis. Considering that successives iterations bisect the previous interval into two new ones, where one of them will be chose as the interval for the next iteration, the convergence of the method is given by:
Following this reasoning from a pure mathematical point of view, modifying this scheme, such that three or even more intervals are taken in each iteration instead of two, would produce a convergence as:
where is the number of intervals to be considered. It is clear, then, that the greater is the value the faster the convergence is reached.
Nevertheless, a greater number of subintervals will imply a harder computational implementation per iteration. In other words, the number of iterations for a given precision is lower, but the computing time per iteration is higher. This push-and-pull situation is very interesting to analyse as there is not a clear answer about which scenario is more favorable, and it even depends on the number of subintervals .
1. Modify the Bisection function provided in class and write two new routines, Trisection and Quadsection. These new routines should have to find roots like Bisection does, but using three and four subintervals per iteration respectively.
Test your routines using the next function
Be aware this function has analytic roots, so you can compare directly your results.
2. Make a plot and illustrate the behaviour of Bisection, Trisection and Quadsection in terms of the number of iterations.
3. For a float32 precision, how long does each method take?
4. Compare all the previous routines with the function offered by Scipy (scipy.optimize.bisect)
Question:
If you were going to use one of these routines for a professional usage, which one would you choose and why?