roots- Root-finding algorithms (1-dimensional)

Safe HaskellSafe-Inferred




data SecantMethod a b Source

Iteratively refine 2 estimates x1, x2 of a root of f until total convergence (which may or may not ever be achieved) using the secant method.


(Fractional a, Ord a) => RootFinder SecantMethod a a 
(Eq a, Eq b) => Eq (SecantMethod a b) 
(Show a, Show b) => Show (SecantMethod a b) 

secant :: (Ord a, Fractional a) => (a -> a) -> a -> a -> a -> Either (SecantMethod a a) aSource

secant f x1 x2 xacc: Using the secant method, return the root of a function thought to lie between x1 and x2. The root is refined until its accuracy is +-xacc.