title |
---|
stats_distribution_exponential |
[TOC]
Experimental
An exponential distribution is the distribution of time between events in a Poisson point process.
The inverse scale parameter lambda
specifies the average time between events ((\lambda)), also called the rate of events.
Without argument, the function returns a random sample from the standard exponential distribution (E(\lambda=1)).
With a single argument, the function returns a random sample from the exponential distribution (E(\lambda=\text{lambda})). For complex arguments, the real and imaginary parts are sampled independently of each other.
With two arguments, the function returns a rank-1 array of exponentially distributed random variates.
@note The algorithm used for generating exponential random variates is fundamentally limited to double precision.1
result = [[stdlib_stats_distribution_exponential(module):rvs_exp(interface)]]([lambda] [[, array_size]])
Elemental function
lambda
: optional argument has intent(in)
and is a scalar of type real
or complex
.
If lambda
is real
, its value must be positive. If lambda
is complex
, both the real and imaginary components must be positive.
array_size
: optional argument has intent(in)
and is a scalar of type integer
with default kind.
The result is a scalar or rank-1 array with a size of array_size
, and the same type as lambda
.
If lambda
is non-positive, the result is NaN
.
{!example/stats_distribution_exponential/example_exponential_rvs.f90!}
Experimental
The probability density function (pdf) of the single real variable exponential distribution is:
For a complex variable (z=(x + y i)) with independent real (x) and imaginary (y) parts, the joint probability density function is the product of the corresponding real and imaginary marginal pdfs:2
result = [[stdlib_stats_distribution_exponential(module):pdf_exp(interface)]](x, lambda)
Elemental function
x
: has intent(in)
and is a scalar of type real
or complex
.
lambda
: has intent(in)
and is a scalar of type real
or complex
.
If lambda
is real
, its value must be positive. If lambda
is complex
, both the real and imaginary components must be positive.
All arguments must have the same type.
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. If lambda
is non-positive, the result is NaN
.
{!example/stats_distribution_exponential/example_exponential_pdf.f90!}
Experimental
Cumulative distribution function (cdf) of the single real variable exponential distribution:
For a complex variable (z=(x + y i)) with independent real (x) and imaginary (y) parts, the joint cumulative distribution function is the product of corresponding real and imaginary marginal cdfs:2
result = [[stdlib_stats_distribution_exponential(module):cdf_exp(interface)]](x, lambda)
Elemental function
x
: has intent(in)
and is a scalar of type real
or complex
.
lambda
: has intent(in)
and is a scalar of type real
or complex
.
If lambda
is real
, its value must be positive. If lambda
is complex
, both the real and imaginary components must be positive.
All arguments must have the same type.
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. If lambda
is non-positive, the result is NaN
.
{!example/stats_distribution_exponential/example_exponential_cdf.f90!}
Footnotes
-
Marsaglia, George, and Wai Wan Tsang. "The ziggurat method for generating random variables." Journal of statistical software 5 (2000): 1-7. ↩
-
Miller, Scott, and Donald Childers. Probability and random processes: With applications to signal processing and communications. Academic Press, 2012 (p. 197). ↩ ↩2