As shown in the noteboook, I was calculating the variance of a Gaussian distribution centered at x=0. The correct result should be just w^2, which is a property of Gaussian distribution. The result here is not only wrong, but even still has x in the formula, which is not what I would expect after an integration. Can anyone see what the problem here is? Did I type the formula in a correct way? I'm new to Mathematica.
Ah, silly me. Thanks Claude!
Bounds are necessary.
Integrate[x^2/E^(x^2/(2*w^2)), { x, -\[Infinity], \[Infinity]}, Assumptions -> w > 0]/ Integrate[E^(-(x^2/(2*w^2))), { x, -\[Infinity], \[Infinity]}, Assumptions -> w > 0]
works perfectly.