It can be proved that
$\int_0^\infty sin(x^2) dx= \sqrt{\frac{\pi}{8}}$
Use Monte-Carlo integration to evaluate Integrate
$\int_0^\infty sin(x^2) dx$
In [7]:
import numpy as np
In [8]:
np.sin(1)
Out[8]:
0.8414709848078965
In [9]:
x=np.random.rand(1000000)
y=1/x-1
gx=np.sin(y**2)/x**2
np.mean(gx)
Out[9]:
-1662038.9858042086
In [ ]: