/** * This returns the combination of n choose r * @param n the number of elements overall * @param r the number of elements to choose * @return the amount of possible combinations for this applyTransformToDestination of elements */ public static double combination(double n,double r) { double nFac=MathUtils.factorial(n); double rFac=MathUtils.factorial(r); double nMinusRFac=MathUtils.factorial((n-r)); return nFac/(rFac * nMinusRFac); }//end combination
/** * This returns the permutation of n choose r. * * @param n the n to choose * @param r the number of elements to choose * @return the permutation of these numbers */ public static double permutation(double n, double r) { double nFac = MathUtils.factorial(n); double nMinusRFac = MathUtils.factorial((n - r)); return nFac / nMinusRFac; }//end permutation
/** * This returns the permutation of n choose r. * @param n the n to choose * @param r the number of elements to choose * @return the permutation of these numbers */ public static double permutation(double n,double r) { double nFac=MathUtils.factorial(n); double nMinusRFac=MathUtils.factorial((n-r)); return nFac/nMinusRFac; }//end permutation
/** * This returns the combination of n choose r * * @param n the number of elements overall * @param r the number of elements to choose * @return the amount of possible combinations for this applyTransformToDestination of elements */ public static double combination(double n, double r) { double nFac = MathUtils.factorial(n); double rFac = MathUtils.factorial(r); double nMinusRFac = MathUtils.factorial((n - r)); return nFac / (rFac * nMinusRFac); }//end combination