Chapter 7 Numerical Differentiation and Integration



Similar documents
Instantaneous Rate of Change:

Lecture 10: What is a Function, definition, piecewise defined functions, difference quotient, domain of a function

In other words the graph of the polynomial should pass through the points

Derivatives Math 120 Calculus I D Joyce, Fall 2013

Verifying Numerical Convergence Rates

The Derivative as a Function

SAT Subject Math Level 1 Facts & Formulas

2 Limits and Derivatives

Section 3.3. Differentiation of Polynomials and Rational Functions. Difference Equations to Differential Equations

ACT Math Facts & Formulas

6. Differentiating the exponential and logarithm functions

2.1: The Derivative and the Tangent Line Problem

CHAPTER 7. Di erentiation

Tangent Lines and Rates of Change

Math 113 HW #5 Solutions

Sections 3.1/3.2: Introducing the Derivative/Rules of Differentiation

The EOQ Inventory Formula

FINITE DIFFERENCE METHODS

Math 229 Lecture Notes: Product and Quotient Rules Professor Richard Blecksmith

MATHEMATICS FOR ENGINEERING DIFFERENTIATION TUTORIAL 1 - BASIC DIFFERENTIATION

5 Numerical Differentiation

1.6. Analyse Optimum Volume and Surface Area. Maximum Volume for a Given Surface Area. Example 1. Solution

New Vocabulary volume

M(0) = 1 M(1) = 2 M(h) = M(h 1) + M(h 2) + 1 (h > 1)

13 PERIMETER AND AREA OF 2D SHAPES

Math Test Sections. The College Board: Expanding College Opportunity

Integration. Topic: Trapezoidal Rule. Major: General Engineering. Author: Autar Kaw, Charlie Barker.

Notes: Most of the material in this chapter is taken from Young and Freedman, Chap. 12.

Average and Instantaneous Rates of Change: The Derivative

Projective Geometry. Projective Geometry

Høgskolen i Narvik Sivilingeniørutdanningen STE6237 ELEMENTMETODER. Oppgaver

November 16, Interpolation, Extrapolation & Polynomial Approximation

Perimeter, Area and Volume of Regular Shapes

SAT Math Facts & Formulas

SAT Math Must-Know Facts & Formulas

SAMPLE DESIGN FOR THE TERRORISM RISK INSURANCE PROGRAM SURVEY


Writing Mathematics Papers

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

f(x) f(a) x a Our intuition tells us that the slope of the tangent line to the curve at the point P is m P Q =

Taylor and Maclaurin Series

INTERPOLATION. Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y).

Determine the perimeter of a triangle using algebra Find the area of a triangle using the formula

Theoretical calculation of the heat capacity

Pressure. Pressure. Atmospheric pressure. Conceptual example 1: Blood pressure. Pressure is force per unit area:

4.3 Lagrange Approximation

A Multigrid Tutorial part two

The modelling of business rules for dashboard reporting using mutual information

Research on the Anti-perspective Correction Algorithm of QR Barcode

Chapter 10: Refrigeration Cycles

CHAPTER 8: DIFFERENTIAL CALCULUS

Volumes of Pyramids and Cones. Use the Pythagorean Theorem to find the value of the variable. h 2 m. 1.5 m 12 in. 8 in. 2.5 m

Note nine: Linear programming CSE Linear constraints and objective functions. 1.1 Introductory example. Copyright c Sanjoy Dasgupta 1

An inquiry into the multiplier process in IS-LM model

Numerical Analysis An Introduction

3 Ans. 1 of my $30. 3 on. 1 on ice cream and the rest on 2011 MATHCOUNTS STATE COMPETITION SPRINT ROUND

Algebra I Vocabulary Cards

Optimized Data Indexing Algorithms for OLAP Systems

Solutions by: KARATUĞ OZAN BiRCAN. PROBLEM 1 (20 points): Let D be a region, i.e., an open connected set in

Integrals of Rational Functions

APPLIED MATHEMATICS ADVANCED LEVEL

minimal polyonomial Example

Schedulability Analysis under Graph Routing in WirelessHART Networks

MATH 132: CALCULUS II SYLLABUS

Geometric Stratification of Accounting Data

Linear Algebra Notes for Marsden and Tromba Vector Calculus

How To Ensure That An Eac Edge Program Is Successful

Simplify the rational expression. Find all numbers that must be excluded from the domain of the simplified rational expression.

A strong credit score can help you score a lower rate on a mortgage

Section 2.3 Solving Right Triangle Trigonometry

Can a Lump-Sum Transfer Make Everyone Enjoy the Gains. from Free Trade?

Shell and Tube Heat Exchanger

THE NEISS SAMPLE (DESIGN AND IMPLEMENTATION) 1997 to Present. Prepared for public release by:

G(s) = Y (s)/u(s) In this representation, the output is always the Transfer function times the input. Y (s) = G(s)U(s).

Differentiation and Integration

14.1. Basic Concepts of Integration. Introduction. Prerequisites. Learning Outcomes. Learning Style

BX in ( u, v) basis in two ways. On the one hand, AN = u+

y cos 3 x dx y cos 2 x cos x dx y 1 sin 2 x cos x dx

EC201 Intermediate Macroeconomics. EC201 Intermediate Macroeconomics Problem set 8 Solution

u dx + y = 0 z x z x = x + y = 0 6) 2

Binary Search Trees. Adnan Aziz. Heaps can perform extract-max, insert efficiently O(log n) worst case

Inner Product Spaces

Torchmark Corporation 2001 Third Avenue South Birmingham, Alabama Contact: Joyce Lane NYSE Symbol: TMK

The Fourth International DERIVE-TI92/89 Conference Liverpool, U.K., July Derive 5: The Easiest... Just Got Better!

Algebra Cheat Sheets

Vector and Matrix Norms

Solutions to Homework 10

OPTIMAL DISCONTINUOUS GALERKIN METHODS FOR THE ACOUSTIC WAVE EQUATION IN HIGHER DIMENSIONS

Compute the derivative by definition: The four step procedure

SOLUTIONS. f x = 6x 2 6xy 24x, f y = 3x 2 6y. To find the critical points, we solve

Partial Fractions Examples

SWITCH T F T F SELECT. (b) local schedule of two branches. (a) if-then-else construct A & B MUX. one iteration cycle

Representation of functions as power series

Series FOURIER SERIES. Graham S McDonald. A self-contained Tutorial Module for learning the technique of Fourier series analysis

Derive 5: The Easiest... Just Got Better!

The Method of Least Squares. Lectures INF2320 p. 1/80

Transcription:

45 We ave a abit in writing articles publised in scientiþc journals to make te work as Þnised as possible, to cover up all te tracks, to not worry about te blind alleys or describe ow you ad te wrong idea Þrst, and so on. So tere isn t any place to publis, in a digniþed manner, wat you actually did in order to get to do te work. Ricard Pilips Feynman (1918-1988) Capter 7 Numerical Differentiation and Integration Agivensetof(n+1) data points (x i,y i ), i =0, 1,,...,nis assumed to represent some function y = y(x). Te data can come from some experiment or statistical study, were y = y(x) is unknown, or te data can be generated from a known function y = y(x). We assume te data points are equally spaced along te x-axis so tat x i+1 x i = is a constant for i =0, 1,,...,n 1. In tis capter we develop ways to approximate te derivatives of y = y(x) given only te data points. We also develop ways to integrate te function y = y(x) based solely upon te data points given. Numerical Approximation for Derivative To approximate te derivative function y! (x), evaluated at one of te given data points (x i,y i ),sayatx = x m, x 0 <x m <x n, we assume tat te function y(x) as a Taylor series expansion about te point x m given by eiter of te forms or y(x m + ) =y(x m )+y! (x m ) + y!! (x m )! + y!!! (x n ) 3 3! + (7.1) y(x m ) =y(x m ) y! (x m ) + y!! (x m )! y!!! (x m ) 3 + (7.) 3! By solving te equation (7.1) for te Þrst derivative one obtains te forward derivative approximation y! (x m )= y(x m + ) y(x m ) + O(). (7.3) Solving te equation (7.) for te Þrst derivative gives te backward derivative approximation y! (x m )= y(x m) y(x m ) + O(). (7.4)

46 Subtracting te equation (7.) from te equation (7.1) gives y(x m + ) y(x m ) =y! (x m )+y!!! (x m ) 3 3! fromwiconecanobtaintecentralderivativeapproximation y! (x m )= y(x m + ) y(x m ) + (7.5) + O( ) (7.6) wic is more accurate tan te results from equations (7.3) or (7.4). By using Taylor series expansions one can develop a variety of derivative approximations. One can derive a derivative approximation for any order derivative. Consider an approximation for te jt derivative d j y dx j x=x i = y (j) (x i ), (7.7) were j a positive integer. Te derivative can be approximated by assuming te derivative can be represented in te form y (j) (x i )= 1 j [β my(x i m)+β m 1 y(x i (m 1))+ + β 1 y(x i ) α 0 y(x i )+ + α n 1 y(x i +(n 1))+α n y(x i + n)] + O( N ) involving (m + n +1) data points, were β m, β m 1,...,β 1, α 0, α 1,...,α n and N are constants to be determined. Let y i+j = y(x i + j) for te index j ranging over te values j = m, (m 1),...,(n 1),n and expand tese terms in a Taylor series wic are ten substitute into te equation (7.8). One can ten collect like terms and force te rigt-and side of equation (7.8) to equal te left-and side of equation (7.8) by setting certain coefficients equal to eiter zero or one. Tis will produce a system of equations were te coefficients β m,...,β 1, α 0,...,α n and te order N of te error term can be determined. Example 7-1. (Derivative formula) Derive a formula for te Þrst derivative of te form (7.8) y! (x m )= 1 [α 0y m + α 1 y m+1 + α y m+ ]+O( N ) (7.9) were α 0, α 1, α and N are constants to be determined. Solution: Substitute te Taylor series expansions y m+1 = y(x m + ) =y(x m )+y! (x m ) + y!! (x m )! + y m+ = y(x m +) =y(x m )+y! (x m )()+y!! (x m ) ()! + (7.10)

47 into te assumed form for te derivative to obtain y m! = 1 "!α 0 y m + α 1 y m + y m! + # " y!! m + + α y m + y m! () ()+y!! m We collect like terms and write te above equation in te form y! m = 1! (α 0 + α 1 + α )y m +(α 1 + α ())y m! +(α $ 1 + α ( ))y m!! + O(3 ) #$ +. (7.11) In order tat te rigt-and side of equation (7.11) reduce to y! m we require te unknown coefficients to satisfy te equations α 0 + α 1 + α =0 α 1 +α =1 (1/) α 1 +α =0. (7.1) We solve tis system of equations and Þnd α 0 = 3/, α 1 =and α = 1/. Tis gives te derivative formula y! (x m )= 3y m +4y m+1 y m+ + O( ) (7.13) were te 1/ factor as simpliþed te error term in equation (7.11). By including more terms in te expansions above one can determine te exact form for te error term. Example 7-. (Derivative formula) Derive an approximation formula for te second derivative of te form y!! (x m )= 1 [β 1y m 1 + α 0 y m + α 1 y m+1 ]+O( N ) (7.14) were β 1, α 0, α 1 and N are constants to be determined. Solution: Substitute te Taylor series expansions given by equations (7.1) and (7.) into te equation (7.14) and ten combine like terms to obtain y!! (x m )= 1 [(β 1 + α 0 + α 1 )y m 1 +(α 0 + α 1 ())y! m +(α 0 /+α 1 ( ))y m!! +(α 1 β 1 )y m!!! 3 3! +(α 1 + β 1 )y m (iv) 4 $ 4! +. (7.15) In order for te rigt-and side of tis equation to reduce to y!! m we require te coefficients to satisfy te conditions β 1 + α 0 +α 1 =0 α 0 +α 1 =0 (1/) α 0 +α 1 =1

48 We solve tis system of equations and Þnd β 1 =1, α 0 = and α 1 =1. Observe tat tese values for β 1, α 0, α 1 make te y m!!! coefficient zero and so one obtains te second derivative approximation y!! (x m )= y m 1 y m + y m+1 + O( ). (7.16) Derivative approximations of a function can also be derived by differentiating a polynomial approximation of te function. For example, one can use a polynomial approximations suc as te Newton forward, Newton backward or Stirling polynomial approximations for y(x) and ten one can differentiate te polynomial approximation and use tat as an approximation for te derivative. For te Þrst derivative one obtains te approximation dy dp n(s) ds, were s = x x 0 dx x=x0 ds dx x=x0 (7.17) Approximations for iger derivatives can be obtain by taking iger order derivatives of te approximating polynomials. Tis gives te approximation d m y dx m 1 d m P n (s) m ds m (7.18) for m =1,, 3,... Differentiation is a rougening process and so one sould expect to obtain large errors wen using collocation polynomials to approximate a derivative. Te error term associated wit a derivative of an interpolating polynomial is obtained by differentiating te error term of te interpolating polynomial. Example 7-3. (Derivative formula) Obtain approximations for te derivatives y! (x 0 ),y!! (x 0 ) and y!!! (x 0 ) by differentiation of te Stirling polynomial approximation wic we obtain from te lozenge diagram of Þgure 4-1 % s+1 & % + s & " # s y0 + y 1 y(x) P n (x) =y 0 + + 1 " # s +1 3 y 1 + 3 y + + 3 % s+ 4 y 1 & % + s+1 & 4 4 y + (7.19) were s = x x 0 takes on integer values at x 0,x 1,... Solution: We use cain rule differentiation to differentiate te approximating

49 polynomial and ten use tese derivatives to approximate te derivatives of y(x). Expanding te equation (7.19) we Þnd " y0 + y 1 y(x) y 0 + s wit derivatives + 1 4 (s4 s ) 4 y + # + 1 s y 1 + 1 6 (s3 s) " 3 y 1 + 3 # y y! (x) 1!" # y0 + y 1 + s y 1 + 1 " 3 y 1 + 3 # y 6 (3s 1) + 1 $ 4 (4s3 s) 4 y + y!! (x) 1 "! 3 y 1 + 3 # y y 1 + s + 1 $ 1 (6s 1) 4 y + y!!! (x) 1!" 3 y 1 + 3 # $ y 3 + s 4 y + At te point x = x 0 we ave s =0and so we obtain te approximations y! (x 0 ) 1!" # y0 + y 1 1 " 3 y 1 + 3 #$ y 6 y!! (x 0 ) 1! y 1 1 $ 1 4 y y!!! (x 0 ) 1!" 3 y 1 + 3 #$ y 3 Tese same results can be obtain by differentiating te equation (4.95) considered earlier. Note also tat derivative approximations can be obtained from te appropriate values of a difference table. Alternatively, te differences can be expressed in terms of ordinate values and so te above derivative formulas can also be expressed in terms of ordinate values. Error Terms for Derivative Approximations To derive error terms associated wit numerical differentiation or integration we will need te following results. (1.) If F (x) is a continuous function over te interval a x b, tentere exists at least one point c suc tat a c b and for positive constants α and β. αf (a)+βf (b) =(α + β)f (c) (7.0)

50 (.) A generalization of te above result is te following. For F (x) continuous over te interval a<x<b,witpointsx i satisfying a x i b for i =1,...,n ten one can write F (x 1 )+F (x )+ + F (x n )=nf (ξ) (7.1) for some value ξ lying in te interval [a, b]. Te result (7.0) follows from te inequalities, tat if F (a) F (b), ten for positive weigts α and β or (α + β)f (a) αf (a)+βf (b) (α + β)f (b) F (a) αf (a)+βf (b) α + β F (b). Hence, if F (x) is continuous over te interval [a, b], ten tere exists at least one point c suc tat αf (a)+βf (b) α + β = F (c). Te result (7.1) is obtained by similar arguments. Te error associated wit an it derivative approximation evaluated at a point x 0 is deþned Error = y (i) (x 0 ) y (i) (x 0 ) approx (7.) Most error terms can be obtained by truncation of appropriate Taylor series expansions. For example, to Þnd an error term associated wit te forward derivative approximation y 0! = y 1 y 0 we truncate te Taylor series expansion and write y 1 = y(x 0 + ) =y(x 0 )+y! (x 0 ) + y!! (ξ)!, x 0 < ξ <x 0 + (7.3) Te error term is ten found from te relation " # y! y(x0 + ) y(x 0 ) (x 0 ) = Error (7.4) Substituting te Taylor series expansion for y(x 0 + ) gives Error = y! 0 1!y 0 + y!0 $!! + y(ξ)! y 0 = y!! (ξ). (7.5)

51 Sometimes it is necessary to use Taylor series expansions on one or more terms in a derivative approximation. For example, to Þnd an error term associated wit te central difference approximation for te second derivative y 0!! = y 1 y 0 + y 1 we use truncated Taylor series expansions from equations (7.1) and (7.) to obtain wic simpliþes to " Error =y 0!! y 1 y 0 + y 1 Error =y 0!! 1! y 0 y 0! + y 0!! +y 0 + y 0! + y!! 0 # + y!!! 0 y!!! 0 3 6 + y(iv) 0 (ξ 1 ) 4 $ 3 6 + y(iv) 0 (ξ ) 4 4 4 y 0 (7.6) Error = 1 y(iv) 0 (ζ) (7.7) To derive te result given by equation (7.7) we ave made te assumption tat te derivative y (iv) 0 (x) is a continuous function so tat 4 4 y(iv) 0 (ξ 1 )+ 4 4 y(iv) 0 (ξ )= " 4 4 + 4 4 # y (iv) 0 (ζ) wic is a special case of te result (7.0) previously cited. Note also we ad to go to fourt order terms in te expansions because te tird order terms added to zero. Metod of Undetermined Coefficients One can assume a derivative formula for f! (x) involving undetermined coef- Þcients and ten select te coefficients so tat te assumed derivative representation is exact wen te function f(x) is a polynomial. For example, wit equal spacing were x i+1 = x i +, one can assume a derivative formula f! (x i )=β 0 f(x i )+β 1 f(x i+1 )+β f(x i+ ) (7.8) were β 0, β 1, β are undetermined coefficients, and ten require tat tis formula be exact for te cases f(x) =1, f(x) =x x i and f(x) =(x x i ). In tis way one obtains tree equations from wic te tree unknowns β 0, β 1, β can be determined. We ave: For f(x) =1, te equation (7.8) becomes 0=β 0 + β 1 + β For f(x) =x x i, te equation (7.8) becomes 1= β 1 + β (7.9) For f(x) =(x x i ), te equation (7.8) becomes 0= β 1 + β 4

5 We solve te equations (7.9) and Þnd β 0 = 3/, β 1 =4/, andβ = 1/. Tis gives te Þrst derivative formula f! (x i )= 1 [ 3f(x i)+4f(x i+1 ) f(x i+ )] (7.30) Te error term associated wit tis formula can be obtained from equation (7.) togeter wit appropriate Taylor series expansions. Te metod of undetermined coefficients is applicable for determining bot derivative and integration formulas. Numerical Integration In tis section we develop integration formulas and associated error terms wic can be used for evaluating integrals of te form I 1 = ' b a f(x) dx or I = ' b a w(x)f(x) dx (7.31) were w(x) is called a weigt function. Integration formulas are also referred to as quadrature formulas. Te term quadrature coming from te ancient practice of constructing squares wit area equivalent to tat of a given plane surface. Te integrands f(x) or w(x)f(x) in equations (7.31) are assumed to be continuous wit known values over te interval a x b. Te interval [a, b], over wic te integral is desired, is divided by (n+1) points into sections wit a = x 0 <x 1 <x <... < x n = b. Tis is called partitioning te interval into n-panels. Tese panels can be of equal lengts or unequal lengts as illustrated in te Þgure 7-1. Figure 7-1. Partition of interval [a, b] into n-panels.

53 By developing integration formulas for te area under te curve associated wit one or more panels, one can repeat te integration formula until te area associated wit all panels is calculated. We begin by developing a one-panel formula. Assume tat te interval [a, b] is partitioned wit equal spacing wit a = x 0, b = x n, = b a n, x j = x 0 + j, for j =0, 1,,...,n. (7.3) Teareaundertecurve y = f(x) between and x i is approximated by constructing a straigt line interpolating polynomial troug te points (,y i 1 ) and (x i,y i ) andtenintegrating tis interpolation function. We use y i 1 = f( ) and y i = f(x i ) and obtain from te lozenge diagram of Þgure 4-1, wit appropriate notation cange, te straigt line P 1 (x) =y i 1 + s y i 1 + s(s 1) f!! (ξ(x)), were s = x (7.33) and y i 1 = y i y i 1. Te area associated wit one-panel is ten approximated by f(x) dx P 1 (x) dx = $!y i 1 + s y i 1 + s(s 1) f!! (ξ(x)) dx. (7.34) We use te cange of variable for s given by equation (7.33) and integrate te Þrst two terms of equation (7.34) to obtain f(x) dx = $ 1!sy i 1 + s y i 1 = 0 [y i 1 + y i ] (7.35) wic is known as te trapezoidal rule since te area of a trapezoid is te average eigt times te base. Alternatively te trapezoidal rule can be derived by integrating te Lagrange interpolating polynomial from to x i. P 1 (x) = x x i x i f( )+ x x i f(x i )

54 Te last integral in equation (7.34) represents an integral of te error term accompanying te approximation polynomial. In order to evaluate tis last integral we use te mean value teorem ' xn x m ' xn f(x)g(x) dx = f(ζ) g(x) dx, x m < ζ <x n, (7.36) x m were it is assumed tat te functions f, g are continuous in te interval [x m,x n ] and g(x) remains of one sign over te interval. i.e. Eiter g(x) 0 or g(x) 0 over te interval. By integrating te error term of te straigt line approximating polynomial one obtains te local error term associated wit te trapezoidal rule formula. Tis integration produces local error = (s s) f!! (ξ(x)) dx, s = x local error = 3 f!! (ζ) ' 1 local error = 3 1 f!! (ζ). 0 (s s) ds = 3 f!! (ζ)! s 3 3 s, ds = dx $ 1 0 (7.37) Te one-panel trapezoidal formula wit local error term can be written in eiter of te forms or f(x) dx = [y i 1 + y i ] 3 1 f!! (ζ) f(x) dx = [f()+f(x i )] 3 1 f!! (ζ) By partitioning an interval [x 0,x n ] into n +1 points one can write ' xn x 0 f(x) dx = n( j=1 ' xj (7.38) x j 1 f(x) dx. (7.39) Now one can apply te trapezoidal rule to eac of te n-panels. Te sum tat results gives a representation of te integral over te interval [x 0,x n ]. Tis representation is called te extended trapezoidal rule or composite trapezoidal rule and can be represented for equal or unequal panel spacing. For unequal panel spacing te extended trapezoidal rule is written ' xn x 0 f(x) dx = 1 (y 0 + y 1 )+ (y 1 + y )+ + n (y n 1 + y n )+global error (7.40)