UNDPR
This function evaluates the discrete uniform probability density function.
Function Return Value
UNDPR — Function value, the probability that a random variable from a uniform distribution having scale parameter N will be equal to IX. (Output)
Required Arguments
IX — Argument for which the discrete uniform probability density function is to be evaluated. (Input)
N — Scale parameter. N must be greater than 0. (Input)
FORTRAN 90 Interface
Generic: UNDPR (IX, N)
Specific: The specific interface names are S_UNDPR and D_UNDPR.
FORTRAN 77 Interface
Single: UNDPR (IX, N)
Double: The double precision name is DUNDPR.
Description
The discrete uniform PDF is defined for positive integers x in the range 1, …, N, N > 0. It has the value , and y = 0, for x > N. Allowing the function to accept values of x resulting in y = 0, for x > N is provided as a convenience to the user. Values of x ≤ 0 are errors.
Example
In this example, we evaluate the discrete uniform probability density function at IX = 3, N = 5.
USE UMACH_INT
USE UNDPR_INT
IMPLICIT NONE
INTEGER NOUT, IX, N
REAL PR
CALL UMACH(2, NOUT)
IX = 3
N = 5
PR = UNDPR(IX, N)
WRITE (NOUT, 99999) IX, N, PR
99999 FORMAT (' UNDPR(', I2, ', ', I2, ') = ', F6.4)
END
Output
UNDPR( 3, 5) = 0.2000