@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction2() { ROOT_FINDER.getRoot((DoubleFunction1D) null, X1, X2); }
private IsdaCompliantDiscountCurveCalibrator(double accuracy) { this.rootFinder = new NewtonRaphsonSingleRootFinder(accuracy); }
/** * Uses the function and its derivative. * @param function The function, not null * @param derivative The derivative, not null * @param x1 The first bound of the root, not null * @param x2 The second bound of the root, not null * @return The root * @throws MathException If the root is not found in 1000 attempts; if the Newton * step takes the estimate for the root outside the original bounds. */ public Double getRoot(Function<Double, Double> function, Function<Double, Double> derivative, Double x1, Double x2) { checkInputs(function, x1, x2); ArgChecker.notNull(derivative, "derivative"); return getRoot(DoubleFunction1D.from(function), DoubleFunction1D.from(derivative), x1, x2); }
checkInputs(function, x1, x2); ArgChecker.notNull(derivative, "derivative function"); double y1 = function.applyAsDouble(x1);
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction6() { ROOT_FINDER.getRoot((DoubleFunction1D) null, X); }
private static final NewtonRaphsonSingleRootFinder ROOT_FINDER = new NewtonRaphsonSingleRootFinder();
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess1() { ROOT_FINDER.getRoot(F1, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess3() { ROOT_FINDER.getRoot(F1, DF1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher1() { ROOT_FINDER.getRoot(F2, 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 testEnclosedExtremum() { ROOT_FINDER.getRoot(F2, DF2, X1, X3); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction5() { ROOT_FINDER.getRoot((Function<Double, Double>) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullLower1() { ROOT_FINDER.getRoot(F2, (Double) null, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher2() { ROOT_FINDER.getRoot(F1, X1, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction4() { ROOT_FINDER.getRoot(null, DF1, X1, X2); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullHigher4() { ROOT_FINDER.getRoot(F1, DF1, X1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDerivative4() { ROOT_FINDER.getRoot(F2, (Function<Double, Double>) null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullInitialGuess2() { ROOT_FINDER.getRoot(F2, (Double) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction1() { ROOT_FINDER.getRoot((Function<Double, Double>) null, X1, X2); }