binomial
compute binomial coefficients
Calling Sequence
Parameters
Description
Examples
binomial(n, r)
nr
n, r
-
expressions
The binomial(n,r) function computes binomial coefficients.
You can enter the command binomial using either the 1-D or 2-D calling sequence. For example, binomial(n, 2) is equivalent to n2 .
If the arguments are both non-negative integers with 0≤r≤n, then nr=n!r!⁢n−r!, which is the number of distinct sets of r objects that can be chosen from n distinct objects.
If n and r are integers that do not satisfy 0≤r≤n, or n and r are rationals or floating-point numbers, then the general definition is used, that is,
nr=Γ⁡n+1Γ⁡r+1⁢Γ⁡n−r+1
At all points n,r where none of n, r, and n−r is a negative integer, the above definition is equivalent to:
nr=limt→0⁡Γ⁡n+t+1Γ⁡r+1⁢Γ⁡n+t−r+1
In the case that n is a negative integer, binomial(n,r) is defined by this limit. If r is a negative integer, by the symmetry relation binomial(n,r) = binomial(n,n-r), the above limit is used.
In the case that exactly two of the expressions n, r, and n−r are negative integers, Maple also signals the invalid_operation numeric event, allowing the user to control this singular behavior by catching the event. See numeric_events for more information.
For symbolic arguments, some simplifications, for example, binomial(n, 1) = n, can be made, but typically binomial returns unevaluated.
For positive integer arguments, binomial is computed using GMP. A limited number of previous computed values will be cached and new values will be computed using a recurrence formula. In practice that means that it is very fast to compute sequences of binomial coefficients for fixed values of n or r.
binomial⁡4,2
6
binomial⁡2,12
163⁢π
binomial⁡2.1,2+3⁢I
−56.56167619−98.27156511⁢I
binomial⁡n,2
n2
expand⁡
12⁢n2−12⁢n
NumericStatus⁡invalid_operation=false:
binomial⁡−3,5
−21
NumericStatus⁡invalid_operation
true
computing sequences of binomial coefficients is optimized to be faster than computing each one in isolation
seq⁡binomial⁡100,i,i=50..60
100891344545564193334812497256,98913082887808032681188722800,93206558875049876949581681100,84413487283064039501507937600,73470998190814997343905056800,61448471214136179596720592960,49378235797073715747364762200,38116532895986727945334202400,28258808871162574166368460400,20116440213369968050635175200,13746234145802811501267369720
See Also
combinat
combinat[multinomial]
combinat[numbcomb]
expand
GAMMA
initialfunctions
numeric_events
NumericStatus
Download Help Document