Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

The Islamic University of Gaza

Faculty of Engineering
Civil Engineering Department

Numerical Analysis

ECIV 3306

Chapter 4
Truncation Errors and Taylor Series
1

Introduction
Truncation errors
Result when approximations are used to
represent exact mathematical procedure

For example:

Taylor Series - Definition


Mathematical Formulation used widely in numerical
methods to express functions in an approximate
fashion. Taylor Series.
It is of great value in the study of numerical methods.
It provides means to predict a functional value at one
point in terms of:
- the function value
at another point
- its derivatives
3

Taylors Theorem
General Expression
2
( 3)
3
(n)
n
f
'
'
(
x
)
h
f
(
x
)
h
f
(
x
)
h
i
i
i
f ( x i 1) f ( x i ) f ' ( x i )h

.......
Rn
2!
3!
n!

Where:

h xi 1 xi
Rn is the remainder term to account
for all terms from n+1 to infinity.
And

f ( n 1) ( ) n 1
Rn
h
(n 1)!

is a value of x that lies somewhere between xi and xi+1


4

Taylors Theorem
Any smooth function can be approximated as
a polynomial
Zero-order approximation: only true if xi+1 and xi are

very close to each other

f ( xi 1) f ( xi )
First-order approximation: in form of a straight line

f ( xi 1) f ( xi ) f ' ( xi )h
Second-order approximation:
2
f
'
'
(
x
)
h
i
f ( x i 1 ) f ( x i ) f ' ( x i )h
2!

Taylors Theorem - Remainder Term


Remainder Term: What is ?
If Zero-order approximation:

f ( xi 1) f ( xi ) Ro

f ' ( )

Ro
h

Taylor Series - Example


Use zero-order to fourth-order Taylor series expansions
to approximate the function.
f(x)= -0.1x4 0.15x3 0.5x2 0.25x +1.2
From xi = 0 with h =1. Predict the functions value at xi+1 =1.
Solution
f(xi)= f(0)= 1.2 ,
f(xi+1)= f(1) = 0.2 exact solution
Zero- order approx. (n=0) f(xi+1)=1.2

Et = 0.2 1.2 = -1.0

First- order approx. (n=1) f(xi+1)= 0.95

f ( xi 1) f ( xi )
f ( xi 1) f ( xi ) f ' ( xi )h

f '(x ) 0.4x 3 - 0.45 x 2 - x - 0.25 , f ' (0) 0.25


f ( x i 1) 1.2 - 0.25h 0.95
E t 0.2 0.95 - 0.75

Taylor Series - Example

Second- order approximation (n=2) f(xi+1)= 0.45


f ' ' ( x i )h 2
f ( x i 1) f ( x i ) f ( x i )h
2!
'

f ''(x ) -1.2 x 2 - 0.9x -1 , f '' (0) -1


f ( xi 1) 1.2 - 0.25h - 0.5 h 2 0.45
E t 0.2 0.45 - 0.25
Third-order approximation (n=3) f(xi+1)= 0.3
f ''(x i )h 2 f
f (x i 1) f (x i ) f (x i )h

2!

(3)

'

(x ) - 2.4x - 0.9 , f

(x i )h 3
3!

(0) 0.9

f ( xi 1) 1.2 - 0.25h - 0.5 h 2 - 0.15h 3 0.3


E t 0.2 - 0.3 - 0.1

Taylor Series - Example


Fourth-order approximation (n = 4) f(xi+1)= 0.2
f ' ' ( x i ) h 2 f ( 3) ( x i ) h 3 f ( 4 ) ( x i ) h 4
f ( x i 1) f ( x i ) f ( x i )h

2!
3!
4!
'

f( xi+1)= 1.2 - 0.25h - 0.5 h2 0.15h3 0.1h 4= 0.2


Et = 0.2 0.2 = 0
f (5) ( ) 5
R
h
The remainder term (R4) = 0 4
5!
because the fifth derivative of the fourth-order polynomial is
zero.

Approximation using Taylor Series Expansion


The nth-order Approximation

10

Taylor Series
In General, the n-th order Taylor Series will be exact
for n-th order polynomial.
For other differentiable and continuous functions,
such as exponentials and sinusoids, a finite number of
terms will not yield an exact estimate. Each additional
term will contribute some improvement.
Truncation error is decreased by addition of terms to
the Taylor series.
If h is sufficiently small, only a few terms may be
required to obtain an approximation close enough to
the actual value for practical purposes.
11

12

Example 2

13

Example 2

14

Example 2

15

Example 3

16

Example 3
x
3.0
3.2
3.4
3.6
3.8
4.0
4.2
4.4
4.6
4.8
5.0
5.2
5.4
5.6
5.8
6.0
6.2
6.4
6.6
6.8
7.0

h
0.0
0.2
0.4
0.6
0.8
1.0
1.2
1.4
1.6
1.8
2.0
2.2
2.4
2.6
2.8
3.0
3.2
3.4
3.6
3.8
4.0

one term
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170
170

two terms
170.0
234.8
299.6
364.4
429.2
494.0
558.8
623.6
688.4
753.2
818.0
882.8
947.6
1012.4
1077.2
1142.0
1206.8
1271.6
1336.4
1401.2
1466.0

three terms
170.00
244.52
338.48
451.88
584.72
737.00
908.72
1099.88
1310.48
1540.52
1790.00
2058.92
2347.28
2655.08
2982.32
3329.00
3695.12
4080.68
4485.68
4910.12
5354.00

four terms
170.00
245.22
344.05
470.67
629.26
824.00
1059.06
1338.61
1666.83
2047.90
2486.00
2985.30
3549.97
4184.19
4892.14
5678.00
6545.94
7500.13
8544.75
9683.98
10922.00

five terms
170.00
245.24
344.43
472.62
635.41
839.00
1090.16
1396.23
1765.14
2205.37
2726.00
3336.68
4047.63
4869.66
5814.13
6893.00
8118.80
9504.63
11064.18
12811.69
14762.00

six terms
170.00
245.24
344.44
472.69
635.74
840.00
1092.65
1401.61
1775.62
2224.26
2758.00
3388.22
4127.26
4988.47
5986.23
7136.00
8454.34
9958.99
11668.84
13604.04
15786.00

17

Example 3

18

You might also like