3 changed files with 18 additions and 23 deletions
@ -1,22 +0,0 @@ |
|||
using MathNet.Numerics.RootFinding; |
|||
using NUnit.Framework; |
|||
using System; |
|||
|
|||
namespace MathNet.Numerics.UnitTests.RootFindingTests |
|||
{ |
|||
[TestFixture] |
|||
public class BrentRootFinderTest |
|||
{ |
|||
readonly BrentRootFinder _solver = new BrentRootFinder(100, 1e-14); |
|||
|
|||
[Test] |
|||
public void MultipleRoots() |
|||
{ |
|||
Func<double, double> f = (x) => { return x * x - 4; }; |
|||
_solver.Func = f; |
|||
double root = _solver.Solve(-5, 5); |
|||
|
|||
Assert.AreEqual(0, f(root)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using MathNet.Numerics.RootFinding; |
|||
using NUnit.Framework; |
|||
|
|||
namespace MathNet.Numerics.UnitTests.RootFindingTests |
|||
{ |
|||
[TestFixture] |
|||
public class BrentRootFindingTest |
|||
{ |
|||
[Test] |
|||
public void MultipleRoots() |
|||
{ |
|||
var solver = new BrentRootFinder(100, 1e-14) {Func = x => x*x - 4}; |
|||
double root = solver.Solve(-5, 5); |
|||
Assert.AreEqual(0, solver.Func(root)); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue