Monte Carlo Method, Python, Numerical Integration, Data Science.
say a=-2 and b=5. If we take a random point x_i between a and b, we can multiply f(x_i) by (b-a) to get the area of a rectangle of width (b-a) and height f(x_i). The idea behind Monte Carlo integration is to approximate the integral value (gray area on figure 1) by the averaged area of rectangles