CH 6 - Application of Interoplations
CH 6 - Application of Interoplations
CH 6 - Application of Interoplations
Numerical Analysis I
Prepared By
Biruk Endeshaw Mekonnen
March 8, 2021
Chapter 6
d
v(t) = y(t)
dt
On the other hand, if we are provided with velocity v(t) as a function of time, its integration
denotes its position. Z t
y(t) = v(t) dt
0
There are so many methods available to find the derivative and definite integration of a func-
tion. But when we have a complicated function or a function given in tabular form, they we
use numerical methods. In the present chapter, we shall be concerned with the problem of
numerical differentiation and integration.
1. The function values are known but the function is unknown, such functions are called
tabulated function.
The choice of the formula is the same as discussed for interpolation if the derivative at a point
near the beginning of a set of values given by a table is required then we use Newton’s forward
interpolation formula, and if the same is required at a point near the end of the set of given
tabular values, then we use Newton’s backward interpolation formula. The central difference
formula (Bessel’s and Stirling’s) used to calculate value for points near the middle of the set
of given tabular values. If the values of x are not equally spaced, we use Newton’s divided
difference interpolation formula or Lagrange’s interpolation formula to get the required value
of the derivative.
Consider the data (xi , f (xi )) given at equispaced points xi = x0 + ih, i = 0, 1, 2, . . . , n where h
is the step length. The Newton’s forward Interpolation formula is given by
where u = x−x h
0
dy dy du 1 dy
= =
dx du dx h du
dy 1 2u − 1 2 3u2 − 6u + 2 3 4u3 − 18u2 + 22u − 6 4
= ∆y0 + ∆ y0 + ∆ y0 + ∆ y0
dx h 2! 3! 4!
5u4 − 40u3 + 105u2 − 100u + 24 5
+ ∆ y0 + · · · (6.2)
5!
d2 y
d dy du 1 d dy
= = ×
dx2 du dx dx h du dx
12u2 − 36u + 22 4
1 6u − 6 3
= 2 ∆2 y0 + ∆ y0 + ∆ y0
h 3! 4!
20u3 − 120u2 + 210u − 100 5
+ ∆ y0 + · · · (6.3)
5!
and so on.
Equations (6.2) & (6.3) give the approximate derivatives of f (x) at arbitrary point x = x0 + uh.
When x = x0 , u = 0, Eqs.(6.2) and (6.3) becomes
dy 0 1 1 2 1 3 1 4
= f (x0 ) = ∆y0 − ∆ y0 + ∆ y0 − ∆ y0 + · · · (6.4)
dx x=x0 h 2 3 4
2
dy 00 1 2 3 11 4 5 5
and = f (x0 ) = 2 ∆ y0 − ∆ y0 + ∆ y0 − ∆ y0 + · · · (6.5)
dx2 x=x0 h 12 6
and so on.
dy d2 y
Example 6.1. Find the value of dx and dx2 at x = 0.1 from the following table:
x y ∆y ∆2 y ∆3 y
0.1 0.9975
-0.0075
0.2 0.9900 -0.0049
-0.0124 0.0001
0.3 0.9776 -0.0048
-0.0172
0.4 0.9604
Therefore,
dy 1 1 2 1 3
= ∆y0 − ∆ y0 + ∆ y0
dx x=x0 h 2 3
1 1 1
= − 0.0075 − (−0.0049) + (0.0001) = −0.050167.
0.1 2 3
Example 6.2. The table given below reveals the velocity ‘v’of a body during the time ‘t ’specified.
Find its acceleration at t = 1.1.
t: 1.0 1.1 1.2 1.3 1.4
v: 43.1 47.7 52.1 56.4 60.8
Example 6.3. Find f 0 (1.1) and f 00 (1.1) from the following table:
Since x = 1.1 is a non-tabulated point near the beginning of the table, we take x0 = 1.0 and
compute u = x−x h =
0 1.1−1.0
0.2 = 0.5.
3u2 − 6u + 2 3
0 1 2u − 1 2
Hence, f (x) = ∆f (x0 ) + ∆ f (x0 ) + ∆ f (x0 )
h 2! 3!
3(0.5)2 − 6(0.5) + 2
1
f 0 (1.1) = 0.1 + 0 + (0.05)
0.2 6
= 0.4895
1 6u − 6 3
f 00 (x) = 2
∆ f (x0 ) + ∆ f (x0 )
h2 3!
1 6(0.5) − 6
f 00 (1.1) = 0.3 + (0.05)
(0.2)2 6
= 6.875.
Consider the data (xi , f (xi )) given at equispaced points xi = x0 +ih, where h is the step length.
The Newton’s backward interpolation formula is given by
where u = x−x h
n
d2 y 12u2 + 36u + 22 4
1 2 6u + 6 3
= ∇ yn + ∇ y n + ∇ yn
dx2 h2 3! 4!
20u3 + 120u2 + 210u + 100 5
+ ∇ y0 + · · · (6.8)
5!
and so on.
Equations (6.7) and (6.8) can be used to determine the approximate differentiation of first,
second, etc. order at any point x, where x = xn + uh.
If x = xn , then u = 0.
Equations (6.7) and (6.8) become
0 1 1 2 1 3 1 4
f (xn ) = ∇yn + ∇ yn + ∇ yn + ∇ yn + · · · (6.9)
h 2 3 4
00 1 2 3 11 4 5 5
f (xn ) = 2 ∇ yn + ∇ yn + ∇ yn + ∇ yn + · · · (6.10)
h 12 4
dy d2 y
Example 6.4. Find dx and dx2 of y = ex + 1 at x = 2.5 from the following table:
x y ∇y ∇2 y ∇3 y
1.0 3.7183
1.7634
1.5 5.4817 1.1440
2.9074 0.7420
2.0 8.3891 1.8860
4.7934
2.5 13.1825
dy d2 y
Example 6.5. From the following table, find the values of dx and dx2 at x = 2.03.
x y ∇y ∇2 y ∇3 y ∇4 y
1.96 0.7825
-0.0086
1.98 0.7739 -0.0002
-0.0088 0.0002
2.00 0.7651 0 -0.0004
-0.0088 -0.0002
2.02 0.7563 -0.0002
-0.0090
2.04 0.7473
Therefore,
Example 6.6. The distance covered by an athlete for the 50 meter race is given in the following
table:
T ime(sec) 0 1 2 3 4 5 6
Distance(meter) 0 2.5 8.5 15.5 24.5 36.5 50
Determine the speed of the athlete at t = 5 sec., correct to two decimals.
Solution: Here we are to find derivative at t = 5 which is near the end of the table, hence we
shall use the formula obtained from Newton’s backward difference formula. The backward
difference table is as follows:
t s ∇s ∇2 s ∇3 s ∇4 s ∇5 s ∇6 s
0 0
2.5
1 2.5 3.5
6 -2.5
2 8.5 1 3.5
7 1 -3.5
3 15.5 2 0 1
9 1 -2.5
4 24.5 3 -2.5
12 -1.5
5 36.5 1.5
13.5
6 50
The speed of the athlete at t = 5 sec is given by
ds 1 1 2 1 3 1 4 1 5
= ∇s5 + ∇ s5 + ∇ s5 + ∇ s5 + ∇ s5
dt t=5 h 2 3 4 5
1 1 1 1 1
= 12 + (3) + (1) + (0) + (−3.5)
1 2 3 4 5
= 13.1333 meter/sec.
If we want to determine the values of the derivatives of the function near the middle of the
given set of arguments. We may apply any central difference formula. Therefore using Stir-
ling’s formula, we get
u2 2 u3 − u ∆3 y−1 + ∆3 y−2
u ∆y0 + ∆y−1
f (x) = y0 + + ∆ y−1 +
1! 2 2! 3! 2
4 2
u − 5u + 4u ∆5 y−2 + ∆5 y−3
5 3
u −u 4
+ ∆ y−2 + + · · · (6.11)
4! 5! 2
Where u = x−xh
0
Example 6.7. Find f 0 (0.6) and f 00 (0.6) from the following table:
Solution: Here, the derivatives are required at the central point x = 0.6, so we use Stirling’s
formula. The difference table is:
f 0 (0.6) = 2.6445.
d2 y
1 2 1 4
= 2 ∆ y−1 − ∆ y−2
dx2 x=x0 h 12
1 1
= 0.0365 + 0 − (0.0002)
(0.1)2 12
= 100(0.0365 − 0.000016)
f 00 (0.6) = 3.6484.
Example 6.8. Compute the values of f 0 (3.1) and f 00 (3.1) using the following table.
x 1 2 3 4 5
f (x) 0 1.4 3.3 5.6 8.1
Solution: The central difference table is
x y = f (x) ∆y ∆2 y ∆3 y ∆4 y
x−2 = 1 0
1.4
x−1 = 2 1.4 0.5
1.9 -0.1
x0 = 3 3.3 0.4 -0.1
2.3 -0.2
x1 = 4 5.6 0.2
2.5
x2 = 5 8.1
3.1−3
Let x0 = 3, h = 1, u = 1
= 0.1
The divided difference interpolation polynomial fitting the data (xi , f (xi )), i = 0, 1, 2, . . . , n is
given by
However, we can also determine the Newton’s divided differences interpolation polynomial
and differentiate it to obtain f 0 (x) and f 00 (x).
Example 6.9. Find the first and second derivatives at x = 1.6, for the function represented by
the following tabular data:
Remark 6.1. Often, in applications, we require the maximum and/ or minimum of a func-
tion given as a tabulated data. We may obtain the interpolation polynomial, differentiate it
and set it equal to zero to find the stationary points. Alternatively, we can use the numerical
differentiation formula for finding the first derivative, set it equal to zero to find the station-
ary points. The numerical values obtained for the second derivatives at these stationary points
decides whether there is a maximum or a minimum at these points.
Example 6.10. Find x for which y is maximum and find this value of y
x y ∆ ∆2 ∆3 ∆4
1.2 0.9320
0.0316
1.3 0.9636 -0.0097
0.0219 -0.0002
1.4 0.9855 -0.0099 0.0002
0.120 0
1.5 0.9975 -0.0099
0.0021
1.6 0.9996
u(u − 1) 2
y = y0 + u∆y0 + ∆ y0 + . . .
2
u(u − 1)
= 0.9320 + 0.031u + (−0.0097) (Neglecting higher differences)
2
dy 2u − 1
= 0.0316 + (−0.0097)
du 2
At a maximum,
dy
=0
du
1
⇒ 0.0316 = u − (0.0097) ⇒ u = 3.76
2
∴ x = x0 + uh = 1.2 + (0.1)(3.76) = 1.576
x = xn + uh
⇒ 1.576 = 1.6 + (0.1)u ⇒ u = −0.24
u(u + 1) 2 u(u + 1)(u + 2) 3
y(1.576) = yn + u∇yn + ∇ yn + ∇ yn
2! 3!
(−0.24)(1 − 0.24)
= 0.9996 − (0.24 × 00021) + (−0.0099)
2
dy
= 0.9999988 = 0.9999nearly
du
∴ Maximum y = 0.9999. (Approximately)
dy d2 y
1. From the following table find the value of dx and dx2 at the point x = 1.0.
dy d2 y
2. From the following table of values of x and y, obtain dx and dx2 for x = 1.2, 2.2 and 1.6
[Ans. y 0 (1.2) = 3.3205, y 00 (1.2) = 3.318; y 0 (2.2) = 9.0228, y 00 (2.2) = 8.992; y 0 (1.6) = 4.953, y 00 (1.6) =
4.9525]
3. A rod is rotating in a plane. The following table gives the angle θ(radians) through which
the rod has turned for various values of the time t (seconds).
4. From the table below, for what value of x, y is minimum? Also find this value of y.
x 3 4 5 6 7 8
[Ans. 5.6875, 0.2628]
y 0.25 0.240 0.259 0.262 0.250 0.224
2. Closed form solutions exist but these solutions are complex and difficult to use for cal-
culations.
3. Data for variables are available in the form of a table, but no mathematical relationship
between them is known as is often the case with experimental data.
where x = x0 + uh
Z n
u2 − u 2 u3 − 3u2 + 2u 3 u4 − 6u3 + 11u2 − 6u 4
I=h y0 + u∆y0 + ∆ y0 + ∆ y0 + ∆ y0 + · · · du
0 2! 3! 4!
xn
n(n − 2)2 3
n(2n − 3) 2
Z
n
I= y dx = nh y0 + ∆y0 + ∆ y0 + ∆ y0
x0 2 12 24
1 n4 3n3 11n2 1 n5 35n3 50n2
4 4
+ − + − 3n ∆ y0 + − 2n + − + 12n ∆5 y0
24 5 2 3 120 6 4 3
1 n6 5n5 225n3 274n2
4 6
+ − + 17n − + − 60n ∆ y0 + · · · (6.18)
720 7 2 4 3
The formula given by Equation (6.18) is known as Newton-Cotes closed quadrature formula.
From the general formula ((6.18)), we can derive or deduce different integration formulae by
substituting n = 1, 2, 3, . . ., etc.
Figure 6.1
Each subinterval with the line approximation for the function forms a trapezoid as shown in
Figure 6.1. The area of each trapezoid is computed by multiplying the interval size h by the
average value of the function value in that subinterval. After the individual trapezoidal areas
are obtained, they are all added to obtain the overall approximation to the integral.
Substituting n = 1 in Equation (6.18) and considering the curve y = f (x) through the points
(x0 , y0 ) and (x1 , y1 ) as a straight line (a polynomial of first degree so that the differences of
order higher than first become zero), we get
Z x1
1 h 1 h
I1 = y dx = h y0 + ∆y0 = y0 + (y1 − y0 ) = (y0 + y1 ) (6.19)
x0 2 2 2 2
Similarly, we have
Z x2
h
I2 = y dx =
(y1 + y2 )
x1 2
Z x3
h
I3 = y dx = (y2 + y3 )
x2 2
In general, we have Z xn
h
In = y dx = (yn−1 + yn ) (6.20)
xn−1 2
Figure 6.2
Adding all the integrals (Eq.(6.19), Eq.(6.20)) and using the interval additive property of the
definite integrals, we obtain
n Z xn
X h
I= Ii = y dx = y0 + 2(y1 + y2 + y3 + · · · + yn−1 ) + yn (6.21)
i=1 x0 2
Summarising, the trapezoidal rule signifies that the curve y = f (x) is replaced by n-straight
lines joining the points (xn , yn ), i = 0, 1, 2, 3, . . . , n. The area bounded by the curve y = f (x),
the ordinates x = x0 , x = xn and the x-axis is then approximately equivalent to the sum of the
areas of the n-trapezoids so obtained.
Let y = f (x) be a continuous function with continuous derivatives in the interval [x0 , xn ].
Expanding y in a Taylor’s series around x = x0 , we get
x1 x1
(x − x0 )2 00
Z Z
y dx = y0 + (x − + x0 )y00
y0 + · · · dx
x0 x0 2!
h2 0 h3 00 h4 000
= hy0 + y0 + y0 + y0 + · · · (6.22)
2 6 24
h2 00
h h h 0
Likewise, (y0 + y1 ) = (y0 + y(x0 + h)) = y0 + y0 + hy0 + y0 + · · ·
2 2 2 2
2 3 4
h h h
= hy0 + y00 + y000 + y0000 + · · · (6.23)
2 4 12
Hence, the error e1 in (x0 , x1 ) is obtained from Eqs. (6.22) and (6.23) as
x1
−1 3 00
Z
h
e1 = y dx − (y0 + y1 ) = h y0 + · · ·
x0 2 12
−1 3 00
en = h yn−1 + · · ·
12
Hence, the total error E in the interval (x0 , xn ) can be written as
n
X −h3 00
y0 + y100 + y200 + · · · + yn−1
00
E= en = (6.25)
n=1
12
If y 00 (x̄) is the largest value of the n quantities in the right hand side of Eq.(6.25), then we have
−1 3 00 b − a 2 00
E= h ny (x̄) = − h y (x̄) (6.26)
12 12
h
I = (y0 + y6 ) + 2(y1 + y2 + y3 + y4 + y5 )
2
0.2
I = (1 + 3.320) + 2(1.221 + 1.492 + 1.822 + 2.226 + 2.718)
2
I = 2.3278 ≈ 2.328
significant figures.
b−a 12−0
Solution: Dividing the interval (0, 12) into 6 equal parts, each of width h = n
= 6
= 2.
1
The values of f (x) = 1+x 2 at each points of sub-divisions are given by
x 0 2 4 6 8 10 12
y = f (x) 1 0.2 0.05882 0.02703 0.01538 0.00990 0.00690
y0 y1 y2 y3 y4 y5 y6
The trapezoidal rule can be written as
h
I = (y0 + y6 ) + 2(y1 + y2 + y3 + y4 + y5 )
2
2
I = (1 + 0.00690) + 2(0.2 + 0.05882 + 0.02703 + 0.01538 + 0.00990)
2
I = 1.62916
h
I= [(y0 + y8 ) + 2(y1 + y2 + y3 + y4 + y5 + y6 + y7 )]
2
0.5
I= (0.3010 + 0.7781) + 2(0.3979 + 0.4771 + 0.5440 + 0.6020 + 0.6532 + 0.6989 + 0.7403)
2
I = 2.32666