lib/muflax/math.rb in muflax-0.3.13 vs lib/muflax/math.rb in muflax-0.3.14

- old
+ new

@@ -25,7 +25,15 @@ n = 1 n += 1 while θ(n) < exceptions n end alias :sufficient :sufficiency + + def factorial n + (2..n).reduce(1){|f, x| f * x} + end + + def choose k, n + Math.factorial(n) / (Math.factorial(k) * Math.factorial(n - k)) + end end end