Download presentation
Presentation is loading. Please wait.
Published byEileen Tucker Modified over 9 years ago
2
Chapter 4 Numerical Differentiation and Integration 1/16 Given x 0, approximate f ’(x 0 ). h xfhxf xf h )()( lim)(' 00 0 0 x0x0 x1x1 h x1x1 x0x0 h 4.1 Numerical Differentiation forward backward
3
Chapter 4 Numerical Differentiation and Integration -- Numerical Differentiation Approximate f(x) by its Lagrange polynomial with interpolating points x 0 and x 0 + h. f (x) = f ’(x) = f ’(x 0 ) = O(h)O(h) 2/16
4
Chapter 4 Numerical Differentiation and Integration -- Numerical Differentiation Approximate f(x) by its Lagrange polynomial with interpolating points { x 0, x 1, …, x n }. f ’(x j ) = Note: In general, more evaluation points produce greater accuracy. In general, more evaluation points produce greater accuracy. On the other hand, the number of functional evaluations grows and the roundoff error increases. Hence the numerical differentiation is unstable! On the other hand, the number of functional evaluations grows and the roundoff error increases. Hence the numerical differentiation is unstable! 3/16
5
Chapter 4 Numerical Differentiation and Integration -- Numerical Differentiation Example: Given three points x 0, x 0 + h, and x 0 + 2h, please derive the three- point formulae for each of the points. Symmetric to formula 1, with h < 0. x –1 x1x1 x0x0 Five-point formulae are given on p.171 4/16
6
Chapter 4 Numerical Differentiation and Integration -- Numerical Differentiation Approximate f ”(x 0 ) Consider Taylor expansions of f(x 0 + h) and f(x 0 – h) at x 0 : )( 12 )()(2)( 1 )( )4( 2 000 2 0 f h hxfxfhxf h xf HW: p.176-177 #7, 13 Excuses for not doing homework I could only get arbitrarily close to my textbook. I couldn't actually reach it. 5/16
7
Chapter 4 Numerical Differentiation and Integration -- Elements of Numerical Integration 4.3 Elements of Numerical Integration Approximate -- Numerical Quadrature Integrate the Lagrange interpolating polynomial of f (x) instead. Idea Select a set of distinct nodes a x 0 < x 1 <…< x n b from [a, b]. The Lagrange polynomial is AkAk Error interpolatory quadrature 6/16
8
Chapter 4 Numerical Differentiation and Integration -- Elements of Numerical Integration Definition: The degree of accuracy, or precision, of a quadrature formula is the largest positive integer n such that the formula is exact for x k for each k = 0, 1, …, n. Example: Consider the linear interpolation on [a, b], we have f(x)f(x) ab f(a)f(a) f(b)f(b) trapezoidal rule Please determine the precision of this formula. Solution: Consider x k for each k = 0, 1, … x 0 = 1 : = x : = x 2 : Degree of Precision = 1 7/16
9
Chapter 4 Numerical Differentiation and Integration -- Elements of Numerical Integration For equally spaced nodes : Let Cotes coefficient Note: Cotes coefficients does not depend on either f(x) or [a, b], and can be determined by n and i only. Hence we can find these coefficients from a table. The formulae are called Newton-Cotes formulae. n = 1: Trapezoidal Rule Precision = 1 8/16
10
Chapter 4 Numerical Differentiation and Integration -- Elements of Numerical Integration n = 2: Simpson’s Rule Precision = 3 n = 3: Simpson’s 3/8-Rule. Precision = 3, and n = 4: Cotes Rule. Precision = 5, and Theorem: For the (n+1)-point closed Newton-Cotes formula, there exists (a, b) for which if n is even and f C n+2 [a, b], and if n is odd and f C n+1 [a, b]. HW: p.195 #7, 9, 11, 13 9/16
11
Chapter 4 Numerical Differentiation and Integration -- Composite Numerical Integration 4.4 Composite Numerical Integration Due to the oscillatory nature of high-degree polynomials, piecewise interpolation is applied to approximate f(x) a piecewise approach that uses the low-order Newton-Cotes formulae. Haven’t we had enough formulae? What’s up now? Oh come on, you don’t seriously consider h=(b a)/2 acceptable, do you? Why can’t you simply refine the partition if you have to be so picky? Don’t you forget the oscillatory nature of high- degree polynomials! Uh-oh Composite Trapezoidal Rule: Apply Trapezoidal Rule on each [x k – 1, x k ]: = Tn= Tn /*MVT*/ 10/16
12
Chapter 4 Numerical Differentiation and Integration -- Composite Numerical Integration Composite Simpson’s Rule: 44444 = Sn= SnNote: To simplify the notation, we may let n’ = 2n. Then To simplify the notation, we may let n’ = 2n. Then and and 11/16
13
Chapter 4 Numerical Differentiation and Integration -- Composite Numerical Integration Composite integration techniques are all stable. Example: Consider the Simpson’s Rule with n subintervals on [a, b]. Assume that f (x i ) is approximated by f *(x i ) such that f (x i ) = f *(x i ) + i for each i = 0, 1, …, n. Then the accumulated error e(h) is If | i | < for all i = 0, 1, …, n, then When we refine the partition to ensure accuracy, the increased computation will NOT increase the roundoff error. 12/16
14
Chapter 4 Numerical Differentiation and Integration -- Composite Numerical Integration Example: Use Trapezoidal rule and Simpson’s rule with n = 8 to approximate where = 3.138988494 where = 3.141592502 Solution: When programming we usually keep dividing the subintervals into 2 equally spaced smaller subintervals. That is, take n = 2 k for k = 0, 1, … When k = 9, T 512 = 3.14159202 = 3.141592502= S 4 HW: p.204 #7(a)(b) 13/16
15
Chapter 4 Numerical Differentiation and Integration -- Romberg Integration 4.5 Romberg Integration Since the error of Trapezoidal rule is when we reduce the length of each subinterval into a half, Solve for I : = S n In general: Romberg sequence Romberg method: < ? … … … T 1 = )0( 0 T T 8 = )3( 0 T T 4 = )2( 0 T T 2 = )1( 0 T S 1 = )0( 1 T R 1 = )0( 3 T S 2 = )1( 1 T C 1 = )0( 2 T C 2 = )1( 2 T S 4 = )2( 1 T 14/16
16
Lab 08. Shape Roof Time Limit: 2 seconds; Points: 4 The kind of roof shown in Figure 1 is shaped from plain flat rectangular plastic board in Figure 2. Figure 1 Figure 2 The transection of the roof is a sine curve with altitude l centimeters. Given the length of the roof, your task is to calculate the length of the flat board needed to shape the roof. 15/16
17
Chapter 4 Numerical Differentiation and Integration -- Richardson’s Extrapolation 4.2 Richardson’s Extrapolation Generate high-accuracy results while using low-order formulae Suppose that for some h 0, we have a formula T 0 (h) that approximates an unknown I, and that the truncation error has the form: T 0 (h) I = 1 h + 2 h 2 + 3 h 3 + … Replace h by half its value, we have T 0 (h/2) I = 1 (h/2) + 2 (h/2) 2 + 3 (h/2) 3 + … Q : How to improve the accuracy from O(h) to O(h 2 ) ?... 4 3 2 1 12 )()(2 3 3 2 2 0 2 0 hhI hTT h 16/16
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.