Gamma { private Gamma() { } private  Gamma(); static double beta(double alpha, double beta); static double gamma(double x); static double incompleteBeta(double alpha, double beta, double xx); static double incompleteGamma(double alpha, double x); static double incompleteGammaComplement(double alpha, double x); static double logGamma(double x);  }
@Test public void testGamma() { double[] x = {1, 2, 5, 10, 20, 50, 100}; double[] expected = { 1.000000e+00, 1.000000e+00, 2.400000e+01, 3.628800e+05, 1.216451e+17, 6.082819e+62, 9.332622e+155 }; for (int i = 0; i < x.length; i++) { assertEquals(expected[i], Gamma.gamma(x[i]), expected[i] * 1.0e-5); assertEquals(gammaInteger(x[i]), Gamma.gamma(x[i]), expected[i] * 1.0e-5); assertEquals(gammaInteger(x[i]), Math.exp(Gamma.logGamma(x[i])), expected[i] * 1.0e-5); } }