
1 Sep
2009
1 Sep
'09
12:42 a.m.
G'day Ralf.
Quoting "Ralf M."
the binomial coefficients are usually used with integers, but it is also possible to get the binomial coefficient of real values (cf. http://en.wikipedia.org/wiki/Binomial_coefficient ).
Maybe this could be added to the boost math library. Here's a sample implementation using standard g++:
template <class T> T Choose(T n, T k) { return exp(lgamma(n + 1.0) - lgamma(k + 1.0) - lgamma(n - k + 1.0)); }
Boost.Math almost has it:
#include