4.1 More on Finite Differences
67
∂
2
f
∂ x 2 ≈
f (x + Δx) − 2 f (x) + f (x − Δx)
(Δx) 2
=
f k+1 − 2 f k + f k−1
(Δx) 2
(4.9)
4.1.4 Truncation Error
The following example specifie the truncation error made when using finit differences. Consider the function:
f (x) = A sin (2π x/λ)
(4.10)
where A is a constant amplitude and λ is a certain wavelength. The derivative of this
function is given by:
d f
dx
= 2π A/λ cos (2π x/λ)
(4.11)
If we use the centred difference as a proxy for the firs derivative, we obtain:
f (x + Δx) − f (x − Δx)
2Δx
=
A sin [2π(x + Δx)/λ] − A sin [2π (x − Δx)/λ]
2Δx
With some mathematical manipulation, the latter equation can be formulated as:
f (x + Δx) − f (x − Δx)
2Δx
= 2π A/λ cos (2π x/λ) · [1 − ]
where the relative error with respect to the true solution – the truncation error – is
given by:
(Δx) = 1 −
sin (2πΔx/λ)
2πΔx/λ
Fig. 4.2 Relative error (%) inherent with use of the centred scheme for (4.11) as a function of
Δx/λ
Précédent

- 80/185

Suivant