You are on page 1of 18

17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

GE 122 L8: INTERPOLATION

Ransie Apura
Assistant Professor
UPD DGE

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

▪ Curve Fitting and


Interpolation
OUTLINE
▪ Numerical Methods
o Lagrange’s
o Newton’s

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 2

1
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

CURVE FITTING AND INTERPOLATION


Given: 𝑛 + 1 𝑑𝑎𝑡𝑎 𝑝𝑜𝑖𝑛𝑡𝑠 𝑥𝑖 , 𝑦𝑖 , 𝑖 = 0,1,2, … , 𝑛 → estimate 𝑦(𝑥).

• Interpolation
o Constructing a curve through the data points
o Assumption: data points are accurate and distinct

• Curve Fitting
o Applied to data that contains scatter (noise) – usually due to
measurement errors.
o Find a smooth curve that approximates the data points.
o Curve does not necessarily hit the data points.
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 3

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

CURVE FITTING AND INTERPOLATION

Curve Fitting – best fit line


for data points

Interpolation – curve that


fits data points (fill in the
gaps)

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 4

2
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

INTERPOLATION
• Given: values of function “𝑓” in the form
or as ordered pairs

• Find a 𝑃𝑛 𝑥 of degree n (or less) that assumes the given values, thus,

• 𝑃𝑛 𝑥 : approximate values of “𝑓” for “𝑥 ′ 𝑠” between 𝑥0 and 𝑥𝑛 .

Interpolation: inside interval


Extrapolation: outside interval

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 5

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

INTERPOLATION
How to find 𝑃𝑛 𝑥 ? Most common method is polynomial interpolation (use of
algebraic polynomial).
For 𝑛 + 1 data points, there is one and
General formula for an
only one polynomial of order n that
nth order polynomial
passes through all the points.

Why use algebraic polynomial?


• Convenient functions. Differential and integral of polynomial are still
polynomial.
• Coefficients can be solved via linear systems.
• These are well-known classes of functions that can map set of real numbers
into itself.
• Uniformly approximate continuous functions

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 6

3
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

INTERPOLATION
Weierstrass Approximation Theorem
• Given any function (defined
and continuous on a closed
bounded interval), there exists
a polynomial that is as “close”
to the given function as
desired.

• 𝑓 𝑥 is defined and continuous


on 𝑎, 𝑏 .
• For each 𝜀 > 0, there exists a
polynomial with the property For GE 122, we’ll only discuss Lagrange and Newton’s
𝑓 𝑥 − 𝑃 𝑥 < 𝜀 for all 𝑥 in 𝑎, 𝑏 . Interpolation (there are variety of mathematical
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering
formats to express polynomial interpolation). 7

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


• Also known as Newton’s Divided-Difference Interpolating Polynomial.

PRELIMINARIES: Simplest interpolation is when 𝑛 = 1 (connecting 2 data points


with a straight line), known as linear interpolation.
• Estimating 𝑓1 𝑥 using similar triangles (see
figure).
𝑓1 𝑥 − 𝑓 𝑥0 𝑓 𝑥1 − 𝑓 𝑥0 Slope of line connecting
= the points. It is also the
𝑥 − 𝑥0 𝑥1 − 𝑥0
finite divided difference
of the 1st derivative.
𝑓 𝑥1 − 𝑓 𝑥0
𝑓1 𝑥 = 𝑓 𝑥0 + 𝑥 − 𝑥0
𝑥1 − 𝑥0
1st Order Linear Interpolation Formula
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 8

4
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Linear Interpolation (Example): Estimate ln 2 using linear interpolation.
Interpolate between ln 1 = 0 and ln 6 = 1.791759.
SOLUTION: Analytically ln 2 = 0.6931472
Step 1: 𝑥0 = 1 𝑥1 = 6
1.791759 − 0
𝑓1 2 = 0 + 2 − 1 = 0.358352
6−1
Step 2: Repeat for smaller interval ln 1 = 0
and ln 4 = 1.386294.
1.386294 − 0
𝑓1 2 = 0 + 2 − 1 = 0.462098
4−1

Smaller interval between data points → better


estimate/approximation.
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 9

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Consider 𝑛 = 2 (quadratic interpolation)
• Improving estimate as we introduce some curvature to line connecting the
points (at least 3 data points available).

𝑓2 𝑥 = 𝑏0 + 𝑏1 x − 𝑥0 + 𝑏2 (x − 𝑥0 )(x − 𝑥1 ) 2nd order Curvature

Linear Interpolation
from 𝑥0 to 𝑥1

𝑓 𝑥2 −𝑓 𝑥1 𝑓 𝑥1 −𝑓 𝑥0
𝑓 𝑥1 −𝑓 𝑥0 −
𝑥2 −𝑥1 𝑥1 −𝑥0
𝑏0 = 𝑓 𝑥0 𝑏1 = 𝑏2 =
𝑥1 −𝑥0 𝑥2 −𝑥0
Slope of line connecting 𝑥0 to 𝑥1

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 10

10

5
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Quadratic Interpolation (Example): Estimate ln 2 . Use ln 1 = 0, ln 4 =
1.386294, and ln 6 = 1.791759.
SOLUTION: Analytically ln 2 = 0.6931472
Step 1: 𝑥0 = 1 𝑓 𝑥0 = 0
𝑥1 = 4 𝑓 𝑥1 = 1.386294
𝑥2 = 6 𝑓 𝑥2 = 1.791759

Step 2: 𝑏0 = 0
1.386294−0
𝑏1 = = 0.462098
4−1
1.791759−1.386294
−0.462098
6−4
𝑏2 = = −0.051873
6−1

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 11

11

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Quadratic Interpolation (Example): Estimate ln 2 . Use ln 1 = 0, ln 4 =
1.386294, and ln 6 = 1.791759.
SOLUTION: Analytically ln 2 = 0.6931472
Step 3: Substitute values to 𝑓2 𝑥 equation

𝑓2 𝑥 = 0 + 0.462098 x − 1 − 0.051873 (x − 1)(x − 4)

Step 4: Evaluate ln 2 using interpolation


function in step 3

𝑓2 2 = 0.565844

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 12

12

6
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Newton’s Interpolation is a series of divided differences. Higher order
differences are computed by taking differences of lower order differences.
• These differences can be used to evaluate coefficients to yield the
interpolating polynomial.

REMEMBER: Interpolation is all about finding a 𝑃𝑛 𝑥 to approximate the values


of “𝑓” for “𝑥 ′ 𝑠” between 𝑥0 and 𝑥𝑛 .

𝑃𝑛 𝑥 : Interpolating polynomial

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 13

13

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


𝒊 𝒙𝒊 𝒇 𝒙𝒊 1st 2nd 3rd
0 𝒙𝟎 𝒇 𝒙𝟎 𝒇 𝒙𝟏 , 𝒙𝟎 𝒇 𝒙𝟐 , 𝒙𝟏 , 𝒙 𝟎 𝒇 𝒙𝟑 , 𝒙𝟐 , 𝒙𝟏 , 𝒙𝟎
1 𝒙𝟏 𝒇 𝒙𝟏 𝒇 𝒙𝟐 , 𝒙𝟏 𝒇 𝒙𝟑 , 𝒙𝟐 , 𝒙 𝟏
2 𝒙𝟐 𝒇 𝒙𝟐 𝒇 𝒙𝟑 , 𝒙𝟐
3 𝒙𝟑 𝒇 𝒙𝟑
• 1st order difference 𝑓 𝑥1 , 𝑥0 is computed by taking differences of 𝑓 𝑥0 and 𝑓 𝑥1 ; 1st order
difference 𝑓 𝑥2 , 𝑥1 is computed by taking differences of 𝑓 𝑥1 and 𝑓 𝑥2 ; 1st order
difference 𝑓 𝑥3 , 𝑥2 is computed by taking differences of 𝑓 𝑥2 and 𝑓 𝑥3 .

• 2nd order difference 𝑓 𝑥2 , 𝑥1 , 𝑥0 is computed by taking differences of 𝑓 𝑥1 , 𝑥0 and 𝑓 𝑥2 , 𝑥1 ;


2nd order difference 𝑓 𝑥3 , 𝑥2 , 𝑥1 is computed by taking differences of 𝑓 𝑥2 , 𝑥1 and 𝑓 𝑥3 , 𝑥2 .

• 3rd order difference 𝑓 𝑥3 , 𝑥2 , 𝑥1 , 𝑥0 is computed by taking differences of 𝑓 𝑥2 , 𝑥1 , 𝑥0 and


UP Diliman Department of Geodetic Engineering
𝑓 𝑥3 , 𝑥2 , 𝑥1 .
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 14

14

7
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Divided Differences

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 15

15

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Newton’s Interpolating Polynomial: 𝑥0 , 𝑥1 , ⋯, 𝑥𝑛 are 𝑛 + 1 distinct numbers in
𝑎, 𝑏 .

where

NOTE: b’s of previous examples are the a’s in this equation.


UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 16

16

8
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 . 𝒙 𝟏 𝟒 𝟔 𝟓
𝑦 0 1.386294 1.791759 1.609438
Step 1: Write the Newton Interpolating Polynomial: 𝑛=3
𝑝3 𝑥 = 𝑎0 + 𝑎1 𝑥 − 𝑥0 + 𝑎2 𝑥 − 𝑥0 𝑥 − 𝑥1 + 𝑎3 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥0 𝑥 − 𝑥2
Step 2: Compute for a’s (coefficients of the polynomial)
𝑎0 = 𝑓 𝑥0 = 0
𝑓 𝑥1 − 𝑓 𝑥0 1.386294 − 0
𝑎1 = 𝑓 𝑥0 , 𝑥1 = = = 0.462098
𝑥1 − 𝑥0 4−1
1.791759 − 1.386294
− 𝑎1
𝑎2 = 𝑓 𝑥0 , 𝑥1 , 𝑥2 = 6−4 = −0.0518731
6−1
1.609438 − 1.791759 1.791759 − 1.386294

5−6 6−4 − 𝑎2
𝑎3 = 𝑓 𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 = 5 −4 = 0.007865
UP Diliman Department of Geodetic Engineering
5−1
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 17

17

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 . 𝒙 𝟏 𝟒 𝟔 𝟓
𝑦 0 1.386294 1.791759 1.609438
Step 2: or we can tabulate the computation for convenience
𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑
1 0 Number of columns depends
on order of interpolation.
4 1.386294 Problem requires 3rd order,
5 1.791759 hence, k=3.

6 1.609438

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 18

18

9
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 .
Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑
Compute for the divided
1 0 difference values of
column k=1.
4 1.386294 0.462098
5 1.791759 0.2027325
6 1.609438 0.182321
1.386294 − 0
= 0.462098
4−1
1.791759 − 1.386294
= 0.2027325
6−4
1.609438 − 1.791759
= 0.182321
UP Diliman Department of Geodetic Engineering 5−6
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 19

19

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 .
Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑
Compute for the divided
1 0 difference values of
column k=2.
4 1.386294 0.462098
5 1.791759 0.2027325 −0.0518731
6 1.609438 0.182321 −0.0204115
0.2027325 − 0.462098
= −0.0518731
6−1
0.182321 − 0.2027325
= −0.0204115
5−4

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 20

20

10
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 .
Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑
Compute for the divided
1 0 difference value(s) of
column k=3.
4 1.386294 0.462098
5 1.791759 0.2027325 −0.0518731
6 1.609438 0.182321 −0.0204115 0.007865
−0.0204115 − −0.0518731
= 0.007865
5−1

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 21

21

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: Estimate ln 2 using 3rd order Newton interpolating polynomial. y is
𝑓 𝑥 = ln 𝑥 .
Step 3: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑
The diagonal terms in the
1 0 table are the coefficients
of the polynomial.
4 1.386294 0.462098
5 1.791759 0.2027325 −0.0518731
6 1.609438 0.182321 −0.0204115 0.007865
Write the Newton Interpolating Polynomial (Step 1 equation).
𝑝3 𝑥 = 0 + 0.462098 𝑥 − 1 − 0.0518731 𝑥 − 1 𝑥 − 4 + 0.007865 𝑥 − 1 𝑥 − 4 𝑥 − 6
Step 3: Evaluate at x=2.
𝑝3 2 = 0 + 0.462098 2 − 1 − 0.0518731 2 − 1 2 − 4 + 0.007865 2 − 1 2 − 4 2 − 6
= 0.6287674
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 22

22

11
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Example: The data points below lie on a polynomial, determine the degree of
this polynomial.
𝒙 −𝟐 𝟏 𝟒 −𝟏 𝟑 −𝟒
𝑦 −1 2 59 4 24 −53
Step 1: Construct divided difference table (similar tabulation from previous
example except number of columns is unknown (problem is find the degree).
𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑 𝒌=𝟒 𝒌=𝟓
Arbitrarily set the columns
−2 −1
to k=5, we’ll just add
1 2 succeeding column(s) if
4 59 necessary.
−1 4
3 24
−4 −53
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 23

23

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑 𝒌=𝟒 𝒌=𝟓
Compute for the divided
−2 −1 difference values of
1 2 1 column k=1.
4 59 19
−1 4 11
3 24 5
−4 −53 11

2− −1 59−2 4−59 24−4


=1 = 19 = 11 =5
1− −2 4−1 −1−4 3− −1

−53−24
= 11 Numerator differences from column 𝑦𝑖 ; denominator
−4−3
differences from column 𝑥𝑖 .
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 24

24

12
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑 𝒌=𝟒 𝒌=𝟓
Compute for the divided
−2 −1 difference values of
1 2 1 column k=2 and k=3.
4 59 19 3
−1 4 11 4 1
3 24 5 6 1
−4 −53 11 −2 1

19−1 11−19 5−11 11−5


K=2: =3 =4 =6 = −2
4− −2 −1−1 3−4 −4− −1
Numerator differences from column 𝑘 = 1; denominator differences from column 𝑥𝑖 .

4−3 6−4 −2−6 Numerator differences from


K=3: =1 =1 =1 column 𝑘 = 2; denominator
−1− −2 3−1 −4−4
UP Diliman Department of Geodetic Engineering
differences from column 𝑥𝑖 .
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 25

25

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Step 2: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑 𝒌=𝟒 𝒌=𝟓
Compute for the divided
−2 −1 difference values of
1 2 1 column k=4 and k=5.
4 59 19 3
−1 4 11 4 1
3 24 5 6 1 0
−4 −53 11 −2 1 0 0

1−1 1−1 Numerator differences from column 𝑘 = 3;


K=4: =0 =0 denominator differences from column 𝑥𝑖 .
3− −2 −4− 1

0−0
K=5: =0 Numerator differences from column 𝑘 = 4;
−4− −2 denominator differences from column 𝑥𝑖 .

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 26

26

13
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(1) NEWTON’S INTERPOLATION


Step 3: 𝒙𝒊 𝒚𝒊 𝒌=𝟏 𝒌=𝟐 𝒌=𝟑 𝒌=𝟒 𝒌=𝟓
−2 −1
1 2 1
4 59 19 3
−1 4 11 4 1
3 24 5 6 1 0
−4 −53 11 −2 1 0 0

Last non-zero diagonal term in the table would indicate the degree of
polynomial.

Answer: 𝑛 = 3 (cubic degree or 3rd degree)

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 27

27

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


Reformulation of Newton Polynomial (avoiding computation of divided
difference). Polynomial Interpolation equation is

*Lagrange Multipliers or Lagrange Polynomials

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 28

28

14
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


General Procedure:

1. Choose the order.


2. Choose “order + 1” closest to the surrounding points.
3. Lay framework (Lagrange’s Interpolation Polynomial equation).
4. Construct each Lagrange Polynomial.
5. Put it all together.
6. Plug in and interpolate.

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 29

29

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


Example: Given the data points below. Use Lagrange’s Interpolation to
determine y at x =1.

Step 1: Choose order (maximize all given points): n = 2 order


Step 2: Order +1 (n +1 = 3) will use all given points (number of terms in the
polynomial equation).

Step 3: Framework:
𝑃 𝑥 = 𝑓 𝑥0 𝐿2,0 𝑥 + 𝑓 𝑥1 𝐿2,1 𝑥 + 𝑓 𝑥2 𝐿2,2 𝑥
Step 4: Construct each Lagrange Polynomial 𝑘 ≠𝑖
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 Working equation for
𝐿2,𝑘 𝑥 = ∙ ∙
𝑥𝑘 − 𝑥0 𝑥𝑘 − 𝑥1 𝑥𝑘 − 𝑥2 Lagrange Polynomial
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 30

30

15
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


Example: Given the data points below. Use Lagrange’s Interpolation to
determine y at x =1.

Step 4: Construct each Lagrange Polynomial


𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥−2 𝑥−3
𝐿2,0 𝑥 = ∙ ∙ = ∙ = ∙
𝑥0 − 𝑥0 𝑥0 − 𝑥1 𝑥0 − 𝑥2 𝑥0 − 𝑥1 𝑥0 − 𝑥2 0−2 0−3
𝑘 ≠𝑖
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥−0 𝑥−3
𝐿2,1 𝑥 = ∙ ∙ = ∙ = ∙
𝑥1 − 𝑥0 𝑥1 − 𝑥1 𝑥1 − 𝑥2 𝑥1 − 𝑥0 𝑥1 − 𝑥2 2−0 2−3

𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥−0 𝑥−2
𝐿2,2 𝑥 = ∙ ∙ = ∙ = ∙
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥2 𝑥2 − 𝑥0 𝑥2 − 𝑥1 3−0 3−2
UP Diliman Department of Geodetic Engineering
RJAA | GE 122: Mathematical Methods in Geodetic Engineering 31

31

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


Example: Given the data points below. Use Lagrange’s Interpolation to
determine y at x =1.

Step 5: Put it all together.


𝑥−2 𝑥−3 𝑥−0 𝑥−3 𝑥−0 𝑥−2
𝑃 𝑥 =7 ∙ + 11 ∙ + 28 ∙
0−2 0−3 2−0 2−3 3−0 3−2

Step 6: Plug in and interpolate: substitute x = 1 and solve for P(x)


𝑃 𝑥 =4

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 32

32

16
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

(2) LAGRANGE’S INTERPOLATION


Example: Given the data points below. Use Lagrange’s Interpolation to
determine y at x =1.

If Chosen order is n = 1, order +1 (n +1 = 2). Use of 2 points (number of terms in


the polynomial equation).
Framework:
𝑃 𝑥 = 𝑓 𝑥0 𝐿2,0 𝑥 + 𝑓 𝑥1 𝐿2,1 𝑥

*closest points are used (x=0 y=7 and x=2 y=11).

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 33

33

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

REFERENCES
• Kreyszig, Erwin (2011). “Advanced Engineering Mathematics,
10th Edition.” John Wiley and Sons.
• Chapra, S. and Canale, R. (2010). “Numerical Methods for
Engineers, 6th Edition.”
• Burden, R. and Faires, J. (2011). “Numerical Analysis, 9th Edition.”

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 34

34

17
17/10/2021

NOT FOR SHARING OR DISTRIBUTION


Only for the educational purpose of GE 122

Questions? ☺
raapura@up.edu.ph

UP Diliman Department of Geodetic Engineering


RJAA | GE 122: Mathematical Methods in Geodetic Engineering 35

35

18

You might also like