Numerical Calculus IV
Numerical Calculus IV
Numerical Calculus IV
Numerical Calculus IV
b n−1
h
∫ f (x) dx ≈ (f (a) + 2 ∑ f (xi ) + f (b))
a 2 i=1
b n−1 n−1
h
∫ f (x) dx ≈ (f (a) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (b))
a 3 i=0 i=1
Problem 1
Let f be given by f (x) = sin(πx).
1
Approximate ∫ f (x) dx using the composite trapezoidal rule with
0
f being evaluated at 5 evenly spaced points.
1
Approximate ∫ f (x) dx using the composite midpoint rule with f
0
being evaluated at 5 evenly spaced points.
1
Approximate ∫ f (x) dx using the composite Simpson’s rule with f
0
being evaluated at 5 evenly spaced points.
Numerical Calculus IV 10/30
Note that
1 1
1 1 1 2
∫ sin(πx) dx = [− cos(πx)] = − cos(π)+ cos(0) = = 0.63661 . . . .
0 π 0 π π π
Numerical Calculus IV 12/30
b n−1
h b − a 2 ′′
∫ f (x) dx = (f (a) + 2 ∑ f (xi ) + f (b)) − h f (ξ).
a 2 i=1 12
Numerical Calculus IV 13/30
Proof By the error identity for the trapezoidal rule, for all positive
integers i such that i ≤ n, there exists ξi ∈ (xi−1 , xi ) for which
b n xi
∫ f (x) dx = ∑ ∫ f (x) dx
a i=1 xi−1
n
h3
= ∑ ( (f (xi−1 ) + f (xi )) − f ′′ (ξi ))
h
i=1 2 12
h n h3 n ′′
= ∑(f (xi−1 ) + f (xi )) − ∑ f (ξi )
2 i=1 12 i=1
n−1
h nh 2 1 n ′′
= (f (a) + 2 ∑ f (xi ) + f (b)) − h ∑ f (ξi )
2 i=1 12 n i=1
n−1
h b − a 2 1 n ′′
= (f (a) + 2 ∑ f (xi ) + f (b)) − h ∑ f (ξi )
2 i=1 12 n i=1
because nh = b − a.
Numerical Calculus IV 14/30
Hence,
n
n min f ′′ (x) ≤ ∑ f ′′ (ξi ) ≤ n max f ′′ (x)
x∈[a,b] i=1 x∈[a,b]
and
1 n ′′
min f ′′ (x) ≤ ′′
∑ f (ξi ) ≤ max f (x).
x∈[a,b] n i=1 x∈[a,b]
Numerical Calculus IV 15/30
If
1 n ′′ ′′
∑ f (ξi ) = min f (x)
n i=1 x∈[a,b]
then
f ′′ (ξi ) = min f ′′ (x)
x∈[a,b]
for all positive integers i such that i ≤ n and, for all positive integers j
such that j ≤ n,
1 n ′′ 1 n ′′ ′′
∑ f (ξi ) = ∑ f (ξj ) = f (ξj ).
n i=1 n i=1
Numerical Calculus IV 16/30
If
1 n ′′ ′′
∑ f (ξi ) = max f (x)
n i=1 x∈[a,b]
then
f ′′ (ξi ) = max f ′′ (x)
x∈[a,b]
for all positive integers i such that i ≤ n and, for all positive integers j
such that j ≤ n,
1 n ′′ 1 n ′′ ′′
∑ f (ξi ) = ∑ f (ξj ) = f (ξj ).
n i=1 n i=1
Numerical Calculus IV 17/30
If
1 n ′′
min f ′′ (x) ≠ ′′
∑ f (ξi ) ≠ max f (x)
x∈[a,b] n i=1 x∈[a,b]
then
1 n ′′
min f ′′ (x) < ′′
∑ f (ξi ) < max f (x)
x∈[a,b] n i=1 x∈[a,b]
and so, since f ∈ C 2 [a, b], by the Intermediate Value Theorem there
exists c ∈ (min{c1 , c2 }, max{c1 , c2 }) for which
1 n ′′
f ′′ (c) = ∑ f (ξi )
n i=1
where c1 is such that c1 ∈ [a, b] and f ′′ (c1 ) = min f ′′ (x) and c2 is such
x∈[a,b]
that c2 ∈ [a, b] and f ′′ (c2 ) = max f ′′ (x).
x∈[a,b]
Numerical Calculus IV 18/30
1 n ′′
f ′′ (ξ) = ∑ f (ξi )
n i=1
and
b n−1
h b − a 2 ′′
∫ f (x) dx = (f (a) + 2 ∑ f (xi ) + f (b)) − h f (ξ).
a 2 i=1 12
Numerical Calculus IV 19/30
b n−1 n−1
h
∫ f (x) dx = (f (a) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (b))
a 3 i=0 i=1
b − a 4 (4)
− h f (ξ).
180
Numerical Calculus IV 21/30
Problem 2
1
Suppose that n is a positive integer. Let h = and let xi = ih for all
n
nonnegative integers i such that i ≤ n. Let f be given by f (x) = sin(πx).
Given that there exists ξ ∈ (0, 1) for which
1 n−1
h2
(f (0) + 2 ∑ f (xi ) + f (1)) − f ′′ (ξ),
h
∫ f (x) dx =
0 2 i=1 12
We have that
1 n−1
h
∣∫ f (x) dx − (f (0) + 2 ∑ f (xi ) + f (1))∣
0 2 i=1
1 2 ′′
= ∣− h f (ξ)∣ for some ξ ∈ (0, 1)
12
h2
≤ max ∣f ′′ (x)∣
12 x∈[0,1]
1
= max ∣−π 2 sin(πx)∣
12n2 x∈[0,1]
π2
= .
12n2
Numerical Calculus IV 23/30
π2 2 π2 π
2
< 0.0001 ⇔ n > ⇔n> √ .
12n 0.0012 0.0012
π
Moreover, √ = 90.6899 . . . and so taking n ≥ m with m = 91
0.0012
guarantees that
1 n−1
h
∣∫ f (x) dx − (f (0) + 2 ∑ f (xi ) + f (1))∣ < 0.0001.
0 2 i=1
Numerical Calculus IV 24/30
Problem 3
1
Suppose that n is a positive integer. Let h = and let xi = 2ih for all
2n
nonnegative integers i such that i ≤ n. Let f be given by f (x) = sin(πx).
Given that there exists ξ ∈ (0, 1) for which
1 n
h2 ′′
∫ f (x) dx = 2h ∑ f (xi−1 + h) + f (ξ),
0 i=1 6
We have that
1 n
h2 ′′
∣∫ f (x) dx − 2h ∑ f (xi−1 + h)∣ = ∣ f (ξ)∣ for some ξ ∈ (0, 1)
0 i=1 6
h2
≤ max ∣f ′′ (x)∣
6 x∈[0,1]
1
= max ∣−π 2 sin(πx)∣
24n2 x∈[0,1]
π2
= .
24n2
Numerical Calculus IV 26/30
π2 2 π2 π
2
< 0.0001 ⇔ n > ⇔n> √ .
24n 0.0024 0.0024
π
Moreover, √ = 64.1274 . . . and so taking n ≥ m with m = 65
0.0024
guarantees that
1 n
∣∫ f (x) dx − 2h ∑ f (xi−1 + h)∣ < 0.0001.
0 i=1
Numerical Calculus IV 27/30
Problem 4
1
Suppose that n is a positive integer. Let h = and let xi = 2ih for all
2n
nonnegative integers i such that i ≤ n. Let f be given by f (x) = sin(πx).
Given that there exists ξ ∈ (0, 1) for which
1 n−1 n−1
h
∫ f (x) dx = (f (0) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (1))
0 3 i=0 i=1
h4 (4)
− f (ξ),
180
determine an integer m which is such that taking n ≥ m will guarantee
that
1 n−1 n−1
h
∣∫ f (x) dx − (f (0) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (1))∣ < 0.0001.
0 3 i=0 i=1
Numerical Calculus IV 28/30
We have that
1 n−1 n−1
h
∣∫ f (x) dx − (f (0) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (1))∣
0 3 i=0 i=1
h4 (4)
= ∣− f (ξ)∣ for some ξ ∈ (0, 1)
180
h4
≤ max ∣f (4) (x)∣
180 x∈[0,1]
1
= max ∣π 4 sin(πx)∣
2880n4 x∈[0,1]
π4
= .
2880n4
Numerical Calculus IV 29/30
π4 4 π4 π
4
< 0.0001 ⇔ n > ⇔n> .
2880n 0.288 0.2881/4
π
Moreover, = 4.2884 . . . and so taking n ≥ m with m = 5
0.2881/4
guarantees that
1 n−1 n−1
h
∣∫ f (x) dx − (f (0) + 4 ∑ f (xi + h) + 2 ∑ f (xi ) + f (1))∣ < 0.0001.
0 3 i=0 i=1
Numerical Calculus IV 30/30
References
Burden, Faires & Burden, Numerical Analysis, 10E
Section 4.4