0% found this document useful (0 votes)
10 views9 pages

taylorsSeries

This chapter revisits Taylor's theorem, explaining its significance in numerical methods and how to express functions as Taylor polynomials. It covers the calculation of function values and error bounds using Taylor series, along with several examples demonstrating the application of the theorem. The chapter emphasizes the importance of knowing the function and its derivatives at a single point to approximate values at other points effectively.

Uploaded by

nurunnabialtair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

taylorsSeries

This chapter revisits Taylor's theorem, explaining its significance in numerical methods and how to express functions as Taylor polynomials. It covers the calculation of function values and error bounds using Taylor series, along with several examples demonstrating the application of the theorem. The chapter emphasizes the importance of knowing the function and its derivatives at a single point to approximate values at other points effectively.

Uploaded by

nurunnabialtair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Chapter 01.

07
Taylor Theorem Revisited

After reading this chapter, you should be able to

1. understand the basics of Taylor’s theorem,


2. write transcendental and trigonometric functions as Taylor’s polynomial,
3. use Taylor’s theorem to find the values of a function at any point, given the values of
the function and all its derivatives at a particular point,
4. calculate errors and error bounds of approximating a function by Taylor series, and
5. revisit the chapter whenever Taylor’s theorem is used to derive or explain numerical
methods for various mathematical procedures.

The use of Taylor series exists in so many aspects of numerical methods that it is imperative
to devote a separate chapter to its review and applications. For example, you must have
come across expressions such as
x2 x4 x6
cos( x) = 1 − + − + (1)
2! 4! 6!
x3 x5 x7
sin( x) = x − + − + (2)
3! 5! 7!
x2 x3
ex = 1+ x + + + (3)
2! 3!
All the above expressions are actually a special case of Taylor series called the Maclaurin
series. Why are these applications of Taylor’s theorem important for numerical methods?
Expressions such as given in Equations (1), (2) and (3) give you a way to find the
approximate values of these functions by using the basic arithmetic operations of addition,
subtraction, division, and multiplication.

Example 1
Find the value of e 0.25 using the first five terms of the Maclaurin series.
Solution
The first five terms of the Maclaurin series for e x is
x2 x3 x4
ex ≈ 1+ x + + +
2! 3! 4!

01.07.1
01.07.2 Chapter 01.07

0.25 2 0.25 3 0.25 4


e 0.25 ≈ 1 + 0.25 + + +
2! 3! 4!
= 1.2840
The exact value of e 0.25 up to 5 significant digits is also 1.2840.
But the above discussion and example do not answer our question of what a Taylor series is.
Here it is, for a function f ( x )
f ′′( x ) 2 f ′′′( x ) 3
f ( x + h ) = f ( x ) + f ′( x )h + h + h + (4)
2! 3!
provided all derivatives of f ( x ) exist and are continuous between x and x + h .

What does this mean in plain English?


As Archimedes would have said (without the fine print), “Give me the value of the function at
a single point, and the value of all (first, second, and so on) its derivatives, and I can give
you the value of the function at any other point”.
It is very important to note that the Taylor series is not asking for the expression of
the function and its derivatives, just the value of the function and its derivatives at a single
point.
Now the fine print: Yes, all the derivatives have to exist and be continuous between x
(the point where you are) to the point, x + h where you are wanting to calculate the function
at. However, if you want to calculate the function approximately by using the n th order
Taylor polynomial, then 1st ,2 nd ,...., n th derivatives need to exist and be continuous in the
closed interval [ x, x + h] , while the (n + 1) th derivative needs to exist and be continuous in
the open interval ( x, x + h) .

Example 2
π 
Take f ( x ) = sin ( x ) , we all know the value of sin   = 1 . We also know the f ′( x ) = cos( x )
2
π  π 
and cos  = 0 . Similarly f ′′( x ) = − sin(x) and sin   = 1 . In a way, we know the value
2 2
π
of sin ( x ) and all its derivatives at x = . We do not need to use any calculators, just plain
2
differential calculus and trigonometry would do. Can you use Taylor series and this
information to find the value of sin (2) ?
Solution
π
x=
2
x+h=2
h = 2− x
π
= 2−
2
= 0.42920
Taylor Theorem Revisited 01.07.3

So
h2 h3 h4
f ( x + h ) = f ( x ) + f ′( x )h + f ′′( x ) + f ′′′( x ) + f ′′′′( x) +
2! 3! 4!
π
x=
2
h = 0.42920
π  π 
f ( x ) = sin ( x ) , f   = sin   = 1
2 2
π 
f ′( x ) = cos( x ) , f ′  = 0
2
π 
f ′′( x ) = − sin ( x ) , f ′′  = −1
2
π 
f ′′′(x ) = − cos(x) , f ′′′  = 0
2
π 
f ′′′′( x ) = sin(x) , f ′′′′  = 1
2
Hence
π π  π  π  h π  h π  h
2 3 4


f  + h  = f   + f  h + f   ′′ ′′

+ f   ′ ′
+ f  ′ ′ +
2  2 2  2  2!  2  3!  2  4!
π 
f  + 0.42920  = 1 + 0(0.42920 ) − 1
(0.42920 )
2
+0
(0.42920 )
3
+1
(0.42920 )
4
+
2  2! 3! 4!
= 1 + 0 − 0.092106 + 0 + 0.00141393 + 
≅ 0.90931
The value of sin (2) I get from my calculator is 0.90930 which is very close to the value I just
obtained. Now you can get a better value by using more terms of the series. In addition, you
can now use the value calculated for sin (2) coupled with the value of cos(2 ) (which can be
calculated by Taylor series just like this example or by using the sin 2 x + cos 2 x ≡ 1 identity)
to find value of sin ( x ) at some other point. In this way, we can find the value of sin ( x ) for
any value from x = 0 to 2π and then can use the periodicity of sin ( x ) , that is
sin ( x ) = sin ( x + 2nπ ), n = 1,2,  to calculate the value of sin ( x ) at any other point.

Example 3
x3 x5 x7
Derive the Maclaurin series of sin ( x ) = x − + − +
3! 5! 7!
Solution
π
In the previous example, we wrote the Taylor series for sin ( x ) around the point x = .
2
Maclaurin series is simply a Taylor series for the point x = 0 .
f ( x ) = sin ( x ) , f (0 ) = 0
01.07.4 Chapter 01.07

f ′( x ) = cos( x ) , f ′(0) = 1
f ′′( x ) = − sin ( x ) , f ′′(0) = 0
f ′′′( x ) = − cos( x ) , f ′′′(0) = −1
f ′′′′( x ) = sin ( x ) , f ′′′′(0 ) = 0
f ′′′′′( x ) = cos(x) , f ′′′′′(0 ) = 1

Using the Taylor series now,


h2 h3 h4 h5
f ( x + h ) = f ( x ) + f ′( x )h + f ′′( x ) + f ′′′( x ) + f ′′′′( x ) + f ′′′′′( x ) + 
2! 3! 4 5
2 3 4
h h h h5
f (0 + h ) = f (0) + f ′(0)h + f ′′(0) + f ′′′(0) + f ′′′′(0) + f ′′′′′(0) + 
2! 3! 4 5
2 3 4 5
h h h h
f (h ) = f (0 ) + f ′(0 )h + f ′′(0 ) + f ′′′(0 ) + f ′′′′(0 ) + f ′′′′′(0 ) + 
2! 3! 4 5
2 3 4 5
h h h h
= 0 + 1(h ) − 0 −1 + 0 +1 +
2! 3! 4 5
3 5
h h
= h− + +
3! 5!
So
x3 x5
f (x ) = x − + −
3! 5!
x3 x5
sin ( x ) = x − + −
3! 5!

Example 4
Find the value of f (6) given that f (4) = 125 , f ′(4) = 74 , f ′′(4) = 30 , f ′′′(4) = 6 and all
other higher derivatives of f ( x ) at x = 4 are zero.
Solution
h2 h3
f ( x + h ) = f ( x ) + f ′( x )h + f ′′( x ) + f ′′′( x ) + 
2! 3!
x=4
h = 6−4
=2
Since fourth and higher derivatives of f ( x ) are zero at x = 4 .
22 23
f (4 + 2 ) = f (4 ) + f ′(4 )2 + f ′′(4 ) + f ′′′(4 )
2! 3!
2  2 
2 3
f (6) = 125 + 74(2) + 30  + 6 
 2!   3! 
= 125 + 148 + 60 + 8
= 341
Taylor Theorem Revisited 01.07.5

Note that to find f (6) exactly, we only needed the value of the function and all its
derivatives at some other point, in this case, x = 4 . We did not need the expression for the
function and all its derivatives. Taylor series application would be redundant if we needed to
know the expression for the function, as we could just substitute x = 6 in it to get the value
of f (6) .
Actually the problem posed above was obtained from a known function
f ( x ) = x 3 + 3 x 2 + 2 x + 5 where f (4) = 125 , f ′(4) = 74 , f ′′(4) = 30 , f ′′′(4) = 6 , and all other
higher derivatives are zero.

Error in Taylor Series


As you have noticed, the Taylor series has infinite terms. Only in special cases such as a
finite polynomial does it have a finite number of terms. So whenever you are using a Taylor
series to calculate the value of a function, it is being calculated approximately.

The Taylor polynomial of order n of a function f (x) with (n + 1) continuous derivatives in


the domain [ x, x + h] is given by
2 n
h
f ( x + h ) = f ( x ) + f ′(x )h + f ' ' (x ) ++ f (n )
(x ) h + Rn ( x + h )
2! n!
where the remainder is given by

Rn ( x + h ) =
(h )n+1 f (n+1) (c ) .
(n + 1)!
where
x<c< x+h
that is, c is some point in the domain ( x, x + h ) .

Example 5
The Taylor series for e x at point x = 0 is given by
x2 x3 x4 x5
ex = 1+ x + + + + +
2! 3! 4! 5!
a) What is the truncation (true) error in the representation of e1 if only four terms of the
series are used?
b) Use the remainder theorem to find the bounds of the truncation error.
Solution
a) If only four terms of the series are used, then
x2 x3
ex ≈ 1+ x + +
2! 3!
12 13
e ≈ 1+1+ +
1

2! 3!
= 2.66667
The truncation (true) error would be the unused terms of the Taylor series, which then are
01.07.6 Chapter 01.07

x4 x5
Et = + +
4! 5!
14 15
= + +
4! 5!
≅ 0.0516152
b) But is there any way to know the bounds of this error other than calculating it
directly? Yes,
hn
f ( x + h ) = f ( x ) + f ( x )h +  + f ( x ) + Rn ( x + h )
′ (n )
n!
where

Rn ( x + h ) =
(h)
n +1
f (n +1) (c ) , x < c < x + h , and
(n + 1)!
c is some point in the domain ( x, x + h ) . So in this case, if we are using four terms of the
Taylor series, the remainder is given by ( x = 0, n = 3)

R3 (0 + 1) =
(1)3+1 f (3+1) (c )
(3 + 1)!
1
= f (4 ) (c )
4!
ec
=
24
Since
x<c< x+h
0 < c < 0 +1
0 < c <1
The error is bound between
e0 e1
< R3 (1) <
24 24
1 e
< R3 (1) <
24 24
0.041667 < R3 (1) < 0.113261
So the bound of the error is less than 0.113261 which does concur with the calculated error
of 0.0516152 .

Example 6
The Taylor series for e x at point x = 0 is given by
x2 x3 x4 x5
ex = 1+ x + + + + +
2! 3! 4! 5!
As you can see in the previous example that by taking more terms, the error bounds decrease
and hence you have a better estimate of e1 . How many terms it would require to get an
approximation of e1 within a magnitude of true error of less than 10 −6 ?
Taylor Theorem Revisited 01.07.7

Solution
Using (n + 1) terms of the Taylor series gives an error bound of

Rn ( x + h ) =
(h )n+1 f (n+1) (c )
(n + 1)!
x = 0, h = 1, f ( x) = e x

Rn (1) =
(1)
n +1
f (n +1) (c )
(n + 1)!
=
(1)
n +1
ec
(n + 1)!
Since
x<c< x+h
0 < c < 0 +1
0 < c <1
1 e
< Rn (1) <
(n + 1)! (n + 1)!
So if we want to find out how many terms it would require to get an approximation of e1
within a magnitude of true error of less than 10 −6 ,
e
< 10 −6
(n + 1)!
(n + 1)!> 10 6 e
(n + 1)!> 10 6 × 3 (as we do not know the value of e but it is less than 3).
n≥9
So 9 terms or more will get e1 within an error of 10 −6 in its value.

We can do calculations such as the ones given above only for simple functions. To
do a similar analysis of how many terms of the series are needed for a specified accuracy for
any general function, we can do that based on the concept of absolute relative approximate
errors discussed in Chapter 01.02 as follows.
We use the concept of absolute relative approximate error (see Chapter 01.02 for
details), which is calculated after each term in the series is added. The maximum value of
m , for which the absolute relative approximate error is less than 0.5 × 10 2− m % is the least
number of significant digits correct in the answer. It establishes the accuracy of the
approximate value of a function without the knowledge of remainder of Taylor series or the
true error.
Multiple-Choice Test
Chapter 01.07
Taylors Series Revisited
1. The coefficient of the x5 term in the Maclaurin polynomial for sin (2 x ) is
(A) 0
(B) 0.0083333
(C) 0.016667
(D) 0.26667

2. Given f (3) = 6 , f ′(3) = 8 , f ′′(3) = 11 , and that all other higher order derivatives of
f ( x ) are zero at x = 3 , and assuming the function and all its derivatives exist and are
continuous between x = 3 and x = 7 , the value of f (7 ) is
(A) 38.000
(B) 79.500
(C) 126.00
(D) 331.50

dy
3. Given that y ( x ) is the solution to= y 3 + 2 , y (0) = 3 the value of y (0.2 ) from a
dx
second order Taylor polynomial written around x = 0 is
(A) 4.400
(B) 8.800
(C) 24.46
(D) 29.00


x 2n n
4. The series ∑ (− 1)
n
4 is a Maclaurin series for the following function
n =0 ( 2n )!
(A) cos(x )
(B) cos(2 x )
(C) sin (x )
(D) sin (2 x )

01.07.1
01.07.2 Chapter 01.07

5. The function
x
2
erf (x ) =
π ∫
−t 2
e dt
0
is called the error function. It is used in the field of probability and cannot be
calculated exactly for finite values of x . However, one can expand the integrand as a
Taylor polynomial and conduct integration. The approximate value of erf (2.0) using
the first three terms of the Taylor series around t = 0 is
(A) -0.75225
(B) 0.99532
(C) 1.5330
(D) 2.8586

6. Using the remainder of Maclaurin polynomial of nth order for f ( x ) defined as


x n +1 ( n +1 )
Rn ( x ) = f (c ), n ≥ 0, 0 ≤ c ≤ x
(n + 1)!
the least order of the Maclaurin polynomial required to get an absolute true error of at
most 10−6 in the calculation of sin (0.1) is (do not use the exact value of sin(0.1) or
cos(0.1) to find the answer, but the knowledge that |sin( x)| ≤ 1 and | cos( x) |≤ 1 ).
(A) 3
(B) 5
(C) 7
(D) 9

For a complete solution, refer to the links at the end of the book.

You might also like