BINOM
This function evaluates the binomial coefficient.
Function Return Value
BINOM — Function value. (Output)
See Comment 1.
Required Arguments
N — First parameter of the binomial coefficient. (Input)
N must be nonnegative.
M — Second parameter of the binomial coefficient. (Input)
M must be nonnegative and less than or equal to N.
FORTRAN 90 Interface
Generic: BINOM (N, M)
Specific: The specific interface names are S_BINOM and D_BINOM.
FORTRAN 77 Interface
Single: BINOM (N, M)
Double: The double precision function name is DBINOM.
Description
The binomial function is defined to be
with n  m  0. Also, n must not be so large that the function overflows.
Comments
1. If the generic version of this function is used, the immediate result must be stored in a variable before use in an expression. For example:
X = BINOM(9, 5) Y = SQRT(X)
must be used rather than
Y = SQRT(BINOM(9, 5)).
If this is too much of a restriction on the programmer, then the specific name can be used without this restriction.
2. To evaluate binomial coefficients for nonintegral values of the arguments, the complete beta function or log beta function should be used.
Example
In this example, is computed and printed.
 
USE BINOM_INT
USE UMACH_INT
 
IMPLICIT NONE
! Declare variables
INTEGER M, N, NOUT
REAL VALUE
! Compute
N = 9
M = 5
VALUE = BINOM(N, M)
! Print the results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) N, M, VALUE
99999 FORMAT (' BINOM(', I1, ',', I1, ') = ', F6.2)
END
Output
 
BINOM(9,5) = 126.00