Integration |
|
Integration is the operation of finding the area under a curve, f(x), between given limits, from x=lo to x=hi. If the form of f(x) is suitable, and if we are smart enough, it may be possible to solve the integration analytically to get an exact answer. If this is not possible, f(x) can be integrated numerically to give an approximate answer. Such a computation is known as quadrature. The errors introduced in the process depend upon the properties of f(x) and on the method of integration. Common methods require that f(x) and its derivatives are continuous and that its high-order derivatives are "small". Some simple methods of numerical integration are illustrated below. Rectangle RuleThe range [lo,hi] is divided up into N equally sized intervals of width (hi-lo)/N. In a given interval, f(x) is approximated by its value at the centre of an interval, hence rectangles:
Trapezoidal RuleThe range [lo,hi] is divided up into N intervals, as before. A straight-line approximation for f(x) is used in each interval, i.e. the area under f(x) is approximated by a series of trapeziums. Note that the area of a trapezium is its width multiplied by the average of the two parallel sides.
Simpson's RuleA straight line can be fitted through any two points and a quadratic can be fitted through three points.
Fitting
The area under a quadratic is easy to work out:
Simpson's method is much more accurate than the rectangle and trapezoidal rules, for a given number of intervals. ComplexityThe rectangle rule evaluates f(x) N times. The trapezoidal rule and Simpson's method evaluate f(x) N+1 times. DemonstrationThe
HTML FORM demonstrates the integration of a function, -- 1999 L.A.
|
|
↑ © L. Allison, www.allisons.org/ll/ (or as otherwise indicated). Created with "vi (Linux)", charset=iso-8859-1, fetched Saturday, 20-Apr-2024 12:15:37 UTC. Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off. |