Numerical Differentiation & Integration Numerical Differentiation I Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c � 2011 Brooks/Cole, Cengage Learning
Introduction General Formulas 3-pt Formulas Outline Introduction to Numerical Differentiation 1 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 2 / 33
Introduction General Formulas 3-pt Formulas Outline Introduction to Numerical Differentiation 1 General Derivative Approximation Formulas 2 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 2 / 33
Introduction General Formulas 3-pt Formulas Outline Introduction to Numerical Differentiation 1 General Derivative Approximation Formulas 2 Some useful three-point formulas 3 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 2 / 33
Introduction General Formulas 3-pt Formulas Outline Introduction to Numerical Differentiation 1 General Derivative Approximation Formulas 2 Some useful three-point formulas 3 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 3 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 4 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative The derivative of the function f at x 0 is f ( x 0 + h ) − f ( x 0 ) f ′ ( x 0 ) = lim . h h → 0 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 4 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative The derivative of the function f at x 0 is f ( x 0 + h ) − f ( x 0 ) f ′ ( x 0 ) = lim . h h → 0 This formula gives an obvious way to generate an approximation to f ′ ( x 0 ) ; simply compute f ( x 0 + h ) − f ( x 0 ) h for small values of h . Although this may be obvious, it is not very successful, due to our old nemesis round-off error. Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 4 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative The derivative of the function f at x 0 is f ( x 0 + h ) − f ( x 0 ) f ′ ( x 0 ) = lim . h h → 0 This formula gives an obvious way to generate an approximation to f ′ ( x 0 ) ; simply compute f ( x 0 + h ) − f ( x 0 ) h for small values of h . Although this may be obvious, it is not very successful, due to our old nemesis round-off error. But it is certainly a place to start. Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 4 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative (Cont’d) To approximate f ′ ( x 0 ) , suppose first that x 0 ∈ ( a , b ) , where f ∈ C 2 [ a , b ] , and that x 1 = x 0 + h for some h � = 0 that is sufficiently small to ensure that x 1 ∈ [ a , b ] . Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 5 / 33
Introduction General Formulas 3-pt Formulas Introduction to Numerical Differentiation Approximating a Derivative (Cont’d) To approximate f ′ ( x 0 ) , suppose first that x 0 ∈ ( a , b ) , where f ∈ C 2 [ a , b ] , and that x 1 = x 0 + h for some h � = 0 that is sufficiently small to ensure that x 1 ∈ [ a , b ] . We construct the first Lagrange polynomial P 0 , 1 ( x ) for f determined by x 0 and x 1 , with its error term: f ( x ) = P 0 , 1 ( x ) + ( x − x 0 )( x − x 1 ) f ′′ ( ξ ( x )) 2 ! = f ( x 0 )( x − x 0 − h ) + f ( x 0 + h )( x − x 0 ) + ( x − x 0 )( x − x 0 − h ) f ′′ ( ξ ( x )) − h h 2 for some ξ ( x ) between x 0 and x 1 . Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 5 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ( x ) = f ( x 0 )( x − x 0 − h ) + f ( x 0 + h )( x − x 0 ) + ( x − x 0 )( x − x 0 − h ) f ′′ ( ξ ( x )) − h h 2 Differentiating gives f ( x 0 + h ) − f ( x 0 ) � ( x − x 0 )( x − x 0 − h ) � f ′ ( x ) + D x f ′′ ( ξ ( x )) = h 2 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 6 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ( x ) = f ( x 0 )( x − x 0 − h ) + f ( x 0 + h )( x − x 0 ) + ( x − x 0 )( x − x 0 − h ) f ′′ ( ξ ( x )) − h h 2 Differentiating gives f ( x 0 + h ) − f ( x 0 ) � ( x − x 0 )( x − x 0 − h ) � f ′ ( x ) + D x f ′′ ( ξ ( x )) = h 2 f ( x 0 + h ) − f ( x 0 ) + 2 ( x − x 0 ) − h f ′′ ( ξ ( x )) = h 2 + ( x − x 0 )( x − x 0 − h ) D x ( f ′′ ( ξ ( x ))) 2 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 6 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ( x ) = f ( x 0 )( x − x 0 − h ) + f ( x 0 + h )( x − x 0 ) + ( x − x 0 )( x − x 0 − h ) f ′′ ( ξ ( x )) − h h 2 Differentiating gives f ( x 0 + h ) − f ( x 0 ) � ( x − x 0 )( x − x 0 − h ) � f ′ ( x ) + D x f ′′ ( ξ ( x )) = h 2 f ( x 0 + h ) − f ( x 0 ) + 2 ( x − x 0 ) − h f ′′ ( ξ ( x )) = h 2 + ( x − x 0 )( x − x 0 − h ) D x ( f ′′ ( ξ ( x ))) 2 Deleting the terms involving ξ ( x ) gives f ′ ( x ) ≈ f ( x 0 + h ) − f ( x 0 ) h Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 6 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ′ ( x ) ≈ f ( x 0 + h ) − f ( x 0 ) h Approximating a Derivative (Cont’d) One difficulty with this formula is that we have no information about D x f ′′ ( ξ ( x )) , so the truncation error cannot be estimated. Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 7 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ′ ( x ) ≈ f ( x 0 + h ) − f ( x 0 ) h Approximating a Derivative (Cont’d) One difficulty with this formula is that we have no information about D x f ′′ ( ξ ( x )) , so the truncation error cannot be estimated. When x is x 0 , however, the coefficient of D x f ′′ ( ξ ( x )) is 0, and the formula simplifies to f ′ ( x 0 ) = f ( x 0 + h ) − f ( x 0 ) − h 2 f ′′ ( ξ ) h Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 7 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ′ ( x 0 ) = f ( x 0 + h ) − f ( x 0 ) − h 2 f ′′ ( ξ ) h Forward-Difference and Backward-Difference Formulae For small values of h , the difference quotient f ( x 0 + h ) − f ( x 0 ) h can be used to approximate f ′ ( x 0 ) with an error bounded by M | h | / 2, where M is a bound on | f ′′ ( x ) | for x between x 0 and x 0 + h . Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 8 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation f ′ ( x 0 ) = f ( x 0 + h ) − f ( x 0 ) − h 2 f ′′ ( ξ ) h Forward-Difference and Backward-Difference Formulae For small values of h , the difference quotient f ( x 0 + h ) − f ( x 0 ) h can be used to approximate f ′ ( x 0 ) with an error bounded by M | h | / 2, where M is a bound on | f ′′ ( x ) | for x between x 0 and x 0 + h . This formula is known as the forward-difference formula if h > 0 and the backward-difference formula if h < 0. Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 8 / 33
Introduction General Formulas 3-pt Formulas Forward-Difference Formula to Approximate f ′ ( x 0 ) y Slope f 9 ( x 0 ) f ( x 0 1 h ) 2 f ( x 0 ) Slope h x 0 1 h x x 0 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 9 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation Example 1: f ( x ) = ln x Use the forward-difference formula to approximate the derivative of f ( x ) = ln x at x 0 = 1 . 8 using h = 0 . 1, h = 0 . 05, and h = 0 . 01, and determine bounds for the approximation errors. Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 10 / 33
Introduction General Formulas 3-pt Formulas Numerical Differentiation Example 1: f ( x ) = ln x Use the forward-difference formula to approximate the derivative of f ( x ) = ln x at x 0 = 1 . 8 using h = 0 . 1, h = 0 . 05, and h = 0 . 01, and determine bounds for the approximation errors. Solution (1/3) The forward-difference formula f ( 1 . 8 + h ) − f ( 1 . 8 ) h with h = 0 . 1 Numerical Analysis (Chapter 4) Numerical Differentiation I R L Burden & J D Faires 10 / 33
Recommend
More recommend