Incremental search
A crude method of solving a nonlinear function is by doing an incremental search. Using an arbitrarily starting point , we can obtain values of
for every increment of
. We assume that the values of
,
,
… are going in the same direction as indicated by their sign. Once the sign changes, a solution is deemed as found. Otherwise, the iterative search terminates when it crosses the boundary point
.
A pictorial example of the root-finder method for iteration is given in the following graph:
![](https://static.packt-cdn.com/products/9781784394516/graphics/B03898_03_37a.jpg)
An example can be seen from the Python code:
''' Python code: Incremental search method ''' """ An incremental search algorithm """ import numpy as np def incremental_search(f, a, b, dx): """ :param f: The function to solve :param a: The left boundary x-axis value :param b: The right boundary x-axis value :param dx: The incremental value in searching :return: The x-axis value of the root, number of iterations used """ fa = f(a) c...