NUMERICAL DIFFERENTIATION AND INTEGRATION

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Numerical Integration of Functions
Part 5 Chapter 19 Numerical Differentiation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
NUMERICAL DIFFERENTIATION AND INTEGRATION
Numerical Computation
Chapter 7 Numerical Differentiation and Integration
Today’s class Romberg integration Gauss quadrature Numerical Methods
Lecture 18 - Numerical Differentiation
Chapter 18 Interpolation The Islamic University of Gaza
NUMERICAL ERROR ENGR 351 Numerical Methods for Engineers
Newton-Cotes Integration Formula
CURVE FITTING ENGR 351 Numerical Methods for Engineers
Lecture 3: Integration. Integration of discrete functions
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW III.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 22 Integration of Equations.
NUMERICAL ERROR ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.
Chapter 6 Numerical Interpolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Standing.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Numerical Differentiation and Integration ~ Newton-Cotes.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
Numerical Integration Formulas
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 21 Newton-Cotes Integration Formula.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Numerical Computation
Wicomico High School Mrs. J. A. Austin AP Calculus 1 AB Third Marking Term.
Interpolation. Interpolation is important concept in numerical analysis. Quite often functions may not be available explicitly but only the values of.
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.
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
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapter 21.
Numerical Integration
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 5 Integration and Differentiation.
Interpolation - Introduction
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 21 Numerical Differentiation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.
Chapter 4, Integration of Functions
NUMERICAL DIFFERENTIATION Forward Difference Formula
High Accuracy Differentiation Formulas
Part 6 - Chapter 21.
Chapter 7 Numerical Differentiation and Integration
Gauss Quadrature Rule of Integration
Advanced Numerical Methods (S. A. Sahu) Code: AMC 51151
Numerical Integration Formulas
Chapter 22.
Numerical Analysis Lecture 27.
Numerical Differentiation
Interpolation.
Chapter 23.
Chapter 7 Numerical Differentiation and Integration
Numerical differentiation
Numerical Integration:
Numerical Computation and Optimization
SKTN 2393 Numerical Methods for Nuclear Engineers
Pengintegralan Numerik (lanjutan) Pertemuan 10
Romberg Rule of Integration
SKTN 2393 Numerical Methods for Nuclear Engineers
Romberg Rule of Integration
SKTN 2393 Numerical Methods for Nuclear Engineers
Romberg Rule of Integration
Numerical Computation and Optimization
Romberg Rule of Integration
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Numerical Integration
Presentation transcript:

NUMERICAL DIFFERENTIATION AND INTEGRATION ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier Dr. B.A. DeVantier

Copyright © 2003 by Lizette R. Chevalier Permission is granted to students at Southern Illinois University at Carbondale to make one copy of this material for use in the class ENGR 351, Numerical Methods for Engineers. No other permission is granted. All other rights are reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the copyright owner.

Specific Study Objectives Understand the derivation of the Newton-Cotes formulas Recognize that the trapezoidal and Simpson’s 1/3 and 3/8 rules represent the areas of 1st, 2nd, and 3rd order polynomials Be able to choose the “best” among these formulas for any particular problem

Specific Study Objectives Recognize the difference between open and closed integration formulas Understand the theoretical basis of Richardson extrapolation and how it is applied in the Romberg integration algorithm and for numerical differentiation

Specific Study Objectives Recognize why both Romberg integration and Gauss quadrature have utility when integrating equations (as opposed to tabular or discrete data). Understand basic finite difference approximations Understand the application of high-accuracy numerical-differentiation. Recognize data error on the processes of integration and differentiation.

Numerical Differentiation and Integration Calculus is the mathematics of change. Engineers must continuously deal with systems and processes that change, making calculus an essential tool of our profession. At the heart of calculus are the related mathematical concepts of differentiation and integration.

Differentiation Dictionary definition of differentiate - “to mark off by differences, distinguish; ..to perceive the difference in or between” Mathematical definition of derivative - rate of change of a dependent variable with respect to an independent variable

f(x) Dy Dx x

Integration The inverse process of differentiation Dictionary definition of integrate - “to bring together, as parts, into a whole; to unite; to indicate the total amount” Mathematically, it is the total value or summation of f(x)dx over a range of x. In fact the integration symbol is actually a stylized capital S intended to signify the connection between integration and summation.

f(x) x

Mathematical Background

Mathematical Background

Overview Newton-Cotes Integration Formulas Integration of Equations Trapezoidal rule Simpson’s Rules Unequal Segments Open Integration Integration of Equations Romberg Integration Gauss Quadrature Improper Integrals

Overview Numerical Differentiation Applied problems High accuracy formulas Richardson’s extrapolation Unequal spaced data Uncertain data Applied problems

Newton-Cotes Integration Common numerical integration scheme Based on the strategy of replacing a complicated function or tabulated data with some approximating function that is easy to integrate

Newton-Cotes Integration Common numerical integration scheme Based on the strategy of replacing a complicated function or tabulated data with some approximating function that is easy to integrate fn(x) is an nth order polynomial

The approximation of an integral by the area under - a first order polynomial - a second order polynomial

The approximation of an integral by the area under - a first order polynomial - a second order polynomial We can also approximated the integral by using a series of polynomials applied piece wise.

An approximation of an integral by the area under straight line segments.

An approximation of an integral by the area under straight line segments.

Newton-Cotes Formulas Closed form - data is at the beginning and end of the limits of integration Open form - integration limits extend beyond the range of data.

Trapezoidal Rule First of the Newton-Cotes closed integration formulas Corresponds to the case where the polynomial is a first order

Trapezoidal Rule A straight line can be represented as:

Trapezoidal Rule Integrate this equation. Results in the trapezoidal rule.

Trapezoidal Rule Recall the formula for computing the area of a trapezoid: height x (average of the bases) base height base

Trapezoidal Rule The concept is the same but the trapezoid is on its side. base height height height width base

Error of the Trapezoidal Rule This indicates that is the function being integrated is linear, the trapezoidal rule will be exact. Otherwise, for section with second and higher order derivatives (that is with curvature) error can occur. A reasonable estimate of x is the average value of b and a

Multiple Application of the Trapezoidal Rule Improve the accuracy by dividing the integration interval into a number of smaller segments Apply the method to each segment Resulting equations are called multiple-application or composite integration formulas

Multiple Application of the Trapezoidal Rule where there are n+1 equally spaced base points.

} } Multiple Application of the Trapezoidal Rule We can group terms to express a general form } } width average height

} Multiple Application of the Trapezoidal Rule width average height The average height represents a weighted average of the function values Note that the interior points are given twice the weight of the two end points

Example Evaluate the following integral using the trapezoidal rule and h = 0.1

Simpson’s 1/3 Rule Corresponds to the case where the function is a second order polynomial

Simpson’s 1/3 Rule Designate a and b as x0 and x2, and estimate f2(x) as a second order Lagrange polynomial

Simpson’s 1/3 Rule After integration and algebraic manipulation, we get the following equations } width average height

Error Single application of Trapezoidal Rule. Single application of Simpson’s 1/3 Rule

Multiple Application of Simpson’s 1/3 Rule

The odd points represent the middle term for each application The odd points represent the middle term for each application. Hence carry the weight 4. The even points are common to adjacent applications and are counted twice. i=1 (odd) weight of 4 i=2 (even) weight of 2 f(x) x

Simpson’s 3/8 Rule Corresponds to the case where the function is a third order polynomial

Integration of Unequal Segments Experimental and field study data is often unevenly spaced In previous equations we grouped the term (i.e. hi) which represented segment width.

Integration of Unequal Segments We should also consider alternately using higher order equations if we can find data in consecutively even segments trapezoidal rule

Integration of Unequal Segments We should also consider alternately using higher order equations if we can find data in consecutively even segments 1/3 rule trapezoidal rule

Integration of Unequal Segments We should also consider alternately using higher order equations if we can find data in consecutively even segments 1/3 rule trapezoidal rule 3/8 rule

Integration of Unequal Segments We should also consider alternately using higher order equations if we can find data in consecutively even segments trapezoidal rule 1/3 rule trapezoidal rule 3/8 rule

Example Integrate the following using the trapezoidal rule, Simpson’s 1/3 Rule, a multiple application of the trapezoidal rule with n=2 and Simpson’s 3/8 Rule. Compare results with the analytical solution.

Integration of Equations Integration of analytical as opposed to tabular functions Romberg Integration Richardson’s Extrapolation Romberg Integration Algorithm Gauss Quadrature Improper Integrals

Richardson’s Extrapolation Use two estimates of an integral to compute a third more accurate approximation The estimate and error associated with a multiple application trapezoidal rule can be represented generally as: I = I(h) + E(h) where I is the exact value of the integral I(h) is the approximation from an n-segment application E(h) is the truncation error h is the step size (b-a)/n

Make two separate estimates using step sizes of h1 and h2 . I(h1) + E(h1) = I(h2) + E(h2) Recall the error of the multiple-application of the trapezoidal rule Assume that is constant regardless of the step size

Substitute into previous equation: I(h1) + E(h1) = I(h2) + E(h2)

Thus we have developed an estimate of the truncation error in terms of the integral estimates and their step sizes. This estimate can then be substituted into: I = I(h2) + E(h2) to yield an improved estimate of the integral:

What is the equation for the special case where the interval is halved? i.e. h2 = h1 / 2

Example Use Richardson’s extrapolation to evaluate:

Romberg Integration We can continue to improve the estimate by successive halving of the step size to yield a general formula: k = 2; j = 1 Note: the subscripts m and l refer to more and less accurate estimates

Gauss Quadrature Extend the area under the straight line f(x) x f(x) x

Method of Undetermined Coefficients Recall the trapezoidal rule Before analyzing this method, answer this question. What are two functions that should be evaluated exactly by the trapezoidal rule? This can also be expressed as where the c’s are constant

The two cases that should be evaluated exactly by the trapezoidal rule: 1) y = constant 2) a straight line f(x) y = 1 f(x) y = x -(b-a)/2 x (b-a)/2 -(b-a)/2 x (b-a)/2

Thus, the following equalities should hold. FOR y=1 since f(a) = f(b) =1 FOR y =x since f(a) = x =-(b-a)/2 and f(b) = x =(b-a)/2

Evaluating both integrals For y = 1 For y = x Now we have two equations and two unknowns, c0 and c1. Solving simultaneously, we get : c0 = c1 = (b-a)/2 Substitute this back into:

We get the equivalent of the trapezoidal rule. DERIVATION OF THE TWO-POINT GAUSS-LEGENDRE FORMULA Lets raise the level of sophistication by: - considering two points between -1 and 1 - i.e. “open integration”

Previously ,we assumed that the equation f(x) -1 x0 x1 1 x Previously ,we assumed that the equation fit the integrals of a constant and linear function. Extend the reasoning by assuming that it also fits the integral of a parabolic and a cubic function.

We now have four equations and four unknowns c0 c1 x0 and x1 What equations are you solving?

f(xi) is either 1, xi, xi2 or xi3 Solve these equations simultaneously

This results in the following The interesting result is that the integral can be estimated by the simple addition of the function values at

What if we aren’t integrating from –1 to 1? A simple change in variables can be use to translate other limits. Assume that the new variable xd is related to the original variable x in a linear fashion. x = a0 + a1xd Let the lower limit x = a correspond to xd = -1 and the upper limit x=b correspond to xd=1 a = a0 + a1(-1) b = a0 + a1(1)

a = a0 + a1(-1) b = a0 + a1(1) SOLVE THESE EQUATIONS SIMULTANEOUSLY substitute

These equations are substituted for x and dx respectively. Let’s do an example to appreciate the theory behind this numerical method.

Example Estimate the following using two-point Gauss Legendre:

Higher-Point Formulas For two point, we determined that c0 = c1= 1 For three point: c0 = 0.556 x0=-0.775 c1= 0.889 x1=0.0 c2= 0.556 x2=0.775

Higher-Point Formulas Your text goes on to provide additional weighting factors (ci’s) and function arguments (xi’s) in Table 8.5 p. 593

Numerical Differentiation Forward finite divided difference Backward finite divided difference Center finite divided difference All based on the Taylor Series

Forward Finite Difference

Forward Divided Difference f(x) What is derivative at this point? (xi, yi) x

Forward Divided Difference f(x) (x i+1,y i+1) (xi, yi) Determine a second point base on Dx (h) x

Forward Divided Difference f(x) (x i+1,y i+1) How does this compare to the actual first derivative at xi? estimate (xi, yi) x

Forward Divided Difference f(x) (x i+1,y i+1) actual estimate (xi, yi) x

Forward Divided Difference Error is proportional to the step size first forward divided difference O(h2) error is proportional to the square of the step size O(h3) error is proportional to the cube of the step size

f(x) actual (xi,yi) estimate (xi-1,yi-1) x

Backward Difference Approximation of the First Derivative Expand the Taylor series backwards The error is still O(h)

Centered Difference Approximation of the First Derivative Subtract backward difference approximation from forward Taylor series expansion

f(x) actual (xi+1,yi+1) (xi,yi) estimate (xi-1,yi-1) x

f(x) f(x) f(x) x x f(x) x x forward finite divided difference approx. true derivative x x f(x) f(x) backward finite divided difference approx. centered finite divided difference approx. x x

Numerical Differentiation You should be familiar with the following Tables in your text Table 7.1: Common Finite Difference Formulas Table 7.2: Higher order finite difference formulas

Richardson Extrapolation Two ways to improve derivative estimates decrease step size use a higher order formula that employs more points Third approach, based on Richardson extrapolation, uses two derivatives estimates to compute a third, more accurate approximation

Richardson Extrapolation For a centered difference approximation with O(h2) the application of this formula will yield a new derivative estimate of O(h4)

Example Given the following function, use Richardson’s extrapolation to determine the derivative at 0.5. f(x) = -0.1x4 - 0.15x3 - 0.5x2 - 0.25x +1.2 Note: f(0) = 1.2 f(0.25) =1.1035 f(0.75) = 0.636 f(1) = 0.2

Derivatives of Unequally Spaced Data Common in data from experiments or field studies Fit a second order Lagrange interpolating polynomial to each set of three adjacent points, since this polynomial does not require that the points be equi-spaced Differentiate analytically

Derivative and Integral Estimates for Data with Errors In addition to unequal spacing, the other problem related to differentiating empirical data is measurement error Differentiation amplifies error Integration tends to be more forgiving Primary approach for determining derivatives of imprecise data is to use least squares regression to fit a smooth, differentiable function to the data In absence of other information, a lower order polynomial regression is a good first choice

Specific Study Objectives Understand the derivation of the Newton-Cotes formulas Recognize that the trapezoidal and Simpson’s 1/3 and 3/8 rules represent the areas of 1st, 2nd, and 3rd order polynomials Be able to choose the “best” among these formulas for any particular problem

Specific Study Objectives Recognize the difference between open and closed integration formulas Understand the theoretical basis of Richardson extrapolation and how it is applied in the Romberg integration algorithm and for numerical differentiation

Specific Study Objectives Recognize why both Romberg integration and Gauss quadrature have utility when integrating equations (as opposed to tabular or discrete data). Understand the application of high-accuracy numerical-differentiation. Recognize data error on the processes of integration and differentiation.

…..end of lecture