8.2 Finite differences through interpolation

FD approximations of the p-th derivative of a function f at a point x are local linear combinations of function values at node points,
N (p) --1---∑ D f(x) := (Δx )p f(xi)ai(x) (8.6 ) i=0 -dp- r = dxpf (x) + 𝒪 ((Δx )) ,
where the nodes {xi} do not need to include x (that is, the grid can be staggered). In the FD case, the number of nodes is usually kept fixed as resolution is changed, resulting in a fixed convergence order r. This is in contrast to discrete spectral collocation methods, discussed in Section 9, which can be seen as approximation through global polynomial interpolation at special nodal points.

A way of systematically constructing FD operators with an arbitrary distribution of nodes, any desired convergence order, and which are centered, one-sided or partially off-centered in any way is through interpolation. A local polynomial interpolant is used to approximate the function f, and the FD approximation is defined as the exact derivative of the interpolant. That is,

∑N f (x ) ≈ ℐ[f](x) := f(xi)ℓ(iN)(x) (8.7 ) i=0
and, for instance, for a first derivative,
N -d- ∑ -d-(N ) Df (x ) := dx ℐ[f](x) = f(xi)dx ℓi (x). (8.8 ) i=0
Notice that the expression (8.8View Equation) does have the form of Eq. (8.6View Equation), where {xi} are the nodal points of the interpolant and
-d- (N) ai(x) = (Δx )dx ℓi (x). (8.9 )

The truncation error for the FD approximation (8.8View Equation) to the first derivative can be estimated by differentiating the error formula for the interpolant, Eq. (8.5View Equation),

d d d ( 1 ) Ef ′(x ) :=---f(x ) − --ℐ [f ](x) = --- ---------f(N+1)(ξx)ωN+1 (x) dx ( dx dx) (N + 1)! ----1---- -d- (N+1) ----1---- (N+1 ) d-- = (N + 1)! dx f (ξx) ωN+1 (x) + (N + 1)!f (ξx) dxωN+1 (x). (8.10 )
The derivative of the first term in Eq. (8.10View Equation) is more complicated to estimate than the second one without analyzing the details of the dependence of ξ on x. But if we restrict x to be a nodal point x = xk, then ω (x ) = 0 N+1 k and the previous equation simplifies to
N E ′(x ) = ---1----f (N+1 )(ξ ) ∏ (x − x ). (8.11 ) f k (N + 1)! xk k i i=0,i⁄=k
Notice that Eq. (8.11View Equation) implies that the resulting FD approximation has design convergence order r = N. For the usual case of equally spaced nodes, for instance, where x = kΔx k, we obtain
N -(Δx-)N-- (N+1) ∏ Ef′(xk) = (N + 1)!f (ξxk) (k − i) (8.12 ) i=0,i⁄=k
and the error is proportional to (Δx )N. If the nodes are not equally spaced, the error can be bounded by a constant proportional to N (Δx ), where in this case Δx is the maximal distance between neighboring nodal points.

Example 47. A first-order one-sided FD approximation for d∕dx.
We construct a first-degree interpolant using two nodal points {x ,x } 0 1,

(1) (1) ℐ[f](x) = f(x0)ℓ0 (x) + f(x1)ℓ1 (x), (8.13 )
with
(1) x − x1 (1) x − x0 ℓ0 (x) = -------, ℓ1 (x ) = -------. (8.14 ) x0 − x1 x1 − x0
Then
d-- f-(x1) −-f(x0) Df (x) := dxℐ [f ](x) = x1 − x0 . (8.15 )
If we evaluate x at x0 or x1 we obtain the standard first-order forward and backward FD approximations D + and D −, respectively [cf. Eqs. (7.70View Equation)]. From Eq. (8.12View Equation) we recover the known first-order convergence for these approximations, r = 1, which can also be obtained directly through a Taylor expansion in Δx of Eq. (8.15View Equation).

Example 48. A second-order centered finite-difference approximation for d∕dx.
Now we construct a second-degree interpolant using three nodal points {x0, x1,x2},

ℐ[f](x) = f(x0)ℓ(02)(x) + f(x1)ℓ(12)(x) + f(x2)ℓ(22)(x), (8.16 )
with
ℓ(2)(x) = (x-−-x1-)(x-−-x2-)-, ℓ(2)(x) = -(x-−-x0)(x-−-x2)-, ℓ(2)(x) = -(x-−-x0)(x-−-x1)(8..17 ) 0 (x0 − x1 )(x0 − x2) 1 (x1 − x0)(x1 − x2) 2 (x2 − x0)(x2 − x1)
If we assume the points to be equally spaced, x2 − x1 = Δx = x1 − x0, and evaluate the derivative at the center one, x = x1, we obtain
d f (x2 ) − f (x0 ) Df (x1 ) :=---ℐ[f](x1) = --------------, (8.18 ) dx 2Δx
the standard second-order centered FD operator D0 [cf. Eq. (7.32View Equation)].

One can proceed in this way to systematically construct any FD approximation to any derivative with any desired convergence order and distribution of nodal points. The result for centered-difference approximations to d∕dx with even accuracy order r at equally spaced nodes can be written in terms of D0, D+, D − as follows [228],

r∕∑2−1 D = D (− 1)να ((Δx )2D D )ν , (8.19 ) r 0 ν + − ν=0
with
α0 = 1, --ν---- αν = 4ν + 2α ν− 1 for ν = 1, 2,...,(r∕2 − 1).

Example 49. The fourth, sixth, eighth and tenth-order centered FD approximations to d∕dx are:

(Δx )2 D4 = D0 − D0 ------D+D − , 6 4 D = D + D (Δx-)-D2 D2 , 6 4 0 30 + − (Δx )6 D8 = D6 − D0 ------D3+D3 − , 1408 D = D + D (Δx-)-D4 D4 . 10 8 0 630 + −

  Go to previous page Go up Go to next page