NewtonRaphsonSingleRootFinder extends RealSingleRootFinder { @Override public Double getRoot(final Function1D<Double, Double> function, final Double x1, final Double x2) { Validate.notNull(function, "function"); return getRoot(DoubleFunction1D.from(function), x1, x2); } NewtonRaphsonSingleRootFinder();  NewtonRaphsonSingleRootFinder(final double accuracy); @Override Double getRoot(final Function1D<Double, Double> function, final Double x1, final Double x2); Double getRoot(final Function1D<Double, Double> function, final Double x); Double getRoot(final DoubleFunction1D function, final Double x1, final Double x2); Double getRoot(final DoubleFunction1D function, final Double x); Double getRoot(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative, final Double x1, final Double x2); Double getRoot(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative, final Double x); Double getRoot(final DoubleFunction1D function, final DoubleFunction1D derivative, final Double x1, final Double x2); Double getRoot(final DoubleFunction1D function, final DoubleFunction1D derivative, final Double x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction1() { ROOT_FINDER.getRoot((Function1D<Double, Double>) null, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLower1() { ROOT_FINDER.getRoot(F2, (Double) null, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher1() { ROOT_FINDER.getRoot(F2, X1, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction2() { ROOT_FINDER.getRoot((DoubleFunction1D) null, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLower2() { ROOT_FINDER.getRoot(F1, (Double) null, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher2() { ROOT_FINDER.getRoot(F1, X1, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction3() { ROOT_FINDER.getRoot(null, DF2, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDerivative1() { ROOT_FINDER.getRoot(F2, null, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLower3() { ROOT_FINDER.getRoot(F2, DF2, null, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher3() { ROOT_FINDER.getRoot(F2, DF2, X1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction4() { ROOT_FINDER.getRoot(null, DF1, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDerivative2() { ROOT_FINDER.getRoot(F1, null, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLower4() { ROOT_FINDER.getRoot(F1, DF1, null, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher4() { ROOT_FINDER.getRoot(F1, DF1, X1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEnclosedExtremum() { ROOT_FINDER.getRoot(F2, DF2, X1, X3); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDerivative3() { ROOT_FINDER.getRoot(F1, (DoubleFunction1D) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDerivative4() { ROOT_FINDER.getRoot(F2, (Function1D<Double, Double>) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction5() { ROOT_FINDER.getRoot((Function1D<Double, Double>) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction6() { ROOT_FINDER.getRoot((DoubleFunction1D) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess1() { ROOT_FINDER.getRoot(F1, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess2() { ROOT_FINDER.getRoot(F2, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess3() { ROOT_FINDER.getRoot(F1, DF1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess4() { ROOT_FINDER.getRoot(F2, DF2, null); }
@Test public void test() { assertEquals(ROOT_FINDER.getRoot(F2, DF2, ROOT, X2), ROOT, 0); assertEquals(ROOT_FINDER.getRoot(F2, DF2, X1, ROOT), ROOT, 0); assertEquals(ROOT_FINDER.getRoot(F1, X1, X2), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F1, DF1, X1, X2), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F2, X1, X2), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F2, DF2, X1, X2), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F1, X), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F1, DF1, X), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F2, X), ROOT, EPS); assertEquals(ROOT_FINDER.getRoot(F2, DF2, X), ROOT, EPS); }