gaussian

mdtools.statistics.gaussian(x, mu=0, sigma=1)[source]

Gaussian distribution.

\[f(x) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}\]
Parameters:
  • x (scalar or array_like) – Array of \(x\) values for which to evaluate \(f(x)\).

  • mu (scalar or array_like, optional) – Mean of the distribution. If an array of means is given, it must be broadcastable to a common shape with x.

  • sigma (scalar or array_like, optional) – Standard deviation of the distribution. If an array of standard deviations is given, it must be broadcastable to a common shape with x.

Returns:

f (scalar or array_like) – The function values \(f(x)\) at the given \(x\) values.

See also

scipy.stats.norm

Normal continuous random variable.

Examples

>>> from scipy.stats import norm
>>> x = np.linspace(-1, 3, 5)
>>> y1 = mdt.stats.gaussian(x, mu=1, sigma=1)
>>> y2 = norm.pdf(x, loc=1, scale=1)
>>> np.allclose(y1, y2, rtol=0)
True
>>> y1
array([0.05399097, 0.24197072, 0.39894228, 0.24197072, 0.05399097])