exponentialPdf¶
Evaluates the exponential probability density function (PDF).
Synopsis¶
exponentialPdf (x, b)
Required Arguments¶
- float
x
(Input) - Argument for which the exponential PDF is to be evaluated.
x
must be non-negative. - float
b
(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 exponentialPdf
evaluates the exponential probability
density function. The exponential distribution is a special case of the
gamma distribution and is defined as
\[f(x|b) = \mathit{\Gamma}(x|1,b) = \frac{1}{b} e^{-\tfrac{x}{b}}\]
Example¶
In this example, we evaluate the exponential PDF at x
= 2.0, b
=
1.0.
from __future__ import print_function
from numpy import *
from pyimsl.stat.exponentialPdf import exponentialPdf
x = 2.0
b = 1.0
p = exponentialPdf(x, b)
print("The probability density of exponential random variable X")
print("with scale parameter b = %3.1f and value x = %3.1f is %6.4f" %
(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