This function evaluates the binomial coefficient.
BINOM — Function
value. (Output)
See Comment
1.
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.
Generic: BINOM (N, M)
Specific: The specific interface names are S_BINOM and D_BINOM.
Single: BINOM (N, M)
Double: The double precision function name is DBINOM.
The binomial function is defined to be
with n ≥ m ≥ 0. Also, n must not be so large that the function overflows.
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.
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
BINOM(9,5) = 126.00
PHONE: 713.784.3131 FAX:713.781.9260 |