Binomial coefficients

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


binomial(n, k)


binomial(n, k) represents the binomial coefficient .

Binomial coefficients are defined for complex arguments via the gamma function:


With , this coincides with the usual binomial coefficients for integer arguments satisfying 0 ≤ kn.

A symbolic function call is returned if one of the arguments cannot be evaluated to a number of type Type::Numeric. However, for k = 0, k = 1, k = n - 1, and k = n, simplified results are returned for any n.

Let n be a number of type Type::Numerical. If k evaluates to a nonnegative integer, then is returned. If n - k evaluates to a nonnegative integer, then is returned. If k or n - k evaluates to a negative integer, then 0 is returned. If k evaluates to a floating-point number, then a floating-point value is returned. In all other cases, a symbolic call of binomial is returned.

A floating-point value is returned if both arguments are numerical and at least one of them is a floating-point value.

Environment Interactions

When called with floating-point arguments, the function is sensitive to the environment variable DIGITS which determines the numerical working precision.


Example 1

We demonstrate some calls with exact and symbolic input data:

binomial(10, k) $ k=-2..12

binomial(-23/12, 3), binomial(1 + I, 3)

binomial(n, k), binomial(n, 1), binomial(n, 4)

Floating point values are computed for floating-point arguments:

binomial(-235/123, 3.0), binomial(3.0, 1 + I)

Example 2

The expand function handles expressions involving binomial:

binomial(n, 3) = expand(binomial(n, 3))

binomial(2, k) = expand(binomial(2, k))

The float attribute handles binomial if all arguments can be converted to floating-point numbers:

binomial(sin(3), 5/4), float(binomial(sin(3), 5/4))

Example 3

The functions diff and series can handle binomial:

diff(binomial(n, k), n);
diff(binomial(n, k), k);

normal(series(binomial(n, k), k = 0, 3))

series(binomial(2*n, n), n = infinity, 4)


n, k

arithmetical expressions

Return Values

Arithmetical expression.

See Also

MuPAD Functions

Was this topic helpful?