up previous next
binomial

binomial coefficient

Syntax
binomial(N: INT, K: INT): INT
binomial(N: RINGELEM, K: INT): RINGELEM

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/6)*x^6 +x^4*y +(-1/2)*x^4 +2*x^2*y^2 -2*x^2*y +(4/3)*y^3 +(1/3)*x^2 -2*y^2 +(2/3)*y

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

See Also