Skip to content

Commit f6b2b32

Browse files
committed
improve readibility, fix equation rendering, update specs
1 parent c9682d0 commit f6b2b32

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

doc/specs/stdlib_stats_distribution_exponential.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,37 @@ Experimental
1414

1515
### Description
1616

17-
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, also called the rate of events.
17+
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.
1818

19-
Without argument the function returns a random sample from the standard exponential distribution `E(1)` with `lambda = 1`.
19+
Without argument, the function returns a random sample from the standard exponential distribution $E(\lambda=1)$.
2020

21-
With a single argument, the function returns a random sample from the exponential distribution `E(lambda)`.
21+
With a single argument, the function returns a random sample from the exponential distribution $E(\lambda=\text{lambda})$.
2222
For complex arguments, the real and imaginary parts are sampled independently of each other.
2323

24-
With two arguments the function returns a rank one array of exponentially distributed random variates.
24+
With two arguments, the function returns a rank-1 array of exponentially distributed random variates.
2525

26-
Note: the algorithm used for generating exponetial random variates is fundamentally limited to double precision. Ref.: Marsaglia, G. & Tsang, W.W. (2000) `The ziggurat method for generating random variables', J. Statist. Software, v5(8).
26+
@note
27+
The algorithm used for generating exponential random variates is fundamentally limited to double precision.[^1]
2728

2829
### Syntax
2930

3031
`result = [[stdlib_stats_distribution_exponential(module):rvs_exp(interface)]]([lambda] [[, array_size]])`
3132

3233
### Class
3334

34-
Function
35+
Elemental function
3536

3637
### Arguments
3738

38-
`lambda`: optional argument has `intent(in)` and is a scalar of type `real` or `complex`. The value of `lambda` has to be non-negative.
39+
`lambda`: optional argument has `intent(in)` and is a scalar of type `real` or `complex`.
40+
If `lambda` is `real`, its value must be positive. If `lambda` is `complex`, both the real and imaginary components must be positive.
3941

4042
`array_size`: optional argument has `intent(in)` and is a scalar of type `integer` with default kind.
4143

4244
### Return value
4345

44-
The result is a scalar or rank one array with a size of `array_size`, and has the same type of `lambda`.
46+
The result is a scalar or rank-1 array with a size of `array_size`, and the same type as `lambda`.
47+
If `lambda` is non-positive, the result is `NaN`.
4548

4649
### Example
4750

@@ -57,15 +60,13 @@ Experimental
5760

5861
### Description
5962

60-
The probability density function (pdf) of the single real variable exponential distribution:
63+
The probability density function (pdf) of the single real variable exponential distribution is:
6164

62-
$$f(x)=\begin{cases} \lambda e^{-\lambda x} &x\geqslant 0 \\\\ 0 &x< 0\end{}$$
65+
$$f(x)=\begin{cases} \lambda e^{-\lambda x} &x\geqslant 0 \\\\ 0 &x< 0\end{cases}$$
6366

64-
For a complex variable (x + y i) with independent real x and imaginary y parts, the joint probability density function
65-
is the product of the corresponding marginal pdf of real and imaginary pdf (for more details, see
66-
"Probability and Random Processes with Applications to Signal Processing and Communications", 2nd ed., Scott L. Miller and Donald Childers, 2012, p.197):
67+
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]
6768

68-
$$f(x+\mathit{i}y)=f(x)f(y)=\begin{cases} \lambda_{x} \lambda_{y} e^{-(\lambda_{x} x + \lambda_{y} y)} &x\geqslant 0, y\geqslant 0 \\\\ 0 &otherwise\end{}$$
69+
$$f(x+\mathit{i}y)=f(x)f(y)=\begin{cases} \lambda_{x} \lambda_{y} e^{-(\lambda_{x} x + \lambda_{y} y)} &x\geqslant 0, y\geqslant 0 \\\\ 0 &\text{otherwise}\end{cases}$$
6970

7071
### Syntax
7172

@@ -80,12 +81,13 @@ Elemental function
8081
`x`: has `intent(in)` and is a scalar of type `real` or `complex`.
8182

8283
`lambda`: has `intent(in)` and is a scalar of type `real` or `complex`.
84+
If `lambda` is `real`, its value must be positive. If `lambda` is `complex`, both the real and imaginary components must be positive.
8385

8486
All arguments must have the same type.
8587

8688
### Return value
8789

88-
The result is a scalar or an array, with a shape conformable to arguments, and has the same type of input arguments.
90+
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`.
8991

9092
### Example
9193

@@ -103,13 +105,11 @@ Experimental
103105

104106
Cumulative distribution function (cdf) of the single real variable exponential distribution:
105107

106-
$$F(x)=\begin{cases}1 - e^{-\lambda x} &x\geqslant 0 \\\\ 0 &x< 0\end{}$$
108+
$$F(x)=\begin{cases}1 - e^{-\lambda x} &x\geqslant 0 \\\\ 0 &x< 0\end{cases}$$
107109

108-
For a complex variable (x + y i) with independent real x and imaginary y parts, the joint cumulative distribution
109-
function is the product of corresponding marginal cdf of real and imaginary cdf (for more details, see
110-
"Probability and Random Processes with Applications to Signal Processing and Communications", 2nd ed., Scott L. Miller and Donald Childers, 2012, p.197):
110+
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]
111111

112-
$$F(x+\mathit{i}y)=F(x)F(y)=\begin{cases} (1 - e^{-\lambda_{x} x})(1 - e^{-\lambda_{y} y}) &x\geqslant 0, \;\; y\geqslant 0 \\\\ 0 &otherwise \end{}$$
112+
$$F(x+\mathit{i}y)=F(x)F(y)=\begin{cases} (1 - e^{-\lambda_{x} x})(1 - e^{-\lambda_{y} y}) &x\geqslant 0, \;\; y\geqslant 0 \\\\ 0 & \text{otherwise} \end{cases}$$
113113

114114
### Syntax
115115

@@ -124,15 +124,20 @@ Elemental function
124124
`x`: has `intent(in)` and is a scalar of type `real` or `complex`.
125125

126126
`lambda`: has `intent(in)` and is a scalar of type `real` or `complex`.
127+
If `lambda` is `real`, its value must be positive. If `lambda` is `complex`, both the real and imaginary components must be positive.
127128

128129
All arguments must have the same type.
129130

130131
### Return value
131132

132-
The result is a scalar or an array, with a shape conformable to arguments, and has the same type of input arguments.
133+
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`.
133134

134135
### Example
135136

136137
```fortran
137138
{!example/stats_distribution_exponential/example_exponential_cdf.f90!}
138139
```
140+
141+
[^1] Marsaglia, George, and Wai Wan Tsang. "The ziggurat method for generating random variables." _Journal of statistical software_ 5 (2000): 1-7.
142+
143+
[^2] Miller, Scott, and Donald Childers. _Probability and random processes: With applications to signal processing and communications_. Academic Press, 2012 (p. 197).

0 commit comments

Comments
 (0)