where x
0
and x ∈ [a, b], f
0
(x) is a fir st-order derivative of f (x), f ″(x) is a second-order
derivative of f (x) and so on. The Taylor expansion for e
x
can be derived by setting
f (x)=e
x
and expanding this function about x
0
= 0 using the Taylor series. The
Taylor series repres entation of functions is an extremely useful tool for approxima-
ting functions and thereby deriving numerical methods of solution. Because the
series is infinite, only a finite number of initial terms can be retained for approxima-
ting the solution. The higher-order terms usually contribute negligibly to the final
sum and can be justifiably discarded. Often, series approximations of functions
require only the first few terms to generate the desired accuracy. In other words,
the series is truncated, and the error in the approximation depends on the discarded
terms and is called the truncation error. The Taylor series truncated to the nth order
term can exactly represent an nth-order polynomial. However, an infinite Taylor
series is required to converge exactly to a non-polynomial function.
Since the function value is known at x
0
and we are trying to obtain the function
value at x, the difference, x – x
0
, is called the step size, which we denote as the
independent variable h. As you will see, the step size plays a key role in determining
both the truncation error and the round-off error in the final solution. Let’s rewrite
the Taylor series expansion in terms of the powers of h:
fxðÞ¼fx
0
ðÞþf
0
x
0
ðÞh þ
f
00
x
0
ðÞh
2
2!
þ
f
000
x
0
ðÞh
3
3!
þþ
f
n
x
0
ðÞh
n
n!
þ: (1:12)
As the step size h is gradually decreased when evaluating f (x), the higher-order terms
are observed to diminish much faster than the lower-order terms due to the dependency
of the higher-order terms on larger powers of h.ThisisdemonstratedinExamples 1.10
and 1.11. We can list two possible methods to reduce the truncation error:
(1) reduce the step size h, and/or
(2) retain as many terms as possible in the series approximation of the function.
While both these possibilities will reduce the truncation error, they can increase the
round-off error. As h is decreased, the higher-order terms greatly diminish in value.
This can lead to the addition operation of small numbers to large numbers or
subtractive cancellation, especially in an alternating series in which some terms are
added while others are subtracted such as in the following sine series:
sin x ¼ x
x
3
3!
þ
x
5
5!
x
7
7!
þ: (1:13)
One way to curtail loss in accuracy due to addition of large quantities to small
quantities is to sum the small terms first, i.e. sum the terms in the series backwards.
Reducing the step size is usually synonymous with an increased number of
computational steps: more steps must be “climbed” before the desired function
value at x is obtained. Increased computations, either due to reduction in step size
or increased number of terms in the series, will generally increase the round-off error.
There is a trade-off between reducing the truncation error and limiting the round-off error, despite the
fact that these two sources of error are independent from each other in origin.
We will explore the nature and implications of these two error types when
evaluating functions numerically in the next few examples.
The Taylor series can be rewritten as a finite series with a remainder term R
n
:
fx
0
þ hðÞ¼fx
0
ðÞþf
0
x
0
ðÞh þ
f
00
x
0
ðÞh
2
2!
þ
f
000
x
0
ðÞh
3
3!
þþ
f
n
x
0
ðÞh
n
n!
þ R
n
(1:14)
27
1.6 Taylor series and truncation error