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.

Return Value

The binomial coefficient

\binom{n}{m}

is returned.

Description

The binomial function is defined to be

\binom{n}{m} = \frac{n!}{m!(n-m)!}

with nm ≥ 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