discrete_uniform_cdf

Evaluates the discrete uniform cumulative distribution function (CDF).

Synopsis

#include<imsls.h>

floatimsls_f_discrete_uniform_cdf(int ix, int n)

The type double function is imsls_d_discrete_uniform_cdf.

Required Arguments

intix (Input)
Argument for which the discrete uniform CDF is to be evaluated. ix must be positive.

intn (Input)
Scale parameter. n must be positive.

Return Value

The probability that a discrete uniform random variable takes a value less than or equal to ix. A value of NaN is returned if an input value is in error.

Description

The function discrete_uniform_cdf evaluates the discrete uniform cumulative distribution function (CDF) with scale parameter n, defined

 

where I = ix and N = n.

Example

In this example, we evaluate the discrete uniform CDF 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_cdf(ix, n);

printf("The probability that a discrete uniform ");

printf("random variable\nwith scale ");

printf("parameter n = %1i is less than ", n);

printf("or equal to %li\nis %6.4f\n\n", ix, p);

}

Output

 

The probability that a discrete uniform random variable

with scale parameter n = 5 is less than or equal to 3

is 0.6000