Handout CIV 208 Analisis Numerik CIV 208 P7

Respect, Professionalism, &
Entrepreneurship
Mata Kuliah : Analisis Numerik
Kode
: CIV - 208
SKS
: 3 SKS

Interpolasi
Pertemuan - 7

Respect, Professionalism, &
Entrepreneurship

• Sub Pokok Bahasan :
 Interpolasi Newton
 Interpolasi Lagrange

Respect, Professionalism, &
Entrepreneurship
• You will frequently have occasion to estimate

intermediate values between precise data
points.
• The most common method used for this purpose
is polynomial interpolation.
• Recall that the general formula for an nth-order
polynomial is

f(x)=a0+a1x+a2x2+···+anxn
• For n+1 data points, there is one and only one
polynomial of order n that passes through all the
points.
• For example, there is only one straight line (that
is, a first-order polynomial) that connects two
points (Fig. a).
• Similarly, only one parabola connects a set of
three points (Fig. b).

Respect, Professionalism, &
Entrepreneurship
• Polynomial interpolation consists of determining

the unique nth-order polynomial that fits n+1
data points.
• This polynomial then provides a formula to
compute intermediate values.
• Although there is one and only one nth-order
polynomial that fits n+1 points, there are a
variety of mathematical formats in which this
polynomial can be expressed.
• Two alternatives that are well-suited for
computer implementation are the Newton and
the Lagrange polynomials.

Respect, Professionalism, &
Entrepreneurship

Newton Linear
Interpolation
• The simplest form of
interpolation is to connect two
data points with a straight line.

This technique, called linear


f is
x1 depicted
 f  x0 
interpolation,
 x  x0 
f1  x   f  x 0  
x1  Using
x0
graphically in Fig.
similar
triangles :

• which is a linear-interpolation
formula. The notation f (x)

Respect, Professionalism, &
Entrepreneurship


Example 1 :
Estimate the natural logarithm of 2 using
linear interpolation.
First, perform the computation by
interpolating between ln 1=0 and
ln6=1.791759.
Then, repeat the procedure, but use a
smaller interval from ln 1 to ln 4 (1.386294).
Note that the true value of ln 2 is
0.6931472.

Respect, Professionalism, &
Entrepreneurship

Newton Quadratic Interpolation
• If three data points are available,
this can be accomplished with a
second-order polynomial (also called
a quadratic polynomial or a

parabola).
• A particularly convenient form for
this purpose is
f2(x)=b0+b1(x−x0)+b2(x−x0)
(x−x )

Respect, Professionalism, &
Entrepreneurship

• A simple procedure can be used to
determine the values of the
coefficients.
• For x = x0 b0=f(x0)
f  x1   f  x0 
b 
1

• For x = x1
• For x = x2


x1  x0

f  x2   f  x1  f  x1   f  x0 

x2  x1
x1  x0
b2 
x 2  x0

Respect, Professionalism, &
Entrepreneurship
Example 2 :
Fit a second-order
polynomial to the three
points used in Example
1:
x0=1 f(x0)=0
x1=4 f(x1)=1.386294
x2=6 f(x2)=1.791759
• Use the polynomial to

evaluate ln 2.

2
1.8

1.79

f(x) = - 0.05x^2 + 0.72x - 0.67

1.6
1.4

1.39

1.2
1
0.8
0.6
0.4
0.2

0

0
0

1

2

3

4

5

6

7

Respect, Professionalism, &

Entrepreneurship

General Form of Newton’s
Interpolating Polynomials
• The preceding analysis can be generalized to fit
an nth-order polynomial to n+1 data points.
• The nth-order polynomial is
fn(x)=b0+b1(x−x0)+···+bn(x−x0)
(x−x1)···(x−xn−1)(1)
• We use these data points and the following
equations to evaluate the coefficients:

Respect, Professionalism, &
Entrepreneurship

• bo = f(xo) (2)
• b1 = f[x1.xo] (3)
• b2 = f[x2, x1, xo] (4)

…....

• bn = f[xn, xn1, ……, x1, xo] (5)
• where the bracketed function
evaluations are finite divided
differences.

Respect, Professionalism, &
Entrepreneurship

• For example, the first finite divided
difference is represented generally
as
f ( xi )  f ( x j )





f xi , x j 

xi  x j


• The second finite divided difference,
which represents the difference of
two first divided
is
f  xi , xdifferences,
j   f  x j , xk 
f  xi , x j , x k  
expressed
generally
xi  xkas

Respect, Professionalism, &
Entrepreneurship

• Similarly, the nth finite divided
difference
is
f  xn , xn  1 ,..., x1   f  xn  1 , xn  2 ,..., x0 
f  x , x ,..., x , x  
n

n 1

1

0

x n  x0

• These differences can be used to
evaluate the coefficients in Eqs. (2)
through (5), which can then be
substituted into Eq. (1) to yield the
interpolating polynomial

Respect, Professionalism, &
Entrepreneurship

Respect, Professionalism, &
Entrepreneurship

Example 3
In Example 2, data points at x0=1, x1=4,
and x2=6 were used to estimate ln 2 with a
parabola.
Now, adding a fourth point [x3=5; f(x3)=
1.609438], estimate ln 2 with a third-order
Newton’s interpolating polynomial.

Respect, Professionalism, &
Entrepreneurship

Lagrange Interpolating
Polynomials
• The Lagrange interpolating
polynomial is simply a reformulation
of the Newton polynomial that
avoids the computation of divided
differences.
n
(6)
 x  represented
Li  x  f  xi 

• It can f nbe
concisely
as
i 0

Respect, Professionalism, &
Entrepreneurship

• Where
n

Li  x  
j 0
j i

x  xj
xi  x j

• where designates the “product of.”
• For example, the linear version
(n=1) is
x  x0
x  x1
f1  x  
f  x0  
f  x1 
x0  x1
x1  x0

Respect, Professionalism, &
Entrepreneurship

• and the second-order version is

• the summation of all the products
designated by Eq. (6) is the unique
nth order polynomial that passes
exactly through all n+1 data points.

Respect, Professionalism, &
Entrepreneurship

Example 4
• Use a Lagrange interpolating
polynomial of the first and second
order to evaluate ln 2 on the basis of
the data given in Example 2:
x0=1
f(x0)=0
x1=4

f(x1)=1.386294

x2=6

f(x2)=1.791760

Respect, Professionalism, &
Entrepreneurship

Homework