Numerical Differentiations

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Department of Mathematics

MTL107: Numerical Methods and Computations


Exercise Set 9: Numerical Differentiation-three point formulas, five point formulas.

1. Use the forward-difference formulas and backward-difference formulas to determine each


missing entry in the following tables:

0 0
x f(x) f (x) x f(x) f (x)
0.5 0.4794 0.0 0.00000
a. b.
0.6 0.5646 0.2 0.74140
0.7 0.6442 0.4 1.3718

2. The data in Exercise 1 were taken from the following functions. Compute the actual
errors in Exercise 1, and find error bounds using the error formulas.
a. f (x) = sin x b. f (x) = ex − 2x2 + 3x − 1.

3. Use the most accurate 3-point formula to determine each missing entry in the following
tables:

0 0
x f(x) f (x) x f(x) f (x)
1.1 9.025013 8.1 16.94410
a. 1.2 11.02318 b. 8.3 17.56492
1.3 13.46374 8.5 18.19056
1.4 16.44465 8.7 18.82091

0 0
x f(x) f (x) x f(x) f (x)
2.9 -4.827866 2.0 3.6887983
c. 3.0 -4.240058 d. 2.1 3.6905701
3.1 -3.496909 2.2 3.6688192
3.2 -2.596792 2.3 3.6245909

4. The data in Exercise 3 were taken from the following functions. Compute the actual
errors in Exercise 3, and find error bounds using the error formulas.
a. f (x) = e2x b. f (x) = x ln x.
2
c. f (x) = x cos x − x sin x d. f (x) = 2(ln x)2 + 3 sin x.
0 0
x f(x) f (x) x f(x) f (x)
2.1 -1.709847 -3.0 9.367879
2.2 -1.373823 -2.8 8.233241
a. 2.3 -1.119214 b. -2.6 7.180350
2.4 -0.9160143 -2.4 6.209329
2.5 -0.7470223 -2.2 5.320305
2.6 -0.6015966 -2.0 4.513417

5. Use the formulas given in this section to determine, as accurately as possible, approxima-
tions for each missing entry in the above tables:

6. The data in Exercise 5 were taken from the following functions. Compute the actual
errors in Exercise 5, and find error bounds using the error formulas.
a. f (x) = tan x b. f (x) = ex/3 + x2 .

7. Use the following data and the knowledge that the first five derivatives of f are bounded
0
on [1, 5] by 2,3,6, and 23, respectively, to approximate f (3) as accurately as possible.
Find a bound for the error.

x 1 2 3 4 5
f(x) 2.4142 2.6734 2.8974 3.0976 3.2804

8. Repeat Exercise 1 using 4-digit rounding arithmetic, and compare the errors to those in
Exercise 2.

9. Repeat Exercise 5 using 4-digit rounding arithmetic, and compare the errors to those in
Exercise 6.
00
10. Let f (x) = cos πx. Approximate f (0.5) using the values of f (x) at x = 0.24, 0.5, and
0.75 and the second derivative midpoint formula

00 1 h2 (4)
f (x0 ) = [f (x 0 − h) − 2f (x 0 ) + f (x 0 + h)] − f (ξ)
h2 12
for some ξ, where x0 − h < ξ < x0 + h. Compare this result to the exact value. Find a
bound for the error.

x 0.2 0.4 0.6 0.8 1.0


f(x) 0.9798652 0.9177710 0.8080348 0.6386093 0.3843735
11. Consider the above table of data:
0 0
a. Approximate f (0.2) and f (1.0) using the five-point endpoint formula. For x0 < ξ <
x0 + 4h.

0 1 h4
f (x0 ) = [−25f (x0 )+48f (x0 +h)−36f (x0 +2h)+16f (x0 +3h)−3f (x0 +4h)]+ f (5) (ξ)
12h 5
0
b. Approximate f (0.6) using the five-point midpoint formula

0 1 h4
f (x0 ) = [f (x0 − 2h) − 8f (x0 − h) + 8f (x0 + h) − f (x0 + 2h)] + f (5) (ξ)
12h 30
for some ξ, where x0 − 2h < ξ < x0 + 2h.

ANSWERS

1. From the forward and backward difference formula, we have the following approximations:
0 0 0
1a. f (0.5) ≈ 0.8520, f (0.6) ≈ 0.8520, f (0.7) ≈ 0.7960

0 0 0
1b. f (0.0) ≈ 3.7070, f (0.2) ≈ 3.1520, f (0.4) ≈ 3.1520

2a. x Actual Error Error Bound


0.5 0.0255 0.0282
0.6 0.0267 0.0282
0.7 0.0312 0.0322

2b. x Actual Error Error Bound


0.0 0.2930 0.3000
0.2 0.2694 0.2779
0.4 0.2602 0.2779

2.

3. For the endpoints of the tables, we use 3-Point Endpoint Formula. The other approxima-
tions come from 3-Point Midpoint formula:

0 0 0 0
3a. f (1.1) ≈ 17.769705, f (1.2) ≈ 22.193635, f (1.3) ≈ 27.107350, f (1.4) ≈ 32.150850
0 0 0 0
3b. f (8.1) ≈ 3.092050, f (8.3) ≈ 3.116150, f (8.5) ≈ 3.139975, f (8.7) ≈ 3.163525
0 0 0 0
3c. f (2.9) ≈ 5.101375, f (3.0) ≈ 6.654785, f (3.1) ≈ 8.216330, f (3.2) ≈ 9.786010
0 0 0 0
3d. f (2.0) ≈ 0.13533150, f (2.1) ≈ −0.09989550, f (2.2) ≈ −0.3298960, f (2.3) ≈ −0.5546700.

4.
4a. x Actual Error Error Bound
1.1 0.280322 0.359033
1.2 0.147282 0.179517
1.3 0.179874 0.219262
1.4 0.378444 0.438524

4b. x Actual Error Error Bound


8.1 1.8594 ×10−4 2.0322 ×10−5
8.3 1.0551 ×10−4 1.0161 ×10−5
8.5 9.116 ×10−5 9.677 ×10−6
8.5 2.0197 ×10−4 1.9355 ×10−5

5. The approximations and the formulas: 5PEP=5 Point Endpoint formula and 5PMP=5
Point Mid Point formula used are:

0 0 0
5a. f (2.1) ≈ 3.899344(5P EP ), f (2.2) ≈ 2.876876(5P EP ), f (2.3) ≈ 2.249704(5P M P ),
0 0 0
f (2.4) ≈ 1.837756(5P M P ), f (2.5) ≈ 1.544210(5P EP ), f (2.6) ≈ 1.355496(5P EP ).

0 0 0
5b. f (−3.0) ≈ −5.877358(5P EP ), f (−2.8) ≈ −5.468933(5P EP ), f (−2.6) ≈ −5.059884(5P M P ),
0 0 0
f (−2.4) ≈ −4.650223(5P M P ), f (−2.2) ≈ −4.239911(5P EP ), f (−2.0) ≈ −3.828853(5P EP ).

6.
0 1
7. f (3) ≈ 12
[f (1) − 8f (2) + 8f (4) − f (5)] = 0.21062, with an error bound given by

|f ( 5)(x)|h4 23
max ≤ = 0.76̄.
1≤x≤5 30 30

8. From the forward-backward difference formula, we have the following approximations:


0 0 0
8a. f (0.5) ≈ 0.852, f (0.6) ≈ 0.852, f (0.7) ≈ 0.7960

0 0 0
8b. f (0.0) ≈ 3.707, f (0.2) ≈ 3.153, f (0.4) ≈ 3.153

9. For the endpoints of the tables, we use Formula 5PEP. The other approximations come
0 0 0
from Formula 5PMP. 9a. f (2.1) ≈ 3.884, f (2.2) ≈ 2.896, f (2.3) ≈ 2.249,
0 0 0
f (2.4) ≈ 1.836, f (2.5) ≈ 1.550, f (2.6) ≈ 1.348.

0 0 0
9b. f (−3.0) ≈ −5.883, f (−2.8) ≈ −5.467, f (−2.6) ≈ −5.059,
0 0 0
f (−2.4) ≈ −4.650, f (−2.2) ≈ −4.208, f (−2.0) ≈ −3.875.
00
10. The approximation is −4.8 × 10−9 . f (0.5) = 0. The error bound is 0.35874. The method
is very accurate since the function is symmetric about x = 0.5.
4c. x Actual Error Error Bound
2.9 0.011956 0.0180988
3.0 0.0049251 0.00904938
3.1 0.0004765 0.00493920
3.2 0.0013745 0.00987840

4d. x Actual Error Error Bound


2.0 0.00252235 0.00410304
2.1 0.00142882 0.00205152
2.2 0.00204851 0.00260034
2.3 0.00437954 0.00520068

0
11. 11a. f (0.2) ≈ −0.1951027
0
11b. f (1.0) ≈ −1.541415
0
11c. f (0.6) ≈ −0.6824175.
6a. x Actual Error Error Bound
2.1 0.0242312 0.109271
2.2 0.0105138 0.0386885
2.3 0.0029352 0.0182120
2.4 0.0013262 0.00644808
2.5 0.0138323 0.109271
2.6 0.0064225 0.0386885

6b. x Actual Error Error Bound


-3.0 1.55 ×10−5 6.33 ×10−7
-2.8 1.32 ×10−5 6.76 ×10−7
-2.6 7.95 ×10−7 1.05 ×10−7
-2.4 6.79 ×10−7 1.13 ×10−7
-2.2 1.28 ×10−5 6.76 ×10−7
-2.0 7.96 ×10−6 6.76 ×10−7

You might also like