Part6 Interpolation
Part6 Interpolation
Computing Methods in
Engineering
INTERPOLATION
3.1 SCOPE
Interpolation
function
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.
f (x) =c1 +c2x+c3x2 +c4x3 +...cn+1xn The Newton equivalent of the general
interpolation polynomial can be expressed as:
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)
𝑓𝑁 (𝑥) = 𝑎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:
𝑓𝑁 (𝑥) = 𝑎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:
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:
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:
Table 3.1 shows the Newton divided finite difference table for the points (x1, f1),
(x2, f2) , (x3, f3), (x4, f4)
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
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:
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)
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.
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
The linear Lagrangian polynomial passing through the points (x1, f1), (x2, f2) can
be written as:
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.
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:
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
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:
Any i -th Shape (Weight) function in the Lagrangian polynomial can be expressed
as:
The Lagrangian polynomial for the given 4 points can be written symbolically as:
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)
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.
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.
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:
If the continuities expressed by Equation 3.11 are written for the piecewise
parabolic functions in Equation 3.10, the following equations are obtained.
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 xx2
f (2)(x) =a2x2 +b2x+c2 x2 xx3
f (3)(x) =a3x2 +b3x+c3 x3 xx4
Using the expressions above, the function value and continuity can be written
symbolically as follows:
𝑑𝑓 (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 ]
𝑑𝑥 𝑑𝑥
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 −1c2 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 −1c2 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 0x3
f (2)(x) =−0.2444
x2 +5.7333
x−7.6 3x6
f (3)(x) =1.0667
x2 −10x+39.6 6x9
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.
The function value, continuity and extreme conditions to be used in finding the
coefficients can be expressed as follows:
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) 𝑑𝑓 (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 −1b2 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:
𝑑𝑓 (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
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.
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:
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.
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:
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:
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(xi ) =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 ) =bL(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
dx i i
=1
i
i
=0
i i
i
=1
i
dx i
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:
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:
(−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
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:
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
Figure 3.9: Sequential spread interpolation points within two- and three-
dimensional regular boundaries.
n m n
f (x, y) =ci xi cj yj =cijxi yj
m
The bivariate general parabolic function for the given points can be expressed as:
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:
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:
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)
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:
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:
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 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
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:
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 ).
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 0 0f1
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
c1
f (x, y) =c1 +c2x+c3y+c4xy=1 x y xyc2 (3.37)
c3
c
4
If the corner coordinates and function values are substituted in Equation 3.37, the
following set of equations is obtained:
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.
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:
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.
Using the above information, the bivariate cubic Hermite interpolation polynomial
and its derivatives can be expressed 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 3y22c6
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 3y32c9
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)
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.
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:
(3.47)
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
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
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.
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+c42 +c5+c62 +c73 +c82+c92 +c103 +c113+c123
f (,) =c +2c +c +3c 2 +2c +c 2 +3c 2+c
2 4 5 7 8 9 11 12
(3.52)
Table 3.8: Square geometry data for two-dimensional Hermite interpolation with
respect to the natural coordinate system.
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 32 2 2 0 32 3 c2
(3.53)
0 0 1 0 2 0 2 2 32 3 32...
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 11 12 13 121 112 13 131 113 c1
2
f 0 1 0 21 1 0 31 21v1 12 2
0 311 1 c2
2
f2 0 0 1 0 1 21 0 12 211 312 13 3112 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 22 2 0 32 222 2
2 2
0 322 2 c5
2
0 0 1 0 2 0 2 2 32 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 33 3 33 33 c7
2 3 3
(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 32 2 2 0 32 3 X−1F = NF
0 0 1 0 2 0 2 2 32 3 32
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:
c1
f (x, y, z) =c1 +c2x+c3y+c4z =1 x y zc2 (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
1x 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) =
1x
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:
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
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
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) =
1x
yz
xy
yzzx 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:
Special case:
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:
function LinearSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE LINEAR SPLINE
METHOD
x=[0 2 4 6] ;
f=[1 3 6 10] ;
function ParabolicSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE PARABOLIC SPLINE
METHOD
x=[0 2 4 6] ;
f=[1 3 6 10] ;
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
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 ;
function CubicSpline
% THIS PROGRAM CALCULATES THE INTERPOLACY VALUE WITH THE CUBIC SPLINE
METHOD
x=[0 2 4 6] ;
f=[1 3 6 10] ;
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
% 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