Numerical Integration of Functions

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Computational Methods in Physics PHYS 3437
Asymptotic error expansion Example 1: Numerical differentiation –Truncation error via Taylor expansion.
NUMERICAL DIFFERENTIATION AND INTEGRATION
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Chapter 7 Numerical Differentiation and Integration
Today’s class Romberg integration Gauss quadrature Numerical Methods
Lecture 18 - Numerical Differentiation
Numerical Integration
Numerical Integration Lecture (II)1
Numerical Integration
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 30 Numerical Integration & Differentiation.
Newton-Cotes Integration Formula
Lecture 3: Integration. Integration of discrete functions
MANE 4240 & CIVL 4240 Introduction to Finite Elements Numerical Integration in 1D Prof. Suvranu De.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 29 Numerical Integration.
Chapter 17 Numerical Integration Formulas. Graphical Representation of Integral Integral = area under the curve Use of a grid to approximate an integral.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 22 Integration of Equations.
Numerical Integration
Chapter 17 Objectives Recognizing that Newton-Cotes integration formulas are based on the strategy of replacing a complicated function or tabulated data.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 32.
Integration of Equations
8/8/ Gauss Quadrature Rule of Integration Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker
CISE301_Topic7KFUPM1 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM Read Chapter 21, Section 1 Read Chapter 22, Sections 2-3.
Quadrature Greg Beckham. Quadrature Numerical Integration Goal is to obtain the integral with as few computations of the integrand as possible.
Numerical Integration Formulas
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
Simpson’s 1/3 rd Rule of Integration. What is Integration? Integration The process of measuring the area under a.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 21 Newton-Cotes Integration Formula.
Chapter 4, Integration of Functions. Open and Closed Formulas x 1 =a x 2 x 3 x 4 x 5 =b Closed formula uses end points, e.g., Open formulas - use interior.
Engineering Analysis ENG 3420 Fall 2009
Chapter 4 Numerical Differentiation and Integration 1/16 Given x 0, approximate f ’(x 0 ). h xfhxf xf h )()( lim)('    x0x0 x1x1 h x1x1 x0x0.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Automatic Integration
3. Numerical integration (Numerical quadrature) .
Lecture 19 - Numerical Integration CVEN 302 July 22, 2002.
Integration Integration: is the total value, or summation, of f(x) dx over the range from a to b:
Numerical Computation
1 Chapter 7 NUMERICAL INTEGRATION. 2 PRELIMINARIES We use numerical integration when the function f(x) may not be integrable in closed form or even in.
1 Simpson’s 1/3 rd Rule of Integration. 2 What is Integration? Integration The process of measuring the area under a curve. Where: f(x) is the integrand.
Lecture 22 - Exam 2 Review CVEN 302 July 29, 2002.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Numerical Differentiation and Integration ~ Integration.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 22.
5. Integration 2.Quadrature as Box Counting 3.Algorithm: Trapezoid Rule 4.Algorithm: Simpson’s Rule 5.Integration Error 6.Algorithm: Gaussian Quadrature.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Chap. 11 Numerical Differentiation and Integration
Numerical Integration
Use of Newton-Cotes Formulas and eventual shortcomings Matlab code to increase number of segments with trapezoid, 1/3 and 3/8 rule.
Techniques for Numerical Integration
1/7  4.6 Adaptive Quadrature Methods Chapter 4 Numerical Differentiation and Integration -- Adaptive Quadrature Methods   /2  /4  /8 Predict the.
The purpose of Chapter 5 is to develop the basic principles of numerical integration Usefule Words integrate, integral 积分(的), integration 积分(法), quadrature.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 5 Integration and Differentiation.
SE301_Topic 6Al-Amer20051 SE301:Numerical Methods Topic 6 Numerical Integration Dr. Samir Al-Amer Term 053.
Quadrature – Concepts (numerical integration) Don Allen.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.
Chapter 7 Numerical Differentiation and Integration
Chapter 22.
NUMERICAL DIFFERENTIATION AND INTEGRATION
Chapter 7 Numerical Differentiation and Integration
NUMERICAL INTEGRATION
Numerical Computation and Optimization
Numerical Integration of Functions
Romberg Rule of Integration
SKTN 2393 Numerical Methods for Nuclear Engineers
Romberg Rule of Integration
Numerical Computation and Optimization
Romberg Rule of Integration
Numerical Integration
Presentation transcript:

Numerical Integration of Functions Chapter 18 Numerical Integration of Functions

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

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

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

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

Composite Trapezoidal Rule Evaluate the integral

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

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

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

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.

Romberg Integration Accelerated Trapezoidal Rule

Romberg Integration Accelerated Trapezoid Rule

Accelerated trapezoidal Rule Romberg Integration Accelerated trapezoidal Rule

» intg = romberg(‘example1’,0,pi,0.00001,2) 0.0000 0.0000 -5.5122 0.0000 -5.1677 0 -3.8758 0 0 » intg = Romberg(‘example1’,0,pi,0.00001,3) 0.0000 0.0000 -5.5122 -4.9221 0.0000 -5.1677 -4.9313 0 -3.8758 -4.9461 0 0 -4.6785 0 0 0 » intg = romberg(‘example1’,0,pi,0.00001,4) 0.0000 0.0000 -5.5122 -4.9221 -4.9349 0.0000 -5.1677 -4.9313 -4.9348 0 -3.8758 -4.9461 -4.9348 0 0 -4.6785 -4.9355 0 0 0 -4.8712 0 0 0 0 » intg = romberg(‘example1’,0,pi,0.00001,6) 0.0000 0.0000 -5.5122 -4.9221 -4.9349 -4.9348 -4.9348 0.0000 -5.1677 -4.9313 -4.9348 -4.9348 -4.9348 0 -3.8758 -4.9461 -4.9348 -4.9348 -4.9348 0 0 -4.6785 -4.9355 -4.9348 -4.9348 0 0 0 -4.8712 -4.9348 -4.9348 0 0 0 0 -4.9189 -4.9348 0 0 0 0 0 -4.9308 0 0 0 0 0

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

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

Trapezoidal rule gives exact solution for constant and linear functions

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

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

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

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

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

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

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

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

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

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

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

Example: Gauss Quadrature Evaluate Coordinate transformation Two-point formula

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

Gauss-Legendre Formulas

Gauss Quadrature

Gauss Quadrature k = 2 Exact Q = -4.9348 » I=Gauss_quad(‘example1’,0,pi,2); t = -0.5774 -0.7746 -0.8611 -0.9062 0.5774 0 -0.3400 -0.5385 0 0.7746 0.3400 0 0 0 0.8611 0.5385 0 0 0 0.9062 c = 1.0000 0.5556 0.3479 0.2369 1.0000 0.8889 0.6521 0.4786 0 0.5556 0.6521 0.5689 0 0 0.3479 0.4786 0 0 0 0.2369 tt = -0.5774 0.5774 cd = 1 » I I = -8.6878 » Q=quad8(‘example1’,0,pi) Q = -4.9348 k = 2 Exact Q = -4.9348

Gauss Quadrature k = 5 Exact Q = -4.9348 » I=Gauss_quad(‘example1’,0,pi,5); t = -0.5774 -0.7746 -0.8611 -0.9062 0.5774 0 -0.3400 -0.5385 0 0.7746 0.3400 0 0 0 0.8611 0.5385 0 0 0 0.9062 c = 1.0000 0.5556 0.3479 0.2369 1.0000 0.8889 0.6521 0.4786 0 0.5556 0.6521 0.5689 0 0 0.3479 0.4786 0 0 0 0.2369 tt = -0.9062 -0.5385 0.5385 0.9062 cd = 0.2369 0.4786 0.5689 » I I = -4.9333 Gauss Quadrature k = 5 Exact Q = -4.9348

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

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)