Class LogBinomialCoefficient
java.lang.Object
org.apache.commons.numbers.combinatorics.LogBinomialCoefficient
public class LogBinomialCoefficient
extends java.lang.Object
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.-
Constructor Summary
Constructors Constructor Description LogBinomialCoefficient() -
Method Summary
Modifier and Type Method Description static doublevalue(int n, int k)Computes the logarithm of the binomial coefficient.
-
Constructor Details
-
LogBinomialCoefficient
public LogBinomialCoefficient()
-
-
Method Details
-
value
public static double value(int n, int k)Computes the logarithm of the binomial coefficient. The largest value ofnfor which all coefficients can fit into alongis 66.- Parameters:
n- Size of the set.k- Size of the subsets to be counted.- Returns:
log(n choose k).- Throws:
java.lang.IllegalArgumentException- ifn < 0.java.lang.IllegalArgumentException- ifk > n.java.lang.IllegalArgumentException- if the result is too large to be represented by along.
-