You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/specs/stdlib_stats_distribution_exponential.md
+47-7Lines changed: 47 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,20 +15,29 @@ Experimental
15
15
### Description
16
16
17
17
An exponential distribution is the distribution of time between events in a Poisson point process.
18
-
The inverse scale parameter `lambda` specifies the average time between events (\(\lambda\)), also called the rate of events.
18
+
The inverse `scale` parameter `lambda` specifies the average time between events (\(\lambda\)), also called the rate of events. The location `loc` specifies the value by which the distribution is shifted.
19
19
20
-
Without argument, the function returns a random sample from the standard exponential distribution \(E(\lambda=1)\).
20
+
Without argument, the function returns a random sample from the unshifted standard exponential distribution \(E(\lambda=1)\) or \(E(loc=0, scale=1)\).
21
21
22
-
With a single argument, the function returns a random sample from the exponential distribution \(E(\lambda=\text{lambda})\).
22
+
With a single argument of type `real`, the function returns a random sample from the exponential distribution \(E(\lambda=\text{lambda})\).
23
23
For complex arguments, the real and imaginary parts are sampled independently of each other.
24
24
25
-
With two arguments, the function returns a rank-1 array of exponentially distributed random variates.
25
+
With one argument of type `real` and one argument of type `integer`, the function returns a rank-1 array of exponentially distributed random variates for (E(\lambda=\text{lambda})\).
26
+
27
+
With two arguments of type `real`, the function returns a random sample from the exponential distribution \(E(loc=loc, scale=scale)\).
28
+
For complex arguments, the real and imaginary parts are sampled independently of each other.
29
+
30
+
With two arguments of type `real` and one argument of type `integer`, the function returns a rank-1 array of exponentially distributed random variates for \(E(loc=loc, scale=scale)\).
26
31
27
32
@note
28
33
The algorithm used for generating exponential random variates is fundamentally limited to double precision.[^1]
Instead of of the inverse scale parameter `lambda`, it is possible to pass `loc` and `scale`, where \(scale = \frac{1}{\lambda}\) and `loc` specifies the value by which the distribution is shifted.
`lambda`: has `intent(in)` and is a scalar of type `real` or `complex`.
85
108
If `lambda` is `real`, its value must be positive. If `lambda` is `complex`, both the real and imaginary components must be positive.
86
109
110
+
`loc`: has `intent(in)` and is a scalar of type `real` or `complex`.
111
+
112
+
`scale`: has `intent(in)` and is a positive scalar of type `real` or `complex`.
113
+
If `scale` is `real`, its value must be positive. If `scale` is `complex`, both the real and imaginary components must be positive.
114
+
87
115
All arguments must have the same type.
88
116
89
117
### Return value
90
118
91
-
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`.
119
+
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. If non-positive `lambda` or `scale`, the result is `NaN`.
120
+
92
121
93
122
### Example
94
123
@@ -112,8 +141,14 @@ For a complex variable \(z=(x + y i)\) with independent real \(x\) and imaginar
Alternative to the inverse scale parameter `lambda`, it is possible to pass `loc` and `scale`, where \(scale = \frac{1}{\lambda}\) and `loc` specifies the value by which the distribution is shifted.
`lambda`: has `intent(in)` and is a scalar of type `real` or `complex`.
128
163
If `lambda` is `real`, its value must be positive. If `lambda` is `complex`, both the real and imaginary components must be positive.
129
164
165
+
`loc`: has `intent(in)` and is a scalar of type `real` or `complex`.
166
+
167
+
`scale`: has `intent(in)` and is a positive scalar of type `real` or `complex`.
168
+
If `scale` is `real`, its value must be positive. If `scale` is `complex`, both the real and imaginary components must be positive.
169
+
130
170
All arguments must have the same type.
131
171
132
172
### Return value
133
173
134
-
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`.
174
+
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. With non-positive `lambda`or `scale`, the result is `NaN`.
0 commit comments