@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeA1() { new IncompleteBetaFunction(-A, B); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeB2() { new IncompleteBetaFunction(A, -B, EPS, MAX_ITER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeEps() { new IncompleteBetaFunction(A, B, -EPS, MAX_ITER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeA2() { new IncompleteBetaFunction(-A, B, EPS, MAX_ITER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeB1() { new IncompleteBetaFunction(A, -B); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNegativeIter() { new IncompleteBetaFunction(A, B, EPS, -MAX_ITER); }
/** * Creates an instance. * * @param a the a value * @param b the b value */ public InverseIncompleteBetaFunction(double a, double b) { ArgChecker.notNegativeOrZero(a, "a"); ArgChecker.notNegativeOrZero(b, "b"); _a = a; _b = b; _beta = new IncompleteBetaFunction(a, b); }
@Test public void test() { final double a = RANDOM.nextDouble(); final double b = RANDOM.nextDouble(); final double x = RANDOM.nextDouble(); final Function<Double, Double> f1 = new IncompleteBetaFunction(a, b); final Function<Double, Double> f2 = new IncompleteBetaFunction(b, a); assertEquals(f1.apply(0.), 0, EPS); assertEquals(f1.apply(1.), 1, EPS); assertEquals(f1.apply(x), 1 - f2.apply(1 - x), EPS); } }