Professional Documents
Culture Documents
Lecture 2
1
Introduction
Truncation errors
• For example:
2
Taylor Series - Definition
• Mathematical Formulation used widely in numerical
methods to express functions in an approximate
fashion……. Taylor Series.
3
Taylor’s Theorem
General Expression
2 ( 3) 3 ( n) n
f ' ' ( x ) h f ( x ) h f ( x ) h
f ( x i 1 ) f ( x i ) f ' ( x i )h i
i
....... i
Rn
2! 3! n!
Where:
h xi 1 xi
Rn is the remainder term to account f ( n 1) ( ) n 1
for all terms from n+1 to infinity. Rn h
(n 1)!
2! 5
Taylor’s Theorem - Remainder Term
6
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 function’s 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 f ( xi 1 ) f ( xi )
Et = 0.2 – 1.2 = -1.0
• First- order approx. (n=1) f(xi+1)= 0.95 f ( xi 1 ) f ( xi ) f ' ( xi )h
f(x)= -0.4x3 – 0.45x2 – x – 0.25, f’(0)= -0.25
f( xi+1)= 1.2- 0.25h = 0.95
Et = 0.2 - 0.95 = -0.75
7
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 x2 – 0.9x -1 , f’’(0)= -1
f( xi+1)= 1.2 - 0.25h - 0.5 h2 = 0.45
Et = 0.2 – 0.45 = -0.25
• Third-order approximation (n=3) f(xi+1)= 0.3
f ' ' ( x i ) h 2 f ) 3( ( x i ) h 3
f ( x i 1 ) f ( x i ) f ( x i )h
'
2! 3!
f( xi+1)= 1.2 - 0.25h - 0.5 h2 – 0.15h3 = 0.3
Et = 0.2 – 0.3 = -0.1
8
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!
9
Approximation using Taylor Series Expansion
10
Taylor Series
11
Example 4.2
12
13
Effect of non-linearity
14
15
16
Taylor Series
17
Effect of step size
18
19
20
21