diff --git a/src/FSharp/FindRoots.fs b/src/FSharp/FindRoots.fs index 9ec6173f..5cd71f0a 100644 --- a/src/FSharp/FindRoots.fs +++ b/src/FSharp/FindRoots.fs @@ -41,11 +41,26 @@ module FindRoots = // direct algorithms + let bisection maxIterations accuracy lowerBound upperBound (f:double->double) = + match Bisection.TryFindRoot(tobcl f, lowerBound, upperBound, accuracy, maxIterations) with + | true, root -> Some root + | false, _ -> None + let brent maxIterations accuracy lowerBound upperBound (f:double->double) = match Brent.TryFindRoot(tobcl f, lowerBound, upperBound, accuracy, maxIterations) with | true, root -> Some root | false, _ -> None + let newtonRaphson maxIterations accuracy lowerBound upperBound (f:double->double) (df:double->double) = + match NewtonRaphson.TryFindRoot(tobcl f, tobcl df, 0.5 * (lowerBound + upperBound), lowerBound, upperBound, accuracy, maxIterations) with + | true, root -> Some root + | false, _ -> None + + let newtonRaphsonGuess maxIterations accuracy guess (f:double->double) (df:double->double) = + match NewtonRaphson.TryFindRoot(tobcl f, tobcl df, guess, Double.MinValue, Double.MaxValue, accuracy, maxIterations) with + | true, root -> Some root + | false, _ -> None + let newtonRaphsonRobust maxIterations subdivision accuracy lowerBound upperBound (f:double->double) (df:double->double) = match RobustNewtonRaphson.TryFindRoot(tobcl f, tobcl df, lowerBound, upperBound, accuracy, maxIterations, subdivision) with | true, root -> Some root