Grade of Service Probability Function Python
Pure Python


You should use a for loop rather than a while loop.
You can use a generator comprehension to build all prob's.
You can use sum to get the sum.




def grade_of_service(n, p, c):
    return sum(binom(n, k)*(p**k)*((1-p)**(n-k)) for k in range(c+1, n+1))


Numpy and friends


Use numpy.arange rather than range.
Write out the equation same as above, just not in a comprehension.
Change sum to numpy.sum.




import numpy


def grade_of_service(n, p, c):
    k = numpy.arange(c+1, n+1)
    return numpy.sum(binom(n, k)*(p**k)*((1-p)**(n-k)))


This has a problem with numbers that exceed a certain size, as numpy numbers are finite.