Class BinomialCoefficientDouble
- java.lang.Object
-
- org.apache.commons.numbers.combinatorics.BinomialCoefficientDouble
-
public final class BinomialCoefficientDouble extends Object
Representation of the binomial coefficient, as adouble
. It is "n choose k
", the number ofk
-element subsets that can be selected from ann
-element set.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
value(int n, int k)
Computes the binomial coefficient.
-
-
-
Method Detail
-
value
public static double value(int n, int k)
Computes the binomial coefficient.The largest value of
n
for which all coefficients can fit into adouble
is 1029. Largern
may result in infinity depending on the value ofk
.Any
min(k, n - k) >= 515
cannot fit into adouble
and 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 < 0
ork > n
.
-
-