Class LogBinomialCoefficient
java.lang.Object
org.apache.commons.numbers.combinatorics.LogBinomialCoefficient
Natural logarithm of the
binomial coefficient.
It is "
n choose k", the number of k-element subsets that
can be selected from an n-element set.-
Method Summary
Modifier and TypeMethodDescriptionstatic doublevalue(int n, int k) Computes the logarithm of the binomial coefficient.
-
Method Details
-
value
Computes the logarithm of the binomial coefficient.This returns a finite result for any valid
n choose k.- Parameters:
n- Size of the set.k- Size of the subsets to be counted.- Returns:
log(n choose k).- Throws:
IllegalArgumentException- ifn < 0,k < 0ork > n.
-