1.2 Quadrature
Determining areas and volumes of bodies given in analytical form, also called quadrature, is an important problem in science.Assume that the area I under the curve y = f(x) for x in A = (0,1.5) is to be computed, see the figure below. Matematically I can be expressed as the integral
( I = / f(x)dx )A2 |------------| | ___ | y | / \______| y = f(x) |/ | | | I = the area under the | | curve y=f(x) 0 |____________| 0 x 1.5Probabilistically we may estimate I in the following way. Sample N random points in (0,1.5) x (0,2) and record how many, n, that are falling under the curve. Then we may estimate I asI (n/N)*Hwhere H is the area of the sampling box, in this case 3 (= 1.5 x 2). This probabilistic is sometimes called Hit-or-miss Monte Carlo.Alternatively, if we knew the average fo of f in the interval (0,1.5) we could compute the area as
I = fo*1.5In order to use this approach we must estimate fo. This could be done by using random numbers xi in (0,1.5), compute yi=f(xi) and estimatefo (1/N)(y1+... +yN)This technique is called Crude Monte Carlo.In the example above the argument x of the function f is in Rn, where n=1. However, the method is easy to extend to arbitrary n and A may be a complicated many-dimensional region.