Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Integration of Functions

Similar presentations


Presentation on theme: "Numerical Integration of Functions"— Presentation transcript:

1 Numerical Integration of Functions
Chapter 18 Numerical Integration of Functions

2 Numerical Integration
Tabulated data – the accuracy of the integral is limited by the number of data points Continuous function – we can generate as many f(x) as required to attain the required accuracy Richardson extrapolation and Romberg integration Gauss Quadratures

3 Round-off errors may limit the precision of lower-order Newton-Cotes composite integration formula
Use Romberg Integration for efficient integration

4 Romberg Integration More efficient methods to achieve better accuracy have been developed Romberg integration - uses Richardson extrapolation Idea behind Richardson extrapolation -improve the estimate by eliminating the leading term of truncation error at coarser grid levels

5 Richardson Extrapolation
The exact integral can be represented as This is true for any h = (ba)/n Use trapezoidal rule as an example

6 Composite Trapezoidal Rule
Evaluate the integral

7 Richardson Extrapolation
Truncation error for trapezoidal rule Substitute into the exact integral Which leads to

8 Richardson Extrapolation
Plugging back into I = I(h) + E(h) If h2 = h1/2, then

9 Richardson Extrapolation
Combine two O(h2) estimates to get an O(h4) estimate Can also combine two O(h4) estimates to get an O(h6) estimate Combine two O(h6) estimates to get an O(h8) estimate Im and Il are more and less accurate estimates, respectively

10 Romberg Integration General form is called Romberg Integration
j: level of accuracy - j+1 is more accurate (more segments) k: level of integration - k=1 is the original trapezoidal rule estimate (O(h2)), k=2 is improved (O(h4)), k=3 corresponds to O(h6), etc.

11 Romberg Integration Accelerated Trapezoidal Rule

12 Romberg Integration Accelerated Trapezoid Rule

13 Accelerated trapezoidal Rule
Romberg Integration Accelerated trapezoidal Rule

14 » intg = romberg(‘example1’,0,pi,0.00001,2)
» intg = Romberg(‘example1’,0,pi, ,3) » intg = romberg(‘example1’,0,pi, ,4) » intg = romberg(‘example1’,0,pi, ,6)

15 CVEN 302-501 Homework No. 12 Chapter 17
Problem 17.3 (25), 17.5 (25)– Hand Calculation Chapter 18 Problem 18.2 (25), 18.4 (25) Due on Monday, 11/17/2008 at the beginning of the period

16 Gauss Quadrature Assume a and b are limits of integration
Trapezoidal rule should give exact results for constant and linear functions

17 Trapezoidal rule gives exact solution for constant and linear functions

18 Gauss Quadrature Now instead of trapezoidal, which has fixed end points (a,b), let them float 4 unknowns - x0 ,x1 ,c0 ,c1 4 equations - constant, linear (had before in trapezoidal rule), quadratic, cubic Integrate from -1 to 1 to simplify math

19 Trapezoidal vs. Gauss-Quadrature
Exact for constant and linear functions Exact for constant, linear, quadratic and cubic functions

20 Gauss Quadrature The idea is that if we evaluate the function at certain points (non-uniformly distributed), and sum with certain weights, we will get accurate integral Evaluation points and weights are tabulated

21 Gauss-Legendre Quadrature
Choose (c0 , c1 , x0 , x1) to yield highest possible accuracy

22 Gauss Quadratures Newton-Cotes Formulas
use evenly-spaced functional values Gauss Quadratures (Gauss-Legendre formulas) change of variables so that the interval of integration is [1,1] select functional values at non-uniformly distributed points to achieve higher accuracy

23 Gauss Quadrature on [a, b]
To go to [1,1] from other limits [a,b] - use linear transformation Change from a  x  b to 1  xd  1 Coordinate transformation

24 Gauss Quadrature on [a, b]
Coordinate transformation from [a,b] to [1,1] a t1 t2 b

25 Gauss Quadrature on [1, 1]
x0 x1 -1 1 Choose (c0 , c1 , x0 , x1) such that the method yields “exact integral” for f(x) = x0, x1, x2, x3

26 Gauss Quadrature on [1, 1]
Exact integral for f = x0, x1, x2, x3 Four equations for four unknowns

27 Gauss Quadrature on [1, 1]
x0 x1 x2 -1 1 Choose (c0, c1, c2, x0, x1, x2) such that the method yields “exact integral” for f(x) = x0, x1, x2, x3,x4, x5

28 Gauss Quadrature on [1, 1]
Exact integral for f = x0, x1, x2, x3, x4, x5

29 Example: Gauss Quadrature
Evaluate Coordinate transformation Two-point formula

30 Example: Gauss Quadrature
Three-point formula Four-point formula

31 Gauss-Legendre Formulas

32 Gauss Quadrature

33 Gauss Quadrature k = 2 Exact Q = -4.9348
» I=Gauss_quad(‘example1’,0,pi,2); t = c = tt = 0.5774 cd = 1 » I I = » Q=quad8(‘example1’,0,pi) Q = k = 2 Exact Q =

34 Gauss Quadrature k = 5 Exact Q = -4.9348
» I=Gauss_quad(‘example1’,0,pi,5); t = c = tt = 0.5385 0.9062 cd = 0.2369 0.4786 0.5689 » I I = Gauss Quadrature k = 5 Exact Q =

35 Adaptive Quadrature Composite Simpson’s 1/3 rule requires the use of equally spaced points Use adaptive refinement in regions of relatively abrupt changes Estimate truncation error between two levels of refinement Automatically adjust the step size so that small steps are taken in regions of sharp variations while larger steps are used elsewhere MATLAB functions: quad and quadl

36 MATLAB Integration Methods
trapz(x,y) * Composite trapezoid rule q = quad(‘func’,xmin,xmax) * Adaptive Simpson’s rule (p 439), more efficient for low accuracies or non- smooth functions q =quadl(‘func’,xmin, xmax) * Labatto quadrature – more efficient for high accuracies and smooth functions (p439)


Download ppt "Numerical Integration of Functions"

Similar presentations


Ads by Google