Hypergeometric { public double lNchooseK(int n, int k) { double ans; ans = logfact(n) - logfact(k) - logfact(n - k); return ans; } Hypergeometric(); double phypergeometric(int n, double p, int k, int r); double phypergeometric(int m, int m_t, int n, int n_t); double dhyper(int x, int N, int M, int n); double phyper(int x, int N, int M, int n, boolean lowerTail); double lNchooseK(int n, int k); double logfact(int i);  }
@Test void test_lchoose() { double expected = 3.044522; assertEquals(expected, hypergeometric.lNchooseK(7, 2), EPSILON); }