1 | initial version |
You did not get the expected result because the last ^2
is ill placed; it should be inside the parentheses:
sage: f = 1/(0.1*sqrt(2*pi)) * e^((-1/2)*((x-4)/0.1)^2)
Then
sage: numerical_integral(f, 3.9, 4.1)
(0.6826894921370853, 7.579375928402468e-15)
(the second number is an evaluation of the numerical error).