binomial
Binomial coefficients
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
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 ≤ k ≤ n.
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 floatingpoint number, then a floatingpoint value is returned.
In all other cases, a symbolic call of binomial
is
returned.
A floatingpoint value is returned if both arguments are numerical and at least one of them is a floatingpoint value.
When called with floatingpoint arguments, the function is sensitive
to the environment variable DIGITS
which determines the numerical
working precision.
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 floatingpoint arguments:
binomial(235/123, 3.0), binomial(3.0, 1 + I)
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 floatingpoint numbers:
binomial(sin(3), 5/4), float(binomial(sin(3), 5/4))
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)

Arithmetical expression.