Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 1.4.0.0 (1.4.0.0)
Syntax
| C# | Visual Basic | Visual C++ |
Parameters
- n
- Int32
The upper argument, which must be non-negative. (The order of the polynomial.)
- m
- Int32
The lower argument, which must be non-negative and less than or equal to n. (The order of the term.)
Return Value
The binomial coefficent C(n,m), also denoted "n choose m".
Remarks
The binomial coefficient C(n,m) is the coefficient of xm in the expansion of (1+x)n.
C(n,m) can also be given a combinatoric intrepretation as the total number of distinct subsets of m items in a set of n items.
Pascal's triangle is a classic representation of binomial coefficients.
| C(0,0) | |||||||
| C(1,0) | C(1,1) | ||||||
| C(2,0) | C(2,1) | C(2,2) | |||||
| C(3,0) | C(3,1) | C(3,2) | C(3,3) | ||||
The relation of an element in Pascal's triangle to its two parent elements is C(n+1,m) = C(n,m-1) + C(n,m). There are many other relationships among binomial coefficients. Among the most computationally useful is B(n,m+1) = (n-m)/(m+1) B(n,m), which can be used to generate all the binomial coefficients in a row of Pascal's triangle (i.e., all the coefficients for a given order polynomial) starting from an outer values B(n,0) = 1 =B(n,n). If you need a series of binomial coefficients, using a recurrion will be more computationally efficient than calling this method for each one.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentOutOfRangeException | n is negative, or m lies outside [0,n]. |