Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.

Similar presentations


Presentation on theme: "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions."— Presentation transcript:

1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions

2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2 Integration of Functions Chapter 20 Functions to be integrated numerically are in two forms: –A table of values. We are limited by the number of points that are given – so we are limited to the Trapazoidal rule or Simpsons rules –A function. We can generate as many values of f(x) as needed to attain acceptable accuracy. Will focus on two techniques that are designed to analyze functions: –Romberg integration –Gauss quadrature

3 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3 Romberg Integration Is based on successive application of the trapezoidal rule to attain efficient numerical integrals of functions. Richardson’s Extrapolation Uses two estimates of an integral to compute a third and more accurate approximation. Romberg Integration is a computer technique based on the application of Richardson extrapolation

4 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 The estimate and error associated with a multiple- application trapezoidal rule can be represented generally as I =exact value of integral I(h) =the approximation from an n segment application of trapezoidal rule with step size h E(h) =the truncation error Assumed constant regardless of step size

5 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5 Improved estimate of the integral

6 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. For the special case: 6 This estimate is accurate to O(h 4 )

7 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 7 Successive application of Richardson extrapolation gives the Romberg Integration Algorithm

8 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8 Successive application of Richardson extrapolation gives the Romberg Integration Algorithm More Accurate Less Accurate

9 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9 Let’s make a MATLAB Function to implement this technique We’ll end up with an array the looks like this

10 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 10

11 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 11

12 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 12

13 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary Romberg integration uses Richardson extrapolation to create an efficient strategy for numerical integration 13

14 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 14 Chapter 20B Numerical Integration of Functions

15 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 15 Gauss Quadrature Gauss quadrature uses a strategy of positioning any two points on a curve to define a straight line that would balance the positive and negative errors. The area evaluated under this straight line provides an improved estimate of the integral.

16 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 16 Figure 20.3 Trapazoid Rule Gauss Quadrature

17 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 17 Method of Undetermined Coefficients/ The trapezoidal rule yields exact results when the function being integrated is a constant or a straight line, such as y=1 and y=x: Solve simultaneously Trapezoidal rule

18 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 18 Figure 20.4

19 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 19 Derivation of the Two-Point Gauss-Legendre Formula/ The object of Gauss quadrature is to determine the equations of the form However, in contrast to trapezoidal rule that uses fixed end points a and b, the function arguments x 0 and x 1 are not fixed end points but unknowns. Thus, four unknowns to be evaluated require four conditions. First two conditions are obtained by assuming that the above eqn. for I fits the integral of a constant and a linear function exactly. The other two conditions are obtained by extending this reasoning to a parabolic and a cubic functions.

20 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 20 Solved simultaneously Yields an integral estimate that is third order accurate (It’s exact for a 3 rd order polynomial

21 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 21 Figure 20.5

22 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 22 Notice that the integration limits are from -1 to 1. This was done for simplicity and make the formulation as general as possible. A simple change of variable is used to translate other limits of integration into this form. Provided that the higher order derivatives do not increase substantially with increasing number of points (n), Gauss quadrature is superior to Newton- Cotes formulas. Error for the Gauss- Legendre formulas

23 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Adaptive Quadrature The techniques described previously all use constant step size If a function changes rapidly in some areas and not in others, it is more efficient to use a variable step size The MATLAB functions quad and quadl use adaptive quadrature 23

24 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 24

25 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Multiple Integration Let’s return to Example 19.8 Suppose that the temperature of a rectangular heated plate is described by the following function If the plate is 8 m long (x dimension) and 6 m wide (y dimension), compute the average temperature. 25

26 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 26

27 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 27

28 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 28 Analytical Approach Numerical Approach

29 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 29 (b-a) 2*n (b-a) 048 0 3 6

30 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 30 Double Application of trapz

31 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 31

32 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 32 Tave=trapz(X,trapz(Y,z))/(8*6)

33 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary quad quadl dblquad triplequad double and triple integration using Newton Coates formulas 33


Download ppt "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions."

Similar presentations


Ads by Google