lecture 3 - interpolation

39
LECTURE 3: INTERPOLATION

Upload: chelsie-patricia-demonteverde-miranda

Post on 12-Jan-2016

21 views

Category:

Documents


0 download

DESCRIPTION

interpolation

TRANSCRIPT

Page 1: Lecture 3 - Interpolation

LECTURE 3: INTERPOLATION

Page 2: Lecture 3 - Interpolation

Interpolation

technique of estimating the value of a function for any intermediate value of the independent variable

method of computing the value of the function 𝑦 = 𝑓(𝑥) for any given value of the independent variable 𝑥 when a set of values of 𝑦 = 𝑓(𝑥)for certain values of 𝑥 are known or given

i.e. the process of finding the value of 𝑦 corresponding to any value of 𝑥 = 𝑥𝑖between 𝑥0 and 𝑥𝑛, if 𝑥𝑖 , 𝑦𝑖 , 𝑖 = 0,1,2,… , 𝑛 are the set of 𝑛 + 1 given data points of the function 𝑦 = 𝑓(𝑥)

Easy to do if function is explicitly defined..

Page 3: Lecture 3 - Interpolation

Interpolating Function

if the function 𝑓(𝑥) is not known, then it is very hard to find the exact form of 𝑓(𝑥) with the tabulated values 𝑥𝑖, 𝑦𝑖

𝑓 𝑥 can be replaced by a simpler function 𝜙(𝑥), which has the same values as 𝑓 𝑥 for 𝑥0, 𝑥1, 𝑥2, … , 𝑥𝑛

𝜙(𝑥) is called the interpolating or smoothing function and any other value can be computed from it

Page 4: Lecture 3 - Interpolation

Polynomial Interpolation

If 𝜙(𝑥) is a polynomial, then 𝜙(𝑥) is called the interpolating polynomialand the process of computing the intermediate values of y = 𝑓(𝑥) is called the polynomial interpolation.

In the study of interpolation, we make the following assumptions:

there are no sudden jumps in the values of the dependent variable for the period under consideration

the rate of change of figures from one period to another is uniform.

In this course, interpolation will be based on the calculus of finite differences (forward, backward and central).

Page 5: Lecture 3 - Interpolation

Finite Difference Operators

Forward Differences

Backward Differences

Central Differences

Page 6: Lecture 3 - Interpolation

Forward Differences

or simply difference operator is denoted by Δ

defined as Δ𝑓 𝑥 = 𝑓 𝑥 + ℎ − 𝑓(𝑥)

where ℎ = interval of differencing

or, at 𝑥 = 𝑥𝑖

Δ𝑓 𝑥𝑖 = 𝑓 𝑥𝑖 + ℎ − 𝑓(𝑥𝑖)

Δ𝑦𝑖 = 𝑦𝑖+1 − 𝑦𝑖 for 𝑖 = 0,1,2,… , 𝑛 − 1

hence,

Page 7: Lecture 3 - Interpolation

Second Difference

difference of the first differences

denoted by Δ2𝑦0, Δ2𝑦1, … , Δ2 𝑦𝑛

hence,

generalizing, Δ𝑛+1𝑦𝑖 = Δ𝑛𝑦𝑖+1 − Δ𝑛𝑦𝑖 𝑛 = 0,1,2, …

where Δ0≡ identity operator, i.e., Δ0𝑓 𝑥 = 𝑓(𝑥) and Δ1 = Δ

Page 8: Lecture 3 - Interpolation

Backward Differences

denoted by 𝛻

defined as 𝛻𝑓 𝑥 = 𝑓 𝑥 − 𝑓(𝑥 − ℎ)

or, at 𝑥 = 𝑥𝑖

𝛻𝑦𝑖 = 𝑦𝑖 − 𝑦𝑖−1 for 𝑖 = 𝑛, 𝑛 − 1,… , 1

𝛻𝑦1 = 𝑦1 − 𝑦0, 𝛻𝑦2 = 𝑦2 − 𝑦1, … , 𝛻𝑦𝑛 = 𝑦𝑛 − 𝑦𝑛−1

Second difference

Page 9: Lecture 3 - Interpolation

Central Differences

denoted by 𝛿

defined by 𝛿𝑓 𝑥 = 𝑓 𝑥 +ℎ

2− 𝑓 𝑥 −

2

first central differences

second central differences

Page 10: Lecture 3 - Interpolation
Page 11: Lecture 3 - Interpolation

INTERPOLATION for EQUAL INTERVALS

Assumption:

• for function 𝑦 = 𝑓(𝑥), the set of (𝑛 + 1) functional values 𝑦0, 𝑦1, … , 𝑦𝑛 are given corresponding to the set of (𝑛 + 1) equally spaced values of the independent variable, 𝑥𝑖 = 𝑥0 + 𝑖ℎ, 𝑖 = 0,1,2,… , 𝑛, where ℎ is the spacing

Page 12: Lecture 3 - Interpolation

Newton’s Forward Interpolation Formula

used to interpolate the values of 𝑦 near the beginning of a set of equally spaced tabular values

formula:

where:

𝑦0, 𝑦1, … , 𝑦𝑛 → 𝑠𝑒𝑡 𝑜𝑓 𝑛 + 1 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛𝑎𝑙 𝑣𝑎𝑙𝑢𝑒𝑠

𝑥0, 𝑥1, … , 𝑥𝑛 → 𝑠𝑒𝑡 𝑜𝑓 𝑛 + 1 𝑒𝑞𝑢𝑎𝑙𝑙𝑦 𝑠𝑝𝑎𝑐𝑒𝑑 𝑣𝑎𝑙𝑢𝑒𝑠

𝜙 𝑥 → 𝑦 = 𝑓 𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑓 𝑥𝑖 = 𝜙 𝑥𝑖 𝑓𝑜𝑟 𝑖 = 0,1,2, … , 𝑛

𝑢 =𝑥−𝑥0

Page 13: Lecture 3 - Interpolation

Ex:

Find the value of sin42°.

Since x = 42° is near the starting value 𝑥0 = 40°, we use NFIF.

𝑥 40 45 50 55 60

𝑦 = 𝑠𝑖𝑛𝑥 0.6428 0.7071 0.7660 0.8192 0.8660

i xi yi Δyi Δ2yi Δ3yi Δ4yi

0 40 0.6428 0.0643 -0.0054 -0.0004 01 45 0.7071 0.0589 -0.0058 -0.00042 50 0.766 0.0531 -0.00623 55 0.8192 0.04694 60 0.866

Page 14: Lecture 3 - Interpolation

Seatwork

Page 15: Lecture 3 - Interpolation

Newton’s Backward Interpolation Formula

used to interpolate the values of 𝑦 near the end of the tabulated values

formula:

𝜙 𝑥 = 𝑦𝑛 + 𝑣𝛻𝑦𝑛 +𝑣(𝑣 + 1)

2!𝛻2𝑦𝑛 +⋯+ 𝑣 𝑣 + 1 …

𝑣 + 𝑛 − 1

𝑛!𝛻𝑛𝑦𝑛

where:

𝑣 =𝑥−𝑥𝑛

Page 16: Lecture 3 - Interpolation

Ex:

Calculate the value of 𝑓(84) for the data given in the table below:

Since x = 84 is near the end value 𝑥5 = 90, we use NBIF.

i xi yi ∇yi ∇2yi ∇3yi ∇4yi ∇5yi

0 40 2041 50 224 202 60 246 22 23 70 270 24 2 04 80 296 26 2 0 05 90 324 28 2 0 0 0

Page 17: Lecture 3 - Interpolation

𝑥 = 84 𝑥5 = 90

ℎ = 10

𝑣 =84−90

10= −0.6

From

𝜙 𝑥 = 𝑦𝑛 + 𝑣𝛻𝑦𝑛 +𝑣(𝑣 + 1)

2!𝛻2𝑦𝑛 +⋯+ 𝑣 𝑣 + 1 …

𝑣 + 𝑛 − 1

𝑛!𝛻𝑛𝑦𝑛

𝜙 84 = 324 + −0.6 28 +−0.6 −0.6+1

2!2 = 𝟑𝟎𝟔. 𝟗𝟔

i xi yi ∇yi ∇2yi ∇3yi ∇4yi ∇5yi

0 40 2041 50 224 202 60 246 22 23 70 270 24 2 04 80 296 26 2 0 05 90 324 28 2 0 0 0

Page 18: Lecture 3 - Interpolation

Error

NFIF

NBIF

Page 19: Lecture 3 - Interpolation

INTERPOLATION for UNEQUAL INTERVALS

Page 20: Lecture 3 - Interpolation

Lagrange Formula for Unequal Intervals

Let 𝑦 = 𝑓 𝑥 be a real values continuous function defined in an interval [𝑎, 𝑏]. Let 𝑥0, 𝑥1, … , 𝑥𝑛 be (𝑛 + 1) distinct points which are not necessarily equally spaced and the corresponding values of the function are 𝑦0, 𝑦1, … , 𝑦𝑛.

Since (𝑛 + 1) values of the function are given corresponding to the (𝑛 + 1) values of the independent variable x, we can represent the function 𝑦 = 𝑓(𝑥) as a polynomial in 𝑥 of degree 𝑛.

Page 21: Lecture 3 - Interpolation

Using Lagrange’s interpolation formula, find the value of y corresponding to x = 10 from the following data.

Page 22: Lecture 3 - Interpolation

Apply Lagrange’s interpolation formula to find a polynomial which passes through the points (0, –20), (1, –12), (3, –20) and (4, –24).

Page 23: Lecture 3 - Interpolation

Seatwork

Using Lagrange’s interpolation formula find a polynomial which passes the points

(0, –12), (1, 0), (3, 6), (4, 12).

Page 24: Lecture 3 - Interpolation

Lagrange’s Formula for Inverse Interpolation

By interchanging x and y in the formula, we can express 𝑥 as a function of 𝑦 as follows:

Page 25: Lecture 3 - Interpolation

The following table gives the values of y corresponding to certain values of 𝑥. Find the value of 𝑥 when 𝑦 = 167.59789 by applying Lagrange’s inverse interpolation formula.

Page 26: Lecture 3 - Interpolation

CENTRAL DIFFERENCE INTERPOLATION FORMULAEfor EQUAL INTERVALS

Page 27: Lecture 3 - Interpolation

Central Difference Tables

Page 28: Lecture 3 - Interpolation

Bessel’s Formula

*brackets mean that the average has to be taken

Page 29: Lecture 3 - Interpolation
Page 30: Lecture 3 - Interpolation

Apply Bessel’s interpolation formula to obtain y25, given that y20 = 2860, y24 = 3167, y28 = 3555 and y32 = 4112.

Page 31: Lecture 3 - Interpolation

From Bessel’s Formula,

We get

Page 32: Lecture 3 - Interpolation

Stirling’s Formula

gives the most accurate result for -0.25 ≤ u ≤ 0.25

hence, x0 should be selected such that u satisfies this inequality

𝑦𝑝 = 𝑦0 + 𝑢Δ𝑦−1 + Δ𝑦0

2+𝑢2

2Δ2𝑦−2 +

)𝑢(𝑢2 − 1

3!

Δ3𝑦−2 + Δ3𝑦−12

+)𝑢2 (𝑢2 − 1

4!Δ4𝑦−2

+)𝑢(𝑢2 − 1)(𝑢2 − 22

5!

Δ5𝑦−3 + Δ5𝑦−22

+)𝑢2 (𝑢2 − 1)(𝑢2 − 22

6!Δ6𝑦−3 +⋯

+)𝑢 𝑢2 − 1 𝑢2 − 22 𝑢2 − 32 …[𝑢2 − 𝑛 − 1 2

(2𝑛 − 1)!

Δ2𝑛−1𝑦−𝑛 + Δ2𝑛−1𝑦 )−(𝑛−1

2

+]𝑢2 𝑢2 − 1 𝑢2 − 22 𝑢2 − 32 …[𝑢2 − 𝑛 − 1 2)

(2𝑛)!Δ2𝑛𝑦−𝑛

Page 33: Lecture 3 - Interpolation

𝑦𝑝 = 𝑦0 + 𝑢Δ𝑦−1 + Δ𝑦0

2+𝑞2

2Δ2𝑦−2 +

)𝑞(𝑞2 − 1

3!

Δ3𝑦−2 + Δ3𝑦−12

+)𝑞2 (𝑞2 − 1

4!Δ4𝑦−2

+)𝑞(𝑞2 − 1)(𝑞2 − 22

5!

Δ5𝑦−3 + Δ5𝑦−22

+)𝑞2 (𝑞2 − 1)(𝑞2 − 22

6!Δ6𝑦−3 +⋯

+)𝑞 𝑞2 − 1 𝑞2 − 22 𝑞2 − 32 …[𝑞2 − 𝑛 − 1 2

(2𝑛 − 1)!

Δ2𝑛−1𝑦−𝑛 + Δ2𝑛−1𝑦 )−(𝑛−1

2

+]𝑞2 𝑞2 − 1 𝑞2 − 22 𝑞2 − 32 …[𝑞2 − 𝑛 − 1 2)

(2𝑛)!Δ2𝑛𝑦−𝑛

Page 34: Lecture 3 - Interpolation

Apply Stirling’s interpolation formula to obtain y25, given that y20 = 2860, y24 = 3167, y28 = 3555 and y32 = 4112.

i xi yi Δyi Δ2yi Δ3yi

-1 20 2860 307 81 88

0 24 3167 388 169

1 28 3555 557

2 32 4112

Page 35: Lecture 3 - Interpolation

From Stirling’s Formula

We get

i xi yi Δyi Δ2yi Δ3yi

-1 20 2860 307 81 880 24 3167 388 1691 28 3555 5572 32 4112

Page 36: Lecture 3 - Interpolation

Assignment

Use Stirling’s Formula to find the value of y when x = 1.63 from the following table

Page 37: Lecture 3 - Interpolation

Exercises

Use Stirling’s interpolation formula to find y28, given that y20 = 48234, y25 = 47354, y30

= 46267, y35 = 44978 and y40 = 43389.

Page 38: Lecture 3 - Interpolation

𝜙 𝑥 = 𝑦𝑛 + 𝑣𝛻𝑦𝑛 +𝑣(𝑣 + 1)

2!𝛻2𝑦𝑛 +⋯+ 𝑣 𝑣 + 1 …

𝑣 + 𝑛 − 1

𝑛!𝛻𝑛𝑦𝑛

Page 39: Lecture 3 - Interpolation

Given that 12600 = 112.24972, 12610 = 112.29426, 12620= 112.33877,

12630 = 112.38327. Find the value of 12616 using Laplace-Everett’s Formula.