The Gaussian integral is related to the
error()
function (also known in mathematics as erf
), but has no finite limits. It evaluates to the square root of pi
.
Let's calculate the integral with the quad()
function (for the imports check the file in the code bundle):
print("Gaussian integral", np.sqrt(np.pi),integrate.quad(lambda x: np.exp(-x**2), -np.inf, np.inf))
The return value is the outcome and its error would be as follows:
Gaussian integral 1.77245385091 (1.7724538509055159, 1.4202636780944923e-08)