rootfinding: find roots of scalar functions¶
rootfinding finds roots by bisecting a bracketing interval until the value of the function can be considered sufficiently close to zero. The scheme differs slightly from the implementation of bisection in SciPy: it is better suited for cases where a maximum acceptable residual is a more useful termination criterion than a tolerance for the argument variable, and can lead to fewer function evaluations overall.
The small library also contains functionality to automatically search for a bracket of a root when one is not known. While the library will always start by checking the inputs, it is possible to avoid redundant function calls by providing known values of the function—similarly, objects returned (and exceptions raised) by the library helpfully include function values that may be of interest.
rootfinding was first developed as an internal module of our other project Fronts.
To use this library, install
rootfinding from PyPI as
$ pip install rootfinding. Alternatively, you may copy the
rootfinding.py file from the source code directly into your project (you must retain the copyright notice and license).