NUMERICAL METHODS OF INTEGRATION

30
NUMERICAL METHODS OF INTEGRATION D MANCHE 2013

description

NUMERICAL METHODS OF INTEGRATION . Finding the area under curves:. There are many mathematical applications which require finding the area under a curve. The area “under” a curve is defined as the area between the curve and the x -axis. This area can be: - PowerPoint PPT Presentation

Transcript of NUMERICAL METHODS OF INTEGRATION

Page 1: NUMERICAL METHODS OF  INTEGRATION

NUMERICAL METHODS OF INTEGRATION

D MANCHE 2013

Page 2: NUMERICAL METHODS OF  INTEGRATION

Finding the area under curves: There are many mathematical applications

which require finding the area under a curve. The area “under” a curve is defined as the

area between the curve and the x-axis.

This area can be: • estimated by using “numerical methods” or • calculated using “calculus methods”.

Page 3: NUMERICAL METHODS OF  INTEGRATION

Example to consider: Find the area under the curve

between and

Page 4: NUMERICAL METHODS OF  INTEGRATION

Exact area:It can be shown, using calculus, that the exact area under the curve as shown is 12 square units. (We will see how later.)

Page 5: NUMERICAL METHODS OF  INTEGRATION

Numerical Methods v Calculus: We will consider several numerical

methods which can be used to give a good approximation of the area under a curve.

Calculus, specifically definite integrals, can be used to find the exact area under a curve. We will consider this method later.

Page 6: NUMERICAL METHODS OF  INTEGRATION

Numerical Methods of IntegrationWhile definite integrals lead to the exact area under the curve, numerical methods of integration give an approximation of this area.

These numerical methods for finding area under a curve are particularly useful -if the function is not knownif the function cannot be integrated algebraicallyif the function is difficult to integrate algebraically.

Page 7: NUMERICAL METHODS OF  INTEGRATION

Numerical methods: Rectangle Method

Midpoint Method

Trapezoidal Method

Simpson’s Rule

Monte Carlo Method

Page 8: NUMERICAL METHODS OF  INTEGRATION

Rectangle Method

a b

x0 x1 x2 x3

•The interval from x=a to x=b is first divided into n intervals.

•Each interval has a width of

•Since there are n intervals there will be n +1 x-values.

•The first one is x0 =a and the last one is xn = b.

To keep this example simple, n = 3.

Page 9: NUMERICAL METHODS OF  INTEGRATION

Rectangle Method (cont.) n rectangles are then drawn. The width is the same for each rectangle and

the height is given by the appropriate f(x) value. The area of each rectangle is found in the usual

way (Area = width x height). The sum of the areas of these rectangles

approximates the area under the curve. These rectangles can be constructed in several

ways.

Page 10: NUMERICAL METHODS OF  INTEGRATION

Rectangle MethodUpper rectangles Lower rectangles

Left rectangles Right rectangles

Page 11: NUMERICAL METHODS OF  INTEGRATION

Rectangle Method (cont.)

Shaded area

[The exact area is actually 12 square units. So, in this instance, the rectangle method underestimates the area under the curve.]

Calculations using Left Rectangles

Page 12: NUMERICAL METHODS OF  INTEGRATION

Rectangle method (cont.)•The Rectangle method is the simplest method to use, but it is usually the most

inaccurate.•Its accuracy can be improved by increasing the number of intervals (n). As n gets larger, the closer the approximation gets to the real area under the curve.

n=3

n=30n=12

n=6

Page 13: NUMERICAL METHODS OF  INTEGRATION

Midpoint Method•All of the rectangle methods use f(x0), f(x1), f(x2) or f(x3) as the height of the rectangles, ie. the heights already drawn in the first graph below. •The midpoint method locates the midpoint of each interval eg (x0 +x1)/2, and uses the height f [(x0 +x1)/2] as the height of the rectangle.•The area of this rectangle is generally a better approximation than that obtained by using either the left or right rectangles or upper or lower rectangles.•The process is continued for the remaining intervals and areas added.

Midpoint of interval

Page 14: NUMERICAL METHODS OF  INTEGRATION

Try the midpoint method for yourself:

Page 15: NUMERICAL METHODS OF  INTEGRATION

Midpoint Method (cont.)Shaded area

Note that this is a better approximation than that obtained using the rectangle method.

Page 16: NUMERICAL METHODS OF  INTEGRATION

Trapezoidal MethodInstead of using rectangles, the trapezoidal method (not surprisingly) uses trapeziums to approximate the area under the curve.The trapeziums are formed by joining the points on the curve with straight lines.Compared to the rectangle method, the trapezoidal method gives a better approximation for the real area, as obvious in the graph below.

Page 17: NUMERICAL METHODS OF  INTEGRATION

Trapezoidal Method (cont.)

Recall that the area of a trapezium with parallel sides of length a and b and with perpendicular height h is given by:

Area

a

b

h

Area = average of parallel sides x perpendicular distance between them

Page 18: NUMERICAL METHODS OF  INTEGRATION

Trapezoidal Method (cont.)Shaded area

a=x0 x1 x2 x3=b

where w = width of each strip E = sum of end ordinates M = sum of middle ordinates

Note that all of the terms, except the first and last, appear twice in this expression.

Page 19: NUMERICAL METHODS OF  INTEGRATION

Trapezoidal Method (cont.)

a=x0 x1 x2 x3=b

Area

Area

[Remember that the real area under the curve is 12 square units.]

Page 20: NUMERICAL METHODS OF  INTEGRATION

Trapezoidal Method (cont.) The Trapezoidal Method is an improvement over the

Rectangle Method because the points at the top of each strip are joined by an oblique line rather than a horizontal line from either the left or the right. This leads to a better approximation of the area under the curve.

Rectangle Method (left) Trapezoidal Method

Page 21: NUMERICAL METHODS OF  INTEGRATION

Simpson’s Rule Simpson’s Rule improves on the Trapezoidal method by placing

a parabola (red) rather than an oblique line (green) between points on the curve (blue).

Simpson’s rule considers 2 strips at a time so n must be even.

Page 22: NUMERICAL METHODS OF  INTEGRATION

Simpson’s Rule (cont.)

Area

The proof for Simpson’s rule is beyond the scope of this course, but if interested see http://pages.pacificcoast.net/~cazelais/187/simpson.pdf

Page 23: NUMERICAL METHODS OF  INTEGRATION

Simpson’s Rule (cont.)

Simpson’s Rule requires an even number of intervals, so in this example we will use n=6.

Page 24: NUMERICAL METHODS OF  INTEGRATION

Simpson’s Rule (cont.)

Area

AreaBecause the function here is that of a parabola, Simpson’s Rule gives the exact area. This will not be the case when the function is not a quadratic.

Page 25: NUMERICAL METHODS OF  INTEGRATION

Monte Carlo MethodThe Monte Carlo method involves determining the proportion of the area of a suitably positioned rectangle that includes the area that lies under a given curve (see diagram below).

3

7

Area of rectangle = 21 sq units

Page 26: NUMERICAL METHODS OF  INTEGRATION

Monte Carlo Method (cont.) By positioning a series of randomly chosen points inside this

rectangle and counting the number of these points that fall on or inside the required area, this proportion can be determined. Then the required area (shaded) can be found by multiplying this proportion by the area of the rectangle.

12 points out of 20

Page 27: NUMERICAL METHODS OF  INTEGRATION

Monte Carlo Method (cont.)So in this case: 12 out of 20 points fell in the shaded area The area of the rectangle was 21 square units

Therefore: Area ≈ (12/20) x 21 = 12.6 square units

Generally, the more random points chosen, the better the approximation.

Page 28: NUMERICAL METHODS OF  INTEGRATION

Summary of Numerical Integration Methods used to find an approximation for the area under a

curve used when the function is unknown or cannot be

integrated Rectangle, Midpoint, Trapezoidal methods and

Simpson’s rule generally improve as the number of intervals increases

Monte Carlo Method generally improves as number of random points increases

because repetitive calculations are involved, these methods lend themselves well to spreadsheets

Page 29: NUMERICAL METHODS OF  INTEGRATION

Using Calculus to find area:Since the area lies above the x-axis :

Page 30: NUMERICAL METHODS OF  INTEGRATION

So the exact area under the curve is 12 square units.