Page 1 of 1

Noninteger binomial coefficients

Posted: Wed Dec 01, 2010 2:06 am
by miranda
how can i calculate the value of C(5,0.5)? @binom function expects integer values for both n and k.

Re: Noninteger binomial coefficients

Posted: Wed Dec 01, 2010 2:41 am
by trubador
The following piece of code uses the generalized version of the computation of binomial coefficents and should do the trick for you:

Code: Select all

call gbinom(5,0.5) subroutine gbinom(scalar n,scalar k) scalar gbcoef = @exp(@gammalog(n+1)-@gammalog(k+1)-@gammalog(n-k+1)) endsub

Re: Noninteger binomial coefficients

Posted: Thu Dec 02, 2010 4:53 am
by miranda
great, thanks!!