Beruflich Dokumente
Kultur Dokumente
f (x + h) − f (x)
Fh :=
h
Proposition
Let f be a function twice continuously differentiable, for which we want to
compute the first derivative in x. We define the error as
E (h) := f (x+h)−f
h
(x)
− f 0 (x). For all h, there exists ξ ∈ [x, x + h] and C > 0 such
that
C
|E (h)| ≤ h.
2
Symmetric around x
Tabulate, for h going down to 0
f (x + h) − f (x − h)
Fh :=
2h
Proposition
Let f be a function three times continuously differentiable. The sequence
f (x+h)−f (x−h)
2h converges to f 0 (x) with an order of convergence of 2.
Practical example
f (x) = x 4
Up to 11 correct digits
Goal : Exceptionnally we sometimes only have values on one side of the interval.
Methodology
To find a one-sided formula and its order of convergence :
Write the Lagrange formula that yields the interpolation polynomial
Compute the derivative of the formula
Use the Taylor expansion to find the order of convergence
Examples
One-sided formulas of order 2
Two-sided formula for the second derivative
An unsolved issue : we do not get rid of roundoff errors !
Proposition
For a centered formula, the total error (theoretical+roundoff) is approximately
given by
2C M D
|E (h)| ≈ + h2 .
h 6
Roundoff error Theoretical error
How to obtain the best possible precision and get rid of roundoff errors. . .
Centered differences
f (x+h)−f (x−h)
Step h 2h |E (h)|
10−1 4.0400000000000018 0.0400000000000018
10−2 4.0004000000000035 0.0004000000000035
10−3 4.0000039999997234 0.0000039999997234
Idea
Knowing that the sequence converges quadratically, we can extrapolate from the
beginnning of the sequence what is the end of the sequence.
This way, we get rid of the roundoff errors
gh = g + c1 h + c2 h2 + c3 h3 + · · ·
lim gh = g .
h→0
Theorem
The sequence 2g h − gh converges quadratically to g .
2
gh = g + c2 h2 + c4 h4 + c6 h6 + · · ·
Proposition
g h − 14 gh
The sequence 2
3 converges to g with an order of convergence of h4 .
4
Examples
Computations of f 0 (1) for f (x) = x 4 : too easy for Richardson extrapolation !
Computation of h0 (0) for h(x) = sin x.
Table
h G0,0
&
h
2 G1,0 → G1,1
& &
h
4 G2,0 → G2,1 → G2,2
& & &
h
8 G3,0 → G3,1 → G3,2 → G3,3
& & & &
h
16 G4,0 → G4,1 → G4,2 → G4,3 → G4,4
Quentin Louveaux (ULg - Institut Montefiore) Numerical analysis 2018 11 / 12
Table for the computation of the derivative