Problem

The bell-shaped Gaussian probability density function,

\[f(x)=\frac{1}{\sqrt{2\pi}\sigma}\exp\bigg[ -\frac{1}{2}\bigg( \frac{x-\mu}{\sigma} \bigg)^2 \bigg]\]

is one of the most widely used functions in science and technology. The parameters of the function (mu,sigma>0) are prescribed real numbers. Write a program for evaluating this function when $\mu=0$, $\sigma=2$, $x = 1$.

Verify your answer by getting the same result from Wolfram Alpha mathematical search engine.

Python

Hint: The value pi, and exp() , sqrt() function are built-in in MATLAB, but are not so in Python. You will need to export them using the following command in Python,

from math import pi, exp, sqrt

Comments