Beispiel #1
0
def choose(n, k):
    """ n choose k
    # example, say want to know ways to form committee of 3 students from 20 total students
    >>> choose(20,3)
    1140.0
    """
    return factorial(n) / (factorial(k) * factorial(n - k))
Beispiel #2
0
def choose(n,k):
    """ n choose k
    # example, say want to know ways to form committee of 3 students from 20 total students
    >>> choose(20,3)
    1140.0
    """
    return factorial(n) / (factorial(k)*factorial(n-k))
Beispiel #3
0
 def test_factorial(self):
     self.assertEqual(maths.factorial(5), 120)
Beispiel #4
0
 def test_factorial(self):
    self.assertEqual(maths.factorial(5), 120)
Beispiel #5
0
#!/usr/bin/env python

# system stuff
import sys
# local stuff
from pdapt_lib.machine_learning import maths

print('using python version = ')
print(sys.version)


print(maths.vector_add([1,1,1],[1,2,3]))
print("testing factorial: ", maths.factorial(1000))
print("testing factorial: ", maths.factorial(100))