Numerical Differentiation (MAT 311) PDF

Summary

This document provides a lecture on numerical differentiation, focusing on first-order schemes. It explains the method using Taylor series expansions and provides examples of forward, backward, and central difference approximations. The document also includes exercises.

Full Transcript

Numerical Differentiation MAT 311 First order schemes Introduction to Numerical Differentiation ▶ Numerical differentiation approximates the derivative of a function using discrete data points. ▶ Essential when analytical differentiation is impossible or impract...

Numerical Differentiation MAT 311 First order schemes Introduction to Numerical Differentiation ▶ Numerical differentiation approximates the derivative of a function using discrete data points. ▶ Essential when analytical differentiation is impossible or impractical. ▶ Widely used in engineering, physics, and computational sciences. Importance of Numerical Differentiation ▶ Solving differential equations numerically. ▶ Analyzing experimental data to find rates of change. ▶ Implementing numerical methods in simulations. Taylor Series: Foundation of Numerical Differentiation Key Concept Numerical differentiation schemes approximate continuous derivatives using difference quotients. These formulas are primarily derived from Taylor series expansions. Taylor Series Expansion For a function f (x) that is infinitely differentiable at point x: f ′′ (x) 2 f ′′′ (x) 3 f (x + h) = f (x) + f ′ (x)h + h + h + O(h4 ) 2! 3! ▶ Provides systematic approximation of functions near a point ▶ Forms basis for deriving finite difference formulas ▶ Error term O(h4 ) indicates truncation accuracy Forward Difference: Taylor Series Derivation Step 1: Taylor expansion about x f ′′ (x) 2 f ′′′ (x) 3 f (x + h) = f (x) + f ′ (x)h + h + h + O(h4 ) 2! 3! Step 2: Rearrange to make f ′ (x) the subject  ′′ f (x + h) − f (x) f (x) f ′′′ (x) 2  ′ f (x) = − h+ h +O(h3 ) h 2 6 | {z } truncation error f (x + h) − f (x) Forward Difference Approximation: f ′ (x) ≈ h f ′′ (x) with leading truncation error term: E = − h 2 The approximation is first-order accurate, denoted by O(h) since the leading error term is proportional to h Backward Difference: Taylor Series Derivation Step 1: Taylor expansion about x f ′′ (x) 2 f ′′′ (x) 3 f (x − h) = f (x) − f ′ (x)h + h − h + O(h4 ) 2! 3! Step 2: Rearrange to make f ′ (x) the subject  ′′ f (x) − f (x − h) f (x) f ′′′ (x) 2  ′ f (x) = + h− h +... h 2 6 | {z } truncation error f (x) − f (x − h) Backward Difference Approximation: f ′ (x) ≈ h f ′′ (x) with leading truncation error term: E = h 2 The approximation is first-order accurate, denoted by O(h) since the leading error term is proportional to h Central Difference: Taylor Series Derivation Step 1: Taylor expansions about x f ′′ (x) 2 f ′′′ (x) 3 f (x + h) = f (x) + f ′ (x)h + h + h + O(h4 ) 2! 3! f ′′ (x) 2 f ′′′ (x) 3 f (x − h) = f (x) − f ′ (x)h + h − h + O(h4 ) 2! 3! Step 2: Subtract equations to make f ′ (x) while eliminating f ′′ (x)  ′′′ f (x + h) − f (x − h) f (x) 2  ′ f (x) = − h +... 2h 6 | {z } truncation error f (x + h) − f (x − h) Central Difference Approximation: f ′ (x) ≈ 2h f ′′′ (x) 2 with leading truncation error term: E = − h 6 The approximation is second-order accurate, denoted by O(h2 ) since the leading error term is proportional to h2 Three-Point Forward Difference Step 1: Taylor expansions about x f ′′ (x) 2 f ′′′ (x) 3 f (4) (x) 4 f (x + h) = f (x) + f ′ (x)h + h + h + h + O(h5 ) 2! 3! 4! (1) 8f ′′′ (x) 3 16f (4) (x) 4 f (x + 2h) = f (x) + 2f ′ (x)h + 2f ′′ (x)h2 + h + h + O(h5 ) 3! 4! (2) Step 2: Multiply equation (1) by 4 and subtract equation (2) 2f ′′′ (x) 3 2f (4) (x) 4 4f (x + h) = 4f (x) + 4f ′ (x)h + 2f ′′ (x)h2 + h + h + O(h5 ) 3 3 ′′′ (4) 8f (x) 3 16f (x) 4 −f (x + 2h) = −f (x) − 2f ′ (x)h − 2f ′′ (x)h2 − h − h − O(h5 ) 6 24 ′′′ 2f (x) 3 2f (x) 4 (4) 4f (x + h) − f (x + 2h) = 3f (x) + 2f ′ (x)h + h − h + O(h5 ) 3 3 Step 3: Rearrange to make f ′ (x) the subject  ′′′ −f (x + 2h) + 4f (x + h) − 3f (x) f (x)  f ′ (x) = − h2 +O(h3 ) 2h 3 | {z } truncation error Three-Point Forward Difference The Three-Point Forward Difference is give by −f (x + 2h) + 4f (x + h) − 3f (x) f ′ (x) ≈ 2h f ′′′ (x) 2 with leading truncation error term: E = − h The 3 approximation is second-order accurate, denoted by O(h2 ) since the leading error term is proportional to h2 Exercises (Part 1) 1. Second-Order Backward Difference: 3f (x) − 4f (x − h) + f (x − 2h) f ′ (x) ≈ 2h f ′′′ (x) 2 Truncation Error: E = 3 h (Second-order accurate) 2. Third-Order Forward Difference: −11f (x) + 18f (x + h) − 9f (x + 2h) + 2f (x + 3h) f ′ (x) ≈ 6h f (4) (x) 3 Truncation Error: E = 4 h (Third-order accurate) 3. Third-Order Backward Difference: 2f (x − 3h) − 9f (x − 2h) + 18f (x − h) − 11f (x) f ′ (x) ≈ 6h (4) (x) Truncation Error: E = − f 4 h3 (Third-order accurate) Exercises (Part 2) 4. Fourth-Order Central Difference: −f (x + 2h) + 8f (x + h) − 8f (x − h) + f (x − 2h) f ′ (x) ≈ 12h (5) (x) Truncation Error: E = − f 30 h4 (Fourth-order accurate) 5. Four-Point Forward Difference: −25f (x) + 48f (x + h) − 36f (x + 2h) + 16f (x + 3h) − 3f (x + 4h) f ′ (x) ≈ 12h f (5) (x) 4 Truncation Error: E = 5 h (Fourth-order accurate)

Use Quizgecko on...
Browser
Browser