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_normal.md
+24-17Lines changed: 24 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,16 @@ Experimental
14
14
15
15
### Description
16
16
17
-
A normal continuous random variate distribution, also known as Gaussian, or Gauss or Laplace-Gauss distribution. The location `loc` specifies the mean or expectation. The `scale` specifies the standard deviation.
17
+
A normal continuous random variate distribution, also known as Gaussian, or Gauss or Laplace-Gauss distribution. The location `loc` specifies the mean or expectation ($\mu$). The `scale` specifies the standard deviation ($\sigma$).
18
18
19
-
Without argument the function returns a standard normal distributed random variate N(0,1).
19
+
Without argument, the function returns a standard normal distributed random variate $N(0,1)$.
20
20
21
-
With two arguments, the function returns a normal distributed random variate N(loc, scale^2). For complex arguments, the real and imaginary parts are independent of each other.
21
+
With two arguments, the function returns a normal distributed random variate $N(\mu=\text{loc}, \sigma^2=\text{scale}^2)$. For complex arguments, the real and imaginary parts are independent of each other.
22
22
23
-
With three arguments, the function returns a rank one array of normal distributed random variates.
23
+
With three arguments, the function returns a rank-1 array of normal distributed random variates.
24
24
25
-
Note: the algorithm used for generating normal random variates is fundamentally limited to double precision.
25
+
@note
26
+
The algorithm used for generating exponential random variates is fundamentally limited to double precision.[^1]
26
27
27
28
### Syntax
28
29
@@ -36,15 +37,15 @@ Elemental function (passing both `loc` and `scale`).
36
37
37
38
`loc`: optional argument has `intent(in)` and is a scalar of type `real` or `complex`.
38
39
39
-
`scale`: optional argument has `intent(in)` and is a scalar of type `real` or `complex`.
40
+
`scale`: optional argument has `intent(in)` and is a positive scalar of type `real` or `complex`.
40
41
41
42
`array_size`: optional argument has `intent(in)` and is a scalar of type `integer`.
42
43
43
44
`loc` and `scale` arguments must be of the same type.
44
45
45
46
### Return value
46
47
47
-
The result is a scalar or rank one array, with a size of `array_size`, and as the same type of`scale` and `loc`.
48
+
The result is a scalar or rank-1 array, with a size of `array_size`, and the same type as`scale` and `loc`. If `scale` is non-positive, the result is `NaN`.
48
49
49
50
### Example
50
51
@@ -62,11 +63,11 @@ Experimental
62
63
63
64
The probability density function (pdf) of the single real variable normal distribution:
For complex varible (x + y i) with independent real x and imaginary y parts, the joint probability density function is the product of corresponding marginal pdf of real and imaginary pdf (ref. "Probability and Random Processes with Applications to Signal Processing and Communications", 2nd ed., Scott L. Miller and Donald Childers, 2012, p.197):
68
+
For a complex varible $z=(x + y i)$ with independent real $x$ and imaginary $y$ parts, the joint probability density function is the product of the the corresponding real and imaginary marginal pdfs:[^2]
68
69
69
-
$$f(x + y \mathit{i}) = f(x) f(y) = \frac{1}{2\sigma_{x}\sigma_{y}} e^{-\frac{1}{2}[(\frac{x-\mu}{\sigma_{x}})^{2}+(\frac{y-\nu}{\sigma_{y}})^{2}]}$$
70
+
$$f(x + y \mathit{i}) = f(x) f(y) = \frac{1}{2\sigma_{x}\sigma_{y}} \exp{\left[-\frac{1}{2}\left(\left(\frac{x-\mu_x}{\sigma_{x}}\right)^{2}+\left(\frac{y-\mu_y}{\sigma_{y}}\right)^{2}\right)\right]}$$
70
71
71
72
### Syntax
72
73
@@ -82,13 +83,13 @@ Elemental function
82
83
83
84
`loc`: has `intent(in)` and is a scalar of type `real` or `complex`.
84
85
85
-
`scale`: has `intent(in)` and is a scalar of type `real` or `complex`.
86
+
`scale`: has `intent(in)` and is a positive scalar of type `real` or `complex`.
86
87
87
88
All three arguments must have the same type.
88
89
89
90
### Return value
90
91
91
-
The result is a scalar or an array, with a shape conformable to arguments, and as the same type of input arguments.
92
+
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. If `scale` is non-positive, the result is `NaN`.
92
93
93
94
### Example
94
95
@@ -106,11 +107,13 @@ Experimental
106
107
107
108
Cumulative distribution function of the single real variable normal distribution:
For the complex variable (x + y i) with independent real x and imaginary y parts, the joint cumulative distribution function is the product of corresponding marginal cdf of real and imaginary cdf (ref. "Probability and Random Processes with Applications to Signal Processing and Communications", 2nd ed., Scott L. Miller and Donald Childers, 2012, p.197):
112
+
For the complex variable $z=(x + y i)$ with independent real $x$ and imaginary $y$ parts, the joint cumulative distribution function is the product of the corresponding real and imaginary marginal cdfs:[^2]
`loc`: has `intent(in)` and is a scalar of type `real` or `complex`.
128
131
129
-
`scale`: has `intent(in)` and is a scalar of type `real` or `complex`.
132
+
`scale`: has `intent(in)` and is a positive scalar of type `real` or `complex`.
130
133
131
134
All three arguments must have the same type.
132
135
133
136
### Return value
134
137
135
-
The result is a scalar or an array, with a shape conformable to arguments, as the same type of input arguments.
138
+
The result is a scalar or an array, with a shape conformable to the arguments, and the same type as the input arguments. If `scale` is non-positive, the result is `NaN`.
[^1] Marsaglia, George, and Wai Wan Tsang. "The ziggurat method for generating random variables." _Journal of statistical software_ 5 (2000): 1-7.
147
+
148
+
[^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