title |
---|
stats_distribution_normal |
[TOC]
Experimental
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)).
Without argument, the function returns a standard normal distributed random variate (N(0,1)).
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.
With three arguments, the function returns a rank-1 array of normal distributed random variates.
@note The algorithm used for generating exponential random variates is fundamentally limited to double precision.1
result = [[stdlib_stats_distribution_normal(module):rvs_normal(interface)]]([loc, scale] [[, array_size]])
Elemental function (passing both loc
and scale
).
loc
: optional argument has intent(in)
and is a scalar of type real
or complex
.
scale
: optional argument has intent(in)
and is a positive scalar of type real
or complex
.
array_size
: optional argument has intent(in)
and is a scalar of type integer
.
loc
and scale
arguments must be of the same type.
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
.
{!example/stats_distribution_normal/example_normal_rvs.f90!}
Experimental
The probability density function (pdf) of the single real variable normal distribution:
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
result = [[stdlib_stats_distribution_normal(module):pdf_normal(interface)]](x, loc, scale)
Elemental function
x
: has intent(in)
and is a scalar of type real
or complex
.
loc
: has intent(in)
and is a scalar of type real
or complex
.
scale
: has intent(in)
and is a positive scalar of type real
or complex
.
All three 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 scale
is non-positive, the result is NaN
.
{!example/stats_distribution_normal/example_normal_pdf.f90!}
Experimental
Cumulative distribution function of the single real variable normal distribution:
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
result = [[stdlib_stats_distribution_normal(module):cdf_normal(interface)]](x, loc, scale)
Elemental function
x
: has intent(in)
and is a scalar of type real
or complex
.
loc
: has intent(in)
and is a scalar of type real
or complex
.
scale
: has intent(in)
and is a positive scalar of type real
or complex
.
All three 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 scale
is non-positive, the result is NaN
.
{!example/stats_distribution_normal/example_normal_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