exponentialCdf¶
Evaluates the exponential cumulative distribution function (CDF).
Synopsis¶
exponentialCdf (x, b)
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 exponentialCdf
evaluates the exponential cumulative
distribution function (CDF). This function is a special case of the gamma
CDF
\[G(x) = \frac{1}{\Gamma(a)} \int_0^x e^{-\tfrac{t}{b}} t^{a-1} dt\]
Setting \(a=1\) and applying the scale parameter b = b
yields the
exponential CDF
\[F(x) = \int_0^x e^{-\tfrac{t}{b}} dt = 1 - e^{-\tfrac{x}{b}}\]
This relationship between the gamma and exponential CDFs is used by
exponentialCdf
.
Example¶
In this example, we evaluate the exponential CDF at x
= 2.0, b
=
1.0.
from __future__ import print_function
from numpy import *
from pyimsl.stat.exponentialCdf import exponentialCdf
x = 2.0
b = 1.0
p = exponentialCdf(x, b)
print("The probability that exponential random ")
print("variable X with scale parameter b = %3.1f" % b)
print("is less than or equal to %3.1f" % x)
print("is %6.4f" % 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