...

Taylor series

by taratuta

on
Category: Documents
116

views

Report

Comments

Transcript

Taylor series
SERIES AND LIMITS
4.6 Taylor series
Taylor’s theorem provides a way of expressing a function as a power series in x,
known as a Taylor series, but it can be applied only to those functions that are
continuous and differentiable within the x-range of interest.
4.6.1 Taylor’s theorem
Suppose that we have a function f(x) that we wish to express as a power series
in x − a about the point x = a. We shall assume that, in a given x-range, f(x)
is a continuous, single-valued function of x having continuous derivatives with
respect to x, denoted by f (x), f (x) and so on, up to and including f (n−1) (x). We
shall also assume that f (n) (x) exists in this range.
From the equation following (2.31) we may write
a+h
f (x) dx = f(a + h) − f(a),
a
where a, a + h are neighbouring values of x. Rearranging this equation, we may
express the value of the function at x = a + h in terms of its value at a by
a+h
f (x) dx.
(4.15)
f(a + h) = f(a) +
a
A first approximation for f(a + h) may be obtained by substituting f (a) for
f (x) in (4.15), to obtain
f(a + h) ≈ f(a) + hf (a).
This approximation is shown graphically in figure 4.1. We may write this first
approximation in terms of x and a as
f(x) ≈ f(a) + (x − a)f (a),
and, in a similar way,
f (x) ≈ f (a) + (x − a)f (a),
f (x) ≈ f (a) + (x − a)f (a),
and so on. Substituting for f (x) in (4.15), we obtain the second approximation:
a+h
[ f (a) + (x − a)f (a)] dx
f(a + h) ≈ f(a) +
a
≈ f(a) + hf (a) +
h2 f (a).
2
We may repeat this procedure as often as we like (so long as the derivatives
of f(x) exist) to obtain higher-order approximations to f(a + h); we find the
136
4.6 TAYLOR SERIES
f(x)
Q
R
hf (a)
P
f(a)
θ
h
a
a+h
x
Figure 4.1 The first-order Taylor series approximation to a function f(x).
The slope of the function at P , i.e. tan θ, equals f (a). Thus the value of the
function at Q, f(a + h), is approximated by the ordinate of R, f(a) + hf (a).
(n − 1)th-order approximation§ to be
f(a + h) ≈ f(a) + hf (a) +
h2 hn−1 (n−1)
f (a) + · · · +
f
(a).
2!
(n − 1)!
(4.16)
As might have been anticipated, the error associated with approximating f(a+h)
by this (n − 1)th-order power series is of the order of the next term in the series.
This error or remainder can be shown to be given by
Rn (h) =
hn (n)
f (ξ),
n!
for some ξ that lies in the range [a, a + h]. Taylor’s theorem then states that we
may write the equality
f(a + h) = f(a) + hf (a) +
h2 h(n−1) (n−1)
f (a) + · · · +
f
(a) + Rn (h).
2!
(n − 1)!
(4.17)
The theorem may also be written in a form suitable for finding f(x) given
the value of the function and its relevant derivatives at x = a, by substituting
§
The order of the approximation is simply the highest power of h in the series. Note, though, that
the (n − 1)th-order approximation contains n terms.
137
SERIES AND LIMITS
x = a + h in the above expression. It then reads
f(x) = f(a) + (x − a)f (a) +
(x − a)2 (x − a)n−1 (n−1)
f (a) + · · · +
f
(a) + Rn (x),
2!
(n − 1)!
(4.18)
where the remainder now takes the form
Rn (x) =
(x − a)n (n)
f (ξ),
n!
and ξ lies in the range [a, x]. Each of the formulae (4.17), (4.18) gives us the
Taylor expansion of the function about the point x = a. A special case occurs
when a = 0. Such Taylor expansions, about x = 0, are called Maclaurin series.
Taylor’s theorem is also valid without significant modification for functions
of a complex variable (see chapter 24). The extension of Taylor’s theorem to
functions of more than one variable is given in chapter 5.
For a function to be expressible as an infinite power series we require it to be
infinitely differentiable and the remainder term Rn to tend to zero as n tends to
infinity, i.e. limn→∞ Rn = 0. In this case the infinite power series will represent the
function within the interval of convergence of the series.
Expand f(x) = sin x as a Maclaurin series, i.e. about x = 0.
We must first verify that sin x may indeed be represented by an infinite power series. It is
easily shown that the nth derivative of f(x) is given by
nπ .
f (n) (x) = sin x +
2
Therefore the remainder after expanding f(x) as an (n − 1)th-order polynomial about
x = 0 is given by
xn
nπ ,
Rn (x) =
sin ξ +
n!
2
where ξ lies in the range [0, x]. Since the modulus of the sine term is always less than or
equal to unity, we can write |Rn (x)| < |xn |/n!. For any particular value of x, say x = c,
Rn (c) → 0 as n → ∞. Hence limn→∞ Rn (x) = 0, and so sin x can be represented by an
infinite Maclaurin series.
Evaluating the function and its derivatives at x = 0 we obtain
f(0) = sin 0 = 0,
f (0) = sin(π/2) = 1,
f (0) = sin π = 0,
f (0) = sin(3π/2) = −1,
and so on. Therefore, the Maclaurin series expansion of sin x is given by
sin x = x −
x5
x3
+
− ··· .
3!
5!
Note that, as expected, since sin x is an odd function, its power series expansion contains
only odd powers of x. 138
4.6 TAYLOR SERIES
We may follow a similar procedure to obtain a Taylor series about an arbitrary
point x = a.
Expand f(x) = cos x as a Taylor series about x = π/3.
As in the above example, it is easily shown that the nth derivative of f(x) is given by
nπ .
f (n) (x) = cos x +
2
Therefore the remainder after expanding f(x) as an (n − 1)th-order polynomial about
x = π/3 is given by
(x − π/3)n
nπ ,
Rn (x) =
cos ξ +
n!
2
where ξ lies in the range [π/3, x]. The modulus of the cosine term is always less than or
equal to unity, and so |Rn (x)| < |(x − π/3)n |/n!. As in the previous example, limn→∞ Rn (x) =
0 for any particular value of x, and so cos x can be represented by an infinite Taylor series
about x = π/3.
Evaluating the function and its derivatives at x = π/3 we obtain
f(π/3) = cos(π/3) = 1/2,
√
f (π/3) = cos(5π/6) = − 3/2,
f (π/3) = cos(4π/3) = −1/2,
and so on. Thus the Taylor series expansion of cos x about x = π/3 is given by
2
√
1 x − π/3
1
3
cos x = −
x − π/3 −
+ ··· . 2
2
2
2!
4.6.2 Approximation errors in Taylor series
In the previous subsection we saw how to represent a function f(x) by an infinite
power series, which is exactly equal to f(x) for all x within the interval of
convergence of the series. However, in physical problems we usually do not want
to have to sum an infinite number of terms, but prefer to use only a finite number
of terms in the Taylor series to approximate the function in some given range
of x. In this case it is desirable to know what is the maximum possible error
associated with the approximation.
As given in (4.18), a function f(x) can be represented by a finite (n − 1)th-order
power series together with a remainder term such that
f(x) = f(a) + (x − a)f (a) +
(x − a)2 (x − a)n−1 (n−1)
f (a) + · · · +
f
(a) + Rn (x),
2!
(n − 1)!
where
(x − a)n (n)
f (ξ)
n!
and ξ lies in the range [a, x]. Rn (x) is the remainder term, and represents the error
in approximating f(x) by the above (n − 1)th-order power series. Since the exact
Rn (x) =
139
SERIES AND LIMITS
value of ξ that satisfies the expression for Rn (x) is not known, an upper limit on
the error may be found by differentiating Rn (x) with respect to ξ and equating
the derivative to zero in the usual way for finding maxima.
Expand f(x) = cos x as a Taylor series about x = 0 and find the error associated with
using the approximation to evaluate cos(0.5) if only the first two non-vanishing terms are
taken. (Note that the Taylor expansions of trigonometric functions are only valid for angles
measured in radians.)
Evaluating the function and its derivatives at x = 0, we find
f(0) = cos 0 = 1,
f (0) = − sin 0 = 0,
f (0) = − cos 0 = −1,
f (0) = sin 0 = 0.
So, for small |x|, we find from (4.18)
x2
.
2
Note that since cos x is an even function, its power series expansion contains only even
powers of x. Therefore, in order to estimate the error in this approximation, we must
consider the term in x4 , which is the next in the series. The required derivative is f (4) (x)
and this is (by chance) equal to cos x. Thus, adding in the remainder term R4 (x), we find
cos x ≈ 1 −
cos x = 1 −
x2
x4
+
cos ξ,
2
4!
where ξ lies in the range [0, x]. Thus, the maximum possible error is x4 /4!, since cos ξ
cannot exceed unity. If x = 0.5, taking just the first two terms yields cos(0.5) ≈ 0.875 with
a predicted error of less than 0.002 60. In fact cos(0.5) = 0.877 58 to 5 decimal places. Thus,
to this accuracy, the true error is 0.002 58, an error of about 0.3%. 4.6.3 Standard Maclaurin series
It is often useful to have a readily available table of Maclaurin series for standard
elementary functions, and therefore these are listed below.
x5
x7
x3
+
−
+ · · · for −∞ < x < ∞,
3!
5!
7!
2
4
6
x
x
x
cos x = 1 −
+
−
+ · · · for −∞ < x < ∞,
2!
4!
6!
x5
x7
x3
tan−1 x = x −
+
−
+ · · · for −1 < x < 1,
3
5
7
2
3
x
x4
x
ex = 1 + x +
+
+
+ · · · for −∞ < x < ∞,
2!
3!
4!
2
3
4
x
x
x
ln(1 + x) = x −
+
−
+ · · · for −1 < x ≤ 1,
2
3
4
x3
x2
(1 + x)n = 1 + nx + n(n − 1) + n(n − 1)(n − 2) + · · · for −∞ < x < ∞.
2!
3!
sin x = x −
140
Fly UP