discrete_uniform_pdf
Evaluates the discrete uniform probability density function (PDF).
Synopsis
#include<imsls.h>
floatimsls_f_discrete_uniform_pdf(int ix, int n)
The type double function is imsls_d_discrete_uniform_pdf.
Required Arguments
intix (Input)
Argument for which the discrete uniform PDF is to be evaluated. ix must be positive.
intn (Input)
Scale parameter. nmust be positive.
Return Value
The probability that a random variable from a discrete uniform distribution with scale parameter n will be equal to ix. A value of NaN is returned if an input value is in error.
Description
The function discrete_uniform_pdf evaluates the discrete uniform probability density function (PDF) with scale parameter n, defined
where I = ix and N = n. As a convenience to the user, discrete_uniform_pdf accepts values of I > N, returning p = 0. discrete_uniform_pdfreturns an error message for values of I 0.
Example
In this example, we evaluate the discrete uniform PDF at ix = 3, n = 5.
 
#include <imsls.h>
#include <stdio.h>
int main()
{
int ix = 3;
int n = 5;
float p;
p = imsls_f_discrete_uniform_pdf(ix, n);
printf("The probability density of a discrete ");
printf("uniform\nrandom variable with ");
printf("scale parameter n = %1i\n", n);
printf("and value ix = %1d is %6.4f\n\n", ix, p);
}
Output
 
The probability density of a discrete uniform
random variable with scale parameter n = 5
and value ix = 3 is 0.2000