انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Numerical Differentiation

الكلية كلية العلوم للبنات     القسم قسم فيزياء الليزر     المرحلة 3
أستاذ المادة نزار سالم شنان الزبيدي       4/27/2011 7:18:25 AM

Numerical Differentiation Chapter 5

Nizar Salim 1 lecture 1

5.1 INTRODUCTION

Figure 5.1 presents a set of tabular data in the form of a set of [x,f(x)] pairs. The function

f(x) is known only at discrete values of x. Interpolation within a set of discrete data is

discussed in Chapter 3. Differentiation within a set of discrete data is presented in this

chapter. The discrete data presented in Figure 5.1 are values of the function f(x) = l/x,

which are used as the example problem in this chapter.

The evaluation of a derivative is required in many problems in engineering and

science:

where the alternate notations f (x) and fx(x) are used for the derivatives. The function f(x),

which is to be differentiated, may be a know function or a set of discrete data. In general,

known functions can be differentiated exactly. Differentiation of discrete data, however,

Numerical Differentiation Chapter 5

Nizar Salim 2 lecture 1

requires an approximate numerical procedure. The evaluation of derivatives by

approximate numerical procedures is the subject of this chapter.

Numerical differentiation formulas can be developed by fitting approximating

functions (e.g., polynomials) to a set of discrete data and differentiating the

approximating function. Thus,

This process is illustrated in Figure 5.2. As illustrated in Figure 5.2, even though the

approximating polynomial Pn(x) passes through the discrete data points exactly, the

derivative of the polynomial P n(x) may not be a very accurate approximation of the

derivative of the exact function f(x) even at the known data points themselves. In general,

numerical differentiation is an inherently inaccurate process.

To perform numerical differentiation, an approximating polynomial is fit to the

discrete data, or a subset of the discrete data, and the approximating polynomial is

differentiated. The polynomial may be fit exactly to a set of discrete data by the methods

presented in Sections 4.3 to 4.9, or approximately by a least squares fit as described in

Section 4.10. In both cases, the degree of the approximating polynomial chosen to

represent the discrete data is the only parameter under our control.

Several numerical differentiation procedures are presented in this chapter.

Differentiation of direct fit polynomials, Lagrange polynomials, and divided difference

polynomials can be applied to both unequally spaced data and equally spaced data.

Differentiation formulas based on both Newton forward-difference polynomials and

Newton backward-difference polynomials can be applied to equally spaced data.

Numerical differentiation formulas can also be developed using Taylor series. This

Numerical Differentiation Chapter 5

Nizar Salim 3 lecture 1

approach is quite useful for developing difference formulas for approximating exact

derivatives in the numerical solution of differential equations.

The simple function

5.2 UNEQUALLY SPACED DATA

Three straightforward numerical differentiation procedures that can be used for both

unequally spaced data and equally spaced data are presented in this section:

1. Direct fit polynomials

2. Lagrange polynomials

3. Divided difference polynomials

5.2.1 Direct Fit Polynomials

A direct fit polynomial procedure is based on fitting the data directly by a polynomial and

differentiating the polynomial. Recall the direct fit polynomial, Eq. (4.34):

where Pn(x) is determined by one of the following methods:

Numerical Differentiation Chapter 5

Nizar Salim 4 lecture 1

1. Given N = n + I points, [xi, f(xi)], determine the exact nth-degree polynomial that

passes through the data points, as discussed in Section 4.3.

2. Given N > n + 1 points, [xi, f(xi)], determine the least squares nth-degree polynomial

that best fits the data points, as discussed in Section 4.10.3.

After the approximating polynomial has been fit, the derivatives are determined by

differentiating the approximating polynomial. Thus,

Equations (5.7a) and (5.7b) are illustrated in Example 5.1.

5.2.2. Lagrange Polynomials

The second procedure that can be used for both unequally spaced data and equally spaced

data is based on differentiating a Lagrange polynomial. For example, consider the

second- degree Lagrange polynomial, Eq. (4.45):

5.2.3. Divided Difference Polynomials

The third procedure that can be used for both unequally spaced data and equally spaced

data is based on differentiating a divided difference polynomial, Eq. (4.65):

Numerical Differentiation Chapter 5

Nizar Salim 5 lecture 1

Example 5.1. Direct fit, Lagrange, and divided difference polynomials.

Let s solve the example problem presented in Section 5.1 by the three procedures

presented above. Consider the following three data points:

Solving for ao,a1 and a2 by Gauss elimination gives a0 = 0.858314, a1 = -0.245500, and

a2 =0.023400.

Substituting these values into Eqs. (5.7a) and (5.7b) and evaluating at x = 3.5 yields the

solution for the direct fit polynomial:

Numerical Differentiation Chapter 5

Nizar Salim 6 lecture 1

Substituting the tabular values into Eqs. (5.9a) and (5.9b) and evaluating at x = 3.5

yields the solution for the Lagrange polynomial:

A divided difference table must be constructed for the tabular data to use the divided

difference polynomial. Thus,

Substituting these values into Eqs. (5.11a) and (5.11b) yields the solution for the divided

difference polynomial:

The results obtained by the three procedures are identical since the same three

points are used in all three procedures.

The error in f (3.5) is Error =f (3.5) P 2(3.5) = -0.081700 -(-0.081633) = -0.000067,

and the error in f "(3.5) is Error =f "(3.5)- P 2 (3.5) = 0.046800 (.046647) = 0.000153.

Numerical Differentiation Chapter 5

Nizar Salim 7 lecture 1

5.3 EQUALLY SPACED DATA

When the tabular data to be differentiated are known at equally spaced points, the

Newton forward-difference and backward-difference polynomials, presented in Section

4.6, can be fit to the discrete data with much less effort than a direct fit polynomial, a

Lagrange polynomial, or a divided difference polynomial. This can significantly decrease

the amount of effort required to evaluate derivatives. Thus,

where n( ) is either the Newton forward-difference or backward-difference polynomial.

5.3.1. Newton Forward-Difference Polynomial

Recall the Newton forward-difference polynomial, Eq. (4.88):

Equation (5.15) requires that the approximating polynomial be an explicit function of x,

whereas Eq. (5.16) is implicit in x. Either Eq. (5.16) must be made explicit in x by

introducing Eq. (5.18) into Eq. (5.16), or the differentiation operations in Eq. (5.15) must

be transformed into explicit operations in terms of s, so that Eq. (5.16) can be used

directly.

The first approach leads to a complicated procedure, so the second approach is taken.

From Eq. (5.18), x = x(s). Thus,

Numerical Differentiation Chapter 5

Nizar Salim 8 lecture 1

Higher-order derivatives can be obtained in a similar manner. Recall that nf becomes

less and less accurate as n increases. Consequently, higher-order derivatives become

increasingly less accurate.

At x = x0, s = 0.0, and Eqs. (5.23) and (5.25) becomes

Numerical Differentiation Chapter 5

Nizar Salim 9 lecture 1

Example 5.2. Newton forward-difference polynomial, one-sided.

Let s solve the example problem presented in Section 5.1 using a Newton forwarddifference

polynomial with base point x0 = 3.5, so x0 = 3.5 in Eqs. (5.26) and (5.27).

Selecting data points from Figure 5.1 and constructing the difference table gives

The order of the approximation of P n(x) is the same as the order of the highest-order

difference included in the evaluation. The first term in Eq. (5.32) is fo, so evaluating that

term gives an 0(h) result. The second term in Eq. (5.32) is 2 fo , so evaluating that term

yields an 0(h2) result, etc. Evaluating Eq. (4.32) term by term yields

P n(3.5) = -0.07936_ first order Error = 0.00227_

= -0.08150. second order = 0.00013_

= -0.08161_ third order = 0.00002_

The first-order result is quite inaccurate. The second- and third-order results are quite

good. In all cases, only five significant digits after the decimal place are obtained.

Equation (5.27) gives

Numerical Differentiation Chapter 5

Nizar Salim 10 lecture 1

The order of the approximation of P (x) is one less than the order of the highest-order

difference included in the evaluation. The first term in Eq. (5.33) is 2 fo, so evaluating

that term gives an 0(h) result. The second term in Eq. (5.33) is 3 fo, so evaluating that

term yields an 0(h2) result, etc. Evaluating Eq. (5.33) term by term yields

P (3.5) = 0.0428__ first order Error = -0.0038__

= 0.0460__ second order = -0.0006__

The first-order result is very poor. The second-order result, although much more accurate,

has only four significant digits after the decimal place.

5.3.2. Newton Backward-Difference Polynomial

Recall the Newton backward-difference polynomial, Eq. (4.101):

Higher-order derivatives can be obtained in a similar manner. Recall that V"f becomes

less and less accurate as n increases. Consequently higher-order derivatives become

increasingly less accurate.

At x = xo, s = 0.0, and Eqs. (5.40) and (5.41) become

Numerical Differentiation Chapter 5

Nizar Salim 11 lecture 1

This document was created with Win2PDF available at http://www.daneprairie.com.

The unregistered version of Win2PDF is for evaluation or non-commercial use only.


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .