So what I am doing is this:

#Set mean, s as standard deviation, variance, valores (range of values)
valores = np.arange(-10,10,0.01)
mean =2
s = 3
variance = np.square(s)

# Calculate the pdf
pdf = np.exp(-np.square(valores-mean)/2*variance)/(np.sqrt(2*np.pi*variance))

# Plot it:
plt.plot( valores, pdf)

If I set s=3, my graph is: enter image description here

Now if I set s=6, my graph is: enter image description here

Now, since I increased standard deviation (s from 3 to 6) shouldn't the curve look more "open" or dispersed, not squeezed?


1 Answer 1


You made a slight parentheses error, your pdf should look like this, with the variance in the denominator of the exponential:

pdf = np.exp(-np.square(valores-mean)/(2*variance))/(np.sqrt(2*np.pi*variance))
  • $\begingroup$ Thanks lennart! What a silly mistake I made $\endgroup$ Jan 16, 2020 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.