-
Notifications
You must be signed in to change notification settings - Fork 46
binomial_coefficient
Fabian Kindermann edited this page Apr 2, 2021
·
10 revisions
function binomial_coefficient(n, k)
Calculates the binomial coefficient
-
integer :: n
Total number of elements. Note that this input parameter can not be negative. -
integer :: k
Size of the subset of elements to draw without replacement. Note that needs to be an element of .
-
real*8 :: binomial_coefficient
The value of the binomial coefficient. Note that we use areal*8
number, as it has the larger range than an integer. If necessary, you can convert the number back into integer using the intrinsic Fortran functionint
.
- For further reading refer to:
- Toral, R. & Colet, P. (2014). Stochastic Numerical Methods: An Introduction for Students and Scientists. Weinheim: Wiley.