Previous Up Next

6.6.2  Binomial coefficients: binomial comb nCr

The comb command computes the binomial coefficients.
nCr is a synonyms for comb.


Example.
Input:

comb(5,2)

Output:

10


Remark.
The binomial command (see Section 9.4.3) can also compute the binomial coefficients, but unlike comb and nCr it can take an optional third argument, a real number a, to compute the binomial distribution. In this case binomial(n,p,a) returns (pn) ap(1−a)np, the probability of p successes in n independent Bernoulli trials, where each trial has a probability a of success.


Example.
Input:

binomial(5,2,0.5)

Output:

0.3125

Previous Up Next