Class MathUtils
java.lang.Object
org.unifi.mecvirtualresourceallocation.evaluation.util.MathUtils
Utility class for mathematical operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intbinomialCoefficient(int n, int k) Calculates the binomial coefficient "n choose k".static intsumOfBinomials(int n, int k) Calculates the sum of binomial coefficients from 1 to k for a given n.
-
Method Details
-
sumOfBinomials
public static int sumOfBinomials(int n, int k) Calculates the sum of binomial coefficients from 1 to k for a given n.- Parameters:
n- the number of elementsk- the upper limit for binomial coefficients- Returns:
- the sum of binomial coefficients from 1 to k for a given n
-
binomialCoefficient
public static int binomialCoefficient(int n, int k) Calculates the binomial coefficient "n choose k".- Parameters:
n- the number of elementsk- the number of selections- Returns:
- the binomial coefficient "n choose k"
-