Module Root1D

1D Root finding algorithms.

val brent : ?⁠tol:float ‑> (float ‑> float) ‑> float ‑> float ‑> float

brent f a b returns an approximation x of a root of f in the interval [a,b] with absolute accuracy 6. *. epsilon_float *. abs_float(x) +. tol.

val bisection : ?⁠eps:float ‑> (float ‑> float) ‑> float ‑> float ‑> float

bisection f a b find an approximation of a root in the interval [a,b] using the bisection algorithm.

val illinois : ?⁠eps:float ‑> (float ‑> float) ‑> float ‑> float ‑> float

illinois f a b find an approximation of a root in the interval [a,b] using the Illinois algorithm (which is the Regula Falsi method with a small twist). Order of convergence: ³√3 ≈ 1.442.

val newton : ?⁠good_enough:(float ‑> float ‑> float ‑> bool) ‑> (float ‑> float * float) ‑> float ‑> float

newton f_f' x0 returns an approximate root of f close to the initial guess x0 using Newton's method. f_f' is a function such that f_f' x returns the couple (f x, f' x) where f' x is the derivative of f at x.

val brent2 : ?⁠tol:float ‑> (float ‑> float * int) ‑> float ‑> float ‑> float

brent2 f a b finds a zero of the function f in the same way brent f a b does except that f x returns the couple (y, z) for the number y * 2**z. Thus underflow and overflow can be avoided for a function with large range.

Ref.: Brent, R. (1973) Algorithms for Minimization without Derivatives. Englewood Cliffs, NJ: Prentice-Hall.