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

Chapter 3

The document discusses different methods of interpolation, which is approximating the value of a function for inputs between known data points. It covers Lagrange interpolation, which finds a polynomial that passes through the known points. For n data points it provides a general Lagrange interpolation polynomial of degree n. It also gives examples of linear and quadratic Lagrange interpolation and defines the Lagrange basis polynomials used. Newton's divided difference and forward/backward difference methods are also mentioned.

Uploaded by

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

Chapter 3

The document discusses different methods of interpolation, which is approximating the value of a function for inputs between known data points. It covers Lagrange interpolation, which finds a polynomial that passes through the known points. For n data points it provides a general Lagrange interpolation polynomial of degree n. It also gives examples of linear and quadratic Lagrange interpolation and defines the Lagrange basis polynomials used. Newton's divided difference and forward/backward difference methods are also mentioned.

Uploaded by

Omed. H
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

A

Duhok Polytechnic University


AR
Technical College of Engineering

Energy and Chemical Engineering

Subject: Numerical Analysis

Lecturer’s Name: Dr. Abdulaziz RASHID

Academic Year: 2021/2022


(Second Semester)

Core textbook:
1- Kreyszig, E., Kceyszig, H., and Norminton, E.J.,
”Advanced engineering mathematics”2011.
2- Sauer, Timothy., ” Numerical Analysis”2nd edition, 2014.
Websites: https://www.khanacademy.org/math/precalculus/
x9e81a4f98389efdf:matrices

Dr. Abdulaziz Rashid Interpolation 1


Contents

0.1 Lagrange Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4


0.2 Newton’s Divided Difference Interpolation . . . . . . . . . . . . . . . . . . . . . . . . 8
0.3 Equal Spacing: Newton’s Forward Difference Formula . . . . . . . . . . . . . . . . . . 14

A
0.4 Equal Spacing: Newton’s Backward Difference Formula . . . . . . . . . . . . . . . . . 16
AR

2
Chapter 3
Interpolation

A
We are given the values of a function f (x) at different points x0, x1, · · · , xn.
We want to find approximate values of the function f (x) for ”new” x’s
that lie between these points for which the function values are given. This
process is called interpolation. We write these given values of a function f
AR
in the form
f0 = f (x0) , f1 = f (x1) , ··· , fn = f (xn)
or as ordered pairs
(x0, f0) , (x1, f1) , ··· , (xn, fn)
Where do these given function values come from? They may come from a
”mathematical” function, such as a logarithm or a Bessel function. More
frequently, they may be measured or automatically recorded values of an
”empirical” function, such as air resistance of a car or an airplane at dif-
ferent speeds. Other examples of functions that are ”empirical” are the
yield of a chemical process at different temperatures or the size of the US
population as it appears from censuses taken at 10-year intervals.
A standard idea in interpolation now is to find a polynomial pn(x) of degree
n (or less) that assumes the given values; thus
pn (x0) = f0, pn (x1) = f1, ··· , pn (xn) = fn (1)
We call this pn an interpolation polynomial and x0, · · · , xn the nodes . And
if f (x) is a mathematical function, we call pn an approximation of f (or a
3
polynomial approximation). We use pn to get (approximate) values of f for
x ’s between x0 and xn (”interpolation’) or sometimes outside this interval
x0 5 x 5 xn (”extrapolation”). How Do We Find pn ? We shall explain
several standard methods that give us pn. For given data, the different
methods must give us the same polynomial. However, the polynomials
may be expressed in different forms suitable for different purposes.

0.1 Lagrange Interpolation

A
Given (x0, f0) , (x1, f1) , · · · , (xn, fn) with arbitrarily spaced xi. Lagrange
had the idea multiplying each f j by a polynomial that is 1 at x j and 0 at
the other n nodes and then taking the sum of these n + 1 polynomials. This
AR
gives the unique interpolation polynomial of degree n or less. Beginning
with the simplest case. let us see how this works.
Linear interpolation is interpolation by the straight line through (x0, f0) ,
(x1, f1) ; see Fig. 1. Thus the linear Lagrange polynomial p1 is a sum
p1 = L0 f0 + L1 f1 with L0 the linear polynomial that is 1 at x0 and 0 at x1;
similarly, L1 is 0 at x0 and 1 at x1. Obviously,
x − x1 x − x0
L0(x) = , L1(x) =
x0 − x1 x1 − x0
This gives the linear Lagrange polynomial

Figure 1: Linear Interpolation

x − x1 x − x0
p1(x) = L0(x) f0 + L1(x) f1 = · f0 + · f1 . (2)
x0 − x1 x1 − x0

Dr. Abdulaziz Rashid Interpolation 4


example
Compute a 4D-value of ln 9.2 from ln 9.0 = 2.1972, ln 9.5 = 2.2513 by lin-
ear Lagrange interpolation and determine the error, using ln 9.2 = 2.2192.
Solution
x0 = 9.0, x1 = 9.5, f0 = ln 9.0. f1 = ln 9.5. In (2) we need
x − 9.5 x − 9.0
L0(x) = = −2.0(x − 9.5), L1(x) = = 2.0(x − 9.0)
−0.5 0.5
p1(x) = L0(x) f0 +L1(x) f1 ⇒ P1(x) = −2(x−9.5)(2.1972)+2(x−9)(2.2513)
= −4.3944x + 41.7468 + 4.5026 − 40.5234 = 0.1082x + 1.2234

A
(see Fig. 2 ) and obtain the answer
AR
ln 9.2 ≈ p1(9.2) = 0.1082(9.2) + 1.2234 = 2.2188
The error isε = a − ae = 2.2192 − 2.2188 = 0.0004.

Hence linear interpolation is not sufficient here to get 4D accuracy; it would


suffice for 3D accuracy.

Figure 2: L0 and L1

Quadratic interpolation is interpolation of given (x0, f0) , (x1, f1) , (x2, f2)
by a second degree polynomial p2(x), which by Lagrange’s idea is

Dr. Abdulaziz Rashid Interpolation 5


p2(x) = L0(x) f0 + L1(x) f1 + L2(x) f2 (3)
with L0 (x0) = 1, L1 (x1) = 1, L2 (x2) = 1, and L0 (x1) = L0 (x2) = 0, etc.
We claim that
L0(x) = ll00(x(x)0) = (x(x−x
0 −x
1 )(x−x2 )
1 )(x0 −x2 )

L1(x) = ll11(x(x)1) = (x(x−x


1 −x
0 )(x−x2 )
0 )(x1 −x2 )
(4)

L2(x) = ll22(x(x)2) = (x(x−x 0 )(x−x1 )

A
2 −x0 )(x2 −x1 )

How did we get this? Well, the numerator makes Lk (x j ) = 0 if j ̸= k.


And the denominator makes Lk (xk ) = 1 because it equals the numerator
at x = xk . Hence,
AR
(x − x1) (x − x2) (x − x0) (x − x2) (x − x0) (x − x1)
P2(x) = f0 + f1 + f2
(x0 − x1) (x0 − x2) (x1 − x0) (x1 − x2) (x2 − x0) (x2 − x1)

example Quadratic Lagrange Interpolation


Compute ln 9.2 by (Eqs. 3 and 4) from the data in above example and
the additional third value ln 11.0 = 2.397.
Solution
(x−9.5)(x−11.0)
L0(x) = (9.0−9.5)(9.0−11.0) = x2 − 20.5x + 104.5, L0(9.2) = 0.5400
(x−9.0)(x−11.0) 
L1(x) = (9.5−9.0)(9.5−11.0) = − 0.75
1
x2 − 20x + 99 , L1(9.2) = 0.4800
(x−9.0)(x−9.5) 
L2(x) = (11.0−9.0)(11.0−9.5) = 3 x − 18.5x + 85.5 , L2(9.2) = −0.0200
1 2

(see Fig. 3), so that (Eq. 3) gives, exact to 4D,


ln 9.2 ≈ p2(9.2) = 0.5400·2.1972+0.4800·2.2513−0.0200·2.3979 = 2.2192.

example Quadratic Lagrange Interpolation


Find an interpolating polynomial for the data points (0, 1), (2, 2), and (3,4).

Dr. Abdulaziz Rashid Interpolation 6


Figure 3: L0 and L1 and L2

Solution The Lagrange form is as follows:

A
(x − 2)(x − 3) (x − 0)(x − 3) (x − 0)(x − 2)
P2(x) = 1 +2 +4
(0 − 2)(0 − 3) (2 − 0)(2 − 3) (3 − 0)(3 − 2)
   
1 2  1  1 
= x − 5x + 6 + 2 − x − 3x + 4
2
x − 2x
2
AR
6 2 3
1 1
= x2 − x + 1
2 2
General Lagrange Interpolation Polynomial. For general n we obtain
n n
lk (x)
f (x) ≈ pn(x) = ∑ Lk(x) fk = ∑ lk (xk) fk (5)
k=0 k=0

where Lk (xk ) = 1 and Lk is 0 at the other nodes, and the Lk are independent
of the function f to be interpolated. We get (Eq. 5) if we take
l0(x) = (x − x1) (x − x2) · · · (x − xn)
lk (x) = (x − x0) · · · (x − xk−1) (x − xk+1) · · · (x − xn) , 0<k<n (6)
ln(x) = (x − x0) (x − x1) · · · (x − xn−1)
We can easily see that pn (xk ) = fk . Indeed, inspection of (Eq. 6) shows
that lk (x j ) = 0 if j ̸= k, so that for x = xk , the sum in (Eq. 5) reduces to
the single term (lk (xk ) /lk (xk )) fk = fk
Hence, suppose that we are presented with n+1 points (x0, f0) , . . . , (xn, fn) .
For each k between 0 and n, define the degree n polynomial
Pn(x) = f0L0(x) + · · · + fnLn(x)

Dr. Abdulaziz Rashid Interpolation 7


(x − x0) · · · (x − xk−1) (x − xk+1) · · · (x − xn)
Lk (x) =
(xk − x0) · · · (xk − xk−1) (xk − xk+1) · · · (xk − xn)
example
Find the polynomial of degree 3 or less that interpolates the points
(0, 2),(1, 1),(2, 0), and(3, −1).
Solution
The Lagrange form is as follows:
(x − 1)(x − 2)(x − 3) (x − 0)(x − 2)(x − 3)
P3(x) =2 +1
(0 − 1)(0 − 2)(0 − 3) (1 − 0)(1 − 2)(1 − 3)

A
(x − 0)(x − 1)(x − 3) (x − 0)(x − 1)(x − 2)
+0 −1
(2 − 0)(2 − 1)(2 − 3) (3 − 0)(3 − 1)(3 − 2)
1  1  1 
= − x3 − 6x2 + 11x − 6 + x3 − 5x2 + 6x − x3 − 3x2 + 2x
AR
3 2 6
=−x+2

0.2 Newton’s Divided Difference Interpolation

For given data (x0, f0) , · · · , (xn, fn) the interpolation polynomial pn(x) sat-
isfying (1) is unique, as we have shown. But for different purposes we may
use pn(x) in different forms. Lagrange’s form is useful for deriving formu-
las in numeric differentiation (approximation formulas for derivatives) and
integration.
Practically more important are Newton’s forms of pn(x), which we shall
also use for solving ODEs. They involve fewer arithmetic operations than
Lagrange’s form. Moreover, it often happens that we have to increase the
degree n to reach a required accuracy. Then in Newton’s forms we can
use all the previous work and just add another term, a possibility without
counterpart for Lagrange’s form.
With p0(x) = f [x0] = f0, the Newton’s divided difference interpolation for-
mula can be given as

Dr. Abdulaziz Rashid Interpolation 8


f (x) ≈ f [x0] + (x − x0) f [x0, x1] + (x − x0) (x − x1) f [x0, x1, x2]
(7)
+ · · · + (x − x0) (x − x1) · · · (x − xn−1) f [x0, · · · , xn] .

The coefficients f [x0 . . . xk ] can be recursively calculated as follows. List


the data points in a table:
x0 f (x0)
x1 f (x1)
... ...

A
xn f (xn) .
Now the divided differences, which are the real numbers
f [xk ] = f (xk ) ,
AR
f [xk+1] − f [xk ]
f [xk , xk+1] = ,
xk+1 − xk
f [xk+1, xk+2] − f [xk , xk+1]
f [xk , xk+1, xk+2] = ,
xk+2 − xk
f [xk+1, xk+2, xk+3] − f [xk , xk+1, xk+2]
f [xk , xk+1, xk+2, xk+3] = ,
xk+3 − xk
and so on. Hence,

f [x0] = f (x0) = f0, f [x1] = f (x1) = f1, · · · , f [xn] = f (xn) = fn


f [x1] − f [x0] f1 − f0 f [x2] − f [x1] f2 − f1
f [x0, x1] = = , f [x1, x2] = =
x1 − x0 x1 − x0 x2 − x1 x2 − x1
f [x1, x2] − f [x0, x1]
f [x0, x1, x2] =
x2 − x0
and in general
f [x1, · · · , xk ] − f [x0, · · · , xk−1]
f [x0, · · · , xk ] =
xk − x0

Dr. Abdulaziz Rashid Interpolation 9


An algorithm is shown in the following Table. The first do-loop computes
the divided differences and the second the desired value pn(x̂).

Newton’s Divided Difference Interpolation


ALGORITHM INTERPOL (x0, · · · , xn : f0, · · · , fn : (x̂)x̂)
This algorithm computes an approximation pn(x̂) of f (x̂) at x̂.
INPUT: Data (x0, f0) , (x1, f1) , · · · , (xn, fn) ; x̂
OUTPUT: Approximation pn(x̂) of f (x̂)
Set f [x j ] = f j ( j = 0, · · · , n)
For m = 1, · · · , n − 1) do:

A
For j = 0, · · · , n − m do:

f [x j+1, · · · , x j+m] − f [x j , · · · , x j+m−1]


f [x j , · · · , x j+m] = (8)
AR
x j+m − x j
End
End
Set p0(x) = f0
For k = 1, · · · , n do:

pk (x̂) = pk−1(x̂) + (x̂ − x0) · · · (x̂ − xk−1) f [x0, · · · , xk ] (9)


End
OUTPUT pn(x̂)
End INTERPOLATION
The recursive definition of the Newton’s divided differences allows arrange-
ment into a convenient table. For three points the table has the form

x0 f [x0]
f [x0, x1]
x1 f [x1] f [x0, x1, x2]
f [x1, x2]
x2 f [x2]

Dr. Abdulaziz Rashid Interpolation 10


The coefficients of the polynomial (Eq.7) can be read from the top edge of
the triangle.
Example
Use divided differences to find the interpolating polynomial passing through
the points (0, 1), (2, 2), (3, 4).
Solution
Since n = 2, hence
f (x) ≈ pn(x) = f [x0] + (x − x0) f [x0, x1] + (x − x0) (x − x1) f [x0, x1, x2] .

A
Now, we have
f [x0] = f (x0) = f0 = 1,

f [x1] − f [x0] f (x1) − f (x0) f1 − f0 2 − 1 1


AR
f [x0, x1] = = = = = ,
x1 − x0 x1 − x0 x1 − x0 2 2

f [x1, x2] − f [x0, x1]


f [x0, x1, x2] =
x2 − x0

f [x2] − f [x1] f (x2) − f (x1) f2 − f1 4 − 2


∵ f [x1, x2] = = = = =2
x2 − x1 x2 − x1 x2 − x1 3 − 2

2− 21
∴ f [x0, x1, x2] = 3−0 = 12

Hence f(x) ≈ pn(x) = f0 + (x − x0) f [x0, x1] + (x − x0) (x − x1) f [x0, x1, x2] .
= 1 + (x − 0)( 12 ) + (x − 0)(x − 2)( 21 ) = 12 x2 − 12 x + 1.

we can also arrange differences near the values from which they are ob-
tained. Such an arrangement is called a (divided) difference table. Apply-

Dr. Abdulaziz Rashid Interpolation 11


ing the divided difference leads to the following table:
0 1
x0 f [x0 ] 0 1 1
2−1
f [x0 , x1 ] 2−0 2
2− 12
x1 f [x1 ] f [x0 , x1 , x2 ] ⇒2 2 ⇒ 1
3−0 2 2
f [x1 , x2 ] 4−2 2
3−2
x2 f [x2 ] 3 4 2
3 4

This table is computed as follows: After writing down the x and y coor-
dinates in separate columns, calculate the next columns, left to right, as

A
divided differences.
After completing the divided difference triangle, the coefficients of the poly-
nomial 1,1/2,1/2 can be read from the top edge of the table. The interpo-
AR
lating polynomial can be written as
1 1
P(x) = 1 + (x − 0) + (x − 0)(x − 2),
2 2
Alternatively, we could do more algebra and write the interpolating poly-
nomial as
1 1 1 1
P(x) = 1 + x + x(x − 2) = x2 − x + 1,
2 2 2 2
matching the Lagrange interpolation version shown previously.

Note
Using the divided difference approach, new data points that arrive after
computing the original interpolating polynomial can be easily added.

Example
Add the fourth data point (1,0) to the list in above Example. We can keep
the calculations that were already done and just add a new bottom row to

Dr. Abdulaziz Rashid Interpolation 12


the triangle:
0 1
1
2
1
2 2
2
1
2 −
2
3 4 0
2

A
1 0
AR
The result is one new term to add to the original polynomial P2(x). Reading
from the top edge of the triangle, we see that the new degree 3 interpolating
polynomial is
1 1 1
P3(x) = 1 + (x − 0) + (x − 0)(x − 2) − (x − 0)(x − 2)(x − 3).
2 2 2
Note that
1
P3(x) = P2(x) − (x − 0)(x − 2)(x − 3),
2
so the previous polynomial can be reused as part of the new one.

Note
It is interesting to compare the extra work necessary to add a new point to
the Lagrange formulation versus the divided difference formulation. The
Lagrange polynomial must be restarted from the beginning when a new
point is added; none of the previous calculation can be used. On the other
hand, in divided difference form, we keep the earlier work and add one new
term to the polynomial. Therefore, the divided difference approach has a
”real-time updating” property that the Lagrange form lacks.

Dr. Abdulaziz Rashid Interpolation 13


0.3 Equal Spacing: Newton’s Forward Difference Formula

Newton’s formula (7) is valid for arbitrarily spaced nodes as they may
occur in practice in experiments or observations. However, in many appli-
cations the x j ’s are regularly spaced for instance, in measurements taken
at regular intervals of time. Then, denoting the distance by h, we can write

x0 , x1 = x0 + h, x2 = x0 + 2h, · · · , xn = x0 + nh. (10)

A
We show how (7) now simplify considerably!
AR
To get started, let us define the first forward difference of f at x j by
∆ f j = f j+1 − f j ,
the second forward difference of f at x j by
∆2 f j = ∆ f j+1 − ∆ f j ,
and, continuing in this way, the kth forward difference of f at x j by
∆k f j = ∆k−1 f j+1 − ∆k−1 f j (k = 1, 2, · · · ). (11)
What is the point of this? We show that if we have regular spacing (10),
then
1 k
f [x0, · · · , xk ] = ∆ f0. (12)
k!hk
In (7) we finally set x = x0 + rh. Then x − x0 = rh, x − x1 = (r − 1)h since
x1 − x0 = h, and so on. With this and (12), formula (7) becomes Newton’s
(or Gregory-Newton’s) forward difference interpolation formula

Dr. Abdulaziz Rashid Interpolation 14


 
n
r
f (x) ≈ pn(x) = ∑ ∆s f0 (x = x0 + rh, r = (x − x0) /h)
s
s=0 (13)
r(r − 1) 2 r(r − 1) · · · (r − n + 1) n
= f0 + r∆ f0 + ∆ f0 + · · · + ∆ f0
2! n!

where the binomial coefficients in the first line are defined by


   
r r r(r − 1)(r − 2) · · · (r − s + 1)

A
= 1, = (s > 0, integer )
0 s s!
(14)
and s! = 1 · 2 · · · s.
AR
Example
Compute cosh 0.56 from (13) and the four values in the following table.

j x j f j = cosh x j
0 0.5 1.127626
1 0.6 1.185465
2 0.7 1.255169
3 0.8 1.337435
Solution

j x j f j = cosh x j ∆fj ∆2 f j ∆3 f j
0 0.5 1.127626
0.057839
1 0.6 1.185465 0.011865
0.069704 0.000697
2 0.7 1.255169 0.012562
0.082266
3 0.8 1.337435

Dr. Abdulaziz Rashid Interpolation 15


We compute the forward differences as shown in the table. The values we
need are circled.
In (13) we have r = (0.56 − 0.50)/0.1 = 0.6, so that (13) gives
(0.6) · (−0.4)
cosh 0.56 ≈ 1.127626 + (0.6) · (0.057839) + ( ) · (0.011865)
2
0.6(−0.4)(−1.4)
+ · 0.000697
6
= 1.127626 + 0.034703 − 0.001424 + 0.000039 = 1.160944.

A
∵ the exact 6D-value is cosh 0.56 = 1.160941
∴ The error is ε = a − ae = 1.160941 − 1.160944 = −0.000003.
AR
0.4 Equal Spacing: Newton’s Backward Difference Formula

Instead of forward-sloping differences we may also employ backward-sloping


differences. The difference table remains the same as before (same numbers,
in the same positions), except for a very harmless change of the running
subscript j (which we explain in Example below). Nevertheless, purely
for reasons of convenience it is standard to introduce a second name and
notation for differences as follows. We define the first backward difference
of f at x j bybackward difference of f at x j by
∇ f j = f j − f j−1,
the second backward difference of f at x j by
∇2 f j = ∇ f j − ∇ f j−1,
and, continuing in this way, the kth backward difference of f at x j by

∇k f j = ∇k−1 f j − ∇k−1 f j−1 (k = 1, 2, · · · ) (15)

Dr. Abdulaziz Rashid Interpolation 16


A formula similar to (13) but involving backward differences is Newton’s
(for Gregory-Newton’s) backward difference interpolation formula

 
n
r+s−1
f (x) ≈ pn(x) = ∑ ∇s f0 (x = x0 + rh, r = (x − x0) /h)
s=0
s
r(r + 1) 2 r(r + 1) · · · (r + n − 1) n
= f0 + r∇ f0 + ∇ f0 + · · · + ∇ f0.
2! n!
(16)

A
Example: Newton’s Forward and Backward Interpolations
Compute a 7D-value of the Bessel function J0(x) for x = 1.72 from the four
AR
values in the following table, using
(a) Newton’s forward formula (13).
(b) Newton’s backward formula (16).
j f or jback xj J0(x j )
0 −3 1.7 0.3979849
1 −2 1.8 0.3399864
2 −1 1.9 0.2818186
3 0 2 0.2238908
Solution

j f or jback x j J0(x j ) 1st Diff. 2nd Diff. 3rd Diff.


0 −3 1.7 0.3979849
−0.0579985
1 −2 1.8 0.3399864 −0.0001693
−0.0581678 0.0004093
2 −1 1.9 0.2818186 0.0002400
−0.0579278
3 0 2 0.2238908

Dr. Abdulaziz Rashid Interpolation 17


The computation of the differences is the same in both cases. Only their
notation differs.
(a) Forward. In (13) we have r = (1.72 − 1.70)/0.1 = 0.2, and j goes from
0 to 3 (see first column). In each column we need the first given number,
and (13) thus gives
0.2(−0.8)
J0(1.72) ≈ 0.3979849 + 0.2(−0.0579985) + (−0.0001693)
2
0.2(−0.8)(−1.8)
+ · 0.0004093

A
6
= 0.3979849 − 0.0115997 + 0.0000135 + 0.0000196 = 0.3864183,
which is exact to 6D, the exact 7D -value being 0.3864185.
AR
(b) Backward. For (16) we use j shown in the second column, and in each
column the last number. Since r = (1.72 − 2.00)/0.1 = −2.8, we thus get
from (16)
−2.8(−1.8)
J0(1.72) ≈ 0.2238908−2.8(−0.0579278) + · 0.0002400
2
−2.8(−1.8)(−0.8)
+ · 0.0004093
6
= 0.2238908 + 0.1621978 + 0.0006048 − 0.0002750
= 0.3864184.

Note:
There is a third notation for differences, called the central difference nota-
tion. It is used in numerics for ODEs and certain interpolation formulas.

Dr. Abdulaziz Rashid Interpolation 18


Exercise:

1. Use Lagrange interpolation to find a polynomial that passes through


the points.
(a) (0,1),(2,3),(3,0),
(b) (-1,0),(2,1),(3,1),(5,2)
(c) (0,-2),(2,1),(4,4)
2. Use Newton’s divided differences to find the interpolating polynomials

A
of the points in Exercise 1 , and verify agreement with the Lagrange
interpolating polynomial.
3. Find a polynomial P(x) of degree 3 or less whose graph passes through
AR
the points (0.0), (1,1), (2,2), (3,7).
4. Find a polynomial P(x) of degree 3 or less whose graph passes through
the four data points (-2,8), (0,4), (1,2), (3,-2).
5. Quadratic interpolation. Gamma function.
Calculate the Lagrange polynomial p2(x) for the values Γ(1.00) =
1.0000, Γ(1.02) = 0.9888, Γ(1.04) = 0.9784 of the gamma function
and from it approximations of Γ(1.01) and Γ(1.03).
6. Linear and quadratic interpolation. Find e−0.25 and e−0.75 by linear
interpolation of e−x with x0 = 0, x1 = 0.5 and x0 = 0.5, x1 = 1, respec-
tively. Then find p2(x) by quadratic interpolation of e−x with x0 = 0
x1 = 0.5, x2 = 1 and from it e−0.25 and e−0.75 Compare the errors. Use
4 S-values of e−x .
7. Cubic Lagrange interpolation. Bessel function J0.
Calculate and graph L0, L1, L2, L3 with x0 = 0, x1 = 1, x2 = 2, x3 = 3
on common axes. Find p3(x) for the data
(0, 1), (1, 0.765198), (2, 0.223891)(3.−0.260052) [values of the Bessel

Dr. Abdulaziz Rashid Interpolation 19


function J0(x)]. Find p3 for x = 0.5, 1.5, 2.5 and compare with the
6 S-exact values 0.938470, 0.511828, -0.048384.

A
AR

Dr. Abdulaziz Rashid Interpolation 20

You might also like