Brent's method for univariate function optimization.
from brent_search import brent
def func(x, s):
return (x - s)**2 - 0.8
r = brent(lambda x: func(x, 0), -10, 10)
print(r)
The output should be
(0.0, -0.8, 6)
From command line, enter
pip install brent-search
python -c "import brent_search; brent_search.test()"
- http://people.sc.fsu.edu/~jburkardt/c_src/brent/brent.c
- Numerical Recipes 3rd Edition: The Art of Scientific Computing
- https://en.wikipedia.org/wiki/Brent%27s_method
This project is licensed under the MIT License.