Probability distributions
Normal probability density
prob.normal-pdfAlso called normal pdf, gaussian pdf, normal density, gaussian density
Density of the normal distribution with mean μ and standard deviation σ.
Notation
the point at which the density is evaluated
x ∈ ℝ
mean (location)
μ ∈ ℝ
standard deviation (scale)
σ > 0
Result: the density at x
scalar
Worked examples
Each result is solved exactly and confirmed by two independent computations.
Given
Result
≈ 0.398942280401
Given
Result
≈ 0.241970724519
Given
Result
≈ 0.12098536226
Common mistakes
Treats σ as the variance
The code uses its σ argument where σ2 belongs, as if the parameter were the variance.
Fix: Pass the standard deviation, or take the square root of the variance before using it.
Drops the 1/2 in the exponent
The exponent is −(x − μ)2/σ2 instead of −(x − μ)2/(2σ2).
Fix: Divide the squared deviation by 2σ2.
Normalizing constant omits σ
The density is divided by √(2π) but not by σ, so it does not integrate to one unless σ = 1.
Fix: Divide by σ√(2π).
Source
NIST/SEMATECH e-Handbook, §1.3.6.6.1
NIST/SEMATECH e-Handbook of Statistical Methods. https://www.itl.nist.gov/div898/handbook/ Last updated 2022-04-27. doi:10.18434/M32189