Numerical Calculus I
Numerical Calculus I
Numerical Calculus I
Numerical Calculus I
f (x0 + h) − f (x0 )
.
h
Numerical Calculus I 3/21
f (x0 ) − f (x0 − h)
.
h
Note that
f (x0 − h) − f (x0 ) f (x0 ) − f (x0 − h)
= .
−h h
Numerical Calculus I 4/21
Problem 1
Let f be given by f (x) = x − x2 − x3 .
Compute a forward difference approximation to f ′ (0) using no more
of the values of f than f (0) and f (0.05).
Compute a backward difference approximation to f ′ (0) using no
more of the values of f than f (0) and f (−0.05).
Compute the absolute error in each of the obtained approximations
to f ′ (0).
Numerical Calculus I 5/21
∣1 − 0.9475∣ = 0.0525
Problem 2
Suppose that a ∈ R, that b ∈ R and that a < b. Suppose that f ∈ C 2 [a, b],
that x0 ∈ [a, b) and that the positive number h is such that
x0 + h ∈ (a, b].
Show that
∣f ′ (x0 ) −
f (x0 + h) − f (x0 )
∣.
h
f ′ (x0 ) −
f (x0 + h) − f (x0 )
= O(hm ).
h
Numerical Calculus I 7/21
Moreover
Furthermore,
where
max ∣f ′′ (x)∣ .
1
C=
2 x∈[a,b]
Therefore,
f ′ (x0 ) −
f (x0 + h) − f (x0 )
= O(hm )
h
where
m = 1.
Numerical Calculus I 10/21
Moreover,
So,
Furthermore,
Problem 3
Let f be given by f (x) = x − x2 − x3 .
Compute a central difference approximation to f ′ (0) using no more
of the values of f than f (−0.05) and f (0.05).
Compute a central difference approximation to f ′′ (0) using no more
of the values of f than f (−0.05), f (0) and f (0.05).
Compute the absolute error in the obtained approximation to f ′ (0).
Compute the absolute error in the obtained approximation to f ′′ (0).
Numerical Calculus I 16/21
∣1 − 0.9975∣ = 0.0025.
∣ − 2 − (−2)∣ = 0.
Numerical Calculus I 17/21
Problem 4
Suppose that a ∈ R, that b ∈ R and that a < b. Suppose that f ∈ C 3 [a, b],
that x0 ∈ (a, b) and that the positive number h is such that x0 − h ∈ [a, b)
and x0 + h ∈ (a, b].
Show that
f ′ (x0 ) −
f (x0 + h) − f (x0 − h)
= O(hm ).
2h
Numerical Calculus I 18/21
h3 ′′′
f (x0 + h) − f (x0 − h) = 2hf ′ (x0 ) + (f (ξ1 ) + f ′′′ (ξ2 )) .
6
Consequently,
h2
f ′ (x0 ) − = − (f ′′′ (ξ1 ) + f ′′′ (ξ2 )) .
f (x0 + h) − f (x0 − h)
2h 12
Numerical Calculus I 19/21
Therefore,
∣f ′ (x0 ) −
f (x0 + h) − f (x0 − h)
∣
2h
h2 ′′′
= ∣f (ξ1 ) + f ′′′ (ξ2 )∣
12
h2
≤ (∣f ′′′ (ξ1 )∣ + ∣f ′′′ (ξ2 )∣)
12
h2
≤ ( max ∣f ′′′ (x)∣ + max ∣f ′′′ (x)∣)
12 x∈[x0 ,x0 +h] x∈[x0 −h,x0 ]
h2
≤ ( max ∣f ′′′ (x)∣ + max ∣f ′′′ (x)∣)
12 x∈[x0 −h,x0 +h] x∈[x0 −h,x0 +h]
1
where C = and p = 2.
6
Numerical Calculus I 20/21
Moreover,
h2
∣f ′ (x0 ) − ∣f ′′′ (x)∣
f (x0 + h) − f (x0 − h)
∣ ≤ max
2h 6 x∈[x0 −h,x0 +h]
h2
≤ max ∣f ′′′ (x)∣
6 x∈[a,b]
= αh2
where
max ∣f ′′′ (x)∣ .
1
α=
6 x∈[a,b]
Therefore,
f ′ (x0 ) −
f (x0 + h) − f (x0 − h)
= O(hm )
2h
where
m = 2.
Numerical Calculus I 21/21
References
Burden, Faires & Burden, Numerical Analysis, 10E
Section 4.1