74
T. Torsvik
Fig. 3.7 Taylor series
approximation for the sine
function (black line). Lines in
other colour show how the
approximation improves with
increasing number of terms in
the series
sine function, which is given by
sin(x) =
∞
j =0
(−1) j x 2j +1
(2j + 1)!
= x −
x 3
3!
+
x 5
5!
−
x 7
7!
+ · · · .
The polynomial approximation to the sine function is poor if only the first term in
the series is used (blue line in Fig. 3.7), but improves as the order of the polynomial
approximation increases. The error in the approximation which is associated with
truncation of the series approximation is called the truncation error.
In our case we know the function values at the grid points, but the derivatives
in the PDEs are unknown. We can use the Taylor series approximation to estimate
the derivatives using finite differences. Ignoring the time dimension for the moment,
and looking only at the spatial derivative, we can estimate the value of the derivative
∂f
(n)
m /∂x, by the Taylor series
f
(n)
m+1 = f
(n)
m + x
∂f
(n)
m
∂x
+
x 2
2
∂ 2 f
(n)
m
∂x 2 +
x 3
6
∂ 3 f
(n)
m
∂x 3 + · · · ,
(3.6)
which gives us the Forward Difference method
∂f
(n)
m
∂x
≈
f
(n)
m+1 − f
(n)
m
x
.
(3.7)
The accuracy of the finite difference approximation is determined by the local truncation error (LTE), which for small values of x is dominated by the leading trun-
T. Torsvik
Fig. 3.7 Taylor series
approximation for the sine
function (black line). Lines in
other colour show how the
approximation improves with
increasing number of terms in
the series
sine function, which is given by
sin(x) =
∞
j =0
(−1) j x 2j +1
(2j + 1)!
= x −
x 3
3!
+
x 5
5!
−
x 7
7!
+ · · · .
The polynomial approximation to the sine function is poor if only the first term in
the series is used (blue line in Fig. 3.7), but improves as the order of the polynomial
approximation increases. The error in the approximation which is associated with
truncation of the series approximation is called the truncation error.
In our case we know the function values at the grid points, but the derivatives
in the PDEs are unknown. We can use the Taylor series approximation to estimate
the derivatives using finite differences. Ignoring the time dimension for the moment,
and looking only at the spatial derivative, we can estimate the value of the derivative
∂f
(n)
m /∂x, by the Taylor series
f
(n)
m+1 = f
(n)
m + x
∂f
(n)
m
∂x
+
x 2
2
∂ 2 f
(n)
m
∂x 2 +
x 3
6
∂ 3 f
(n)
m
∂x 3 + · · · ,
(3.6)
which gives us the Forward Difference method
∂f
(n)
m
∂x
≈
f
(n)
m+1 − f
(n)
m
x
.
(3.7)
The accuracy of the finite difference approximation is determined by the local truncation error (LTE), which for small values of x is dominated by the leading trun-
