Chapter 4 Numerical Differentiation and Integration
Chapter 4 Numerical Differentiation and Integration
Three-Point Formulas
If for Lagrange polynomial, we have three points 𝑥0 , 𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥0 + 2ℎ, and
(𝑥−𝑥1 )(𝑥−𝑥2 ) 2𝑥−𝑥1 −𝑥2
𝐿0 (𝑥) = Implies 𝐿0 ′ (𝑥) =
(𝑥0 −𝑥1 )(𝑥0 −𝑥2 ) (𝑥0 −𝑥1 )(𝑥0 −𝑥2 )
2𝑥−𝑥0 −𝑥2 2𝑥−𝑥0 −𝑥1
Similarly 𝐿1 ′ (𝑥) = and 𝐿2 ′ (𝑥) =
(𝑥1 −𝑥0 )(𝑥1 −𝑥2 ) (𝑥2 −𝑥0 )(𝑥2 −𝑥1 )
Putting, 𝐿0 ′ (𝑥), 𝐿1 ′ (𝑥), 𝐿2 ′ (𝑥) in 𝑓 (𝑥) = 𝐿0 (𝑥)𝑓 (𝑥0 ) + 𝐿1 (𝑥)𝑓(𝑥1 ) + 𝐿2 (𝑥)𝑓 (𝑥2 )
2𝑥 − 𝑥1 − 𝑥2 2𝑥 − 𝑥0 − 𝑥2 2𝑥 − 𝑥0 − 𝑥1
𝑓 ′ (𝑥) = 𝑓(𝑥0 ) + 𝑓(𝑥1 ) + 𝑓(𝑥2 )
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )
𝒙 𝒇(𝒙) 𝒇′ (𝒙)
0.5 0.4794
0.6 0.5646
0.7 0.6442
(b) The data in Q1 is taken from the function𝑓 (𝑥) = sin 𝑥. Compute the actual error.
Solution:
Q5. Use the most accurate three-point formula to determine each missing entry in the
following table.
𝒙 𝒇(𝒙) 𝒇′ (𝒙)
8.1 16.94410
8.3 17.56492
8.5 18.19056
8.7 18.82091
(b) The data in Q5 is taken from the function𝑓 (𝑥) = 𝑥 ln 𝑥. Compute the actual error.
Solution: Using 3-Point end point formula
1
𝑓 ′ (𝑥0 ) = [−3𝑓(𝑥0 ) + 4𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 + 2ℎ)]
2ℎ
at 𝑥0 = 8.1 with h = 0.2 is
1
𝑓 ′ (8.1) = [−3(16.94410) + 4(17.56492) − 18.19056] = 3.09205
2(0.2)
1
Using 3-Point mid-point formula 𝑓 ′ (𝑥0 ) = 2ℎ [𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 − ℎ)]
at 𝑥0 = 8.3 with h = 0.2 is
1
𝑓 ′ (8.3) = [18.19056 − 16.94410] = 3.11615
2(0.2)
at 𝑥0 = 8.5 is
1
𝑓 ′ (8.5) = [18.82091 − 17.56492] = 3.139975
2(0.2)
Work to do: Q5. Use the most accurate three-point formula to determine each missing
entry in the following table.
𝒙 𝒇(𝒙) 𝒇′ (𝒙)
2.0 3.6887983
2.1 3.6905701
2.2 3.6688192
2.3 3.6245909
(b) The data in Q5 is of the function𝑓 (𝑥) = 2(ln 𝑥)2 + 3 sin 𝑥. Compute the actual error.