1 | initial version |
Pari/gp delivers:
? s = 0.1;
? intnum( x=3.9, 4.1, exp( -(x-4)^2/2/s^2 ) / sqrt(2*Pi*s^2) )
%2 = 0.6826894921370858971704650911
We can do the same in sage, i.e. call gp:
sage: gp( "intnum( x=3.9, 4.1, exp( -(x-4)^2/2/%s^2 ) / sqrt(2*Pi)/%s)" % ( 0.1, 0.1 ) )
0.6826894921370858971704650911
Or call the numerical integral from sage:
sage: integral_numerical( lambda x : exp( -(x-4)^2/2/0.1^2 ) / sqrt(2*pi)/0.1, 3.9, 4.1 )
(0.6826894921370853, 7.579375928402468e-15)
which computes the approximative value 0.6826894921370853
with an error less than $7,6\cdot 10^{-15}$, as given in the second argument.