0% found this document useful (0 votes)
33 views

Chapter 4 Interpolation Curve Fitting (Part 1)

The document discusses interpolation and curve fitting using Newton's interpolation polynomials. It covers linear, quadratic, and cubic interpolation using Newton's method. Linear interpolation connects two points with a straight line. Quadratic interpolation connects three points with a parabola, and cubic interpolation connects four points with a cubic polynomial. Examples are provided for each type of interpolation.

Uploaded by

NAZIRUL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Chapter 4 Interpolation Curve Fitting (Part 1)

The document discusses interpolation and curve fitting using Newton's interpolation polynomials. It covers linear, quadratic, and cubic interpolation using Newton's method. Linear interpolation connects two points with a straight line. Quadratic interpolation connects three points with a parabola, and cubic interpolation connects four points with a cubic polynomial. Examples are provided for each type of interpolation.

Uploaded by

NAZIRUL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

BEKG 2452 Numerical Methods

Chapter 4: Interpolation and


Curve Fitting (Part 1)

- Newton’s Interpolation polynomials


- Lagrange Interpolating polynomials

Prepared by: DR. LOH SER LEE (FKE)

BEKG 2452 Numerical Methods

Interpolation
A method of estimating the value of a function for any intermediate
value of the independent variable

Newton’s Lagrange
Interpolating Interpolating
Polynomials Polynomials

Curve Fitting
- Find the polynomial function that fits a given set of points

Use the polynomial function to constructing a new data point

[email protected]

1
BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials

- Applicable for equally and unequally spaced


data.

- A straight line from Newton’s Interpolating


Polynomial that passing through two points
𝑥0 , 𝑦0 and 𝑥1 , 𝑦1

𝑓 𝑥 = 𝑏0 + 𝑏1 (𝑥 − 𝑥0 )

[email protected]

BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials

- A parabola from Newton’s Interpolating


Polynomial that passing through three points
𝑥0 , 𝑦0 , 𝑥1 , 𝑦1 and 𝑥2 , 𝑦2
𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )

- General formula of Newton’s Interpolating


Polynomial that passing through 𝑛 points
𝑥0 , 𝑦0 , 𝑥1 , 𝑦1 , … , 𝑥𝑛−1 , 𝑦𝑛−1

𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 𝑥 − 𝑥0 𝑥 − 𝑥1
+ ⋯ + 𝑏𝑛−1 𝑥 − 𝑥0 … 𝑥 − 𝑥𝑛−2

2
BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials

Example:
Construct the parabola that passing through 𝑥0 , 𝑦0 ,
𝑥1 , 𝑦1 and 𝑥2 , 𝑦2 .
From Newton’s Interpolation, the parabolic equation is
𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )

Derivation of coefficient 𝒃𝟎 , 𝒃𝟏 , 𝒃𝟐 :
Substitute 𝑥0 , 𝑦0 into 𝑥 and 𝑦:
0 0
𝑦0 = 𝑏0 + 𝑏1 𝑥0 − 𝑥0 + 𝑏2 (𝑥0 − 𝑥0 )(𝑥0 − 𝑥1 )
∴ 𝑏0 = 𝑦0
[email protected]

BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials

Substitute 𝑥1 , 𝑦1 into 𝑥 and 𝑦: 0


𝑦1 = 𝑦0 + 𝑏1 𝑥1 − 𝑥0 + 𝑏2 (𝑥1 − 𝑥0 )(𝑥1 − 𝑥1 )
𝑦1 − 𝑦0
∴ 𝑏1 =
𝑥1 − 𝑥0
Substitute 𝑥2 , 𝑦2 into 𝑥 and 𝑦:
𝑦1 − 𝑦0
𝑦2 = 𝑦0 + 𝑥 − 𝑥0 + 𝑏2 (𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )
𝑥1 − 𝑥0 2
𝑦 −𝑦 𝑦2 − 𝑦1 𝑦1 − 𝑦0
𝑦2 − 𝑦0 − 𝑥1 − 𝑥0 𝑥2 − 𝑥0 𝑥2 − 𝑥1 − 𝑥1 − 𝑥0
1 0
∴ 𝑏2 = =
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) (𝑥2 − 𝑥0 )
[email protected]

3
BEKG 2452 Numerical Methods

𝑏0 𝑏1 𝑏2 𝑏3 𝑏4

𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖 ∆2 𝑓𝑖 ∆3 𝑓𝑖 ∆4 𝑓𝑖
0 𝑥0 𝑦0
𝑦1 − 𝑦0
∆𝑓0 =
𝑥1 − 𝑥0
1 𝑥1 𝑦1 ∆𝑓1 − ∆𝑓0
∆2 𝑓0 =
𝑥2 − 𝑥0
𝑦2 − 𝑦1 ∆2 𝑓1 − ∆2 𝑓0
∆𝑓1 = ∆3 𝑓0 =
𝑥2 − 𝑥1 𝑥3 − 𝑥0
2 𝑥2 𝑦2 ∆𝑓2 − ∆𝑓1 ∆3 𝑓1 − ∆3 𝑓0
∆2 𝑓1 = ∆4 𝑓0 =
𝑥3 − 𝑥1 𝑥4 − 𝑥0
𝑦3 − 𝑦2 ∆2 𝑓2 − ∆2 𝑓1
∆𝑓2 = ∆3 𝑓1 =
𝑥3 − 𝑥2 𝑥4 − 𝑥1
3 𝑥3 𝑦3 ∆𝑓3 − ∆𝑓2
∆2 𝑓2 =
𝑥4 − 𝑥2
𝑦4 − 𝑦3
∆𝑓3 =
𝑥4 − 𝑥3
4 𝑥4 𝑦4

[email protected] Note: Determination of 𝑏𝑖 depends of the order

BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials


4.1.1 Linear Interpolation
To connect two data points with the first order
polynomial (straight line)
Formula:
𝑓(𝑥) = 𝑏0 + 𝑏1 𝑥 − 𝑥0

Table:
𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖
0 𝑥0 𝑦0
𝑦1 − 𝑦0
∆𝑓0 =
𝑥1 − 𝑥0
1 𝑥1 𝑦1
[email protected]

4
BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials


4.1.1 Linear Interpolation
Example:
Estimate natural logarithm of 2 (ln 2) using linear
interpolation given ln 1 = 0 and ln 3 = 1.0986.
Answer: 1, 0 , 3, 1.0986 , 2, ?
𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖
0 1 0.0000 𝑏0
1.0986 − 0
∆𝑓0 = = 0.5493 𝑏1
3 −1
1 3 1.0986

𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 = 0.5493(𝑥 − 1) ≈ 𝐥𝐧 𝒙
∴ 𝒇 𝟐 = 𝟎. 𝟓𝟒𝟗𝟑
[email protected]

BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials


4.1.2 Quadratic Interpolation
To connect three data points with the second
order polynomial (parabola)
Formula:
𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )

Table:
𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖 ∆2 𝑓𝑖
0 𝑥0 𝑦0
𝑦1 − 𝑦0
∆𝑓0 =
𝑥1 − 𝑥0
1 𝑥1 𝑦1 ∆𝑓1 − ∆𝑓0
∆2 𝑓0 =
𝑥2 − 𝑥0
𝑦2 − 𝑦1
∆𝑓1 =
𝑥2 − 𝑥1
2 𝑥2 𝑦2

5
BEKG 2452 Numerical Methods

4.1.2 Quadratic Interpolation


Example:
Estimate 𝑓(1.7) using quadratic interpolation given
0, 1 , 2, −3 , 4, −8 .
Answer:
𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖 ∆2 𝑓𝑖
0 0 1 𝑏0
−3 − 1
2−0
= −2 𝑏1
1 2 −3 −2.5 − (−2) 𝑏2
= −0.125
4−0
−8 − (−3)
= −2.5
4−2
2 4 −8

𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
= 1 − 2𝑥 − 0.125𝑥(𝑥 − 2)
∴ 𝑓 1.7 = −2.3363
[email protected]

BEKG 2452 Numerical Methods

4.1 Newton’s Interpolating Polynomials


4.1.3 Cubic Interpolation
To connect four data points with the third order
polynomial (cubic polynomial)
Formula:
𝑓 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 𝑥 − 𝑥0 𝑥 − 𝑥1 + 𝑏3 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )

Table: 𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖 ∆2 𝑓𝑖 ∆3 𝑓𝑖

0 𝑥0 𝑦0

𝑦1 − 𝑦0
∆𝑓0 =
𝑥1 − 𝑥0
1 𝑥1 𝑦1 ∆𝑓1 − ∆𝑓0
∆2 𝑓0 =
𝑥2 − 𝑥0
𝑦2 − 𝑦1 ∆2 𝑓1 − ∆2 𝑓0
∆𝑓1 = ∆3 𝑓0 =
𝑥2 − 𝑥1 𝑥3 − 𝑥0
2 𝑥2 𝑦2 ∆𝑓2 − ∆𝑓1
∆2 𝑓1 =
𝑥3 − 𝑥1
𝑦3 − 𝑦2
∆𝑓2 =
𝑥3 − 𝑥2
3 𝑥3 𝑦3

6
BEKG 2452 Numerical Methods

Example:
Estimate 𝑓(5.3) using cubic interpolation given
1, 1 , 4, 9 , 7, 13 , 10, 20 .
Answer:
𝑖 𝑥𝑖 𝑓(𝑥𝑖 ) ∆𝑓𝑖 ∆2 𝑓𝑖 ∆3 𝑓𝑖
0 1 1 𝑏0
2.6667 𝑏1
1 4 9 −0.2222 𝑏2
1.3333 0.0432 𝑏3
2 7 13 0.1667
2.3333
3 10 20

𝑓 𝑥
= 1 + 2.6667 𝑥 − 1 − 0.2222 𝑥 − 1 𝑥 − 4
+ 0.0432(𝑥 − 1)(𝑥 − 4)(𝑥 − 7) ∴ 𝑓 5.3 = 10.8142

BEKG 2452 Numerical Methods

Example 4.1:
Given the following data
𝑖 0 1 2 3
𝑥𝑖 0 1 2 3
𝑓(𝑥𝑖 ) 10 8 2 −9

1) By using Newton’s Interpolating polynomial of


order 2, estimate 𝑓(0.6).
2) By using Newton’s Interpolation, find the
𝑃3 (𝑥) and then use it to estimate 𝑓(2.7).

7
BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials

- Applicable for equally spaced or not equally


spaced data.

- A straight line from Lagrange Interpolating


Polynomial that passing through two points
𝑥0 , 𝑦0 and 𝑥1 , 𝑦1

𝑥 − 𝑥1 𝑥 − 𝑥0
𝑓 𝑥 = 𝑓 𝑥0 + 𝑓 𝑥1
𝑥0 − 𝑥1 𝑥1 − 𝑥0

BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


- A parabola from Lagrange Interpolating
Polynomial that passing through three points
𝑥0 , 𝑦0 , 𝑥1 , 𝑦1 and 𝑥2 , 𝑦2
𝑓 𝑥
𝑥 − 𝑥1 𝑥 − 𝑥2
= 𝑓 𝑥0
𝑥0 − 𝑥1 𝑥0 − 𝑥2
𝑥 − 𝑥0 𝑥 − 𝑥2
+ 𝑓 𝑥1
𝑥1 − 𝑥0 𝑥1 − 𝑥2
𝑥 − 𝑥0 𝑥 − 𝑥1
+ 𝑓 𝑥2
𝑥2 − 𝑥0 𝑥2 − 𝑥1

8
BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


General formula of Lagrange Interpolating Polynomial that
passing through 𝑛 points 𝑥0 , 𝑦0 , 𝑥1 , 𝑦1 , … , 𝑥𝑛−1 , 𝑦𝑛−1 :
n is order of interpolation
𝑛

𝑓𝑛 𝑥 = 𝐿𝑖 𝑥 𝑓(𝑥𝑖 ) = 𝐿0 𝑥 𝑓 𝑥0 + ⋯ + 𝐿𝑛 𝑥 𝑓(𝑥𝑛 )
𝑖=0
where
𝑛
𝑥 − 𝑥𝑗
𝐿𝑖 𝑥 =
𝑥𝑖 − 𝑥𝑗
𝑗=0,𝑗≠𝑖

𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥𝑖−1 𝑥 − 𝑥𝑖+1 𝑥 − 𝑥𝑛
= … …
𝑥𝑖 − 𝑥0 𝑥𝑖 − 𝑥1 𝑥𝑖 − 𝑥𝑖−1 𝑥𝑖 − 𝑥𝑖+1 𝑥𝑖 − 𝑥𝑛

BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


Lagrange Interpolation Coefficient:
𝑛
𝑥 − 𝑥𝑗
𝐿𝑖 𝑥 =
𝑗=0,𝑗≠𝑖
𝑥𝑖 − 𝑥𝑗

is a polynomial with degree n which satisfies


0, 𝑖≠𝑗
𝐿𝑖 𝑥𝑗 =
1, 𝑖=𝑗
and
𝑛

𝐿𝑖 𝑥𝑗 = 1
𝑖=0

9
BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


4.2.1 Linear Interpolation
To connect two data points with the first order
polynomial (straight line)
Formula:
𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1
where
𝑥 − 𝑥1
𝐿0 𝑥 =
𝑥0 − 𝑥1
𝑥 − 𝑥0
𝐿1 𝑥 =
𝑥1 − 𝑥0

BEKG 2452 Numerical Methods

Example:
Use Lagrange Interpolating Polynomial of degree 1 to
estimate 𝑓(4.7) given 𝑓 4.3 = 0.1678 and 𝑓 4.9 =
0.2451 .

Answer:
𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1
where
𝑥 − 𝑥1 𝑥 − 4.9
𝐿0 𝑥 = =
𝑥0 − 𝑥1 4.3 − 4.9
𝑥 − 𝑥0 𝑥 − 4.3
𝐿1 𝑥 = =
𝑥1 − 𝑥0 4.9 − 4.3

10
BEKG 2452 Numerical Methods

Recall:
𝑓 4.3 = 0.1678
Answer: (cont.) 𝑓 4.9 = 0.2451

𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1

𝑥 − 4.9 𝑥 − 4.3
𝑓 𝑥 = 0.1678 + 0.2451
4.3 − 4.9 4.9 − 4.3
4.7 − 4.9 4.7 − 4.3
𝑓 4.7 = 0.1678 + 0.2451
4.3 − 4.9 4.9 − 4.3
= 0.2193

BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


4.2.2 Quadratic Interpolation
To connect three data points with the second
order polynomial (parabola)
Formula:
𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2
where
𝑥 − 𝑥1 𝑥 − 𝑥2
𝐿0 𝑥 =
𝑥0 − 𝑥1 𝑥0 − 𝑥2
𝑥 − 𝑥0 𝑥 − 𝑥2
𝐿1 𝑥 =
𝑥1 − 𝑥0 𝑥1 − 𝑥2
𝑥 − 𝑥0 𝑥 − 𝑥1
𝐿2 𝑥 =
𝑥2 − 𝑥0 𝑥2 − 𝑥1

11
BEKG 2452 Numerical Methods

Example:
Use Lagrange Interpolating Polynomial of degree 2 to
estimate 𝑓(−3.8) given 𝑓 −10.3 = 1.0823, 𝑓 −5.1 =
4.7798 and 𝑓 −1.5 = 9.1514.

Answer:
𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2
where
𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 + 5.1 𝑥 + 1.5
𝐿0 𝑥 = =
𝑥0 − 𝑥1 𝑥0 − 𝑥2 −10.3 + 5.1 −10.3 + 1.5
𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 + 10.3 𝑥 + 1.5
𝐿1 𝑥 = =
𝑥1 − 𝑥0 𝑥1 − 𝑥2 −5.1 + 10.3 −5.1 + 1.5
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 + 10.3 𝑥 + 5.1
𝐿2 𝑥 = =
𝑥2 − 𝑥0 𝑥2 − 𝑥1 −1.5 + 10.3 −1.5 + 5.1

BEKG 2452 Numerical Methods

Answer: (cont.)
Recall:
𝑓 −10.3 = 1.0823
𝑓 −5.1 = 4.7798
𝑓 −1.5 = 9.1514

𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2

𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 + 5.1 𝑥 + 1.5 𝑥 + 5.1 𝑥 + 1.5


𝐿0 𝑥 = = =
𝑥0 − 𝑥1 𝑥0 − 𝑥2 −10.3 + 5.1 −10.3 + 1.5 45.76

𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 + 10.3 𝑥 + 1.5 𝑥 + 10.3 𝑥 + 1.5


𝐿1 𝑥 = = =−
𝑥1 − 𝑥0 𝑥1 − 𝑥2 −5.1 + 10.3 −5.1 + 1.5 18.72

𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 + 10.3 𝑥 + 5.1 𝑥 + 10.3 𝑥 + 5.1


𝐿2 𝑥 = = =
𝑥2 − 𝑥0 𝑥2 − 𝑥1 −1.5 + 10.3 −1.5 + 5.1 31.68

12
BEKG 2452 Numerical Methods

Answer: (cont.)

𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2
𝑥+5.1 𝑥+1.5 𝑥+10.3 𝑥+1.5
= 1.0823 − 4.7798
45.76 18.72
𝑥+10.3 𝑥+5.1
+ 9.1514
31.68

−3.8+5.1 −3.8+1.5
∴ 𝑓 −3.8 = 1.0823
45.76
−3.8+10.3 −3.8+1.5
− 4.7798
18.72
−3.8+10.3 −3.8+5.1
+ 9.1514
31.68
= 6.1874

BEKG 2452 Numerical Methods

Example 4.2:
Given the following data
𝑖 0 1 2
𝑥𝑖 −1 1 3
𝑓(𝑥𝑖 ) 11 8 3

By using Lagrange Interpolating polynomial of


order 2, estimate 𝑓(1.8).

13
BEKG 2452 Numerical Methods

4.2 Lagrange Interpolating Polynomials


4.2.3 Cubic Interpolation
To connect four data points with the third order
polynomial (cubic polynomial)
Formula:
𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2 + 𝐿3 𝑥 𝑓 𝑥3
where
𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥3
𝐿0 𝑥 =
𝑥0 − 𝑥1 𝑥0 − 𝑥2 𝑥0 − 𝑥3
𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 − 𝑥3
𝐿1 𝑥 =
𝑥1 − 𝑥0 𝑥1 − 𝑥2 𝑥1 − 𝑥3
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3
𝐿2 𝑥 =
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥3
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2
𝐿3 𝑥 =
𝑥3 − 𝑥0 𝑥3 − 𝑥1 𝑥3 − 𝑥2

BEKG 2452 Numerical Methods

Example:
Find the Lagrange approximation polynomial of degree 3
𝑥 2 −𝑒 𝑥 +ln 𝑥
for the function 𝑓 𝑥 = . Use the 𝑥0 = 1, 𝑥1 = 3,
𝑥+sin 𝑥
𝑥2 = 4 and 𝑥3 = 7. Then estimate 𝑓 5 .
Answer:
Find the points of the given function.

𝑖 0 1 2 3
𝑥𝑖 1 3 4 7
𝑓(𝑥𝑖 ) −1.2662 −5.6349 −20.6631 −377.8965

𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2 + 𝐿3 𝑥 𝑓 𝑥3

14
BEKG 2452 Numerical Methods

Answer: (cont.)
𝑖 0 1 2 3
𝑥𝑖 1 3 4 7
𝑓(𝑥𝑖 ) −1.2662 −5.6349 −20.6631 −377.8965

𝑥−3 𝑥−4 𝑥−7 𝑥−3 𝑥−4 𝑥−7


𝐿0 𝑥 = =
1−3 1−4 1−7 −36

𝑥−1 𝑥−4 𝑥−7 𝑥−1 𝑥−4 𝑥−7


𝐿1 𝑥 = =
3−1 3−4 3−7 8

𝑥−1 𝑥−3 𝑥−7 𝑥−1 𝑥−3 𝑥−7


𝐿2 𝑥 = =
4−1 4−3 4−7 −9

𝑥−1 𝑥−3 𝑥−4 𝑥−1 𝑥−3 𝑥−4


𝐿3 𝑥 = =
7−1 7−3 7−4 72

BEKG 2452 Numerical Methods

Answer: (cont.)

𝑓 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2 + 𝐿3 𝑥 𝑓 𝑥3
𝑥−3 𝑥−4 𝑥−7 𝑥−1 𝑥−4 𝑥−7
= −1.2662 + −5.6349
−36 8
𝑥−1 𝑥−3 𝑥−7 𝑥−1 𝑥−3 𝑥−4
+ (−20.6631) + −377.8965
−9 72

Simplify the function,


∴ 𝑓 𝑥 = −3.6219𝑥 3 + 24.6935𝑥 2 − 53.8744𝑥 + 31.5365
∴ 𝑓 5 = −73.2355

15
BEKG 2452 Numerical Methods

Example 4.3:
Construct the Lagrange Interpolation polynomial
of degree 3 with the data set given below:
𝑖 0 1 2 𝟑
𝑥𝑖 −1 0 1 2
𝑓(𝑥𝑖 ) 1 1 1 −5

16

You might also like