0% found this document useful (0 votes)
31 views66 pages

Part6 Interpolation

The document discusses interpolation, which is the process of estimating values between known data points using an interpolation function. It describes general interpolation polynomials and Newton interpolation polynomials. General interpolation polynomials find coefficients by solving a system of equations, but can have oscillation issues at higher degrees. Newton interpolation polynomials are an equivalent but easier way to find coefficients without oscillation issues.

Uploaded by

zepozepo06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views66 pages

Part6 Interpolation

The document discusses interpolation, which is the process of estimating values between known data points using an interpolation function. It describes general interpolation polynomials and Newton interpolation polynomials. General interpolation polynomials find coefficients by solving a system of equations, but can have oscillation issues at higher degrees. Newton interpolation polynomials are an equivalent but easier way to find coefficients without oscillation issues.

Uploaded by

zepozepo06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

ES-361

Computing Methods in
Engineering

by Murat Buyuk, PhD


CHAPTER 6

INTERPOLATION

3.1 SCOPE

As in Figure 3.1, the process of estimating intermediate values in a data set is


called interpolation, and the function used for this purpose is called the
interpolation function. In interpolation, a function is passed over all or a part of
the data set and intermediate values are estimated using this function. In
interpolation, the values in the dataset are considered to be accurate (precise) and
free of errors such as measurement errors. Interpolation is especially preferred in
applications where generating data is difficult, expensive and time consuming.

Interpolation
function

Şekil 3.1: Interpolation.

Interpolation is commonly used to represent some or all of the data obtained as a


result of experimental studies with a function. Polynomial functions are very
commonly used for interpolation. Two approaches are used to interpolate with
polynomial functions:

1- General interpolation polynomial: A single high-order polynomial function is


passed through all points (passing an n-order polynomial from n+1 points) to
obtain a global interpolation function.

2- Spline interpolation polynomial: Interpolation polynomials are created using


data points piecewise. A global interpolation function is formed by adding the spline
polynomials to each other in such a way that continuity conditions are met at the
junction points. In this approach, a linear, parabolic, or cubic polynomial is usually
passed through both points.
3.2 GENERAL INTERPOLATION POLYNOME

In this method, a first-order polynomial function, expressed as below, is passed


through all available data points such as (x1, f1), (x2, f2) , (x3, f3),…, (xn+1, fn+1) :

f (x) =c1 +c2x+c3x2 +c4x3 +...cn+1xn (3.1)

The polynomial constants can be found by substituting the known values in


Equation 3.1 as follows.

f (x=x1) = f1 =c1 +c2x1 +c3x12 +c4x13 +...cn+1x1n


f (x=x2) = f2 =c1 +c2x2 +c3x22 +c4x23 +...cn+1x2n
f (x=x3) = f3 =c1 +c2x3 +c3x32 +c4x33 +...cn+1x3n
f (x=x4) = f4 =c1 +c2x4 +c3x42 +c4x43 +...cn+1x4n

f (x=xn+1) = fn+1 =c1 +c2xn+1 +c3xn2+1 +c4xn3+1 +...cn+1xnn+1


The above equations can be rearranged in matrix form and written as:

1 x1 x12 x13 ... x1n c1  f1 


1 x x2 x3 ... xn c  f 
 2 2 2 2  2   2 
1 x3 x3 x3 ... x3n c3  f3 
2 3
  =  (3.2)
1 x4 x42 x43 ... x4n c4  f4 
... ... ... ... ... ......  ... 
    

1xn+ 2
x
1  +1
n
3
x
n+ xnn
...
1  +
1
c 1
n+ 

f 1
n+
A X B

It is a linear system of equations expressed in the form of AX=B


the system of
equations above. For systems of linear equations, unknown constants ci can be
found using one of the solution methods described in Part 1.

The polynomial method described above has the following difficulties:

1- Physical difficulty: As the number of points increases, the degree of the


polynomial will increase, so the interpolation polynomial shows more and
more oscillatory character depending on the number of points and the
degree of the polynomial (especially after a certain degree). The oscillating
character also leads to incorrect estimation of intermediate values.
Therefore, value estimation with the global interpolation polynomial is
usually most accurate with polynomials with low oscillation character (up to
orders 3-4)

Example: Let's re-represent the Runge function f (x) = 1 2 using equidistant


1+25x
points in the [-1,1] range with global interpolation polynomials of different order
and compare the functions with each other.

Figure 3.2: Representation of the Runge function by global interpolation


polynomials of different order.

It is seen from Figure 3.2 that as the degree of the function increases, the
oscillation towards the ends increases and the interpolation polynomial moves
away from the real function.

2- Mathematical difficulty: The coefficients matrix in Equation (3.1) is called


the Vandermonde matrix. If the number of points and the degree of the
interpolation polynomial are too high, this matrix becomes singular and
cannot be calculated vice versa. Therefore, constants ci cannot be
calculated in polynomials of very high order. To overcome the mathematical
difficulty and make it easier to find constants, alternative forms of the
f (x) =c1 +c2x+c3x2 +c4x3 +...cn+1xn general interpolation polynomial such as
Newton and Lagrangian polynomials have been developed.
3.2.1 Newton Interpolation Polynomial

f (x) =c1 +c2x+c3x2 +c4x3 +...cn+1xn The Newton equivalent of the general
interpolation polynomial can be expressed as:

f (x) =a1 +a2(x−x1)+a3(x−x1)(x−x2)+a4(x−x1)(x−x2)(x−x3)+...an+1(x−x1)(x−x2)(x−x3)...(x−xn)


(3.3)

Although the above two function expressions are equivalent (variant expressions
of the same polynomial), it is much easier to find unknown constants in Newtonian
form. Let's first show that both forms are equivalent, using linear and parabolic
interpolation polynomials.

Linear Polynomial: Suppose we have function values (x1, f1), (x2, f2) . We can write
the linear polynomial passing through these two points in two different forms
(general form and Newton form)

General form: f (x) =c1 +c2x


Newton form: fN(x) =a1 +a2(x−x1)
We can write the Newton form in more detail as follows:

𝑓𝑁 (𝑥) = 𝑎1 + 𝑎2 (𝑥 − 𝑥1 ) = 𝑎
⏟1 − 𝑎2 𝑥1 + 𝑎
⏟2 𝑥 = 𝑐1 + 𝑐2 𝑥
𝑐1 =𝐶𝑜𝑛𝑠𝑡𝑎𝑛𝑡 𝑇𝑒𝑟𝑚 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑐2 =𝐿𝑖𝑛𝑒𝑎𝑟 𝑇𝑒𝑟𝑚 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡

Considering that the general and Newton polynomials express the same linear
polynomial, we can write the following relationship between the general polynomial
coefficients and the Newton polynomial coefficients:

c1 =a1 −a2x1, c2 =a2


Parbolic Polynomial: Suppose we have function values (x1, f1), (x2, f2) , (x3, f3). We
can write the parabolic polynomial passing through these three points in two
different forms (general form and Newton form)

General form: f (x) =c1 +c2x+c3x2


Newton form: fN(x) =a1 +a2(x−x1)+a3(x−x1)(x−x2)
We can write the Newton form in more detail as follows:

𝑓𝑁 (𝑥) = 𝑎1 + 𝑎2 (𝑥 − 𝑥1 ) + 𝑎3 (𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) = 𝑎1 + 𝑎2 𝑥 − 𝑎2 𝑥1 + 𝑎3 (𝑥 2 − 𝑥2 𝑥 − 𝑥1 𝑥 + 𝑥1 𝑥2 )
=
𝑎
⏟1 − 𝑎2 𝑥1 + 𝑎3 𝑥1 𝑥2 + (𝑎 ⏟ 2 − 𝑎3 𝑥1 − 𝑎3 𝑥2 ) 𝑥 + 𝑎
⏟3 𝑥2
𝑐1 =𝐶𝑜𝑛𝑠𝑡𝑎𝑛𝑡 𝑇𝑒𝑟𝑚 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑐2 =𝐿𝑖𝑛𝑒𝑎𝑟 𝑇𝑒𝑟𝑚 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑐3 =𝑃𝑎𝑟𝑎𝑏𝑜𝑙𝑖𝑐 𝑇𝑒𝑟𝑚 𝐶𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡
= 𝑐1 + 𝑐2 𝑥 + 𝑐3 𝑥 2
Considering that the general and Newton polynomials express the same parabolic
polynomial, we can write the following relationship between the general polynomial
coefficients and the Newton polynomial coefficients:

c1 =a1 −a2x1 +a3x1x2, c2 =a2 −a3x1 −a3x2, c3 =a3


After showing that the Newtonian polynomial is equivalent to the general
polynomial, we can move on to finding the coefficients of the Newtonian
polynomial. To illustrate the general methodology, let's try to obtain the
coefficients of the Linear, Parabolic and Cubic Newtonian interpolation polynomials.

Linear Newton Polynomial: fN(x) =a1 +a2(x−x1)


We can obtain the coefficients of the linear Newton polynomial passing through
the points (x1, f1), (x2, f2) as follows:
x= x1 : f1 =a1 +a2(x1 −x1) ➔ a1 = f1

x= x2 : f2 =a1 +a2(x2 −x1) ➔ a2 = f2 − f1 


 x2 −x1 
Parabolic Newton Polynomial: fN(x) =a1 +a2(x−x1)+a3(x−x1)(x−x2)
We can obtain the coefficients of the linear Newton polynomial passing through
the points (x1, f1), (x2, f2) , (x3, f3) as follows:

x= x1 : f1 =a1 +a2(x1 −x1)+a3(x1 −x1)(x−x2) ➔ a1 = f1

x= x2 : f2 =a1 +a2(x2 −x1)+a3(x2 −x1)(x2 −x2) ➔ a2 = f2 − f1 


 x2 −x1 
 f3 − f2 − f2 − f1 
 x3 −x2   x2 −x1 
x= x3 : f3 =a1 +a2(x3 −x1)+a3(x3 −x1)(x3 −x2) ➔ a3 =
x3 −x1

Cubic Newton Polynomial:

fN(x) =a1 +a2(x−x1)+a3(x−x1)(x−x2)+a4(x−x1)(x−x2)(x−x3)


We can obtain the coefficients of the linear Newton polynomial passing through
the points (x1, f1), (x2, f2) , (x3, f3), (x4, f4) as follows:
x= x1 : f1 =a1 +a2(x1 −x1)+a3(x1 −x1)(x−x2)+a4(x1 −x1)(x1 −x2)(x1 −x3) ➔
a1 = f1
x= x2 : f2 =a1 +a2(x2 −x1)+a3(x2 −x1)(x2 −x2)+a4(x2 −x1)(x2 −x2)(x2 −x3) ➔
a2 = f2 − f1 
 x2 −x1 
x= x3 : f3 =a1 +a2(x3 −x1)+a3(x3 −x1)(x3 −x2)+a4(x3 −x1)(x3 −x2)(x3 −x3) ➔

 f3 − f2 − f2 − f1 
 x3 −x2   x2 −x1 
a3 =
x3 −x1
x= x4 : f4 =a1 +a2(x4 −x1)+a3(x4 −x1)(x4 −x2)+a4(x4 −x1)(x4 −x2)(x4 −x3)
 f4 − f3 − f3 − f2   f3 − f2 − f2 − f1 
 x4 −x3   x3 −x2   x3 −x2   x2 −x1 

a3 = x 4 − x2 x3 −x1
x4 −x1
From the above expressions, we can see that the coefficients of the Newton
polynomial are obtained by dividing the differences in the function values
consecutively (without solving the set of equations) by intervals. For this reason,
the Newton interpolation method is also called the Newton divided difference
method. Newton's coefficients can also be written using divided finite difference
notation as:

a1 = f1, a2 = f x2,x1, a3 = f x3,x2,x1= f x3,x2− f x2,x1,


x3 −x1
a4 = f x4,x3,x2,x1= f x4,x3,x2− f x3,x2,x1
x4 −x1
n
Using the above expressions, the -th order Newton polynomial can be written in
terms of divided finite difference expressions as follows:

fN(x) =a1 +a2(x−x1)+a3(x−x1)(x−x2)+a4(x−x1)(x−x2)(x−x3)+...an+1(x−x1)(x−x2)(x−x3)...(x−xn)


= f1 + f x2,x1(x−x1)+ f x3,x2,x1(x−x1)(x−x2)+ f x4,x3,x2,x1(x−x1)(x−x2)(x−x3)+...+
f xn+1, xn+1,...,x2,x1(x−x1)(x−x2)(x−x3)...(x−xn)
(3.4)

The Newton polynomial expression is similar to the Taylor series form. Derivatives
in the Taylor series are expressed by divided differences in the Newtonian
polynomial.
The advantage of the Newton polynomial:

- The coefficients of the interpolation polynomial can be easily calculated by


successively divided differences without solving the set of equations.
- If new points are included in the dataset, the degree of the polynomial can
be increased easily, and in this case, the coefficients do not need to be
recalculated from the beginning.
- Applicable to a set of equally spaced or non-equally spaced points.

Since the coefficients of polynomials in Newton's method are calculated by divided


differences, a divided finite difference table is prepared for the data before finding
the coefficients.

Table 3.1 shows the Newton divided finite difference table for the points (x1, f1),
(x2, f2) , (x3, f3), (x4, f4)

Table 3.1: Newton divided difference table.

x f f 
, f ,, f ,,,
x1 f1 f x ,x = f2 − f1
x2 −x1 f x3,x2,x1= f x3,x2− f x2,x1 f x4,x3,x2,x1= f x4,x3,x2− f x3,x2,x1
2 1
x3 −x1 x4 −x1
x2 f2 f x ,x = f3 − f2 f x4,x3,x2= f x4,x3− f x3,x2
3 2
x3 −x2 x4 −x2
x3 f3 f x ,x = f4 − f3
4 3
x4 −x3
x4 f4

Example 3.1: The values of a function at different points are given as : (xi , fi ):
(0,1), (1,2), (3,6), (5,12). Estimate the function values at x=2 and x=4 using
Newton's divided finite difference method?

For the above function values, we can create the Newton divided finite difference
table as in Table 3.2.
Table 3.2: Table of Newton divided differences for data.

x f f 
, f ,, f ,,,
f x2, x1= 2−1=1 f x3,x2,x1= 2−1 =1 1 −1
0 1
1−0 3−0 3 f x4, x3, x2, x1= 4 3 =− 1
5−0 60
f x3,x2= 6−2 =2 f x4,x3,x2=3−2 = 1
1 2
3−1 5−1 4
f x4,x3=12−6 =3
3 6
5−3
5 12

Cubic Newton interpolation polynomial can be formed for the 4 points at hand by
x
taking the =0 point as a reference, and the function values at x=2, x=4 can be
calculated:

f (x) = f1 + f x2, x1(x−x1) + f x3, x2, x1(x−x1)(x−x2) + f x4, x3, x2, x1(x−x1)(x−x2)(x−x3)
f (x) =1+1(x−0) +1(x−0)(x−1) − 1 (x−0)(x−1)(x−3) =1+x+1x(x−1) − 1 x(x−1)(x−3)
3 60 3 60

x =2 için f (2) =1+2+12(2−1)− 1 2(2−1)(2−3) =3.7


3 60
1 1
x =4 için f (4) =1+4+ 4(4−1)− 4(4−1)(4−3) =8.8
3 60
Special case of Newton's polynomial:

In the special case where the distance between the points is equal, the split
differences for the points (x1, f1), (x2 =x1 +h, f2), (x3 =x1 +2h, f3),…,
(xn+1 =x1 +nh, fn+1) can be rearranged as follows:

f x2,x1= f2 − f1 = f1 ( : forward difference operator)


x2 −x1 h
 f3 − f2 − f2 − f1   f3 − f2   f2 − f1 
 −    x3 −x2   x2 −x1   h − h  f −f 2 f
f x3, x2, x1= f x3, x2 f x2, x1 = = = 2 2 1 = 21
x3 −x1 x3 −x1 2h 2h 2!h
Continuing in a similar way, the split finite difference expression for the r -th
difference can be generalized in terms of forward finite difference as follows:

f xr,xr−1,...,x2,x1= fr1
r

r!h
In this case, the n-th order Newton polynomial can be written using its

dimensionless notation
(x−x1) = as:
h
f (x) = f1 +f1+  f1 (−1)+  f1 (−1)(−2)+...+  f1n+1 (−1)(−2)...(−n)
2 3 n+1

2! 3! (n+1)!h
(3.5)

The above expression is also called the Forward Newton-Gregory polynomial.

Example 3.2: The values of a function at different points are given as : (xi , fi ):
(0,1), (2,3), (4,6) , (6,10), (8,16). Estimate the function values at x=3 and x=7
using Newton's divided difference method?

Forward Finite Difference table to be used to estimate function values at x=3 and
x=7 can be prepared as in Table 3.3.

Table 3.3: Forward Finite Differences table for data.

x f f 2 f 3 f 4 f
0 1 f1 =3−1=2 2 f1 =3−2=1 3 f1 =1−1=0 4 f1 =1−0=1
2 3 f2 =6−3=3 2 f2 =4−3=1 3 f2 =2−1=1
4 6 f3 =10−6=4 2 f3 =6−4=2
6 10 f4 =16−10=6
8 16

The fourth-degree Newtonian polynomial for 5 points can be written for the
equidistant case as:
2
f1 3
f1 4
f (x) = f1 +f1+ (−1)+ (−1)(−2)+ f1 (−1)(−2)(−3)
2! 3! 4!
Using the above polynomial expression f (3)and f (7) values can be calculated
as follows:
For x=3 ,  =
x−x1 =3−0 = 3
h 2 2
f (3) =1+23+ 1 3(3−1)+ 0 3(3−1)(3−2)+ 1 3(3−1)(3−2)(3−3) =4.3984
2 2!2 2 3!2 2 2 4!2 2 2 2
For x =7 ,  =
x−x1 = 7−0 = 7
h 2 2
f (7) =1+27 + 1 7(7 −1)+ 0 7(7 −1)(7 −2)+ 1 7(7 −1)(7 −2)(7 −3) =12.6484
2 2!2 2 3!2 2 2 4!2 2 2 2

3.2.2 Lagrangian Interpolation Polynomial

Like the Newtonian polynomial, the Lagrangian interpolation polynomial is a


different expression of a general polynomial. Its main purpose is to find the
coefficients of the interpolation polynomial without solving the set of equations, as
in Newton's method. Now let's write Lagrangian polynomials for linear and
parabolic functions and then generalize.

Linear Lagrange Polynomial:

The linear Lagrangian polynomial passing through the points (x1, f1), (x2, f2) can
be written as:

f (x) =a1(x−x2) +a2(x−x1)


a1, a2 coefficients can be obtained by substituting the function values in the
polynomial as follows:

f1 =a1(x1 −x2) +a2(x1 −x1) ➔ a1 = f1


x1 −x2

f2 =a1(x2 −x2)+a2(x2 −x1) ➔ a2 = f2


x2 −x1
Thus, after the coefficients are replaced, the linear Lagrangian polynomial is
obtained as follows:

f (x) = (x−x2) f1 + (x−x1) f2 = L1(x) f1 +L2(x) f2


(
 −
x1x
2) (
 −
x2x
1)
L1(x) L2(x)

L1(x) , L2(x) functions are also called Shape functions or Weight functions. Figure
functions take the value of 1 or 0 at the interpolation points as seen in Figure 3.3.
1 x=x1 1 x=x2
L1(x) = , L2(x) =
0 x x1 0 x x2

Figure 3.3: Linear shape functions and Linear Lagrangian interpolation polynomial.

Parabolic Lagrange Polynomial:

The parabolic Lagrangian polynomial passing through the points (x1, f1), (x2, f2) ,
(x3, f3) can be written as:
f (x) =a1(x−x2)(x−x3)+a2(x−x1)(x−x3)+a3(x−x1)(x−x2)
The coefficients a1, a2 , a3 can be obtained by substituting the function values in
the polynomial as follows:

f1 =a1(x1 −x2)(x1 −x3)+a2(x1 −x1)(x1 −x3)+a3(x1 −x1)(x1 −x2) ➔ a1 = f1


(x1 −x2)(x1 −x3)

f2 =a1(x2 −x2)(x2 −x3)+a2(x2 −x1)(x2 −x3)+a3(x2 −x1)(x2 −x2)➔ a2 =


f2
(x2 −x1)(x2 −x3)

f3 =a1(x3 −x2)(x3 −x3)+a2(x3 −x1)(x3 −x3)+a3(x3 −x1)(x3 −x2)➔ a3 =


f3
(x3 −x1)(x3 −x2)
Thus, after the coefficients are replaced, the parabolic Lagrange polynomial is
obtained as follows:

f (x) = (x−x2)(x−x3) f1 + (x−x1)(x−x3) f2 + (x−x1)(x−x2) f2 =L1(x) f1 +L2(x) f2 +L3(x) f3


 −
(x1x2 1−
)(xx
3)  −
(x2x1 2−
)(xx
3) −
(x3
 x1 3−
)(xx
2)
L1(x) L2(x) L3(x)

L1(x) , L2(x), L2(x) functions are also called shape functions and these functions
take the value of 1 or 0 at the interpolation points as seen in Figure 3.4.
1 x=x1 1 x=x2 1 x =x3
L1(x) = , L2(x) = , L3(x) =
0 x x1 0 x x2 0 x  x3

Figure 3.4: Parabolic shape functions and Parabolic Lagrange interpolation


polynomial.

Using the writing of the linear and parabolic Lagrangian polynomial, the first-order
Lagrangian polynomial passing through the points (x1, f1), (x2, f2) ,…, (xn+1, fn+1)can
be written as:

f (x) =L1(x) f1 +L2(x) f2 +L3(x) f3 +...+Ln+1(x) fn+1 (3.6)

Any i -th Shape (Weight) function in the Lagrangian polynomial can be expressed
as:

Li (x) = (x−x1)(x−x2)...(x−xi−1)(x−xi+1)...(x−xn) ( i =1,2,...,n+1) (3.7)


(xi −x1)(xi −x2)...(xi −xi−1)(xi −xi+1)...(xi −xn)
Li (x) shape function takes the value 1 or 0 at the interpolation points as follows:
1 x=xi
Li (x) = (3.8)
0 x xi
The value of a function f (x) at a point x in the Lagrangian polynomial is expressed
as the weighted sum of all function values. Shape functions also act as weight
functions.

NOTE: The advantage of Lagrangian interpolation is that the interpolation


coefficients can be calculated directly without the need for solving a set of
equations.
Example 3.3: The values of a function at different points are given as (x1, f1) =(0,1)
, (x2 f2) =(3,5), (x3, f3) =(6,18) , (x4, f4) =(9,36) . Estimate the function values at x=4
and x=7 using the Lagrangian polynomial?

The Lagrangian polynomial for the given 4 points can be written symbolically as:

f (x) = (x−x2)(x−x3)(x−x4) f1 + (x−x1)(x−x3)(x−x4) f2 +


(x1 −x2)(x1 −x3)(x1 −x4) (x2 −x1)(x2 −x3)(x2 −x4)
(x−x1)(x−x2)(x−x4) f + (x−x1)(x−x2)(x−x3) f
(x3 −x1)(x3 −x2)(x3 −x4) 3 (x4 −x1)(x4 −x2)(x4 −x3) 4
By substituting the numerical data, the function values at x=4 and x=7 can be
obtained as follows:

f (4) = (4−3)(4−6)(4−9)1+(4−0)(4−6)(4−9)5+(4−0)(4−3)(4−9)18+
(0−3)(0−6)(0−9) (3−0)(3−6)(3−9) (6−0)(6−3)(6−9)
(4−0)(4−3)(4−6)36=8.5309
(9−0)(9−3)(9−6)
(7 − 3)(7 − 6)(7 − 9) (7 − 0)(7 − 6)(7 − 9) (7 − 0)(7 − 3)(7 − 9)
𝑓(7) = 1+ 5+ 18 +
(0 − 3)(0 − 6)(0 − 9) (3 − 0)(3 − 6)(3 − 9) (6 − 0)(6 − 3)(6 − 9)
(7 − 0)(7 − 3)(7 − 6)
36 = 23.6419
(9 − 0)(9 − 3)(9 − 6)

3.3 SPLINE INTERPOLATION POLYNOMIALS

It has been previously stated that when a single higher-order polynomial is passed
through all points in cases where the number of points is large, the resulting
polynomial is oscillating (causing errors in the interpolation estimates). The
commonly used method to avoid oscillating character is to divide the data into
subgroups (spline) and pass low-order polynomials from them and apply continuity
conditions at the junctions of these groups. This approach is called the spline
interpolation approach. In the piecewise interpolation approach, between two
points is commonly represented by a linear, parabolic, or cubic function.

3.3.1 Linear Spline Interpolation

In this approach, the distance between two points (consecutive points) is


represented by a linear function as seen in Figure 3.5. Linear functions can easily
be written between two points in Newtonian polynomial type as follows:
f (x) = f1 + f2 − f1 x x1  x  x2
 x2 −x1 
f (x) = f2 + f3 − f2 x x2  x  x3
 x3 −x2  (3.9)
...
f (x) = fn + fn+1 − fn x xn  x  xn+1
 xn+1 −xn 

Figure 3.5: Interpolation with linear piecewise functions.

Because linear spline polynomials are simple and easily computable, they are
widely used in solving engineering problems. In addition to this advantage, linear
spline polynomials also have a significant disadvantage. It is also the absence of
derivative (eg. slope) continuity at the junctions.

3.3.2 Parabolic Spline Interpolation

In interpolation with the parabolic segment function, parabolic polynomial


functions are formed between consecutive points as seen in Figure 3.6. Continuity
(continuity of the function and the 1st derivative) conditions are applied at the
junction points of the parabolic polynomials, and an overall (global) estimation
function in non-oscillation character is obtained. For example, in parabolic segment
interpolation through a point n+1
, the number of parabolic polynomials between
consecutive points can be written as:

f (x) =a1x2 +b1x+c1 x1  x  x2


f (x) =a2x2 +b2x+c2 x2  x  x3 (3.10)
...
f (x) =anx2 +bnx+cn xn  x  xn+1
Figure 3.6: Interpolation with functions with parabolic pieces.

From the figures and expressions above, it is seen that there are unknown 3n
polynomial coefficients for each n
parabolic polynomial. These coefficients can be
obtained by using the (n+1) number of function values, the continuity of the
functions at the (n−1) junction points, (n−1) derivative continuity and 1 arbitrarily
chosen 1st derivative value for one of the endpoints.

The function value, continuity and extreme conditions to be used in finding the
coefficients can be expressed as follows:

𝑓 (𝑖) (𝑥𝑖 ) = 𝑓𝑖 , 𝑓 (𝑛) (𝑥𝑛+1 ) = 𝑓𝑛+1 𝑖 = 1, . . . , 𝑛


𝑓 (𝑖) (𝑥𝑖+1 ) = 𝑓 (𝑖+1) (𝑥𝑖+1 ) 𝑖 = 1, . . . , 𝑛 − 1
(𝑖) (𝑖+1)
𝑑𝑓 𝑑𝑓
(𝑥𝑖+1 ) = (𝑥𝑖+1 ) 𝑖 = 1, . . . , 𝑛 − 1
𝑑𝑥 𝑑𝑥
𝑑 2 𝑓(1)
(𝑥1 ) =0 (Boundary Condition ) (3.11)
𝑑𝑥

If the continuities expressed by Equation 3.11 are written for the piecewise
parabolic functions in Equation 3.10, the following equations are obtained.

𝑓 (1) (𝑥1 ) = 𝑓1 = 𝑎1 𝑥12 + 𝑏1 𝑥1 + 𝑐1


𝑓 (2) (𝑥2 ) = 𝑓2 = 𝑎2 𝑥22 + 𝑏2 𝑥2 + 𝑐1
... ⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑉𝑎𝑙𝑢𝑒𝑠
𝑓 (𝑛) (𝑥𝑛 ) = 𝑓𝑛 = 𝑎𝑛 𝑥𝑛2 + 𝑏𝑛 𝑥𝑛 + 𝑐𝑛
2
𝑓 (𝑛) (𝑥𝑛+1 ) = 𝑓𝑛+1 = 𝑎𝑛 𝑥𝑛+1 + 𝑏𝑛 𝑥𝑛+1 + 𝑐𝑛+1 ]

𝑓 (1) (𝑥2 ) = 𝑓 (2) (𝑥2 ) ⇒ 𝑎1 𝑥22 + 𝑏1 𝑥2 + 𝑐1 = 𝑎2 𝑥22 + 𝑏2 𝑥2 + 𝑐2


𝑓 (2) (𝑥3 ) = 𝑓 (3) (𝑥3 ) ⇒ 𝑎2 𝑥32 + 𝑏2 𝑥3 + 𝑐2 = 𝑎3 𝑥32 + 𝑏3 𝑥3 + 𝑐3
...
𝑓 (𝑛−1) (𝑥𝑛 ) = 𝑓 (𝑛) (𝑥𝑛 ) ⇒ 𝑎𝑛−1 𝑥𝑛2 + 𝑏𝑛−1 𝑥𝑛 + 𝑐𝑛−1 = 𝑎𝑛 𝑥𝑛2 + 𝑏𝑛 𝑥𝑛 + 𝑐𝑛 ]
⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
𝑑𝑓(1) 𝑑𝑓(2)
(𝑥2 ) = (𝑥2 ) ⇒ 2𝑎1 𝑥2 + 𝑏1 = 2𝑎2 𝑥2 + 𝑏2
𝑑𝑥 𝑑𝑥
𝑑𝑓(2) 𝑑𝑓(3)
𝑑𝑥
(𝑥3 ) = 𝑑𝑥
(𝑥3 ) ⇒ 2𝑎2 𝑥3 + 𝑏2 = 2𝑎3 𝑥3 + 𝑏3 ⇒ 1. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
...
𝑑𝑓(𝑛−1) 𝑑𝑓(𝑛)
𝑑𝑥
(𝑥𝑛 ) = 𝑑𝑥
(𝑥𝑛 ) ⇒ 2𝑎𝑛−1 𝑥𝑛 + 𝑏𝑛−1 = 2𝑎𝑛 𝑥𝑛 + 𝑏𝑛 ]

df(1) (x ) =02a x +b =0, (Boundary Condition)


dx 1 11 1

The above equations can be rearranged and written in matrix form as follows:

a1 b1 c1 a2 b2 c2 ... an bn cn 
 x12 x1 1 0 0 0 ... 0 0 0 f1 
0 0 0  f 
 0 2 
2
x2 x2 1 ... 0 0
 ... ... ... ... ... ... ... ... ... 
... 1 ... 
a 
 
0 0 0 0 0 0 0 xn2 xn 1 b1  fn 
0 0 0 0 0 0 0 xn2+1 xn+1 1 c1  fn+1
 2  
 x2 x2 1 −x2 −x2
2
−1 ... 0 0 0 a2 0 
0 0 0 x32 x3 1 ... 0 0 0 .b2 =0 

 ... ... ... ... ... ... ... ... ... ... c2  ... 
0 0 0 0 0 −xn2 −xn −1... 0 
 0 0
   
2x2 1 0 −2x2 −1 0 ... 0 0 0 an 0 
0 0 0 0 bn  0 
 2x3 1 0 ... 0 0
 ... ... ... ... ... ... ... ... ... ... cn  ... 
 0 
0 0 0 0 0 0 0 −2xn −xn −1  
2x1 1 0 0 0 0 0 0 0 0  0  (3.12)

From the solution of the linear system of equations in Equation 3.12, the unknown
coefficients of the parabolic segment polynomials are obtained.

Example 3.4: The values of a function at different points are given as (x1, f1) =(0,1)
, (x2 f2) =(3,5), (x3, f3) =(6,18) , (x4, f4) =(9,36) . Estimate the function values at x=4
and x=7 using the parabolic spline method?

Parabolic polynomials passing through the given points can be written as:
f (1)(x) =a1x2 +b1x+c1 x1  xx2
f (2)(x) =a2x2 +b2x+c2 x2 xx3
f (3)(x) =a3x2 +b3x+c3 x3  xx4
Using the expressions above, the function value and continuity can be written
symbolically as follows:

𝑓 (1) (𝑥1 ) = 𝑓1 = 𝑎1 𝑥12 + 𝑏1 𝑥1 + 𝑐1


𝑓 (2) (𝑥2 ) = 𝑓2 = 𝑎2 𝑥22 + 𝑏2 𝑥2 + 𝑐1
⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑉𝑎𝑙𝑢𝑒𝑠
𝑓 (3) (𝑥3 ) = 𝑓3 = 𝑎3 𝑥32 + 𝑏3 𝑥3 + 𝑐3
𝑓 (3) (𝑥4 ) = 𝑓4 = 𝑎3 𝑥42 + 𝑏3 𝑥4 + 𝑐3 ]

𝑓 (1) (𝑥2 ) = 𝑓 (2) (𝑥2 ) ⇒ 𝑎1 𝑥22 + 𝑏1 𝑥2 + 𝑐1 = 𝑎2 𝑥22 + 𝑏2 𝑥2 + 𝑐2


] ⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
𝑓 (2) (𝑥3 ) = 𝑓 (3) (𝑥3 ) ⇒ 𝑎2 𝑥32 + 𝑏2 𝑥3 + 𝑐2 = 𝑎3 𝑥32 + 𝑏3 𝑥3 + 𝑐3

𝑑𝑓 (1) 𝑑𝑓 (2)
(𝑥2 ) = (𝑥2 ) ⇒ 2𝑎1 𝑥2 + 𝑏1 = 2𝑎2 𝑥2 + 𝑏2
𝑑𝑥 𝑑𝑥 ⇒ 1. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
𝑑𝑓 (2) 𝑑𝑓 (3)
(𝑥3 ) = (𝑥3 ) ⇒ 2𝑎2 𝑥3 + 𝑏2 = 2𝑎3 𝑥3 + 𝑏3 ]
𝑑𝑥 𝑑𝑥

df(1) (x ) =02a x +b =0, (Boundary Condition)


dx 1 1 1 1

The above equations can be arranged in matrix form as follows:

a1 b1 c1 a2 b2 c2 ... a3 b3 c3 
 x12 x1 1 0 0 0 0 0 0 a1  f1 
0 0 0
 x22 x2 1 0 0 0 b1  f2
0 0 0 0 0 0 x32 x3 1 c1  f3
    
0 0 0 0 0 0 x42 x4 1 a2 f4
 x22 x2 1
 −x22 −x2 −1 0 0 0 b2 =0 
0 0 0 x32 x3 1 −x32 −x3 −1c2  0 
2x2 1 0 −2x2 −1 0 0 0 0 a3 0 

0 0 0 2x3 1 0 −2x3 −1 0 b3  0 
2x 1 0 0 0 c3  0 
 1 0 0 0 0
If numeric data is substituted, the following matrix form is obtained:
a1 b1 c1 a2 b2 c2 ... a3 b3 c3 
0 0 1 0 0 0 0 0 0 a1  1 
0 0 0
 32 3 1 0 0 0 b1  5 
0 0 0 0 0 0 62 6 1 c1  18
0 0 0
 2 0 0 0 92 9 1 a2 36
3 3 1 −32 −3 −1 0 0 0 b2 =0 
 
0 0 0 62 6 1 −62 −6 −1c2  0 
2x3 1 0 −2x3 −1 0 0 0 0 a3 0 

0 0 0 2x6 1 0 −2x6 −1 0 b3  0 
 0 1 0 0 0 0 0 0 0 c3  0 
From the solution of the above equation, the polynomial coefficients are found as
follows:

a1 =0.7111
, b1 =0, c1 =1,
a2 =−0.2444, b2 =5.7333, c2 =−7.6,
a3 =1.0667, b3 =−10, c3 =39.6,
After substituting the polynomial coefficients, the part polynomials are obtained as
follows:

f (1)(x) =0.7111
x2 +1 0x3
f (2)(x) =−0.2444
x2 +5.7333
x−7.6 3x6
f (3)(x) =1.0667
x2 −10x+39.6 6x9
In this case f (4) and f (7) values are obtained as follows:
f (4) = f (2)(4) =−0.2444
x42 +5.7333
x4−7.6=11.4222
f (7) = f (3)(7) =1.0667
x72 −10x7+39.6=21.8667
3.3.3 Cubic Spline Interpolation

Cubic part (spline) interpolation is one of the most widely used part interpolation
functions. Cubic polynomial functions are created between successive points, as
seen in Figure 3.7, in interpolation with the cubic spline function. Continuity
(function, 1st and 2nd derivative continuity) conditions are applied at the junction
points of the cubic polynomials, and a whole (global) estimation function with
oscillation-free character is formed. For example, in interpolation of cubic
segments passing through n+1
points, the number of cubic polynomials between
n consecutive points can be written as follows.
f (1) (x) =a1x3 +b1x2 +c1x+d1 x1  x  x2
f (2) (x) =a2x3 +b2x2 +c2x+d2 x2  x  x3 (3.13)
...
f (n) (x) =anx3 +bnx2 +cnx+dn xn  x  xn+1
It is seen that there are4n coefficients to be determined in the above n cubic
polynomial. These coefficients can be obtained by using the (n+1) number of
function values, (n−1) number of function continuity at the junction points, (n−1)
number 1st derivative continuity, (n−1) 2nd derivative continuity at the junction
points, and 2 arbitrarily selected 2nd derivative values at the boundary conditions.

Figure 3.7: Interpolation with cubic piece functions.

The function value, continuity and extreme conditions to be used in finding the
coefficients can be expressed as follows:

𝑓 (𝑖) (𝑥𝑖 ) = 𝑓𝑖 , 𝑓 (𝑛) (𝑥𝑛+1 ) = 𝑓𝑛+1 𝑖 = 1, . . . , 𝑛


𝑓 (𝑖) (𝑥𝑖+1 ) = 𝑓 (𝑖+1) (𝑥𝑖+1 ) 𝑖 = 1, . . . , 𝑛 − 1
(𝑖) (𝑖+1)
𝑑𝑓 𝑑𝑓
(𝑥𝑖+1 ) = (𝑥𝑖+1 ) 𝑖 = 1, . . . , 𝑛 − 1
𝑑𝑥 𝑑𝑥
𝑑 2 𝑓(1) 𝑑 2 𝑓(𝑛)
𝑑𝑥
(𝑥1 ) = 0, 𝑑𝑥
(𝑥𝑛+1 ) =0 (Boundary Condition ) (3.14)

If the continuity conditions written in Equation 3.14 are substituted in the cubic
polynomial expressions in Equation 3.13, the following equations are obtained:

𝑓 (1) (𝑥1 ) = 𝑓1 = 𝑎1 𝑥13 + 𝑏1 𝑥12 + 𝑐1 𝑥1 + 𝑑1


𝑓 (2) (𝑥2 ) = 𝑓2 = 𝑎2 𝑥23 + 𝑏2 𝑥22 + 𝑐2 𝑥2 + 𝑑1
... ⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑉𝑎𝑙𝑢𝑒𝑠
(𝑛) 3 2
𝑓 (𝑥𝑛 ) = 𝑓𝑛 = 𝑎𝑛 𝑥𝑛 + 𝑏𝑛 𝑥𝑛 + 𝑐𝑛 𝑥𝑛 + 𝑑𝑛
3 2
𝑓 (𝑛) (𝑥𝑛+1 ) = 𝑓𝑛+1 = 𝑎𝑛 𝑥𝑛+1 + 𝑏𝑛 𝑥𝑛+1 + 𝑐𝑛 𝑥𝑛+1 + 𝑑𝑛+1 ]
𝑓 (1) (𝑥2 ) = 𝑓 (2) (𝑥2 ) ⇒ 𝑎1 𝑥23 + 𝑏1 𝑥22 + 𝑐1 𝑥2 + 𝑑1 = 𝑎2 𝑥23 + 𝑏2 𝑥22 + 𝑐2 𝑥2 + 𝑑2
𝑓 (2) (𝑥3 ) = 𝑓 (3) (𝑥3 ) ⇒ 𝑎2 𝑥33 + 𝑏2 𝑥32 + 𝑐2 𝑥3 + 𝑑2 = 𝑎3 𝑥33 + 𝑏3 𝑥32 + 𝑐3 𝑥3 + 𝑑3
...
𝑓 (𝑛−1) (𝑥𝑛 ) = 𝑓 (𝑛) (𝑥𝑛 ) ⇒ 𝑎𝑛−1 𝑥𝑛3 + 𝑏𝑛−1 𝑥𝑛2 + 𝑐𝑛−1 𝑥𝑛 + 𝑑𝑛−1 = 𝑎𝑛 𝑥𝑛3 + 𝑏𝑛 𝑥𝑛2 + 𝑐𝑛 𝑥𝑛 + 𝑑𝑛 ]
⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠

𝑑𝑓 (1) 𝑑𝑓 (2)
(𝑥2 ) = (𝑥2 ) ⇒ 3𝑎1 𝑥22 + 2𝑏1 𝑥2 + 𝑐1 = 3𝑎2 𝑥22 + 2𝑏2 𝑥2 + 𝑐2
𝑑𝑥 𝑑𝑥
𝑑𝑓 (2) 𝑑𝑓 (3)
(𝑥3 ) = (𝑥3 ) ⇒ 3𝑎2 𝑥32 + 2𝑏2 𝑥3 + 𝑐2 = 3𝑎3 𝑥32 + 2𝑏3 𝑥3 + 𝑐3
𝑑𝑥 𝑑𝑥
...
𝑑𝑓 (𝑛−1) 𝑑𝑓 (𝑛)
(𝑥𝑛 ) = (𝑥𝑛 ) ⇒ 3𝑎𝑛−1 𝑥𝑛2 + 2𝑏𝑛−1 𝑥𝑛 + 𝑐𝑛−1 = 3𝑎𝑛 𝑥𝑛2 + 2𝑏𝑛 𝑥𝑛 + 𝑐𝑛 ]
𝑑𝑥 𝑑𝑥
⇒ 1. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠

𝑑 2 𝑓(1) 𝑑 2 𝑓(2)
(𝑥2 ) = (𝑥2 ) ⇒ 6𝑎1 𝑥2 + 2𝑏1 = 6𝑎2 𝑥2 + 2𝑏2
𝑑𝑥 𝑑𝑥
2
𝑑 𝑓 (2) 2
𝑑 𝑓 (3)

𝑑𝑥
(𝑥3 ) = 𝑑𝑥
(𝑥3 ) ⇒ 6𝑎2 𝑥3 + 2𝑏2 = 6𝑎3 𝑥3 + 2𝑏3 ⇒ 2. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
...
𝑑 2 𝑓(𝑛−1) 𝑑 2 𝑓(𝑛)
(𝑥𝑛 ) = (𝑥𝑛 ) ⇒ 6𝑎𝑛−1 𝑥𝑛 + 2𝑏𝑛−1 = 6𝑎𝑛 𝑥𝑛 + 2𝑏𝑛 ]
𝑑𝑥 𝑑𝑥

𝑑 2 𝑓(1)
𝑑𝑥
(𝑥1 ) = 0 ⇒ 6𝑎1 𝑥2 + 2𝑏1 = 0
] ⇒ Boundary Condition
𝑑 2 𝑓(𝑛)
𝑑𝑥
(𝑥𝑛+1 ) = 0 ⇒ 6𝑎𝑛 𝑥𝑛+1 + 2𝑏𝑛 = 0

The above equations can be rearranged and written in matrix form as follows:
a1 b1 c1 d1 a2 b2 c2 d2 ... an bn cn dn
 x13 x12 x1 1 0 0 0 0 ... 0 0 0 0 f1 
0 0  f 
 0 0 x23 x22 x2 1 ... 0 0 0 0 2 
 ... ... ... ... ... ... ... ... ... ... ... ... ... ... 
 a  f 
0 0 0 0 0 0 0 0 ... xn3 xn2 xn 1 1  n 
0 0
 3 2 0 0 0 0 0 0 ... xn3+1 xn2+1 xn+1 1 b1  fn+1
 x2 x2 x2 1 −x23 −x22 −x2 −1 ... 0 0 0 0 c1  0 
 
0 0
 0 0 x33 x32 x3 1 ... 0 0 0 0 d1  0 
 ... ... ... ... ... ... ... ... ... ... ... ... ...a2  ... 
0 0
 2 0 0 0 0 0 0 ... −xn3 −xn2 −xn −1b2  0 
3x2 2x2 1 0 −3x22 −2x2 −1 0 ... 0 0 0 0 c2 =0 
0 0 0 d2 0 
 0 0 3x32 2x3 1 0 ... 0 0 0
 ... ... ... ... ... ... ... ... ... ... ... ... ...... ... 

0 0 0 0 0 0 0 0 ... −3xn2 −2xn 1 0 an  0 
6x2 2 0 0 −6x2 −2 0 0 ... 0 0 0 0 bn  0 

0 0 0 0 6x3 2 0 0 ... 0 0 0 0 cn  0 
 ... ... ...dn ... 
 ... ... ... ... ... ... ... ... ... ...
0 0 0 0 0 0 0 0 ... −6xn −2 0 0 0 
6x 2  0 
 1 0 0 0 0 0 0 ... 0 0 0 0  
 0 0 0 0 0 0 0 0 ... 6xn+1 2 0 0  0 
(3.15)

From the solution of the system of linear equations expressed by Equation 3.15,
the unknown coefficients of the polynomials of the cubic parts are obtained.

Example 3.5: The values of a function at different points are given as (x1, f1) =(0,1)
, (x2 f2) =(2,3), (x3, f3) =(4,6), (x4, f4) =(6,10). Estimate the function values at x=3
and x=5 using the cubic spline method?

The cubic polynomials passing through the given points can be written as:

f (1)(x) =a1x3 +b1x2 +c1x+d1 x1 xx2


f (2)(x) =a2x3 +b2x2 +c2x+d2 x2 xx3
f (3)(x) =a3x3 +b3x2 +c3x+d3 x3 xx4
Using the expressions above, the function value and continuity can be written
symbolically as follows:
𝑓 (1) (𝑥1 ) = 𝑓1 = 𝑎1 𝑥13 + 𝑏1 𝑥12 + 𝑐1 𝑥1 + 𝑑1
𝑓 (2) (𝑥2 ) = 𝑓2 = 𝑎2 𝑥23 + 𝑏2 𝑥22 + 𝑐2 𝑥2 + 𝑑1
⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑉𝑎𝑙𝑢𝑒𝑠
𝑓 (3) (𝑥3 ) = 𝑓3 = 𝑎3 𝑥33 + 𝑏3 𝑥32 + 𝑐3 𝑥3 + 𝑑3
𝑓 (3) (𝑥4 ) = 𝑓4 = 𝑎3 𝑥43 + 𝑏3 𝑥42 + 𝑐3 𝑥4 + 𝑑3 ]

𝑓 (1) (𝑥2 ) = 𝑓 (2) (𝑥2 ) ⇒ 𝑎1 𝑥23 + 𝑏1 𝑥22 + 𝑐1 𝑥2 + 𝑑1 = 𝑎2 𝑥23 + 𝑏2 𝑥22 + 𝑐2 𝑥2 + 𝑑2


]
𝑓 (2) (𝑥3 ) = 𝑓 (3) (𝑥3 ) ⇒ 𝑎2 𝑥33 + 𝑏2 𝑥32 + 𝑐2 𝑥3 + 𝑑2 = 𝑎3 𝑥33 + 𝑏3 𝑥32 + 𝑐3 𝑥3 + 𝑑3
⇒ 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠

𝑑𝑓 (1) 𝑑𝑓 (2)
(𝑥2 ) = (𝑥2 ) ⇒ 3𝑎1 𝑥22 + 2𝑏1 𝑥2 + 𝑐1 = 3𝑎2 𝑥22 + 2𝑏2 𝑥2 + 𝑐2
𝑑𝑥 𝑑𝑥
𝑑𝑓 (2) 𝑑𝑓 (3)
(𝑥3 ) = (𝑥3 ) ⇒ 3𝑎2 𝑥32 + 2𝑏2 𝑥3 + 𝑐2 = 3𝑎3 𝑥32 + 2𝑏3 𝑥3 + 𝑐3 ]
𝑑𝑥 𝑑𝑥
⇒ 1. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠

𝑑2 𝑓 (1) 𝑑2 𝑓 (2)
(𝑥2 ) = (𝑥2 ) ⇒ 6𝑎1 𝑥2 + 2𝑏1 = 6𝑎2 𝑥2 + 2𝑏2
𝑑𝑥 𝑑𝑥 ⇒ 2. 𝐷𝑒𝑟𝑖𝑣𝑎𝑡𝑖𝑣𝑒 𝐶𝑜𝑛𝑡𝑖𝑛𝑢𝑖𝑡𝑖𝑒𝑠
𝑑2 𝑓 (2) 𝑑2 𝑓 (3)
(𝑥3 ) = (𝑥3 ) ⇒ 6𝑎2 𝑥3 + 2𝑏2 = 6𝑎3 𝑥3 + 2𝑏3 ]
𝑑𝑥 𝑑𝑥
𝑑 2 𝑓(1)
𝑑𝑥
(𝑥1 ) = 0 ⇒ 6𝑎1 𝑥2 + 2𝑏1 = 0
2 (3) ] ⇒ Boundary Condition
𝑑 𝑓
𝑑𝑥
(𝑥4 ) = 0 ⇒ 6𝑎3 𝑥4 + 2𝑏3 = 0

The above equations can be arranged in matrix form as follows:

 x13 x12 x1 1 0 0 0 0 0 0 0 0 a1  f1 


0
 0 0 0 x23 x22 x2 1 0 0 0 0 b1  f2
0 0 0 0 0 0 0 0 x33
x32 x3 1 c1  f3
  
0 0 0 0 0 0 0 0 x43 x42 x4 1 d1  f4
 x23
 x22 x2 1 −x23 −x22 −x2 −1 0 0 0 0 a2  0 
0 0 0 0 x33 x32 x3 1 −x3 −x32
3
−x3 −1b2 =0 
3x22
 2x2 1 0 −3x22 −2x2 −1 0 0 0 0 0 c2  0 
0 0 0 0 3x32 2x3 1 0 −3x32 −2x3 −1 0 d2 0 
6x    
 2 2 0 0 −6x2 −2 0 0 0 0 0 0 a3  0 
0 0 0 0 6x3 2 0 0 −6x3 −2 0 0 b3  0 
6x 0 c3  0 
 1 2 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 6x4 2 0 0 d3 0 
If numeric data is substituted, the following matrix form is obtained:
 0 0 0 1 0 0 0 0 0 0 0 0 a1  1 
 0 0 0 0 23
 22 2 1 0 0 0 0 b1  3 
 0 0 0 0 0 0 0 0 43
42 4 1 c1  6 
 0 0 0 0 0
 3 0 0 0 63 62 6 1 d1  10
 2 2 2 1 −2 −22
2 3
−2 −1 0 0 0 0 a2  0 
   
 0 0 0 0 43 42 4 1 −4 −42
3
−4 −1b2  0 
=
3x22 2x2 1 0 −3x22 −2x2
 −1 0 0 0 0 0 c2  0 
 0 0 0 0 3x42 2x4 1 0 −3x4 −2x4
2
−1 0 d2 0 
 6x2 2 0 0 −6x2 −2    
 0 0 0 0 0 0 a3  0 
 0 0 0 0 6x4 2 0 0 −6x4 −2 0 0 b3  0 
 0 2 0 0 0 0 c3  0 
 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 6x6 2 0 0 d3 0 
From the solution of the above equation, the polynomial coefficients are found as
follows:

a1 =0.025, b1 =0, c1 =0.9, d1 =1


a2 =0, b2 =0.15, c2 =0.6, d2 =1.2
a3 =−0.025, b3 =0.45, c3 =−0.6, d3 =2.8
After substituting the polynomial coefficients, the part polynomials are obtained
as follows:

f (1)(x) =0.025x3 +0.9x+1 0x2


f (2)(x) =0.15x2 +0.6x+1.2 2x4
f (3)(x) =−0.025x3 +0.45x2 −0.6x+2.8 4x6
In this case f (3) and f (5)values are obtained as follows:
f (3) = f (2)(3) =0.15x32 +0.6x3+1.2=4.35
f (5) = f (3)(5) =−0.025x53 +0.45x52 −0.6x5+2.8=7.925

3.3.4 Hermite Interpolation Polynomial

If both the function value and derivative values are known at the data points, as
in Figure 3.8, Hermite interpolation polynomials can be created for the
interpolation estimation. Cubic Hermite polynomial, which is one of the Hermite
polynomials, is used as an interpolation function for thin (Euler) beam elements in
the solution of bending problems of beams with the Finite Element method.

Figure 3.8: Hermite interpolation polynomial.

Let's assume that we have the function and 1st derivative values at the n+1 point
as in Figure 3.8. In this case, considering that the total data 2(n+1) is available
and using these data, a 2n+1
-th order interpolation polynomial can be created.
This polynomial and its 1st derivative can be written in general form as follows:

f (x) =c1 +c2x+c3x2 +...+c2(n+1)x2n+1


(3.16)
df(x) =c +2c x+...+(2n+1)c x2n
2(n+1)
dx 2 3
By substituting the given information in the equations in Equation 3.16, unknown
c1,…, c2(n+1) coefficients can be obtained.
f (x1) = f1 =c1 +c2x+c3x2 +...+c2(n+1)x2n+1
df(x1) = df1 =c +2c x+...+(2n+1)c x2n
2(n+1)
dx dx 2 3
f (x2) = f2 =c1 +c2x+c3x2 +...+c2(n+1)x2n+1
df(x2) = df2 =c +2c x+...+(2n+1)c x2n
2(n+1)
dx dx 2 3
...
f (xn+1) = fn+1 =c1 +c2x+c3x2 +...+c2(n+1)x2n+1
df(xn+1) = dfn+1 =c +2c x+...+(2n+1)c x2n
2(n+1)
dx dx 2 3
If the above equations are written in matrix form, the following form is obtained:
f1 
df 
1 x1 x12 ... x12n+1   1 
0 2n c
(2n+1)x2  1  dx 
 1 2x2 ...
1 x2 x22 ... x22n+1 c2  f2 
 
0 1 2x2 ... (2n+1)x22n c3 =df 2 
dx 
(3.17)
... ... ... ... 
... ...  ...  

1 xn+1 xn2+1 ... xn2+n1+1 c2(n+1) f 
0 (2n+1)xn2+n1  n+1 
1 2xn+1 ... dfn+1
 dx 

From the solution of the linear system of equations in Equation 3.17, the
coefficients of c1,…, c2(n+1) are obtained

Note: In case the number of points is high, the coefficients matrix in Equation
3.17 may become ill-conditioned and the equation system may not be solved. In
such cases, an alternative method, described below, has been developed to easily
construct the Hermite interpolation polynomial. In this alternative method, the
Hermite interpolation polynomial is constructed similarly to the Lagrangian
method.

Alternative Method for Hermite Interpolation Polynomial

In the alternative method, the Hermite interpolation polynomial and its derivative
can be written as follows using Lagrangian functions:

f (x) =U1(x) f1 +U2(x) f2 +...+Un+1(x) fn+1 +V1(x) df1 +V2(x) df2 +...+Vn+1(x) dfn+1
dx dx dx (3.18)
=Ui (x) fi +Vi (x) i
n+1 n+1 df
i=1 i=1 dx
df(x) = dU1(x) f +dU2(x) f +...+dUn+1(x) f +dV1(x) df1 +dV2(x) df2 +...+dVn+1(x) dfn+1
dx dx 1 dx 2 dx n+1 dx dx dx dx dx dx (3.19)
= i fi + i
n+1 dU(x) n+1 dV(x) df
i
i=1 dx i=1 dx dx

Since the above expressions satisfy the given points, the following equations can
be written:

At the point x= x1:


f (x1) = f1 ➔ U1(x1) =1, U2(x1) =0,…, Un+1(x1) =0, V1(x1) =0, V2(x1) =0,…, Vn+1(x1) =0,
df(x1) = df1 ➔ dU1(x1) =0, dU2(x1) =0,…, dUn+1(x1) =0, dV1(x1) =1,…, dV2(x1) =0,
dx dx dx dx dx dx dx
dVn+1(x1) =0,
dx
At the point x= x2:
f (x2) = f2 ➔ U1(x2) =0, U2(x2) =1,…, Un+1(x2) =0, V1(x2) =0, V2(x2) =0,…,
Vn+1(x2) =0,
df(x2) = df2 ➔ dU1(x2) =0, dU2(x2) =0,…, dUn+1(x2) =0, dV1(x1) =0,…, dV2(x2) =1,
dx dx dx dx dx dx dx
dVn+1(x1) =0,
dx

At the point x = xn+1:


f (xn+1) = fn+1 ➔ U1(xn+1) =0, U2(xn+1) =0,…, Un+1(xn+1) =1, V1(xn+1) =0, V2(xn+1) =0,…,
Vn+1(xn+1) =0,
df(xn+1) = dfn+1 ➔ dU1(xn+1) =0, dU2(xn+1) =0,…, dUn+1(xn+1) =0, dV1(xn+1) =1,…,
dx dx dx dx dx dx
dV2(xn+1) =0, dVn+1(xn+1) =1,
dx dx
The above conditions can be written briefly in index notation as follows:

1 i= j
Ui (xj ) = , Vi (xj ) =0 (3.20)
0 i  j
dUi (xj )
=0, dVi (xj ) 1 i = j
=
dx 0 i  j
(3.21)
dx
The above Ui (x)and Vi(x) functions can be written as follows using the Shape
functions ( Li (x)) in the Lagrangian interpolation polynomial:

Ui (x) =(ai +bix)Li (x)2, Vi (x) =(ci +dix)Li (x)2 (3.22)

In this case, the Hermite polynomial can be written as:

f (x) =Ui (x) fi +Vi (x) dfi =(ai +bix)Li (x)2 fi +(ci +dix)Li (x)2 dfi
n+1 n+1 n+1 n+1
(3.23)
i=1 i=1 dx i=1 i=1 dx
From the equivalence of the right and left sides in Equation 3.23, the following
equations can be obtained for the coefficients ai , bi , ci , di :

 2
U(xi ) =(ai +bixi )Li (xi )2 =1 ➔ (ai +bixi )L(xi ) =1 ➔ ai +bixi =1
 i
=1  
 2
V(xi ) =(ci +dixi )Li (xi )2 =0 ➔ (ci +dixi )L(xi ) =0 ➔ ci +dixi =0
 i
=1  
If the equation of the left and right sides of the derivative of Equation 3.23 is
equivalent, the following equations can be obtained for the coefficients ai , bi , ci ,
di :
 2
dUi (xi ) =bL(x ) +2(a +bx )L(x ) dLi (xi ) =0 dLi (xi ) =0
➔ bi +2
dx i  i
=1 
i


i
=1

i i 
i
=1
i
dx dx

dVi (xi ) =d L(x ) +2(c +d x )L(x ) dLi (xi ) =1 ➔ d =1


2

dx i  i
=1 
i


i 
=0

i i 
i
=1
i
dx i

Using the equations written above, the coefficients ai , bi , ci and di can be


obtained as follows:

di =1
ai +bixi =1
ci +dixi =0 bi =−2dLi (xi )

dx
bi +2dLi (xi ) =0 ai =1+2xi dLi (xi )
dx dx
di =1 ci =−xi
When the obtained coefficients ai , bi , ci and di are substituted in Equation 3.23,
the Hermite polynomial can be written in terms of Lagrangian functions as follows:

f (x) =1−2(x−xi) dLi(xi)Li(x)2 fi +(x−xi)Li(x)2 dfi


n+1 n+1
(3.24)
i=1  dx  i=1 dx

Note: In the alternative form above, the Hermite interpolation polynomial can be
written directly by using Lagrangian Shape functions and their derivatives. This
flexibility and convenience is the advantage of this form.
Example 3.6: Construct the cubic Hermite interpolation polynomial using the data
given in the table below and estimate the function value at =3. x

x f(x) f’(x)=df(x)/dx

2 4 -8

4 12 4

The cubic Hermite interpolation polynomial between two points can be written
as:

f (x) =1−2(x−xi ) dLi (xi )Li (x)2 fi +(x−xi )Li (x)2 dfi =
2 n+1

i=1  dx  i=1 dx
1−2(x−x ) dL1(x1)L(x)2 f +(x−x )L(x)2 df1 +1−2(x−x ) dL2(x2)L (x)2 f +(x−x )L (x)2 f2
 1
dx  1 1 1 1
dx  2
dx  2 2 2 2
dx
Using the data in the table, Lagrangian Shape functions and derivatives can be
calculated as follows:

L1(x) = (x−x2) =(x−4) =(4−x) , dL1(x) = (−1) ➔


dL1(x1 =2) = −1
(x1 −x2) (2−4) 2 dx 2 dx 2

L2(x) = (x−x1) =(x−2) =(x−2) , dL2(x) = 1 ➔ dL2(x2 =4) = 1


(x2 −x1) (4−2) 2 dx 2 dx 2
Using Lagrangian Shape functions and their derivatives, the Hermite interpolation
polynomial can be obtained as follows:

 (−1
f (x) =1−2(x−2) )(4− x)2

4+(x−x1)(4− x)2
 (1)
(−8) +1−2(x−4) (x −2)2

12+(x−x2)(x −2)2

2  2   2  2  2   2 
4
 
From the above expression, the value f (3) =5 for x=3 is obtained.

Example 3.7: Construct the cubic Hermite interpolation polynomial using the data
given in the table below and estimate the function value at =6 x
x f(x) f’(x)=df(x)/dx

2 4 -8

4 12 4
8 24 -2

The Hermite interpolation polynomial can be expressed with Lagrangian Figure


functions for the three points above as follows:

f (x) =1−2(x−xi ) dLi (xi )Li (x)2 fi +(x−xi )Li (x)2 dfi =
3 n+1

i=1  dx  i=1 dx
1−2(x−x ) dL1(x1)L(x)2 f +(x−x )L(x)2 df1 +1−2(x−x ) dL2(x2)L (x)2 f +(x−x )L (x)2 f2 +
 1
dx  1 1 1 1
dx  2
dx  2 2 2 2
dx
1−2(x−x ) dL3(x3)L (x)2 f +(x−x )L (x)2 df3 +
 3
dx  3 3 3 3
dx
Using the data in the table, Lagrangian Shape functions and derivatives can be
calculated as follows:

L1(x) = (x−x2)(x−x3) = (x−4)(x−8) = (x −12x+32) ,


2

(x1 −x2)(x1 −x3) (2−4)(2−8) 12


dL1(x) = (2x−12) ➔
dL1(x1 =2) = −8
dx 12 dx 12

L2(x) = (x−x1)(x−x3) = (x−2)(x−8) =−(x −10x+16) ,


2

(x2 −x1)(x2 −x3) (4−2)(4−8) 8


dL2(x) =−(2x−10) ➔ dL2(x2 =4) = 2
dx 8 dx 8

L3(x) = (x −x1)(x − x2) = (x −2)(x −4) = −6x+8) ,


(x2

(x3 −x1)(x3 −x2) (8−2)(8−4) 24


dL3(x) = (2x−6) ➔ dL3(x3 =8) =10
dx 24 dx 24
Using Lagrangian Shape functions and their derivatives, the Hermite interpolation
polynomial can be obtained as follows:


f (x) =1−2(x−2) (−8)(x2
−12 x +32
) 2
(x2
− 12x + 32)2

 12   4+(x−2)  (−8)+
12   12 
1−2(x−4) (2)−(x2 −10x+16) 12+(x−4)−(x2 −10x+16) 4+
2 2

 8  8 


 8 

1−2(x−8) (10)(x2 −6x+8) 24+(x−8)(x2 −6x+8) (−2)
2 2

 24 24   24 
 
From the above expression, the value f (6) =14.8148for x=6 is obtained.
3.4 MULTIVARIABLE GENERAL INTERPOLATION POLYNOMES

The data available for interpolation can sometimes be multivariate or


multidimensional. In such cases, multidimensional interpolation functions can be
created with the products of one-dimensional interpolation functions, if the data is
spread sequentially within regular boundaries, such as a rectangular area or a cube
volume, as in Figure 3.9. General (global) interpolation methods for functions of
two and three variables are described below.

Figure 3.9: Sequential spread interpolation points within two- and three-
dimensional regular boundaries.

3.4.1 General Polynomial Function of Two Variables

The two-dimensional general interpolation polynomial x and y the one-


dimensional general interpolation polynomial written in its direction can be formed
by multiplying and rearranging as follows:

n  m n
f (x, y) =ci xi cj yj  =cijxi yj
m

 i=0  j=0  i=0 j=0 (3.25)


=c00 +c10x+c01y+c11xy+c20x2 +c02y2 +c21x2y+c12xy2 +c22x2y2 +...+cmnxmyn

Example 3.8: In Figure 3.10, the values of a two-variable function f (x, y) at


different points on a rectangular region are given. Calculate the f (5,3) value of
this function with the general polynomial.
Figure 3.10: Data for two-dimensional overall interpolation.

The bivariate general parabolic function for the given points can be expressed as:

f (x, y) =cijxi yj =c00 +c10x+c01y+c11xy+c20x2 +c02y2 +c21x2y+c12xy2 +c22x2y2


2 2

i=0 j=0

If the given values are substituted in the above function, the following equations
are obtained:

f (x1, y1) =c00 +c10x1 +c01y1 +c11x1y1 +c20x12 +c02y12 +c21x12y1 +c12x1y12 +c22x12y12
f (x1, y2) =c00 +c10x1 +c01y2 +c11x1y2 +c20x12 +c02y22 +c21x12y2 +c12x1y22 +c22x12y22
f (x1, y3) =c00 +c10x1 +c01y3 +c11x1y3 +c20x12 +c02y32 +c21x12y3 +c12x1y32 +c22x12y32
f (x2, y1) =c00 +c10x2 +c01y1 +c11x2y1 +c20x22 +c02y12 +c21x22y1 +c12x2y12 +c22x22y12
f (x2, y2) =c00 +c10x2 +c01y2 +c11x2y2 +c20x22 +c02y22 +c21x22y2 +c12x2y22 +c22x22y22
f (x2, y3) =c00 +c10x2 +c01y3 +c11x2y3 +c20x22 +c02y32 +c21x22y3 +c12x2y32 +c22x22y32
f (x3, y1) =c00 +c10x3 +c01y1 +c11x3y1 +c20x32 +c02y12 +c21x32y1 +c12x3y12 +c22x32y12
f (x3, y2) =c00 +c10x3 +c01y2 +c11x3y2 +c20x32 +c02y22 +c21x32y2 +c12x3y22 +c22x32y22
f (x3, y3) =c00 +c10x3 +c01y3 +c11x3y3 +c20x32 +c02y32 +c21x32y3 +c12x3y32 +c22x32y32
The above equations can be arranged in matrix form as follows:

1 x1 y1 x1y1 x12 y12 x12y1 x1y12 x12y12c00 f (x1, y1) 


1
 x1 y2 x1y2 x12 y22 x12y2 x1y22 x12y22c10 f (x1, y2)
1 x1 y3 x1y3 x12 y32 x12y3 x1y32 x12y32c01 f (x1, y3)
    
1 x2 y1 x2y1 x22 y12 x22y1 x2y12 x22y12c11 f (x2, y1)
1
 x2 y2 x2y2 x22 y22 x22y2 x2y22 x22y22c20=f (x2, y2)
1 x2 y3 x2y3 x22 y32 x22y3 x2y32 x22y32c02 f (x2, y3)
1 x3 y1 x3y1 x32 y12 x32y1 x3y12 x32y12c21 f (x3, y1)

1 x3 y2 x3y2 x32 y22 x32y2 x3y22 x32y22c12 f (x3, y2)
1 x32y32c22 f (x3, y3)
 x3 y3 x3y3 x32 y32 x32y3 x3y32
From the solution of the above set of equations, the unknown coefficients of the
polynomial are obtained as follows:

c00 =0, c10 =0, c01 =7, c11 =−2.4167, c20 =0.25, c02 =−0.75, c21 =0.3542, c12 =0.875,
c22 =−0.0938
By substituting the obtained coefficients in the polynomial, the function f (5,3)
value is obtained as follows:

f (5,3) =c00 +c10x5+c01x3+c11x5x3+c20x52 +c02x32 +c21x52x3+c12x5x32 +c22x52x32 =29.0937

3.4.2 Two Variable Lagrange Interpolation

The two-dimensional Lagrangian interpolation polynomial for regularly spaced data


can be constructed by multiplying and rearranging the one-dimensional Lagrangian
polynomials in both directions as follows:

f (x, y) =Lix(x)Ljy(y)f (xi , yj ) =


m n

   
i=1 j=1
L1x (x) L1y (y) +L2y (y) +L3y (y) +...+Lny(y) +L2x (x) L1y (y) +L2y (y) +L3y (y) +...+Lny(y) +
  
L3x (x) L1y (y) +L2y (y) +L3y (y) +...+Lny(y) +...+Lmx(x) L1y (y) +L2y (y) +L3y (y) +...+Lny(y) 
(3.26)

The above expression can be rearranged and written as:

f (x, y) =L1x(x)L1y(y) f (x1, y1)+L1x(x)L2y(y) f (x1, y2)+L1x(x)L3y(y) f (x1, y3)+...+L1x(x)Lny(y) f (x1, yn)+
L2x(x)L1y(y) f (x2, y1)+L2x(x)L2y(y) f (x2, y2)+L2x(x)L3y(y) f (x2, y3)+...+L2x(x)Lny(y) f (x2, yn)+
L3x(x)L1y(y) f (x3, y1)+L3x(x)L2y(y) f (x3, y2)+L3x(x)L3y(y) f (x3, y3)+...+L3x(x)Lny(y) f (x3, yn)+...
+Lmx(x)L1y(y) f (xm, y1)+Lmx(x)L2y(y) f (xm, y2)+Lmx(x)L3y(y) f (xm, y3)+...+Lmx(x)Lny(y) f (xm, yn)
(3.27)
Example 3.9: Calculate the value of the function f (5,3) with the Lagrangian
interpolation polynomial using the data in Figure 3.10 of the function f (x, y)?
The two-variable Lagrangian interpolation polynomial for the given points can be
expressed as:

f (x, y) =Lix(x)Ljy(y)f (xi, yj ) =


3 3

 
i=1 j=1
L1x(x) L1y(y) f (x1, y1)+L2y(y) f (x1, y2)+L3y(y) f (x1, y3) +
 
L2x(x) L1y(y) f (x1, y1)+L2y(y) f (x1, y2)+L3y(y) f (x1, y3) +
 
L3(x) L1y(y) f (x1, y1)+L2y(y) f (x1, y2)+L3y(y) f (x1, y3)
If the above expression is rearranged, it can be written as:

f (x, y) =L1x(x)L1y(y) f (x1, y1)+L1x(x)L2y(y) f (x1, y2)+L1x(x)L3y(y) f (x1, y3)+


L2x(x)L1y(y) f (x2, y1)+L2x(x)L2y(y) f (x2, y2)+L2x(x)L3y(y) f (x2, y3)+
L3x(x)L1y(y) f (x3, y1)+L3x(x)L2y(y) f (x3, y2)+L3x(x)L3y(y) f (x3, y3)+
Above shows the univariate Lagrangian Figure functions Lix(x) and Ljy(y) in x and
y directions and can be expressed as:

L1x(x) = (x−x2)(x−x3) ,L2x(x) = (x−x1)(x−x3) ,L3x(x) = (x−x1)(x−x2)


(x1 −x2)(x1 −x3) (x2 −x1)(x2 −x3) (x3 −x1)(x3 −x2)

L1y(y) = (y−y2)(y−y3) ,L2y(y) = (y−y1)(y−y3) ,L3y(y) = (y−y1)(y−y2)


(y1 −y2)(y1 −y3) (y2 −y1)(y2 −y3) (y3 −y1)(y3 −y2)
Using the Lagrangian Figure functions above, the function value f (5,3) is
calculated as follows:

L1x(5) = (5−4)(5−6) =-0.0417


,L2x(5) = (5−0)(5−6) =0.625
,L3x(5) = (5−0)(5−4) =0.4167
(0−4)(0−6) (4−0)(4−6) (6−0)(6−4)

L1y(3) = (3−2)(3−4) =-0.125


,L2y(3) = (3−0)(3−4) =0.75
,L3y(3) = (3−0)(3−2) =0.375
(0−2)(0−4) (2−0)(2−4) (4−0)(4−2)
f (5,3) =L1x(5)L1y(3) f (0,0)+L1x(5)L2y(3) f (0,2)+L1x(5)L3y(3) f (0,4)+
L2x(5)L1y(3) f (4,0)+L2x(5)L2y(3) f (4,2)+L2x(5)L3y(3) f (4,4)+
L3x(5)L1y(3) f (6,0)+L3x(5)L2y(3) f (6,2)+L3x(5)L3y(3) f (6,4) =29.0938
3.4.3 Interpolation with Bivariate Newton Divided Differences

A general interpolation polynomial with two variables can be written by Newton's


method as:

f (x, y) =c0,0 +c1,0(x−x1)+c0,1(y−y1)+c2,0(x−x1)(x−x2)+c1,1(x−x1)(y−y1)+


c0,2(y−y1)(y−y2)+...+cn,0(x−x1)(x−x2)...(x−xn)+cn−1,1(x−x1)(x−x2)...(x−xn−1)(y−y1)+
cn−2,2(x−x1)(x−x2)...(x−xn−2)(y−y1)(y−y2)+...+c0,m, (y−y1)(y−y2)...(y−ym)
(3.28)

The polynomial coefficients ci, j in Equation 3.28 can be calculated using the
following bivariate Newton divided differences:

 
f xi ; yj = f (xi , yj )
     
f x1, x2; yj = 2 j
f x ; y − f x1; yj
x2 −x1
      f x ; y − f xi ; yj
f xi ; yj , yj+1 = i j+1
yj+1 −yj
(3.29)
...
     
f x , x ,...,x ; y ,...,y − f x1, x2,...,xi ; y1, y2,...,yj−1
f x1, x2,...,xi ; y1, y2,...,yj = 1 2 i 2 j
yj −y1
=
  
f x2, x2,...,xi ; y1, y2,...,yj − f x1, x2,...,xi−1; y1, y2,...,yj 
xi −x1
Newton's polynomial coefficients (if the number of points in the direction is taken x
as m
, and n
as the number of points in the direction y ) can be written in terms
of divided differences as follows:


ci−1, j−1 = f x1,x2,...,xi−1; y1, y2,...,yj−1  ( i =1,2,...m, j =1,2,...n) (3.30)

Example 3.10: Calculate the value f (5,3) of the function f (x, y) with Newton
divided difference polynomial using the data shown in Figure 3.10?

The bivariate Newton polynomial for the given points can be expressed as:

f (x, y) =c0,0 +c1,0(x−x1)+c0,1(y−y1)+c2,0(x−x1)(x−x2)+c1,1(x−x1)(y−y1)+


c0,2(y−y1)(y−y2)+c2,1(x−x1)(x−x2)(y−y1)+c1,2(x−x1)(y−y1)(y−y2)+
c2,2(x−x1)(x−x2)(y−y1)(y−y2)
In the bivariate case, the split difference values can be calculated as follows:
f x1; y1= f (x1, y1) =0, f x1; y2= f (x1, y2) =11, f x1; y3= f (x1, y3) =16
f x2; y1= f (x2, y1) =4, f x2; y2= f (x2, y2) =15, f x2; y3= f (x2, y3) =36
f x3; y1= f (x3, y1) =9, f x3; y2= f (x3, y2) =24, f x3; y3= f (x3, y3) =48

f x1, x2; y1= f x2; y1− f x1; y1 =1,


x2 −x1

f x1, x2; y2= f x2; y2− f x1; y2 =1,


x2 −x1

f x1, x2; y3= f x2; y3− f x1; y3 =5,


x2 −x1

f x2, x3; y1= f x3; y1− f x2; y1 =2.5,


x3 −x2

f x2, x3; y2= f x3; y2− f x2; y2 =4.5,


x3 −x2

f x2, x3; y3= f x3; y3− f x2; y3 =6,


x3 −x2

f x1; y1, y2= f x1; y2− f x1; y1=5.5 ,


y2 −y1

f x2; y1, y2= f x2; y2− f x2; y1 =5.5 ,


y2 −y1

f x3; y1, y2= f x3; y2− f x3; y1 =7.5


y2 −y1

f x1; y2, y3= f x1; y3− f x1; y2 =2.5


y3 −y2

f x2; y2, y3= f x2; y3− f x2; y2 =10.5


y3 −y2
f x3; y2, y3= f x3; y3− f x3; y2 =12
y3 −y2

f x1, x2; y2, y3= f x1, x2; y3− f x1, x2; y2 =2
y3 −y2

f x2, x3; y2, y3= f x2, x3; y3− f x2, x3; y2 =0.75
y3 −y2

f x2, x3; y1, y2= f x2, x3; y2− f x2, x3; y1 =1
y2 −y1

f x1, x2, x3; y1= f x2, x3; y1− f x1, x2; y1 =0.25,
x3 −x1

f x1; y1, y2, y3= f x1; y2, y3− f x1; y1, y2 =−0.75,
y3 −y1

f x1, x2; y1, y2= f x1, x2; y2− f x1, x2; y1 = f x2; y1, y2− f x1; y1, y2 =0
y2 −y1 x2 −x1

f x1,x2,x3; y1, y2= f x2,x3; y1, y2− f x1,x2; y1, y2 =0.1667
x3 −x1

f x1,x2; y1, y2, y3= f x1,x2; y2, y3− f x1,x2; y1, y2 =0.5
y3 −y1

f x2,x3; y1, y2, y3= f x2,x3; y2, y3− f x2,x3; y1, y2 =−0.0625
y3 −y1

f x1, x2, x3; y1, y2, y3= f x1, x2, x3; y2, y3− f x1, x2, x3; y1, y2 =
y3 −y1
f x2, x3; y1, y2, y3− f x1, x2; y1, y2, y3 =-0.0938
x3 −x1

Using the divided difference values calculated above, the Newton polynomial
coefficients can be obtained as follows:
c0,0 = f x1; y1=0,
c1,0 = f x1, x2; y1=1, c0,1 = f x1; y1, y2=5.5, c1,1 = f x1, x2; y1, y2=0
c2,0 = f x1, x2, x3; y1=0.25, c0,2 = f x1; y1, y2, y3=−0.75, c1,2 = f x1, x2; y1, y2, y3=0.5,
, c2,1 = f x1, x2, x3; y1, y2=0.1667, c2,2 = f x1, x2, x3; y1, y2, y3=−0.0938
Using the obtained polynomial coefficients, the function value f (5,3)is calculated
as follows

f (5,3) =c0,0 +c1,0(5−0)+c0,1(3−0)+c2,0(5−0)(5−4)+c1,1(5−0)(3−0)+c0,2(3−0)(3−2)+


c2,1(5−0)(5−4)(3−0)+c1,2(5−0)(3−0)(3−2)+c2,2(5−0)(5−4)(3−0)(3−2) =29.0938

3.5 MULTI-VARIABLE PART INTERPOLATION POLYNOMES

In the previous section, it was stated that multidimensional interpolation functions


can be created with the products of one-dimensional interpolation functions if the
data is spread sequentially within regular boundaries such as rectangular area or
cube volume. However, the data may not always be sequentially spread within
smooth boundaries such as rectangular area or cube volume. In such cases, it can
be quite difficult to construct a global interpolation function valid over the entire
region. To make it easier to obtain the interpolation function within non-uniform
boundaries, the non-uniformly shaped interpolation region is divided into simpler
and smaller basic (sub) regions or shapes as in Figure 3.11. Separate low-order
interpolation polynomials are generated in these simple and small subregions.
These interpolation polynomials created are called multivariate piecewise
interpolation polynomials. With the multivariate piecewise interpolation approach,
obtaining the interpolation functions is facilitated and the accuracy of the
interpolation functions is protected from the oscillation effect.

Figure 3.11: Separation of non-uniformly bounded two-dimensional data space


into simple triangular and quadrangular base (sub) areas for interpolation.
Multivariate (two and three dimensional) piecewise interpolation functions are
widely used in the interpolation of two and three dimensional mechanical, fluid and
heat transfer elements in the Finite Element method. Lagrange and Hermite
interpolation methods are widely used to obtain multivariate piecewise
interpolation polynomials. Lagrange and Hermite methods are generally used for
two-dimensional interpolations, while the Lagrangian method is used for both two-
and three-dimensional interpolations. Obtaining two- and three-dimensional
piecewise interpolation functions with Lagrange and Hermite methods is explained
below.

3.6 TWO VARIABLE PIECE INTERPOLATION FUNCTIONS

In the interpolation of bivariate (two-dimensional) functions, the interpolation


region can be divided into simple basic (sub) shapes such as triangles and
quadrilaterals. These basic shapes are called finite elements in the Finite Element
method. Then, two-dimensional piecewise interpolation functions are obtained on
these simple basic shapes and value estimation is made at the desired points.
Obtaining piecewise interpolation functions with Lagrange and Hermite methods
for commonly used triangular and quadrangular basic shapes (elements) is
explained below.

3.6.1 Lagrangian Interpolation Functions

a) Lagrangian Interpolation Function for Triangular Geometry

The interpolation polynomial can be written as follows for the interpolation


estimation in the triangular base (sub) region, as in Figure 3.12, the boundaries
of which are indicated by 3 points in two-dimensional space.

c1
f (x, y) =c1 +c2x+c3y =1 x y 
c2 (3.31)

c3

Figure 3.12: Two-dimensional interpolation on triangular area.

If the corner coordinates and function values of the triangle are substituted in
Equation 3.31, the following set of equations is obtained:

f1 =c1 +c2x1 +c3y1


f2 =c1 +c2x2 +c3y2
f3 =c1 +c2x3 +c3y3
If the above set of equations is written and solved in matrix form as follows, the
unknown constants c1, c2 , c3 are found.

1 x1 y1c1  f1  c1  1 x1 y1−1f1 


1 x y c =f  c =1 x y  f 
 2 2 2  2 ➔  2  2 2  2
1 x3 y3c3 f3 c3 1 x3 y3 f3
If the constants are replaced in the interpolation function after they are found, the
interpolation function f (x, y) is obtained in Lagrangian form as follows:
1 x1 y1−1f1 
f (x, y) =1 x y1 x2 y2 f2= N1(x, y) f1 +N2(x, y) f2 +N3(x, y) f3 (3.32)
1 x3 y3 f3
The functions Ni (x, y)written in Equation 3.32 are called Shape functions and can
be expressed as follows:
N1(x, y) = 1 (x2y3 −x3y2)+(y2 −y3)x+(x3 −x2)y
2A
N2(x, y) = 1 (x3y1 −x1y3)+(y3 −y1)x+(x1 −x3)y (3.33)
2A
N3(x, y) = 1 (x1y2 −x2y1)+(y1 −y2)x+(x2 −x1)y
2A
A in the figure functions denotes the area of the triangular region and can be
obtained with the following determinant calculation:

1 x1 y1
A= 1 x2 y2
1 (3.34)
2
1 x3 y3
Reminder: In Lagrangian interpolation polynomials, the interpolation polynomial
is expressed as the shape function x function value ( N fi i ).

Exception (Right Triangle):

In solving two-dimensional engineering problems (for example, solving with the


Finite Element method), interpolation on special right triangle geometry is also
sometimes used. A set of axes, called natural coordinates, is used for interpolation
on a special right triangle. Corner coordinates of a right triangle are denoted by
natural coordinates (ξ, η) instead of cartesian coordinates ( x, y ). The corner points
of the special right triangle and their corresponding natural coordinates are shown
in detail in Table 3.4 and Figure 3.13.

Table 3.4: Corner coordinates of the right triangle according to the natural
coordinate system.

Point ξ η f(ξ, η)

1 0 0 f1
2 1 0 f2
3 0 1 f3
Figure 3.13: Two-dimensional interpolation on a right triangle area.

The interpolation function for this particular right triangle can be written as:
c1 
f (,) =c1 +c2 +c3 =1  
c2
 (3.35)

c3
By using the vertex coordinates and function values in Equation 3.35, the
c c
constants 1, 2 , c3 can be obtained as follows:

1 1 1c1  f1  c1  1 1 1−1f1  c1   1 0 0f1 


1    =f  ➔ c =1    f  ➔ c =−1 1 0f 
 
 
c  2  2  2 2  2  2   2
c3 1 3 3 f3
2 2 2
1 3 3c 
 3 
f3
  
 3 
c − 1 0 1 3
f 
c c
By substituting the constants 1, 2 , c3 in Equation 3.35, the interpolation function
can be written in Lagrangian form as follows:

 1 0 0f1 
f (,) =1  −1 1 0 
f2 ➔
−1 0 1
f3

f (,) =(  −
−
1 ) f1 +  f2 +  f3 = N1(,) f1 +N2(,) f2 +N3(,) f3
 (3.36)
N1(,) N (,)
2 N (,)
3

The above expression, N1(,), 𝑁2 (𝜉, 𝜂), N3(,) shows the Shape functions in
natural coordinates.
b) Lagrangian Interpolation Function for Quadrilateral Geometry

Similar to triangle interpolation, the interpolation polynomial for interpolation in a


general quadrilateral area can be expressed as follows, as in Figure 3.14:

 
c1
f (x, y) =c1 +c2x+c3y+c4xy=1 x y xyc2 (3.37)
c3
c 
 4

Figure 3.14: Two-dimensional interpolation over the general rectangular area.

If the corner coordinates and function values are substituted in Equation 3.37, the
following set of equations is obtained:

f1 =c1 +c2x1 +c3y1 +c4x1y1


f2 =c1 +c2x2 +c3y2 +c4x2y2
f3 =c1 +c2x3 +c3y3 +c4x3y3
f4 =c1 +c2x4 +c3y4 +c4x4y4
If the set of equations is written and solved in matrix form as follows, unknown
c c c
constants 1, 2 , c3, 4 are found.

1 x1 y1 x1y1 c1  f1  c1  1 x1 y1 x1y1 −1f1 


1
 x2 y2 x2y2c2 f2 c  1 x2 y2 x2y2 f2
1 x3 y3
=
x3y3c3 f3 ➔ c2=1 x3y3 f3
1  3  x3 y3
 x4 y4 x4y4c4 f4 c4 1 x4 y4 x4y4 f4
If the constants are replaced in the interpolation expression and rearranged, the
interpolation function f (x, y) can be obtained in Lagrangian form as follows:
1 x1 y1 x1y1 −1f1 
1 x y x y  f2
f (x, y) =1 x y xy 2 2 2 2  
1 x3 y3 x3y3 f3
1 x y xy f (3.38)
 4 4 4 4  4
=N1(x, y) f1 +N2(x, y) f2 +N3(x, y) f3 +N4(x, y) f4
Figure shape functions Ni (x, y) written above can be expressed explicitly as:

N1(x, y) = (x−x2)(y− y4) , N2(x, y) = (x−x1)(y− y3)


(x1 −x2)(y1 − y4) (x2 −x1)(y2 − y3)
(3.39)
N3(x, y) = (x−x4)(y− y2) , N4(x, y) = (x−x3)(y− y1)
(x3 −x4)(y3 − y2) (x4 −x3)(y4 − y1)

Exception (Square geometry):

For ease of solution with the Finite Element method, the rectangular geometry
(element) is usually converted into a special square as in Figure 3.15 and
necessary calculations are made. Therefore, in this section, the interpolation
function will be obtained for a special square with sides of 2 units. The natural
coordinate system ( , ) placed at the center of the square can be used to define
the custom square. The corner points of the special square and their corresponding
natural coordinates can be specified as in Table 3.5.

Figure 3.15: Two-dimensional interpolation on a square area.

Table 3.5: Corner coordinates of the square according to the natural coordinate
system.
Point ξ η f(ξ, η)

1 -1 -1 f1
2 1 -1 f2
3 1 1 f3
4 -1 1 f4

The interpolation function for this particular square can be expressed in natural
coordinates as follows:

c1 
c 
f (,) =c1 +c2 +c3+c4=1    2 (3.40)
c3
c4
By using the function values in Table 3.5, the constants c1, c2 , c3, c4 can be
obtained as follows:

1 1 1 11 c1  f1  c1  1 1 1 11 −1f1 


1
 2 2 22c2=f2 c  1 2 2 22 f2
1 3 3 33c3 f3 ➔ c2=1 3 3 33 f3 ➔
1  3 
 4 4 44c4 f4 c4 1 4 4 44 f4
1 1 1 1
 4 f1 
c1   41 4
1
4
1
c  − −1f2
c2= 14 4 4 4
1 f3
 3 − −1 1
c4  4 4 4 4 f4
1 1 1 
 4 − −1
4 4 4
c c c
Substituting the constants 1, 2 , c3, 4 the interpolation function can be expressed
in Lagrangian form as follows:
1 1 1 1
4 4 4 4
 1 1 1 1f1 
− − f2
f (,) =1    1 1 1 14 
 4 4 4
− −  f3
 4 4 4 4 f 
 1 1 1 1 4
 4 − 4 4 − 4
=(1 − − +) f1 +(1 + − −) f2 +(1 + + +) f3 +(1 − + −) f4
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
By rearranging the above expression, it can be written in terms of shape functions
as follows:

f (,) = (1−)(1−) f1 +(1+)(1−) f2 +(1+)(1+) f3 +(1−)(1+) f4


 4
   4
   4
   4
  (3.41)
N1(,) N2(,) N3(,) N4(,)
=N1(,) f1 +N2(,) f2 +N3(,) f3 +N4(,) f4

3.6.2 Two-Dimensional Hermite Interpolation Functions

We mentioned earlier that Hermite interpolation polynomials are constructed using


these two types of information if the data points have both function value and
derivative information. Two-dimensional Hermite interpolation functions can also
be obtained by generalizing them similarly to one-dimensional ones. Cubic Hermite
function, which is one of the two-dimensional Hermite interpolation functions, is
used as an interpolation function for thin plate (also called Kirchhoff plate)
elements, especially in solving the bending problems of thin plates and shells with
the Finite Element method. For this reason, here too, the Cubic Hermite
interpolation functions for triangular and quadrilateral areas will be explained.

a) Cubic Hermite Interpolation Function for Triangular Geometry

Let's assume that functions and derivatives (derivatives with respect to both x and
y) are given at the corner points of the triangle geometry shown in Figure 3.16. In
the solution of bending problems in the field of mechanics, f (xi , yi ) is the
displacement at the i-th point , f (xi , yi )/x and f (xi , yi )/y are the derivatives
correspond to the rotations about the axes at this point. The available data for
triangular geometry (element) can be summarized as in Table 3.6.

Table 3.6: Triangle geometry data for two-dimensional Hermite interpolation.

x y f(x,y) ∂f(x,y)/∂x ∂f(x,y)/∂y


x1 y1 f1 f1 f1
x y
x2 y2 f2 f2 f2
x y
x3 y3 f3 f3 f3
x y

Figure 3.16: Hermite interpolation on triangular area.

Using the above information, the bivariate cubic Hermite interpolation polynomial
and its derivatives can be expressed as follows:

f (x, y) =c1 +c2x+c3y+c4x2 +c5xy+c6 y2 +c7x3 +c8(x2 y+xy2) +c9 y3


f (x, y) =c +2c x+c y+3c x2 +c (2xy+ y2) (3.42)
x 2 4 5 7 8

f (x, y) =c +c x+2c y+c (x2 +2xy) +3c y2


y 3 5 6 8 9

The above equations can be written in matrix multiplication form by excluding


the constants as follows:

 
f (x, y)  c 
  1 x y x2 xy y2 x3 x2y+xy2 y3 c1 
f (x, y)=0 1 0 2x y 0 3x2 2xy+ y2 0  2
 x     (3.43)
  0 0 1 0 x 2y 0 x2 +2xy 3y2...
f (x, y)  c9 
 y   C
If the data in the table is substituted in Equation 3.43, the following set of
equations is obtained:

 
f1 
 
f1 
x 
f  1 x1 y1 x12 x1y1 y12 x13 x12 y1 +x1y12 y13 c1 
 1  0 1 0 2x1 y1 0 3x12 2x1y1 + y12 0 c2
y   
2 c 

f  0 0 1 0 x1 2y1 0 x1 +2x1y1 3y1  3 
2
 2  1 x y x2 x y y2 x3 x2 y +x y2 y3 c4
f2   2 2 2 2 2 2 22 2 2 2 22 2  
x =0 1 0 2x2 y2 0 3x2 2x2 y2 + y2 0 c5 
  0 0 1 0 x2 2y2 0 x22 +2x2 y2 3y22c6
f2    
y  1 x3 y3 x32 x3y3 y32 x33 x32 y3 +x3y32 y33 c7
  0 1 0 2x y 0 3x32 2x3y3 + y32 0 c8 
f3  
f  0 0 1 0 x3 2y3 0 x32 +2x3y3 3y32c9 
3 3

 3    
x  X C
f3 
 

y
 
F
(3.44)

From the solution of the above set of equations, C= c1,…, c9 coefficients are
obtained as C= X−1(F). If the obtained coefficients are substituted in the
interpolation function, the interpolation function can be obtained in terms of known
values at the corner points as follows:

 
f (x, y) 
  1 x y x2 xy y2 x3 x2 y+xy2 y3 
f (x, y)=0 1 0 2x y 0 3x2 2xy+ y2 0 X−1F = NF
 x    (3.45)
  0 0 1 0 x 2y 0 x2 +2xy 3y2
f (x, y)  
 y  N

The above spelling is especially preferred in the Finite Element method and
functions N= N1, N2,…, N9 are called Shape functions. Equation 3.45 can be
written in terms of shape functions as:
f (x, y) = N1 f1 +N2 f1 +N3 f1 +N4 f2 +N5 f2 +N6 f2 +N7 f3 +N8 f3 +N9 f3
x y x y x y
f (x, y) = N1 f +N2 f1 +N3 f1 +N4 f +N5 f2 +N6 f2 +N7 f +N8 f3 +N9 f3
x x 1 x x x y x 2 x x x y x 3 x x x y
f (x, y) = N1 f +N2 f1 +N3 f1 +N4 f +N5 f2 +N6 f2 +N7 f +N8 f3 +N9 f3
y y 1 y x y y y 2 y x y y y 3 y x y y
(3.46)

b) Cubic Hermite Interpolation Function for Quadrangular Geometry

Let's assume that function f (xi , yi ) and f (xi , yi )/x, f (xi , yi )/y derivatives
(derivative with respect to both x and y) values are given at the corner points of
the quadrilateral geometry shown in Figure 3.17 below. In this case, the available
data for the quadrilateral geometry (element) can be summarized as in Table 3.7.

Table 3.7: Quadrilateral geometry data for two-dimensional Hermite interpolation.

x y f(x,y) ∂f(x,y)/∂x ∂f(x,y)/∂y

x1 y1 f1 f1 f1
x y
x2 y2 f2 f2 f2
x y
x3 y3 f3 f3 f3
x y
x4 y4 f4 f4 f4
x y
Figure 3.17: Hermite interpolation on rectangular area.

Using the above information, the bivariate cubic Hermite interpolation polynomial
and its derivatives can be expressed as follows:

f (x, y) =c1 +c2x+c3y+c4x2 +c5xy+c6 y2 +c7x3 +c8x2 y+c9xy2 +c10y3 +c11x3y+c12xy3


f (x, y) =c +2c x+c y+3c x2 +2c xy+c y2 +3c x2 y+c y
x 2 4 5 7 8 9 11 12

f (x, y) =c +c x+2c y+c x2 +2c xy+3c y2 +c x3 +3c xy2


y 3 5 6 8 9 10 11 12

(3.47)

The above equations can be written in matrix multiplication form by excluding


the constants as follows:

 
f (x, y)  c 
  1 x y x2 xy y2 x3 x2 y xy2 y3 x3y xy3 c1 
f (x, y)=0 1 0 2x y 0 3x2 2xy y2 0 3x2 y y3  2 (3.48)
 x    
  0 0 1 0 x 2y 0 x2 2xy 3y2 x3 3xy2... 
f (x, y)  c12
 y  
C

If the data in Table 3.7 are substituted in the above equation, the following set of
equations is obtained.
f1 
f 
 1
x 
f1 
  1 x1 y1 x12 x1y1 y12 x13 x12 y1 x1y12 y13 x13y1 x1y13 c1 
y  
f2  0 1 0 2x1 y1 0 3x12 2x1y1 y12 0 3x12y1 y1 c2 
  0 0 1 0 x 2y 0 x2 2x y 3y2 x3 3x y2 c3 
f2  
x  1 x2 y2 x22 x2y2 y22 x23 x22y2 x2 y22 y23 x23y2 x2y23 c4 
1 1 1 1 1 1 1 1 1

  0 1 0 2x y 0 3x22 2x2y2 y22 0 3x22y2 y2 c5 


f2   2 2
y  0 0 1 0 x2 2y2 0 x22 2x2y2 3y22 x23 3x2y22c6 
f =1 x y x2 x y y2 x3 x2 y x y2 y3 x3y x y3 c 
 3   3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3  7 
f3  0 1 0 2x3 y3 0 3x32 2x3y3 y32 0 3x32y3 y3 c8 
x    
  0 0 1 0 x3 2y3 0 x32 2x3y3 3y32 x33 3x3y32 c9 
f3  1 x4 y4 x42 x4y4 y42 x43 x42y4 x4 y42 y43 x43y4 x4y43 c10
y    
  0 1 0 2x4 y4 0 3x42 2x4y4 y42 0 3x42y4 y4 c11
f4  0 0 1 0 x 2y 0 x2 2x y 3y2 x3 3x y2c 
f   4  4 4 4 4 444 4  12
 
 4 X C
dx
f4 
 

y
 
F
(3.49)

From the solution of the above set of equations, C = 1,…, 12 coefficients are
c c
obtained as C= X F−1
. If the obtained coefficients are substituted in the
interpolation function, the interpolation function can be obtained in terms of known
values at the corner points as follows:

 
f (x, y) 
  1 x y x2 xy y2 x3 x2 y xy2 y3 x3y xy3 
f (x, y)=0 1 0 2x y 0 3x2 2xy y2 0 3x2 y y3 X−1F = NF
 x   
  0 0 1 0 x 2y 0 x2 2xy 3y2 x3 3xy2
f (x, y)  
 y  N

(3.50)

The above spelling is especially preferred in the Finite Element method and
functions N= N1, N2 ,…, N12 are called Shape functions. Equation 3.50 in terms of
shape functions can be written as:
f (x, y) = N1 f1 +N2 f1 +N3 f1 +N4 f2 +N5 f2 +N6 f2 +N7 f3 +N8 f3 +N9 f3
x y x y x y
+N10 f4 +N11 f4 +N12 f4
x y
f (x, y) = N1 f +N2 f1 +N3 f1 +N4 f +N5 f2 +N6 f2 +N7 f
x x 1 x x x y x 2 x x x y x 3
(3.51)
+  N 8 f3 + N 9 f3 + N10 f + N11 f4 + N 12 f4
x x x y x 4 x x x y
f (x, y) = N1 f +N2 f1 +N3 f1 +N4 f +N5 f2 +N6 f2 +N7 f
y y 1 y x y y y 2 y x y y y 3
+N8 f3 +N9 f3 +N10 f4 +N11 f4 +N12 f4
y x y y y y x y y

Exception (Square geometry):

Integral calculations are made on the area or volume of the elements in order to
calculate the stiffness matrices of the elements in calculations with the finite
element method. In order to facilitate these integral calculations and to use
numerical integral methods, the ideal square shape (element) is used as in Figure
3.18, instead of the general rectangular shape (element) as in Figure 3.17, in
calculations with the Finite Element method. Therefore, in this section, the Cubic
Hermite interpolation functions for ideal square geometry will be obtained using
natural coordinates.

Figure 3.18: Ideal square geometry expressed in natural coordinates.

Let's assume that we have the given in Table 3.8. In this case, the cubic Hermite
interpolation function for the special square can be expressed in natural
coordinates as follows:
f (,) =c1 +c2 +c3+c42 +c5+c62 +c73 +c82+c92 +c103 +c113+c123
f (,) =c +2c  +c +3c 2 +2c +c 2 +3c 2+c 
 2 4 5 7 8 9 11 12

f (,) =c +c  +2c +c 2 +2c +3c 2 +c 3 +3c 2


 3 5 6 8 9 10 11 12

(3.52)

Table 3.8: Square geometry data for two-dimensional Hermite interpolation with
respect to the natural coordinate system.

Point ξ η f(ξ, η) ∂f(ξ, η)/∂ξ ∂f(ξ, η)/∂η

1 -1 -1 f1 f1 f1
 
2 1 -1 f2 f2 f2
 
3 1 1 f3 f3 f3
 
4 -1 1 f4 f4 f4
 

The equations in Equation 3.50 can also be written in matrix multiplication form
by excluding the constants as follows:

 
f (,) 
  1   2  2 3 2 2 3 3 3 c1 
f (,)=0 1 0 2  0 32 2 2 0 32 3 c2 
     (3.53)
  0 0 1 0  2 0 2 2 32 3 32... 
f (,)  c12
   
  C

If the data in Table 3.8 are substituted in the above equations, the following set
of equations is obtained:
f1 
f 
 1
 
f 
 1
 1 1 1 12 11 12 13 121 112 13 131 113  c1 
2  

f  0 1 0 21 1 0 31 21v1 12 2
0 311 1 c2 
2 

f2  0 0 1 0 1 21 0 12 211 312 13 3112  c3 
  1   2   2 3 2  2 3 3  3  


   2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2  c4

f2  0 1 0 22 2 0 32 222 2
2 2
0 322 2 c5 
2 
 0 0 1 0  2 0 2 2  32 3 3 2 c 

 =  2 2 6 
f  1   2  2 22 3 2 2 2 2 2 2
3  
 3   3 3 3 3 3 3 3 3 3 33 3 33 33 c7 
2 3 3

f3  0 1 0 23 3 0 332 233 32 0 3323 3 c8 


    
  0 0 1 0 3 23 0 32 233 332 33 3332 c9 
f3  1 4 4 42 44 42 43 424 442 43 434 443 c10
   
  0 1 0 24 4 0 342 244 42 0 3424 4 c11
f4  0 0 1 0  2 0 2 2  32 3 3 2c 
   4 4 4 4  4 4 4 44  12

f4  X C
 
 
f4 
 

 

F

(3.54)

From the solution of the above set of equations, C = 1,…, 12 coefficients are
c c
obtained as C= X F−1
. If the obtained coefficients are substituted in the
interpolation function, the interpolation function can be written in terms of known
values at the corner points as follows:

 
f (,) 
  1   2  2 3 2 2 3 3 3 
f (,)= 0 1 0 2  0 32 2 2 0 32 3 X−1F = NF
    
  0 0 1 0  2 0 2 2 32 3 32
f (,) 
  
 
N

(3.55)

The above N= N1 ,…, N12 are called Shape functions. In this case, the Cubic Hermite
interpolation polynomial can be written in terms of Shape functions as:
f (,) = N1(,) f1 +N2(,) f1 +N3(,) f1 +N4(,) f2 +N5(,)f2 +N6(,)f2 +
   
N7(,) f3 +N8(,)f3 +N9(,)f3 +N10(,) f4 +N11(,)f4 +N12(,) f4
   
(3.56a)

f (,) = N1(,) f +N2(,) f1 +N3(,) f1 +N4(,) f +N5(,) f2 +N6(,) f2 +
  1      2    
N7(,) f +N8(,) f3 +N9(,) f3 +N10(,) f +N11(,) f4 +N12(,) f4
 3      4
   
(3.56b)

f (,) = N1(,) f +N2(,) f1 +N3(,) f1 +N4(,) f +N5(,) f2 +N6(,) f2 +
  1      2    
N7(,) f +N8(,) f3 +N9(,) f3 +N10(,) f +N11(,) f4 +N12(,) f4
 3      4    
(3.56c)

The above N1 ,…, N12 shape functions can be expressed more clearly as follows:

N1(,) =−1( −1)(−1)(2 + +2 +−2), N2(,) =−1( −1)(−1)2(+1)


8 8
N3(,) = 1( −1)2( +1)(−1), N4(,) = 1( +1)(−1)(2 − +2 +−2)
8 8
N5(,) = 1( +1)(−1)2(+1), N6(,) = 1( −1)( +1)2(−1)
8 8
N7(,) =−1( +1)(+1)(2 − +2 −−2), N8(,) = 1( +1)(−1)(+1)2
8 8
N9(,) =−1( −1)( +1)2(+1), N10(,) = 1( −1)(+1)(2 + +2 −−2)
8 8
N11(,) =−1( −1)(−1)(+1)2, N12(,) =−1( −1)2( +1)(+1)
8 8
(3.57)

3.7 FUNCTIONS FOR TRIOVARIABLE PART INTERPOLATION

In the interpolation of three-variable (three-dimensional) functions, the


interpolation region can be divided into simple three-dimensional basic shapes
such as tetrahedron and hexahedron, as in Figure 3.19. Then, three-dimensional
piecewise interpolation functions can be obtained for these simple basic shapes
and value estimation can be made at desired points. In the three-variable case,
the Lagrangian interpolation method is generally used. Therefore, in this section,
it will be explained how to obtain trivariate piecewise interpolation functions for
tetrahedral and hexahedral geometries by Lagrangian method.

Figure 3.19: Separation of a non-uniformly bounded three-dimensional volume


into simple and small basic (sub) volumes.

3.7.1 Interpolation for tetrahedral geometry

The tetrahedral geometry is shown in Figure 3.20. The three-variable interpolation


polynomial for this geometry can be expressed in general form as:

 
c1 
f (x, y, z) =c1 +c2x+c3y+c4z =1 x y zc2 (3.58)
c3 
c 
 4
Figure 3.20: Tetrahedral geometry.

If the corner coordinates and function values in Figure 3.20 are substituted in the
interpolation function, the following set of equations is obtained.

f1  1 x1 y1 z1 c1 

f2= 1 x2 y2 z2
c2
f  1 x y z c  (3.59)
 3   3 3 3 3 
f4
   1x y z c4
4  
F

4 4  C
X

From the solution of the above set of equations, C= c1,…, c4 coefficients are
obtained as C= X (F).
−1
If the obtained coefficients are substituted in the
interpolation function, the interpolation function can be obtained in terms of known
values at the corner points as follows.

f (x, y, z) =
1x
y X
z −1
F (3.60)
N

N= N1, N2, N3 , N4 in Equation 3.60 are called shape functions. Equation 3.60 can
be written in Lagrangian form using shape functions as follows:

f (x, y, z) =N1(x, y, z) f1 +N2(x, y, z) f2 +N3(x, y, z) f3 +N4(x, y, z) f4 (3.61)

The above shape functions N1, N2 , N3 , N4 can be more clearly expressed as:
N1(x, y, z) = 1 p1 +q1x+r1y+s1z, N2(x, y, z) = 1 p2 +q2x+r2 y+s2z
6V 6V (3.62)
N3(x, y, z) = 1 p3 +q3x+r3y+s3z, N4(x, y, z) = p4 +q4x+r4 y+s4z
1
6V 6V
x2 y2 z2 x3 y3 z3 x4 y4 z4 x1 y1 z1
p1 = x3 y3 z3 , p2 = x4 y4 z4 , p3 = x1 y1 z1 , p4 = x2 y2 z2 (3.63a)
x4 y4 z4 x1 y1 z1 x2 y2 z2 x3 y3 z3
1 y2 z2 1 y3 z3 1 y4 z4 1 y1 z1
q1 =−1 y3 z3 , q2 =−1 y4 z4 , q3 =−1 y1 z1 , q4 =−1 y2 z2 (3.63b)
1 y4 z4 1 y1 z1 1 y2 z2 1 y3 z3
y2 1 z2 y3 1 z3 y4 1 z4 y1 1 z1
r1 =− y3 1 z3 , r2 =− y4 1 z4 , r3 =− y1 1 z1 , r4 =− y2 1 z2 (3.63c)
y4 1 z4 y1 1 z1 y2 1 z2 y3 1 z3
y2 z2 1 y3 z3 1 y4 z4 1 y1 z1 1
s1 =− y3 z3 1, s2 =−y4 z4 1, s3 =− y1 z1 1, s4 =−y2 z2 1 (3.63d)
y4 z4 1 y1 z1 1 y2 z2 1 y3 z3 1
The expression V above shows the volume of the 4-sided geometric figure and can
be obtained with the following determinant calculation.

1 x1 y1 z1
1 x2 y2 z2
V = 
1 (3.64)
61 x3 y3 z3
1 z4
 x4 y4

3.7.2 Interpolation for General Hexagonal Geometry

A general hexahedron geometry is shown in Figure 3.21. The coordinates of this


hexahedron are given in Table 3.9.
Figure 3.21: General hexahedron geometry.

Table 3.9: Corner coordinates for general hexahedral geometry.

Point x y z f(x, y, z)

1 x1 y1 z1 f1
2 x2 y2 z2 f2
3 x3 y3 z3 f3
4 x4 y4 z4 f4
5 x5 y5 z5 f5
6 x6 y6 z6 f6
7 x7 y7 z7 f7
8 x8 y8 z8 f8

The three-variable interpolation polynomial for the general hexahedral geometry


in Figure 3.21 can be written in general form as:

f (x, y, z) =c1 +c2x+c3y+c4z +c5xy+c6 yz+c7zx+c8xyz


c1 
c 
=1 x y z xy yz zx xyz 2 (3.65)
...
c8 
If the corner coordinates and function values in Table 3.9 are substituted in the
interpolation function, the following set of equations is obtained.

f1  1 x1 y1 z1 x1y1 y1z1 z1x1 x1y1z1 c1 


f  1 x y z x y y z z x x y z c 
 2  2 2 2 2 2 2 2 2 2 2 2 2 2
f3  1 x3 y3 z3 x3y3 y3z3 z3x3 x3y3z3 c3 
f  1 x y z x y y z z x x y z c 
 4=  4 4 4 4 4 4 4 4 4 4 4 4 4
f  1 x y z x y y z z x x y z c  (3.66)
 5   5 5 5 5 5 5 5 5 5 5 5 5  5 
f6  1 x6 y6 z6 x6 y6 y6z6 z6x6 x6 y6z6 c6 
  1 x y z x y y z z x x y z  
f7   7 7 7 7 7 7 7 7 7 7 7 7 c7 
f8  1 x8 y8 z8 x8 y8 y8z8 z8x8 x8 y8z8 c8 
 
F
 
C
X

From the solution of the above set of equations, C= c1,…, c8 coefficients are
obtained as C= X−1(F). If the obtained coefficients are substituted in the
interpolation function, the interpolation function can be obtained in terms of known
values at the corner points as follows:

f (x, y, z) =
1x
yz
xy
yzzx X
xyz

−1
F (3.67)
N

N= N1, N2,… , N8 in Equation 3.67 are called shape functions. Equation 3.67 can
be written in Lagrangian form using shape functions as follows:

f (x, y, z) = N1(x, y, z) f1 +N2(x, y, z) f2 +N3(x, y, z) f3 +N4(x, y, z) f4


(3.68)
+N5(x, y, z) f5 +N6(x, y, z) f6 +N7(x, y, z) f7 +N8(x, y, z) f8

Special case:

In solving three-dimensional engineering problems (for example, solving with the


Finite Element method), interpolation functions are sometimes used for hexahedral
special cube geometry, as in Figure 3.22. A cube whose sides are 2 units long is
usually considered as a special cube. For this special case, natural coordinates are
used and the coordinate system is placed in the center of the cube. Corner
coordinates of the cube are expressed with natural coordinates ( ,, ) instead
of cartesian coordinates ( x, y, z ). The corner points of the special cube and their
corresponding natural coordinates are given in Table 3.10.
Figure 3.22: Interpolation on cube geometry.

Table 3.10: Corner coordinates for hexahedral geometry relative to the natural
coordinate system.

Point ξ η ζ f(ξ, η, ζ)

1 -1 -1 -1 f1
2 1 -1 -1 f2
3 1 1 -1 f3
4 -1 1 -1 f4
5 -1 -1 1 f5
6 1 -1 1 f6
7 1 1 1 f7
8 -1 1 1 f8

The interpolation polynomial for the special cube in Figure 3.22 can be written in
general form as follows:

f (,,) =c1 +c2 +c3+c4 +c5+c6+c7+c8 (3.69)


The constants C= c1,…, c8 in Equation 3.69 can be found as in the general
hexahedron. After the constants are found, Equation 3.69 can be written in
Lagrangian form in terms of shape functions as follows:

f (,,) = N1(,,) f1 +N2(,,) f2 +N3(,,) f3 +N4(,,) f4 +


(3.70)
N5(,,) f5 +N6(,,) f6 +N7(,,) f7 +N8(,,) f8
The shape functions N1 ,…, N8 in Equation 3.70 can be expressed more clearly as
follows

N1(,,) = (1−)(1−)(1−), N2(,,) = (1+)(1−)(1−)


8 8
N3(,,) = (1+)(1+)(1−), N4(,,) = (1−)(1+)(1−)
8 8 (3.71)
N5(,,) = (1−)(1−)(1+), N6(,,) = (1+)(1−)(1+)
8 8
N7(,,) = (1+)(1+)(1+), N8(,,) = (1−)(1+)(1+)
8 8
Summary

- Estimating intermediate values within a dataset is called interpolation.


- It is especially preferred in applications where interpolation data is difficult,
expensive and time consuming to produce.
- Estimation of intermediate values by interpolation is done by passing a
function or functions over some or all of the data.
- Polynomial functions are widely used in estimating intermediate values by
interpolation.
- If a single polynomial function is to be passed through all of the data in
estimating intermediate values by interpolation, the data must not be evenly
spaced for the accuracy of the interpolation.
- Non-equally spaced data points can be obtained using the roots of the
Chebyshev polynomial.
- If data will be subdivided in estimating intermediate values by interpolation,
a simple polynomial function can be passed from the dataset in each group.
In this case, the data do not need to be evenly spaced for the accuracy of
the interpolation.
- The interpolation polynomial f (x) =c1 +c2x+c3x2 +c4x3 +...cn+1xn can be
expressed in its general form.
- Obtaining the coefficients of the polynomial requires solving a set of
equations in general form.
- Interpolation polynomials can be written directly with methods such as
Newton Divided Differences and Lagrange without solving the set of
equations.
- Interpolation polynomials can be obtained by small equation set solutions in
methods such as Cubic splines and Hermite.
- The piecewise approach is used to interpolate multivariable functions. The
interpolation region is subdivided, and simple (low-order) polynomial
functions are passed through the dataset in each subregion.
- Interpolation is widely used in the Finite Element method in engineering to
estimate the displacement, strain and stress values in the element from the
values at the joint points.
APPENDIX 5: MATLAB PROGRAMS

MATLAB Program: Interpolation with Linear Spline function

function LinearSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE LINEAR SPLINE
METHOD

x=[0 2 4 6] ;
f=[1 3 6 10] ;

x0=5 ; % interpolation point

%Determining the range where the xo point is located


i=1 ;
while x0>x(i)
q=i ;
i=i+1 ;
end

%Function value at xo (with Lagrange Interpolation)


f0=(x0-x(q+1))*f(q)/(x(q)-x(q+1))+(x0-x(q))*f(q+1)/(x (q+1)-x(q))

MATLAB Program: Interpolation with parabolic spline function

function ParabolicSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE PARABOLIC SPLINE
METHOD

x=[0 2 4 6] ;
f=[1 3 6 10] ;

x0=5 ; % interpolation point


% ----------------------------------------
n=length(f) ;

A=zeros(2*(n-1),2*(n-1)) ;
B=zeros(2*(n-1),1) ;

% Interpolation ranges

for i=1:n-1
h(i)=x(i+1)-x(i) ;
end

% Function values (at the upper limits of the range)


for i=1:n-1
A(i,2*i-1)=h(i) ; A(i,2*i)=h(i)^2 ;
B(i)=f(i+1)-f(i) ;
end

% 1st derivative continuities at intermediate points

m=n-1;
for i=1:n-2
A(m+i,2*i-1)=1; A(m+i,2*i)=2*h(i); A(m+i,2*i+1)=-1 ;
end
% Zero 2nd derivative values at the first point
p=m+(n-2) ;
A(p+1,1)=0 ; A(p+1,2)=2 ;

% solution of b,c coefficients


S=inv(A)*B ;
for i=1:n-1
b(i)=S(2*i-1) ; c(i)=S(2*i) ;
end

% Determining the range where the xo point is located


i=1 ;
while x0>x(i)
q=i ;
i=i+1 ;
end

% Function value at point xo


f0=f(q)+b(q)*(x0-x(q))+c(q)*(x0-x(q))^2

MATLAB Program: Interpolation with Cubic Spline function

function CubicSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE CUBIC SPLINE
METHOD

x=[0 2 4 6] ;
f=[1 3 6 10] ;

x0=5 ; % interpolation point


% ----------------------------------------
n=length(f) ;

A=zeros(3*(n-1),3*(n-1)) ;
B=zeros(3*(n-1),1) ;

% Interpolation ranges
for i=1:n-1
h(i)=x(i+1)-x(i) ;
end

% Function values (at the upper limits of the range)


for i=1:n-1
A(i,3*i-2)=h(i) ; A(i,3*i-1)=h(i)^2 ; A(i,3*i)=h(i)^3 ;
B(i)=f(i+1)-f(i) ;
end

% 1st derivative continuities at intermediate points


m=n-1;
for i=1:n-2
A(m+i,3*i-2)=1; A(m+i,3*i-1)=2*h(i); A(m+i,3*i)=3*h(i)^2;
A(m+i,3*i+1)=-1 ;
end

% 2nd derivative continuities at intermediate points


p=m+(n-2) ;
for i=1:n-2
A(p+i,3*i-2)=0 ; A(p+i,3*i-1)=2 ; A(p+i,3*i)=6*h(i) ;
A(p+i,3*i+1)=0 ; A(p+i,3*i+2)=-2 ;
end

% Zero 2nd derivative values at the first and last point


A(3*(n-1)-1,1)=0 ; A(3*(n-1)-1,2)=2 ; A(3*(n-1)-1,3)=0 ;
A(3*(n-1),3*(n-1)-2)=0 ; A(3*(n-1),3*(n-1)-1)=2 ; A(3*(n-1),3*(n-
1))=6*h(n-1) ;

% solution of b, c, d coefficients
S=inv(A)*B ;
for i=1:n-1
b(i)=S(3*i-2) ; c(i)=S(3*i-1) ; d(i)=S(3*i) ;
end

% Determining the range where the xo point is located


i=1 ;
while x0>x(i)
q=i ;
i=i+1 ;
end

% Function value at point xo


f0=f(q)+b(q)*(x0-x(q))+c(q)*(x0-x(q))^2+d(q)*(x0-x(q))^3

You might also like