0% found this document useful (0 votes)
135 views

Chapter 4 Numerical Differentiation and Integration

This document discusses numerical differentiation methods. It introduces the basic formula for approximating the derivative of a function f at a point x0 using finite differences. It then discusses using three-point and five-point formulas which provide greater accuracy by using evaluations of f at multiple points. The document derives the forward and backward three-point formulas and analyzes their errors. It provides examples of using the formulas to calculate missing derivatives from function evaluations and calculates the actual error compared to the true derivative.

Uploaded by

Shayan Ahmed
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)
135 views

Chapter 4 Numerical Differentiation and Integration

This document discusses numerical differentiation methods. It introduces the basic formula for approximating the derivative of a function f at a point x0 using finite differences. It then discusses using three-point and five-point formulas which provide greater accuracy by using evaluations of f at multiple points. The document derives the forward and backward three-point formulas and analyzes their errors. It provides examples of using the formulas to calculate missing derivatives from function evaluations and calculates the actual error compared to the true derivative.

Uploaded by

Shayan Ahmed
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/ 3

Chapter 4 Numerical Differentiation and Integration

4.1 Numerical Differentiation

The derivative of the function f at 𝑥0 is


𝑓(𝑥0 +ℎ)−𝑓(𝑥0 )
𝑓 ′ (𝑥0 ) = lim
ℎ⟶0 ℎ

This formula gives an approximation


to𝑓 ′ (𝑥0 ), as
𝑓(𝑥0 +ℎ)−𝑓(𝑥0 )
𝑓 ′ (𝑥0 ) ≈ ℎ
Or
𝑓(𝑥0 )−𝑓(𝑥0 −ℎ)
𝑓 ′ (𝑥0 ) ≈ ℎ

for small values of h. Although, it is not


very successful, but it is certainly a place to start.
In general, using more evaluation points in formula produces greater accuracy. The most
common formulas are those involving three and five evaluation points.
We first derive some useful three-point formulas and consider aspects of their errors.

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 )

Putting 𝑥 = 𝑥0 , 𝑥1 = 𝑥0 + ℎ, and 𝑥2 = 𝑥0 + 2ℎ we get


−3ℎ −2ℎ ℎ
𝑓 ′ (𝑥0 ) = 𝑓(𝑥0 ) + 𝑓(𝑥1 ) + 𝑓(𝑥2 )
(−ℎ)(−2ℎ) (ℎ)(−ℎ) (2ℎ)(ℎ)
Hence, 3-Point end point formula is
1 ℎ2 (3)
𝑓 ′ (𝑥0 )
= [−3𝑓(𝑥 )
0 + 4𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 + 2ℎ)] + 𝑓 (𝜉0 ) (1)
2ℎ 3
3-Point mid-point formula is
1 ℎ2
𝑓 ′ (𝑥0 ) = [𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 − ℎ)] − 𝑓 (3) (𝜉0 ) (2)
2ℎ 6
Derivative at third point can be obtained from the first by simply replacing h with −h, so there
are actually only two 3-point formulas.
Although the errors in both formulas are O(ℎ2 ), the error in Eq. (2) is approximately half
the error in Eq. (1). This is because Eq. (2) uses data on both sides of 𝑥0 and Eq. (1) uses
data on only one side. The approximation in Eq. (1) is useful near the ends of an interval,
because information about f outside the interval may not be available.

Exercise set 4.1

Q1(a). Use the forward-difference formulas and backward-difference formulas to determine


each missing entry in the following table.

𝒙 𝒇(𝒙) 𝒇′ (𝒙)

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:

𝒙 𝒇(𝒙) 𝒇′ (𝒙) error with


actual 𝒇′ (𝒙)

0.5 0.4794 0.8520 0.0255

0.6 0.5646 0.8520 0.0267

0.7 0.6442 0.7960 0.0312

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)

Using 3-Point end point formula with h = -h


−1
𝑓 ′ (𝑥0 ) = [−3𝑓(𝑥0 ) + 4𝑓(𝑥0 − ℎ) − 𝑓(𝑥0 − 2ℎ)]
2ℎ
at 𝑥0 = 8.7 with h = 0.2 is
−1
𝑓 ′ (8.7) = [−3(18.82091) + 4(18.19056) − 17.56492] = 3.163525
2(0.2)

Derivative of function 𝑓(𝑥) = 𝑥 ln 𝑥 is 𝑓 ′ (𝑥) = 1 + ln 𝑥 implies

𝑓 ′ (8.1) = 3.091864 , and Actual error = 0.000186


𝑓 ′ (8.3) = 3.116256 , and Actual error = 0.000106
𝑓 ′ (8.5) = 3.140066 , and Actual error = 0.000091
𝑓 ′ (8.7) = 3.163323 , and Actual error = 0.000202.

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.

You might also like