Просмотреть файл в отдельном окне: 14494bb07e11f97ed3439ece7ae9e762.pdf

4

Finite Differences,

Interpolation, and

Numerical Differentiation

4.1 INTRODUCTION

Linear interpolation is discussed in the preceding chapter as a method for finding a

particular root of a polynomial, or, transcendental equation when the upper and

lower bounds of the interval for search are provided. To continue the discussion of

the general topic of interpolations which not necessarily linear could be quadratic

(parabolic, cubic, quartic, and so on, we in this chapter present methods for this

general need of interpolation in engineering analyses by treating not only equations

but also a set of N tabulated data, (xi,yi) for i = 1–N. Finite difference table will be

introduced and constructed for the equally-spaced data, that is x2–x1 = x3–x2 = … =

xN-xN–1. This table can be utilized as a forward-difference, backward- difference, or,

central-difference table depending on how its is applied for the interpolation use.

Taylor’s series and a shifting operator are to be used in derivation of the

interpolation formulas in terms of the forward-difference, backward-difference, and

central-difference operators. A program DiffTabl has been developed for printing

out a difference table of a set of equally-spaced data.

Differentiation operator will also be introduced for the derivation of the numerical differentiation needs. When a set of equally-spaced data, (xi,yi) for i = 1–N, are

given, formulas in terms of the forward-difference, backward-difference, and centraldifference operators are derived for the need of calculating the value of dy/dx at a

listed x value or unlisted. If x is not equal to one of the xi, interpolation and

differentiation have to be done combinedly through a modification of the Taylor’s

series expansion.

For curve-fit by polynomials and for interpolation, applications of the versatile

Lagrangian interpolation formula are also discussed. A program called LagrangI

is made available for this need.

QuickBASIC, FORTRAN, and MATLAB versions of the above-mentioned

programs are to be provided. Application of the Mathematica’s function Interpolating Polynomial in place of LagrangI is demonstrated.

In solution of the problems governed by a system of ordinary differential equations with either some initial and/or boundary conditions specified, the finite differences will be applied. In Chapter 6, such method for finding the approximate answer

to the problem is discussed. Accuracy of such approximate solution will depend on

the increment of the independent variable, stepsize, adopted and on which approximate method is employed.

© 2001 by CRC Press LLC

Because numerical differentiation is highly inaccurate, whenever possible

numerical integration should be preferred over numerical differentiation. In case that

one needs to find the velocity of a certain motion study and has the option of

collecting the displacement or acceleration data, then the acceleration data should

be taken not the displacement data. The reason is that one has the choice of applying

numerical differentiation to the displacement data or numerical integration to the

acceleration data to obtain the velocity results. The numerical integration which is

the topic of Chapter 5 has the smoothing effect and hence is more accurate! Graphically, differentiation is of a local evaluation of determining the slope at a selected

point on a curve which could be the result of fitting a number of data points discussed

in Chapter 3 while integration is of a global evaluation of finding the area under the

curve between two specified limits of the independent variable. For a set of three

given points fitted linearly by two linear segments and quadratically by a parabola,

the slope at the mid-point could have very different slope values while the areas

under the linear segments and under the parabola would not differ too significantly.

Hence, it is worthy of emphasizing that learning the computational methods is easier

when compared to making decision of which method is best to solve the problem

at hand.

4.2 PROGRAM DIFFTABL — APPLICATIONS

OF FINITE-DIFFERENCE TABLE

Program DiffTabl has been developed for the need of constructing a table of finite

differences of a given set of N two-dimensional points, (xi,yi) for i = 1–N. The x

values are assumed to be equally spaced, i.e., , x2–x1 = x3–x2 = ••• = xN-xN–1 = h, h

being called the increment, or, stepsize. This so-called difference table can be applied

for interpolation of the y value for a specified, unlisted x value inside the range of

x = x1 and x = xN (extrapolation if outside the range), and differentiation. Table 1

shows a typical difference table.

The symbol used in Table 1 is called Forward Difference Operator. If we refer

the numbers listed in the x and y columns as x1 to x6 and y1 to y6, respectively, the

first number listed under y, 1.9495, is obtained from the calculation of y2–y1 and

is identified as ?y1. The last number listed in the y column, 5.3015, is equal to

y6–y5 and referred to as y5. Or, we may write the general formula as, for i = 1 to 5,

?y i = y i +1 ? y i

(1)

yi is called the first forward difference of y at xi. The higher order forward

differences listed in Table 1 are obtained by extended application of Equation 1.

That is,

?2 y i = ?(y i +1 ? y i ) = ?y i +1 ? ?y i = y i +2 ? 2 y i +1 + y i

© 2001 by CRC Press LLC

(2)

TABLE 1

Difference Table (y = 1 to 2x + 3x2 to 4x3 + 5x4).

x

y

1.1

4.4265

1.2

6.3760

y

2y

3y

4y

5y

1.9495

0.637

2.5865

1.3

8.9625

0.126

0.763

3.3495

1.4

12.3120

1.5

16.5625

1.6

21.8640

0.012

0.138

0.901

4.2505

0.000

0.012

0.150

1.051

5.3015

?3y i = ?2 (y i +1 ? y i ) = ?2 y i +1 ? ?2 y i

= (y i +3 ? 2 y i +2 + y i +1 ) ? (y i +2 ? 2 y i +1 + y i )

(3)

= y i +3 ? 3y i +2 + 3y i +1 ? y i

and so on. We shall show later how the third through seven columns of Table 1 can

be interpreted differently when the backward and central difference operators are

introduced. First, we will demonstrate how Table 1 can be applied for interpolation

of the y value at an unlisted x value, say y(x = 1.24). To do that, the shifting operator,

E, needs to be introduced. The definition of E is such that:

Ey i = y i +1

(4)

That is, if E is operating on yi, the y value is shifted down to the next provided

y value. Interpolation is a problem of not shifting a full step but a fractional step.

For the need of finding y at x = 1.24, the x value falls between x2 = 1.2 and x3 =

1.3. Since the stepsize, h, is equal to 0.1, a full shift from y2 = 6.3760 would lead

to y3 which is equal to 8.9625. We expect the value of y(x = 1.24) to be between y2

and y3. Instead of E1y2, the value of E0.4y2 is to be calculated by shifting only 40%.

To find the meaning of E0.24, or, more generally Er for 0True, AspectRatio->1]

Input[5]: = g4 = Show[g3,Graphics[Text[“Bar Graph of X–Y Data”,

{0.5,18},{–1,0}]]]

Input[6]: = Show[%,FrameLabel->{“X-axis”,”Y-axis”}]

© 2001 by CRC Press LLC

FIGURE 4.

FIGURE 5.

Notice that when no expression inside a pair of doubt quotes is provided for

the command Text, the value of the specified variable will be printed at the desired

location. This is demonstrated in Input[3].

Mathematica also has a function called BarChart in its Graphics package

which can be applied to plot Figure 5 as follows (again, some intermediate Output

responses are omitted):

© 2001 by CRC Press LLC

Input[1]: = Y = {2,4,7,11,24};

Input[2]: = 1.25

Out[4]: = 2.5

To parabolically interpolate the y value at x = 3.75 using the points (3,6), (4,8),

and (5,11), the interactive application of Mathematica goes as:

In[5]: = p2 = InterpolatingPolynomial[{{3,6},{4,8},{5,11}},x]

© 2001 by CRC Press LLC

Out[5]: = 6 + ? 2 +

?

?4 + x ?

(?3 + x)

2 ?

In[6]: = p2/. x -> 3.75 Out[6]: = 7.40625

4.4 PROBLEMS

DIFFTABL

1. Construct the difference table based on the following listed data and then

find the y value at x = 4.5 by using the backward-difference formula up

to the third-order difference.

x

y

1

2

2

4

3

7

4

12

5

20

2. Explain why interpolations using Equation 9 by the first through fourth

orders all fail to match the exact value of y(x = 1.24) = 7.3274 by making

4 plots for x values ranging from 1.2 to 1.3 with an increment of x =

0.001. These 4 plots are to be generated with the 4 equations obtained

when the first 2, 3, 4, and 5 points are fitted by a first-, second-, third-,

and fourth-degree polynomials, respectively. Also, draw a x = 1.24, vertical line crossing all 4 curves.

3. Find the first-, second-, third-, and fourth-order results of y(x = 1.56) by

use of Equation 15.

4. Write Er in terms of binomial coefficient and the backward-difference

operator , similar to Equation 7.

5. Find the first-, second-, third-, and fourth-order results of y(x = 1.24) by

use of Equation 24.

6. Find the first-, second-, third-, and fourth-order results of y(x = 1.56) by

use of Equation 25.

7. Given 6 (x,y) points (1,0.2), (2,0.4), (3,0.7), (4,1.5), (5,2.9), and (6,4.7),

parabolically interpolate y(x = 3.4) first by use of forward differences and

then by use of backward differences.

8. Modify either the QuickBASIC or FORTRAN version of the program

DiffTabl to include the fifth difference for the need of forward or backward interpolation and numerical differentiation.

9. Given 5 (x,y) points (0,0), (1,1), (2,8), (3,27), and (4,64), construct a

complete difference table based on these data. Compute (1) y value at x =

1.25 using a forward, parabolic (second-order) interpolation, (2) y value

at x = 3.7 using a backward, cubic (third-order) interpolation, and (3)

dy/dx value at x = 0 using a forward, third-order approximation.

10. Based on Equation 21, derive the forward-difference formulas for D2yi

and D3yi.

11. Use the result of Problem 10 to compute D2y2 and D3y1 by adopting the

forward-difference terms in Table 1 as high as available.

© 2001 by CRC Press LLC

12. Use the data in Table 1 to compute the first derivative of y at x = 1.155

by including terms up to the third-order forward difference.

13. Apply MATLAB for the points given in Problem 1 to print out the rows

of x, y, ?y, 2y, 3y, and 4y.

14. Same as Problem 13 but the points in Problem 6.

15. Apply Mathematica and DO loops to print out a difference table similar

to that shown in Mathematica Application of Section 4.2 for the points

given in Problem 1.

16. Apply Mathematica and DO loops to print out a difference table similar

to that shown in Mathematica Application of Section 4.2 for the points

given in Problem 6.

17. Compute the binomial coefficient for r = 0.4 and k = 1,2,3,4,5 according

to Equation (8) in Section 4.2 using MATLAB.

18. Rework Problem 17 but using Mathematica.

LAGRANGI

1. Given five points (1,1), (2,3), (3,2), (4,5), and (5,4), use the last three

points and Lagrangian interpolation formula to compute y value at x = 6.

2. A set of 5 (x,y) points is given as (1,2), (2,4), (4,5), (5,2), (6,0), apply the

Lagrangian interpolation formulas to find the y for x = 3 by parabolic

interpolation using the middle three points. Check the answer by (a)

without fitting the three points by a parabolic equation, and (b) by deriving

the parabolic equation and then substituting x equal to 3 to find the y value.

3. Apply the Lagrangian formula to curve-fit the following listed data near

x = 5 by a cubic equation. Use the derived cubic equation to find the y

value at x = 4.5.

x

y

1

2

2

4

3

7

4

12

5

20

4. Use the data set given in Problem 3 to exactly curve-fit them by a quartic

equation y(x) = a1 + a2x + a3x2 + a4x3 + a5x4. Do this manually based on

the Lagrangian formula.

5. Write a program and call it ExactFit.Ln5 for computation of the coefficients a1–5 in the y(x) expression in Problem 4.

6. Generalize the need in Problem 4 by extending the exact fit of N given

(x,y) points by a polynomial y(x) = a1 + a2x + … + aixi–1 + … + aNxN–1

based on the Lagrangian formula. Call this program ExactFit.LnN.

7. Based on the Lagrangian formula, use the first four of the five points given

in Problem 1 to interpolate the y value at x = 2.5 and then the last four

of the five points also at x = 2.5.

8. Write a program and call it Expand.1 which will expand the set of five

points given in Problem 2 to a set of 21 points by using an increment of

x equal to 0.2 and linear interpolation based on the Lagrangian formula.

For any x value which is not equal to any of the x values of the five given

© 2001 by CRC Press LLC

9.

10.

11.

12.

13.

14.

15.

points, this x value is to be tested to determine between which two points

it is located. These two given points are to be used in the interpolation

process by setting N equal to 2 in the program LagrangI. This procedure

is to be repeated for x values between 1 and 6 in computation of all new

y values.

As for Problem 8 except parabolic interpolation is to be implemented.

Call the new program Expand.2.

Extend the concept discussed in Problems 8 and 9 to develop a general

program Expand.M for using N given points and Mth-order Lagrangian

interpolation to obtain an expanded set.

Apply the function InterpolatingPolynomial of Mathematica to solve

Problems 1 and 2.

Check the result of Problem 4 by Mathematica.

Apply LagrangI.m to solve Problem 1 by MATLAB.

Apply LagrangI.m to solve Problem 2 by MATLAB.

Apply LagrangI.m to solve Problem 7 by MATLAB.

4.5 REFERENCE

1. R. C. Weast, Editor-in-Chief, CRC Standard Mathematical Tables, the Chemical

Rubber Co. (now CRC Press LLC), Cleveland, OH, 1964, p. 381.

© 2001 by CRC Press LLC

Finite Differences,

Interpolation, and

Numerical Differentiation

4.1 INTRODUCTION

Linear interpolation is discussed in the preceding chapter as a method for finding a

particular root of a polynomial, or, transcendental equation when the upper and

lower bounds of the interval for search are provided. To continue the discussion of

the general topic of interpolations which not necessarily linear could be quadratic

(parabolic, cubic, quartic, and so on, we in this chapter present methods for this

general need of interpolation in engineering analyses by treating not only equations

but also a set of N tabulated data, (xi,yi) for i = 1–N. Finite difference table will be

introduced and constructed for the equally-spaced data, that is x2–x1 = x3–x2 = … =

xN-xN–1. This table can be utilized as a forward-difference, backward- difference, or,

central-difference table depending on how its is applied for the interpolation use.

Taylor’s series and a shifting operator are to be used in derivation of the

interpolation formulas in terms of the forward-difference, backward-difference, and

central-difference operators. A program DiffTabl has been developed for printing

out a difference table of a set of equally-spaced data.

Differentiation operator will also be introduced for the derivation of the numerical differentiation needs. When a set of equally-spaced data, (xi,yi) for i = 1–N, are

given, formulas in terms of the forward-difference, backward-difference, and centraldifference operators are derived for the need of calculating the value of dy/dx at a

listed x value or unlisted. If x is not equal to one of the xi, interpolation and

differentiation have to be done combinedly through a modification of the Taylor’s

series expansion.

For curve-fit by polynomials and for interpolation, applications of the versatile

Lagrangian interpolation formula are also discussed. A program called LagrangI

is made available for this need.

QuickBASIC, FORTRAN, and MATLAB versions of the above-mentioned

programs are to be provided. Application of the Mathematica’s function Interpolating Polynomial in place of LagrangI is demonstrated.

In solution of the problems governed by a system of ordinary differential equations with either some initial and/or boundary conditions specified, the finite differences will be applied. In Chapter 6, such method for finding the approximate answer

to the problem is discussed. Accuracy of such approximate solution will depend on

the increment of the independent variable, stepsize, adopted and on which approximate method is employed.

© 2001 by CRC Press LLC

Because numerical differentiation is highly inaccurate, whenever possible

numerical integration should be preferred over numerical differentiation. In case that

one needs to find the velocity of a certain motion study and has the option of

collecting the displacement or acceleration data, then the acceleration data should

be taken not the displacement data. The reason is that one has the choice of applying

numerical differentiation to the displacement data or numerical integration to the

acceleration data to obtain the velocity results. The numerical integration which is

the topic of Chapter 5 has the smoothing effect and hence is more accurate! Graphically, differentiation is of a local evaluation of determining the slope at a selected

point on a curve which could be the result of fitting a number of data points discussed

in Chapter 3 while integration is of a global evaluation of finding the area under the

curve between two specified limits of the independent variable. For a set of three

given points fitted linearly by two linear segments and quadratically by a parabola,

the slope at the mid-point could have very different slope values while the areas

under the linear segments and under the parabola would not differ too significantly.

Hence, it is worthy of emphasizing that learning the computational methods is easier

when compared to making decision of which method is best to solve the problem

at hand.

4.2 PROGRAM DIFFTABL — APPLICATIONS

OF FINITE-DIFFERENCE TABLE

Program DiffTabl has been developed for the need of constructing a table of finite

differences of a given set of N two-dimensional points, (xi,yi) for i = 1–N. The x

values are assumed to be equally spaced, i.e., , x2–x1 = x3–x2 = ••• = xN-xN–1 = h, h

being called the increment, or, stepsize. This so-called difference table can be applied

for interpolation of the y value for a specified, unlisted x value inside the range of

x = x1 and x = xN (extrapolation if outside the range), and differentiation. Table 1

shows a typical difference table.

The symbol used in Table 1 is called Forward Difference Operator. If we refer

the numbers listed in the x and y columns as x1 to x6 and y1 to y6, respectively, the

first number listed under y, 1.9495, is obtained from the calculation of y2–y1 and

is identified as ?y1. The last number listed in the y column, 5.3015, is equal to

y6–y5 and referred to as y5. Or, we may write the general formula as, for i = 1 to 5,

?y i = y i +1 ? y i

(1)

yi is called the first forward difference of y at xi. The higher order forward

differences listed in Table 1 are obtained by extended application of Equation 1.

That is,

?2 y i = ?(y i +1 ? y i ) = ?y i +1 ? ?y i = y i +2 ? 2 y i +1 + y i

© 2001 by CRC Press LLC

(2)

TABLE 1

Difference Table (y = 1 to 2x + 3x2 to 4x3 + 5x4).

x

y

1.1

4.4265

1.2

6.3760

y

2y

3y

4y

5y

1.9495

0.637

2.5865

1.3

8.9625

0.126

0.763

3.3495

1.4

12.3120

1.5

16.5625

1.6

21.8640

0.012

0.138

0.901

4.2505

0.000

0.012

0.150

1.051

5.3015

?3y i = ?2 (y i +1 ? y i ) = ?2 y i +1 ? ?2 y i

= (y i +3 ? 2 y i +2 + y i +1 ) ? (y i +2 ? 2 y i +1 + y i )

(3)

= y i +3 ? 3y i +2 + 3y i +1 ? y i

and so on. We shall show later how the third through seven columns of Table 1 can

be interpreted differently when the backward and central difference operators are

introduced. First, we will demonstrate how Table 1 can be applied for interpolation

of the y value at an unlisted x value, say y(x = 1.24). To do that, the shifting operator,

E, needs to be introduced. The definition of E is such that:

Ey i = y i +1

(4)

That is, if E is operating on yi, the y value is shifted down to the next provided

y value. Interpolation is a problem of not shifting a full step but a fractional step.

For the need of finding y at x = 1.24, the x value falls between x2 = 1.2 and x3 =

1.3. Since the stepsize, h, is equal to 0.1, a full shift from y2 = 6.3760 would lead

to y3 which is equal to 8.9625. We expect the value of y(x = 1.24) to be between y2

and y3. Instead of E1y2, the value of E0.4y2 is to be calculated by shifting only 40%.

To find the meaning of E0.24, or, more generally Er for 0True, AspectRatio->1]

Input[5]: = g4 = Show[g3,Graphics[Text[“Bar Graph of X–Y Data”,

{0.5,18},{–1,0}]]]

Input[6]: = Show[%,FrameLabel->{“X-axis”,”Y-axis”}]

© 2001 by CRC Press LLC

FIGURE 4.

FIGURE 5.

Notice that when no expression inside a pair of doubt quotes is provided for

the command Text, the value of the specified variable will be printed at the desired

location. This is demonstrated in Input[3].

Mathematica also has a function called BarChart in its Graphics package

which can be applied to plot Figure 5 as follows (again, some intermediate Output

responses are omitted):

© 2001 by CRC Press LLC

Input[1]: = Y = {2,4,7,11,24};

Input[2]: = 1.25

Out[4]: = 2.5

To parabolically interpolate the y value at x = 3.75 using the points (3,6), (4,8),

and (5,11), the interactive application of Mathematica goes as:

In[5]: = p2 = InterpolatingPolynomial[{{3,6},{4,8},{5,11}},x]

© 2001 by CRC Press LLC

Out[5]: = 6 + ? 2 +

?

?4 + x ?

(?3 + x)

2 ?

In[6]: = p2/. x -> 3.75 Out[6]: = 7.40625

4.4 PROBLEMS

DIFFTABL

1. Construct the difference table based on the following listed data and then

find the y value at x = 4.5 by using the backward-difference formula up

to the third-order difference.

x

y

1

2

2

4

3

7

4

12

5

20

2. Explain why interpolations using Equation 9 by the first through fourth

orders all fail to match the exact value of y(x = 1.24) = 7.3274 by making

4 plots for x values ranging from 1.2 to 1.3 with an increment of x =

0.001. These 4 plots are to be generated with the 4 equations obtained

when the first 2, 3, 4, and 5 points are fitted by a first-, second-, third-,

and fourth-degree polynomials, respectively. Also, draw a x = 1.24, vertical line crossing all 4 curves.

3. Find the first-, second-, third-, and fourth-order results of y(x = 1.56) by

use of Equation 15.

4. Write Er in terms of binomial coefficient and the backward-difference

operator , similar to Equation 7.

5. Find the first-, second-, third-, and fourth-order results of y(x = 1.24) by

use of Equation 24.

6. Find the first-, second-, third-, and fourth-order results of y(x = 1.56) by

use of Equation 25.

7. Given 6 (x,y) points (1,0.2), (2,0.4), (3,0.7), (4,1.5), (5,2.9), and (6,4.7),

parabolically interpolate y(x = 3.4) first by use of forward differences and

then by use of backward differences.

8. Modify either the QuickBASIC or FORTRAN version of the program

DiffTabl to include the fifth difference for the need of forward or backward interpolation and numerical differentiation.

9. Given 5 (x,y) points (0,0), (1,1), (2,8), (3,27), and (4,64), construct a

complete difference table based on these data. Compute (1) y value at x =

1.25 using a forward, parabolic (second-order) interpolation, (2) y value

at x = 3.7 using a backward, cubic (third-order) interpolation, and (3)

dy/dx value at x = 0 using a forward, third-order approximation.

10. Based on Equation 21, derive the forward-difference formulas for D2yi

and D3yi.

11. Use the result of Problem 10 to compute D2y2 and D3y1 by adopting the

forward-difference terms in Table 1 as high as available.

© 2001 by CRC Press LLC

12. Use the data in Table 1 to compute the first derivative of y at x = 1.155

by including terms up to the third-order forward difference.

13. Apply MATLAB for the points given in Problem 1 to print out the rows

of x, y, ?y, 2y, 3y, and 4y.

14. Same as Problem 13 but the points in Problem 6.

15. Apply Mathematica and DO loops to print out a difference table similar

to that shown in Mathematica Application of Section 4.2 for the points

given in Problem 1.

16. Apply Mathematica and DO loops to print out a difference table similar

to that shown in Mathematica Application of Section 4.2 for the points

given in Problem 6.

17. Compute the binomial coefficient for r = 0.4 and k = 1,2,3,4,5 according

to Equation (8) in Section 4.2 using MATLAB.

18. Rework Problem 17 but using Mathematica.

LAGRANGI

1. Given five points (1,1), (2,3), (3,2), (4,5), and (5,4), use the last three

points and Lagrangian interpolation formula to compute y value at x = 6.

2. A set of 5 (x,y) points is given as (1,2), (2,4), (4,5), (5,2), (6,0), apply the

Lagrangian interpolation formulas to find the y for x = 3 by parabolic

interpolation using the middle three points. Check the answer by (a)

without fitting the three points by a parabolic equation, and (b) by deriving

the parabolic equation and then substituting x equal to 3 to find the y value.

3. Apply the Lagrangian formula to curve-fit the following listed data near

x = 5 by a cubic equation. Use the derived cubic equation to find the y

value at x = 4.5.

x

y

1

2

2

4

3

7

4

12

5

20

4. Use the data set given in Problem 3 to exactly curve-fit them by a quartic

equation y(x) = a1 + a2x + a3x2 + a4x3 + a5x4. Do this manually based on

the Lagrangian formula.

5. Write a program and call it ExactFit.Ln5 for computation of the coefficients a1–5 in the y(x) expression in Problem 4.

6. Generalize the need in Problem 4 by extending the exact fit of N given

(x,y) points by a polynomial y(x) = a1 + a2x + … + aixi–1 + … + aNxN–1

based on the Lagrangian formula. Call this program ExactFit.LnN.

7. Based on the Lagrangian formula, use the first four of the five points given

in Problem 1 to interpolate the y value at x = 2.5 and then the last four

of the five points also at x = 2.5.

8. Write a program and call it Expand.1 which will expand the set of five

points given in Problem 2 to a set of 21 points by using an increment of

x equal to 0.2 and linear interpolation based on the Lagrangian formula.

For any x value which is not equal to any of the x values of the five given

© 2001 by CRC Press LLC

9.

10.

11.

12.

13.

14.

15.

points, this x value is to be tested to determine between which two points

it is located. These two given points are to be used in the interpolation

process by setting N equal to 2 in the program LagrangI. This procedure

is to be repeated for x values between 1 and 6 in computation of all new

y values.

As for Problem 8 except parabolic interpolation is to be implemented.

Call the new program Expand.2.

Extend the concept discussed in Problems 8 and 9 to develop a general

program Expand.M for using N given points and Mth-order Lagrangian

interpolation to obtain an expanded set.

Apply the function InterpolatingPolynomial of Mathematica to solve

Problems 1 and 2.

Check the result of Problem 4 by Mathematica.

Apply LagrangI.m to solve Problem 1 by MATLAB.

Apply LagrangI.m to solve Problem 2 by MATLAB.

Apply LagrangI.m to solve Problem 7 by MATLAB.

4.5 REFERENCE

1. R. C. Weast, Editor-in-Chief, CRC Standard Mathematical Tables, the Chemical

Rubber Co. (now CRC Press LLC), Cleveland, OH, 1964, p. 381.

© 2001 by CRC Press LLC

Чтобы не видеть никакую рекламу на сайте, нужно стать

**VIP**-пользователем.

Это можно сделать совершенно бесплатно. Читайте подробности тут.