Module Root1D

module Root1D: sig .. end
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 accuracy 6. *. epsilon_float *. abs_float(x) +. tol.
Raises Invalid_argument if f(a) *. f(b) > 0..
tol : desired length of the interval of uncertainty of the final result (must be >= 0). Default: sqrt epsilon_float.

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

val bisection : ?good_enough:(float -> float -> float -> float -> bool) ->
(float -> float) -> float -> float -> float
bisection f a b find an approximation of a root in the interval [a,b] using the bisection algorithm.
Raises Invalid_argument if f(a) *. f(b) > 0..
good_enough : is a function taking as arguments the current a, b, f(a) and f(b) and returning whether they define a good enough approximation.
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.
Raises Failure if the derivative vanishes during the computations.
good_enough : takes as arguments the current approximation x, the previous approximation xprev, and f(x) and returns whether x is a good enough approximation. Default: abs_float(f x) < sqrt epsilon_float.