# Gaussian Integral incorrect

I'm trying to learn about the Gaussian Normal distribution using Mathematica.

So I defined my Gaussian like this

Gaus[x_, mu_, sigma_] = 1/(sigma*Sqrt[2 \[Pi]]) E^(-(1/2) ((x - mu)/sigma)^2);


I just tried to integrate it

Integrate[Gaus[x, mu, sigma], x, Assumptions -> {sigma > 0}]


which gives me

-(1/2) Erf[(mu - x)/(Sqrt sigma)]


I plot it using a manipulate block

Manipulate[Column[{
Style["Gaussian Normal", Bold],
Plot[Gaus[x, mu, sigma], {x, -5, 5}, ImageSize -> Large,
PlotRange -> Full],
Style["Gaussian Integral", Bold],
Plot[-(1/2) Erf[(mu - x)/(Sqrt sigma)], {x, -5, 5},
ImageSize -> Large, PlotRange -> Full]
}],
{mu, -5, 5, 1}, {sigma, 0.5, 2, 0.5}]


This is what I get for mean=1 and stdev=1: I don't understand why the erf function is going through (0/0) and is not shifted up by 1/2.

• The correct integral is just CDF[NormalDistribution[mu, sigma], x] – Bob Hanlon Jun 22 '20 at 15:59

## 1 Answer

The antiderivative Integrate isn't unique.

Try

Integrate[Gaus[x, mu, sigma], {x, -Infinity, x},Assumptions -> {sigma > 0}]
(*1/2 (1 + Erf[(-mu + x)/(Sqrt sigma)])*)


to get the expected result!