binomialCoefficient¶
Evaluates the binomial coefficient.
Synopsis¶
binomialCoefficient (n, m)
Required Arguments¶
- int
n
(Input) - First parameter of the binomial coefficient. Argument
n
must be nonnegative. - int
m
(Input) - Second parameter of the binomial coefficient. Argument
m
must be nonnegative.
Description¶
The binomial function is defined to be
\binom{n}{m} = \frac{n!}{m!(n-m)!}
with n ≥ m ≥ 0. Also, n must not be so large that the function overflows.
Example¶
In this example, \left( \begin{array}{c} 9 \\ 5 \end{array} \right) is computed and printed.
from __future__ import print_function
from pyimsl.stat.binomialCoefficient import binomialCoefficient
ans = binomialCoefficient(9, 5)
print("Binomial coefficient = ", ans)
Output¶
Binomial coefficient = 126.0