exponential_cdf

Evaluates the exponential cumulative distribution function (CDF).

Synopsis

#include<imsls.h>

floatimsls_f_exponential_cdf(float x, float b)

The type double function is imsls_d_exponential_cdf.

Required Arguments

float x (Input)
Argument for which the exponential CDF is to be evaluated. x must be non-negative.

float b (Input)
Scale parameter of the exponential CDF.   b must be positive.

Return Value

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

Description

The function imsls_f_exponential_cdf evaluates the exponential cumulative distribution function (CDF).  This function is a special case of the gamma CDF

 

Setting a=1 and applying the scale parameter b = b yields the exponential CDF

 

This relationship between the gamma and exponential CDFs is used by imsls_f_exponential_cdf.

Example

In this example, we evaluate the exponential CDF at x = 2.0, b = 1.0.

 

#include <imsls.h>

#include <stdio.h>

 

int main()

{

float x = 2.0;

float b = 1.0;

float p;

 

p = imsls_f_exponential_cdf(x,b);

printf("The probability that exponential random ");

printf("variable X with\nscale parameter b = ");

printf("%3.1f is less than or equal to %3.1f", b, x);

printf("\nis %6.4f\n\n", p);

}

Output

The probability that exponential random variable X with

scale parameter b = 1.0 is less than or equal to 2.0

is 0.8647