Esempio n. 1
0
 /// <summary>
 /// Count the number of possible combinations without repetition.
 /// The order does not matter and each object can be chosen only once.
 /// </summary>
 /// <param name="n">Number of elements in the set.</param>
 /// <param name="k">Number of elements to choose from the set. Each element is chosen at most once.</param>
 /// <returns>Maximum number of combinations.</returns>
 public static double Combinations(int n, int k)
 {
     return(SpecialFunctions.Binomial(n, k));
 }
Esempio n. 2
0
 /// <summary>
 /// Count the number of possible permutations (without repetition).
 /// </summary>
 /// <param name="n">Number of (distinguishable) elements in the set.</param>
 /// <returns>Maximum number of permutations without repetition.</returns>
 public static double Permutations(int n)
 {
     return(SpecialFunctions.Factorial(n));
 }