|
|
|
@ -91,6 +91,13 @@ namespace MathNet.Numerics.UnitTests.RootFindingTests |
|
|
|
Assert.AreEqual(Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f3, df3, 1, 1.99, 1e-14, 100, 20)); |
|
|
|
Assert.AreEqual(Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f3, df3, -1.5, 1.99, 1e-14, 100, 20)); |
|
|
|
Assert.AreEqual(Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f3, df3, 1, 6, 1e-14, 100, 20)); |
|
|
|
|
|
|
|
Func<double, double> f4 = x => 1/(2 - x) - x + 6; |
|
|
|
Func<double, double> df4 = x => 1/(x*x - 4*x + 4) - 1; |
|
|
|
Assert.AreEqual(4 + Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f4, df4, 5, 6, 1e-14, 100, 20), 1e-14); |
|
|
|
Assert.AreEqual(4 - Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f4, df4, 2.01, 3, 1e-14, 100, 20)); |
|
|
|
Assert.AreEqual(4 - Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f4, df4, 2.01, 5, 1e-14, 100, 20)); |
|
|
|
Assert.AreEqual(4 - Math.Sqrt(3), HybridNewtonRaphson.FindRoot(f4, df4, -2, 4, 1e-14, 100, 20)); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
|