bc

bc returns the Binomial coefficient

Syntax

Description

example

c =bc(n, k) Number of pairs chosen among 6 elements.

Input Arguments

expand all

n — Number of elements. Non negative integer.

Data Types: single|double

k — Items to choose from the set of n elements. Non negative integer.

Data Types: single|double

Output Arguments

expand all

c —The binomial coefficient $n!/k!(n-k)!$. Integer

This is the coefficient of the $x^k$ term in the polynomial expansion of the binomial power $(1 + x)^n$. This is also the so called choose function of n and k (nchoosek in MATLAB), i.e. the number of k-element subsets (the k-combinations) of a set of n objects. When a coefficient is large, results may be inexact.

The result is only accurate to 15 digits for double-precision inputs in 32bits computers.

References

Knuth, D. E. (1997). "The Art of Computer Programming", Volume 1:

Fundamental Algorithms, Third ed. Addison-Wesley. [pp. 52--74].

Acknowledgements

Matlab function bc has been adapted to this toolbox by FSDA team

See Also

This page has been automatically generated by our routine publishFS