Lecture 8 - Integration Flashcards
Quadrature rules, Monte Carlo integration
Quadrature rule
Approximating the integral of f (x) on some interval [a,b] with a set of n sample points x :
integral form a to b of f(x) = sum from 1 to n of wi*f(x)
The choices of xi and wi determine a quadrature rule.
Riemann integral
Area under the curve (integral) from point a to b can be approximately represented as sum of the areas of rectangles.
[a,b] is divided into few subsets of the same length
Newton-Cotes 2 versions
Assume that xi’s are evenly spaced in [a,b] :
- —-> CLOSED: xi’s are placed at a and b and equally between
- —–> OPEN: xi’s are not placed equally between a and b but they are not equal to a or b!
Newton-Cotes
The function f (x) in each of the subregion
[xk , xk+1] is approximated using a low degree-polynomial!
Then we’re summing all subregions to get the value of whole area under the curve between points a and b
Newton-Cotes midpoint rule
Most common for OPEN quadrature. It base on a constant function and works the same as Riemann method, we operate on rectangles.
The smaller the subregions are the better the accuracy!
Zero degree poly.
Newton-Cotes trapezoidal rule
Good example of CLOSED quadrature. We are summing the areas of trapezes that are build between points xk and xk+1 . Area = (f(xk) + f(xk+1))/2 * Δx
First degree poly.
Newton-Cotes Simpson’s rule
Also example of closed quadrature.
We are building the parabolas between each f(xk), f(xk+1) and f(xk+xk+1/2) and then we’re adding each subregion. Much better accuracy then with trapezoidal or midpoint, but it requires more calculations.
Second degree poly.
Monte Carlo integration
Developed by Stanisław Ulam.
Basic steps :
1. Chose some figure at the domain of function which area S can be easily computed.
2. Chose N points, N1 - number of points under the curve, N2 - number of points above the curve
3. Approximate value of integral (between points a and b which are the base of figure?) P=N1/N * S