Phys 238:  The Normal Distribution

Clear["Global`*"]

f[x_, X_, σ_] := ((1/(σ Sqrt[2 π]))) Exp[-((((x-X))^2)/(2 (σ^2)))]

f[x, X, σ]

Here are is a comparison of two distribution functions, with σ=1 and σ=2.

Plot[{f[x,  0, 1], f[x, 0, 2]}, {x, -10, 10}, PlotRange->All, LabelStyle->Larger, AxesLabel->{"x", "f(x)"}, PlotLegends->{"σ=1", "σ=2"}, ImageSize->Scaled[0.8]]

Probability functions

For simplicity, take the mean X to be 0.  (One could always define a new variable z=x-X.)

X= 0;

Normalization

The distribution is already normalized (subject to the reasonable assumption that σ is a real positive number).

Integrate[f[x, X, σ], {x, -∞, ∞}, Assumptions -> {σ > 0}]

Function showing the probability of being within ‘t’ standard deviations of the mean.

p[t_] := Integrate[f[x, X, σ], {x, X - t σ, X + t σ}, Assumptions -> {σ > 0}]

p[1]

While the Error Function Erf[ ] is technically a correct answer, it isn’t particularly practical.  Tell Mathematica to give the numerical approximation:

N[p[1]]

Tabulate the probability of getting a result within 1, 2, 3, 5, or 10 standard deviations.

Table[{t, N[p[t], 10]}, {t, {1, 2, 3, 5, 10}}] // TableForm

The 95% confidence level corresponds to just under 2σ.  (The Abs[] ensures that Mathematica only tries real numbers for t.)

FindRoot[N[p[Abs[t]]] == 0.95, {t, 1.}]

The 99% confidence level corresponds to about 2.6 σ.

FindRoot[N[p[Abs[t]]] == 0.99, {t, 1}]