exponential_pdf
Evaluates the exponential probability density function (PDF).
Synopsis
#include<imsls.h>
floatimsls_f_exponential_pdf(floatx, floatb)
The type double function is imsls_d_exponential_pdf.
Required Arguments
floatx (Input)
Argument for which the exponential PDF is to be evaluated. x must be non-negative.
floatb (Input)
Scale parameter of the exponential PDF. b must be positive.
Return Value
The value of the exponential probability density function with argument x and scale parameter b. A value of NaN is returned if an input value is in error.
Description
The function imsls_f_exponential_pdf evaluates the exponential probability density function. The exponential distribution is a special case of the gamma distribution and is defined as
Example
In this example, we evaluate the exponential PDF 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_pdf(x,b);
printf("The probability density of exponential ");
printf("random variable X\nwith scale parameter b = ");
printf("%3.1f and value x = %3.1f is %6.4f\n\n", b, x, p);
}
Output
The probability density of exponential random variable X
with scale parameter b = 1.0 and value x = 2.0 is 0.1353