Professional Documents
Culture Documents
NUMERICAL
INTERPOLATION
• A. J. Clark School of Engineering •Department of Civil and Environmental Engineering
by
■ Example 4
Repeat Example 2 using a finite difference
table
x 1 2 3
f(x) 3 5 8
∆x = 1
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 99
1
Finite-difference Table
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 100
■ Example 4 (cont’d):
x f(x) ∆f ∆2f
1 3
2
2 5 1
3
3 8
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 101
2
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 102
■ Example 4 (cont’d):
Equation 18 gives
∆2 f = 2b2 (∆x )
2
Equation 17 gives
∆f = 2b2 (∆x )x + b2 (∆x ) + b1∆x ( 2
)
[
2 = 2b2 (1)(1) + b2 (1) + (0.5)(1)
2
]
∴ b2 = 0.5
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 103
3
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 4 (cont’d):
Equation 12 gives
f (x ) = b2 x 2 + b1 x + b0
3 = 0.5(1) + 0.5(1) + b0
2
∴ b0 = 2
Hence, the quadratic polynomial is
f (x ) = 0.5 x 2 + 0.5 x + 2
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 104
■ Example 4 (cont’d):
Therefore, f (2.7) can be estimated as
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 105
4
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Newton’s Method
– Newton’s method is a convenient algorithm
to find an nth-order interpolation function
with the use of a finite-difference table
developed for a given set of data points.
– Referring to general form of the finite-
difference table, it can be shown that the
first diagonal row are given by
f (x + ∆x ) = f (x ) − ∆f (x )
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 106
Finite-difference Table
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 107
5
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Newton’s Method
From the finite-difference table, in the first
diagonal, we notice the following:
∆f (x ) = f (x + ∆x ) − f (x )
∆2 f (x ) = ∆f (x + ∆x ) − ∆f (x )
(21)
∆3 f (x ) = ∆2 f (x + ∆x ) − ∆2 f (x )
M
∆n f (x ) = ∆n −1 f (x + ∆x ) − ∆n −1 f (x )
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 108
■ Newton’s Method
Equation 21 can be rearrange to give
f (x + ∆x ) = f (x ) + ∆f (x )
∆f (x + ∆x ) = ∆f (x ) + ∆2 f (x )
(22)
∆2 f (x + ∆x ) = ∆2 f (x ) + ∆3 f (x )
M
∆n −1 f (x + ∆x ) = ∆n −1 f (x ) + ∆n f (x )
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 109
6
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Newton’s Method
The same procedure could be used for any
diagonal row. For example, the equations for
the next diagonal row are
f (x + 2∆x ) = f (x ) + 2∆f (x ) + ∆2 f (x )
∆f (x + 2∆x ) = ∆f (x ) + 2∆2 f (x ) + ∆3 f (x )
(23)
∆2 f (x + 2∆x ) = ∆2 f (x ) + 2∆3 f (x ) + ∆4 f (x )
M
∆n − 3 f (x + 2∆x ) = ∆n − 3 f (x ) + 2∆n − 2 f (x ) + ∆n −1 f (x )
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 110
■ Newton’s Method
All these expansions have the form of
binomial expansion; thus they can be
rewritten as
m
∆f (x + m∆x ) = ∑ bi ∆i f (x ) (24)
i =0
m(m − 1) 2
∆f (x + m∆x ) = f (x ) + m∆f (x ) + ∆ f (x ) + L + ∆m f (x )
2
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 111
7
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Newton’s Method
In general
m
∆r f (x + m∆x ) = ∑ bi ∆r + ` f (x ) (25)
i =0
∆r f (x + m∆x ) = ∆r f (x ) + m∆r +1 f (x ) + L + ∆r + m f (x )
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 112
n(n − 1) 2
f (x ) = f (x0 ) + n∆f (x0 ) + ∆ f (x0 ) + L
2! (26)
n(n − 1)L (n − m + 1) m
+ ∆ f (x0 )
m!
in which x − x0
n= (27)
∆x
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 113
8
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 5
Repeat example 4 using Newton’s formula.
x 1 2 3
f(x) 3 5 8
∆x = 1
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 114
■ Example 5 (cont’d):
The following finite-difference table can be
constructed:
x f(x) ∆f ∆2f
1 3
2
2 5 1
3
3 8
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 115
9
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 5 (cont’d):
The Newton’s formula in this case will be
written as
n(n − 1) 2
f (x ) = f (x0 ) + n∆f (x0 ) + ∆ f (x0 ) (28)
2!
where the following values can be obtained
from the finite-difference table:
x0 = 1, f (1) = 3, ∆f (1) = 2, and ∆2 f (1) = 1
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 116
■ Example 5 (cont’d):
i x f(x) ∆f ∆2f
x0 = 1
0 1 3
f (x0 ) = f (1) = 3
∆f (x0 ) = ∆f (1) = 2 2
∆2 f (x0 ) = ∆2 f (1) = 1 1 2 5 1
3
2 3 8
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 117
10
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 5 (cont’d):
Therefore, Equation 28 can be expressed
as
n(n − 1)
f (x ) = 3 + n(2 ) + (1) (29)
2
x0 = 1
f (x0 ) = f (1) = 3 n(n − 1) 2
∆f (x0 ) = ∆f (1) = 2 f (x ) = f (x0 ) + n∆f (x0 ) + ∆ f (x0 )
2!
∆2 f (x0 ) = ∆2 f (1) = 1
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 118
■ Example 5 (cont’d):
Equation 29 gives the quadratic interpolation
function for this example:
n(n − 1)
f (x ) = 3 + 2n +
2
To estimate f(2.7), we need to find n from Eq.
27 as follows
x − x0 2.7 − 1
n= = = 1.7
∆x 1
1.7(1.7 − 1)
f (x ) = 3 + 2(1.7) + = 6.995
2
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 119
11
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6
Use the Newton’s interpolation formula to find
the angle of twist and the largest torque which
may be applied to the noncircular brass bar as
shown. Assume τ = 40× 106 Pa, a = 0.064 m,
b = 0.025 m, L = 2 m, and G = 77×109 Pa.
T
τ max =
T
c1ab 2 a τmax
TL b
φ= T
c2 ab 3G L
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 120
■ Example 6 (cont’d)
The following table gives the constant c1
and c2 values
a/b c1 c2
T
τ max = 1.5 0.231 0.196
c1ab 2 2.0 0.246 0.229
TL 2.5 0.258 0.249
φ= 3.0 0.267 0.263
c2 ab 3G
∞ 0.333 0.333
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 121
12
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
We need to find two interpolation functions
for c1 and c2 using Newton’s formula.
This will require two finite-difference tables
for c1 and c2 as follows:
T T
τ max = a τmax
c1ab 2
TL b
φ= T
c2 ab 3G L
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 122
■ Example 6 (cont’d)
Finite-difference Table for c1
a/b c1 ∆c1 ∆2 c1 ∆3 c1
1.5 0.231
0.015
2.0 0.246 -0.003
0.012 0
2.5 0.258 -0.003
0.009
3.0 0.267
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 123
13
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Finite-difference Table for c2
a/b c2 ∆c2 ∆2 c2 ∆3 c2
1.5 0.196
0.033
2.0 0.229 -0.013
0.020 0.007
2.5 0.249 -0.006
0.014
3.0 0.263
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 124
■ Example 6 (cont’d)
For c1 and c2, the Newton’s interpolation
formula of Eq. 26 gives
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 125
14
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Finding the Largest Torque:
a 0.064 T
= = 2.56 = x
b 0.025 a τmax
a b
= x 0 = 1 .5 T
b 0 L
a
∆ = ∆x = 2 − 1.5 = 0.5
b
x − x 0 2.56 − 1.5
n = = 2.120
∆x 0 .5
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 126
■ Example 6 (cont’d)
Finding the Largest Torque:
a
f = f (x0 ) = c1 (1.5) = 0.231
From the finite- b 0
difference table a
∆f = ∆f (x0 ) = ∆c1 (1.5) = 0.015
for c1 b 0
a
∆2 f = ∆2 f (x0 ) = ∆2 c1 (1.5) = −0.003
b 0
a
∆3 f = ∆3 f (x0 ) = ∆3 c1 (1.5) = 0
b 0
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 127
15
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Substituting above values into Newton’s
interpolation formula of Eq. 30, we have
n(n − 1)
f (x ) = 0.231 + n(0.015) + (− 0.003) + n(n − 1)(n − 2) (0)
2 6
or
n(n − 1)
c1 = f (x ) = 0.231 + 0.015n − 0.003
2
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 128
■ Example 6 (cont’d) T
a τmax
Therefore b
T
2.12(2.12 − 1)
c1 (2.12 ) = 0.231 + 0.015(2.12) − 0.003 = 0.25924
2
and
T
τ max =
c1ab 2
T
40 × 10 6 = ⇒ T = 414.8 N.m
0.25924(0.064)(0.025) 2
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 129
16
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Finding the Angle of Twist:
a 0.064
= = 2.56 = x T
b 0.025 a τmax
a
= x 0 = 1 .5 b
b 0
T
L
a
∆ = ∆x = 2 − 1.5 = 0.5
b
x − x 0 2.56 − 1.5
n = = 2.120
∆x 0 .5
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 130
■ Example 6 (cont’d)
Finding the Angle of Twist:
a
f = f (x0 ) = c2 (1.5) = 0.196
From the finite- b 0
difference table a
∆f = ∆f (x0 ) = ∆c2 (1.5) = 0.033
for c2 b 0
a
∆2 f = ∆2 f (x0 ) = ∆2 c 2 (1.5) = −0.013
b 0
a
∆3 f = ∆3 f (x0 ) = ∆3c 2 (1.5) = 0.007
b 0
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 131
17
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Finite-difference Table for c2
a/b c2 ∆c2 ∆2 c2 ∆3 c2
1.5 0.196
0.033
2.0 0.229 -0.013
0.020 0.007
2.5 0.249 -0.006
0.014
3.0 0.263
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 132
■ Example 6 (cont’d)
Substituting above values into Newton’s
interpolation formula of Eq. 30, we have
n(n − 1)
f (x ) = 0.196 + n(0.033) + (− 0.013) + n(n − 1)(n − 2) (0.007 )
2 6
or
n(n − 1) n(n − 1)(n − 2 )
c2 = f (x ) = 0.196 + 0.033n − 0.013 + 0.007
2 6
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 133
18
Finite Difference Interpolation
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Example 6 (cont’d)
Therefore,
For a / b = 2.56, n = 2.12
2.12(2.12 − 1)
c2 (2.12 ) = 0.196 + 0.033(2.12 ) − 0.013
2
2.12(2.12 − 1)(2.12 − 2)
+ 0.007
6
= 0.25086
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 134
■ Example 6 (cont’d)
T
Therefore, a τmax
TL b
φ= T
c 2 ab 3G L
414.8(2)
φ=
0.25086(0.064)(0.025) 3 (77 × 10 9 )
= 0.04295 = Angle of Twist
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 135
19
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
20
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Definition
The Lagrange interpolation polynomial is
simply a reformulation of Newton’s
polynomial that avoids the computation
using finite difference, and that can
handled problems with varying interval.
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 138
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Definition of Terms
– The data sample is assumed to consist of n
pairs of values measured on x and f(x),
with xi being the ith measured value of the
independent variable.
– The method provides an estimate of the
value of f(x) at a specified value of x, which
is denoted x0.
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 139
21
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Definition of Terms
f(x0) = estimated value
f(xi) = measured value of dependent variable
i = 1, 2, 3, …, n
The method involves a weighting function, with
the weight given to the ith value of f for x0
denoted as wi(x0).
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 140
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Lagrange Polynomial
The Lagrange interpolating polynomial for
estimating the value of f(x0) is given by
n
f (x0 ) = ∑ wi (x0 ) f (xi ) (31)
i =1
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 141
22
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Lagrange Polynomial
Where
∏ (x )
n −1
j =1 0 − xj
w (x ) = (32)
j ≠i
∏ (x )
i i n −1
j =1 i − xj
j ≠i
Lagrange Polynomials
• A. J. Clark School of Engineering • Department of Civil and Environmental Engineering
■ Lagrange Polynomial
Combining Equations 31 and 32, the result
is
© Assakkaf
ENCE 203 – CHAPTER 6d. NUMERICAL INTERPOLATION Slide No. 143
23