Class BinomialCoefficientDouble
java.lang.Object
org.apache.commons.numbers.combinatorics.BinomialCoefficientDouble
Representation of the
binomial coefficient, as a
double.
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 binomial coefficient.
-
Method Details
-
value
Computes the binomial coefficient.The largest value of
nfor which all coefficients can fit into adoubleis 1029. Largernmay result in infinity depending on the value ofk.Any
min(k, n - k) >= 515cannot fit into adoubleand will result in infinity.- Parameters:
n- Size of the set.k- Size of the subsets to be counted.- Returns:
n choose k.- Throws:
IllegalArgumentException- ifn < 0,k < 0ork > n.
-