Professional Documents
Culture Documents
Solutions to Assignment 6
1. [4.3.1] Approximate the following integrals using the Trapezoidal Rule. Also find the
exact answer and the approximation error.
R1
(a) 0.5 x4 dx;
R 0.5 2
(b) 0 x4
dx;
R1
(d) 0 x2 ex dx.
Answer. Table contains answer to Q.3i. Abbreviations: AE=Abs.error, RE=Rel.error,
T=Trapezoidal, S=Simpson.
Exact
Trapezoid
(a)
0.19375
0.265625
(b) 0.267062786 0.26786
(d) 0.1606027941
0.18394
Simpson
AET
0.1940104 7.2 102
0.2670635 7.9 104
0.1624017 2.3 102
AES
2.6 104
7.1 107
1.8 103
RET
RES
37%
0.13%
0.3% 2.6 104 %
14%
1.1%
Remark: the exact values of the integrals can be using the Fundamental Theorem of
Calculus; integration is very easy in (a) and (b), while (d) requires integration by parts.
The antiderivatives and exact values are:
1
1 5
x
(a)
= 31/160;
5
0.5
(b) [2 ln(4 x)]0.5
0 = 2(ln 3.5 ln 4) = 2 ln(7/8);
1
(d) (2 2x x2 )ex 0 = 2 5e1 .
2. [4.3.3] Find the theoretical bound for approximation error in Ex. 1 and compare it to
the actual error.
Solution. The theoretical error bound for Trapezoidal Rule is
|E(f )|
M2
(b a)3 ,
12
M2 = max |f 00 (x)|.
[a,b]
(a) f 00 (x) = 12x2 , M2 = max[0.5,1] (12x2 ) = 12. Hence |E(f )| 0.53 = 0.125. The actual
error, 0.072, differs from this by less than two times.
(b) f 00 (x) = 4(x 4)3 , M2 = max[0,0.5] 4|x 4|3 = 4|0.5 4|3 0.0933. (Note: as x
becomes closer to 4, |x 4| becomes smaller and |x 4|3 becomes larger. This argument
shows why the maximum is attained at the endpoint x = 0.5.)
Hence |E(f )| 0.0933/12 0.53 9.7 104 . The actual error, 7.9 104 , is just slightly
less.
1
1
S = (f (0) + 4f (1) + f (2)) = (T + 4f (1)).
3
3
5. [4.4.1(a),2(d)] Use the Composite Trapezoidal rule with indicated values of n to approximate the following integrals:
Z 2
Z e+2
dx
(a)
x ln x dx, n = 4,
(b)
, n = 8.
x ln x
1
e
Solution. The main trick here is correct determination of the step h to use in the
formula.
(a) Here h = (2 1)/4 = 0.25; the approximation is
1
0.25 (f (1) + 2(f (1.25) + f (1.5) + f (1.75)) + f (2)) = 0.6399004777.
2
(Exact value is 0.6362943610, abs.error 3.6 103 .)
(a) Here h = ((e + 2) e)/8 = 0.25; the approximation is
7
X
1
0.25 (f (e) + 2
f (e + 0.25k) + f (2 + e)) = 0.4403450138.
2
k=1