up previous next
binomial

binomial coefficient

Syntax
binomial(N:INT or POLY, K:INT):INT

Description
This function computes the binomial coefficient, N choose K according to the formula (N)(N-1)(N-2)...(N-K+1) / K!

The same formula is used if N is a polynomial. The integer K cannot be negative.

Example
/**/  binomial(4,2);
6

/**/  binomial(-4,3);
-20

/**/  binomial(x^2+2*y,3);
1/6x^6 + x^4y - 1/2x^4 + 2x^2y^2 - 2x^2y + 4/3y^3 + 1/3x^2 - 2y^2 + 2/3y

/**/  It = (x^2+2y)(x^2+2y-1)(x^2+2y-2)/6;
true

See Also