diff --git a/src/Numerics/FindRoots.cs b/src/Numerics/FindRoots.cs index deef6948..1dd1a80d 100644 --- a/src/Numerics/FindRoots.cs +++ b/src/Numerics/FindRoots.cs @@ -38,6 +38,7 @@ namespace MathNet.Numerics public static double OfFunction(Func f, double lowerBound, double upperBound, double accuracy = 1e-8) { double root; + if (Brent.TryFindRoot(f, lowerBound, upperBound, accuracy, 100, out root)) { return root; @@ -54,11 +55,13 @@ namespace MathNet.Numerics public static double OfFunctionAndDerivative(Func f, Func df, double lowerBound, double upperBound, double accuracy = 1e-8) { double root; + if (RobustNewtonRaphson.TryFindRoot(f, df, lowerBound, upperBound, accuracy, 100, 20, out root)) { return root; } - if (Brent.TryFindRoot(f, lowerBound, upperBound, accuracy, 100, out root)) + + if (Bisection.TryFindRoot(f, lowerBound, upperBound, accuracy, 100, out root)) { return root; }