You are on page 1of 7

MODULE 2.

2 THE TAYLOR SERIES


PREPARED BY:
ENGR. MARY ABEGAIL P. CADANG
ROUND – OFF ERRORS

 Round – off Errors


- Arise because digital computers cannot represent some quantities exactly.
TWO MAJOR FACETS OF ROUND – OFF ERRORS INVOLVED IN NUMERICAL CALCULATIONS
1. Digital computers have size and precision limits on their ability to represent numbers.
2. Certain numerical manipulations are highly sensitive to round-off errors. This can result from both mathematical
considerations as well as from the way in which computers perform arithmetic operations.
TRUNCATION ERRORS
 Truncation Errors
- Are those that result from using an approximation in place of an exact mathematical procedure.
 Taylor Series
- states that any smooth function can be approximated as a polynomial. It provides a means to express this idea mathematically in a form that
can be used to come up with practical results.
 Complete Taylor Series Expansion:

𝒇′′(𝒙𝒊 ) 𝟐 𝒇′′′(𝒙𝒊 ) 𝟑 𝒇𝒏 𝒙𝒊 𝒏
𝒇 𝒙𝒊+𝟏 = 𝒇 𝒙𝒊 + 𝒇 𝒙𝒊 𝒉 + 𝒉 + 𝒉 + ⋯+ 𝒉
𝟐! 𝟑! 𝒏!
where: 𝒇 𝒙𝒊 - original function
𝒇𝒏 𝒙𝒊 - derived function
h=( 𝒙𝒊+𝟏 - (𝒙𝒊 ))
In the other approach:

𝒇𝒏 (𝒂)
𝒇 𝒙 = ෍ (𝒙 − 𝒂)𝒏
𝒏!
𝒏=𝟎


𝒇"(𝒂) 𝟐
𝒇′′′(𝒂) 𝟑
𝒇𝒏 (𝒂)
=𝒇 𝒂 +𝒇 𝒂 𝒙−𝒂 + (𝒙 − 𝒂) + (𝒙 − 𝒂) + ⋯ + (𝒙 − 𝒂)𝒏
𝟐! 𝟑! 𝒏!
EXAMPLE #1:
 Problem Statement. Use Taylor Series Expansions with n=0 to 6 to approximate 𝑓 𝑥 = cos 𝑥 at 𝑥𝑖+1 = 𝜋/3 on
the basis of the value of 𝑓 𝑥 and its derivatives at 𝑥𝑖 = π/4.

Step 1. Solve for h


𝝅 𝝅 𝝅
𝒉= − =
𝟑 𝟒 𝟏𝟐
Step 2. Solve for the derivatives from 0th to 6th
Order (n) 𝒇𝒏 (𝒙)
0 Cos x
1 - Sin x
2 - Cos x
3 Sin x
4 Cos x
5 - Sin x
6 - Cos x
EXAMPLE #1
Step 3. Solve the results in each term. Note that the statement needs from 0th to 6th term. (n denotes the term)
First Term Second Term
Zeroth Term 𝑓′′(𝑥𝑖 ) 2
𝑓 𝑥𝑖+1 = 𝑓(𝑥𝑖 ) 𝑓′ 𝑥𝑖+1 = 𝑓 𝑥𝑖 + 𝑓 ′ 𝑥𝑖 ℎ 𝑓 ′′ 𝑥𝑖+1
= 𝑓 𝑥𝑖 + 𝑓 ′ 𝑥𝑖 ℎ + ℎ
𝜋 𝜋 2!
𝑓 𝜋/3 = 𝑓(𝜋/4) 𝑓′ 𝜋/3 = 𝑓(𝜋/4) +𝑓 ′ 4 (12) 𝜋 𝜋 𝑓′′(𝜋/4) 𝜋
𝑓′′ 𝜋/3 = 𝑓(𝜋/4) +𝑓 ′ 4 (12) + 2! (12)2
𝑓 𝜋/3 = cos(𝜋/4) π 𝜋 𝜋
𝜋 𝜋 π 𝜋 − cos( ) 𝜋
𝑓′ 𝜋/3 = cos(𝜋/4) + (−sin )( ) 𝑓′′ = cos( ) + (−sin )( ) + 4 ( )2
𝒇 𝝅/𝟑 = 𝟎. 𝟕𝟎𝟕𝟏𝟎𝟔𝟕𝟖𝟏𝟐 4 12 3 4 4 12 2! 12
𝝅 𝝅
Note: use up to 9 decimal places ′
𝒇 𝟑 = 𝟎. 𝟓𝟐𝟏𝟗𝟖𝟔𝟔𝟓𝟖𝟖
′′
𝒇 𝟑 = 𝟎. 𝟒𝟗𝟕𝟕𝟓𝟒𝟒𝟗𝟏𝟒
Note: use up to 9 decimal places
Note: use up to 9 decimal places
Third Term Forth Term
𝑓′′(𝑥𝑖 ) 2 𝑓′′′(𝑥𝑖 ) 3 𝑓′′(𝑥𝑖 ) 2 𝑓′′′(𝑥𝑖 ) 3 𝑓′′′′(𝑥𝑖 ) 4
𝑓 ′′′ 𝑥𝑖+1 = 𝑓 𝑥𝑖 + 𝑓 ′ 𝑥𝑖 ℎ + ℎ + ℎ 𝑓 ′′′′ 𝑥𝑖+1
= 𝑓 𝑥𝑖 + 𝑓 ′ 𝑥𝑖 ℎ + ℎ + ℎ + ℎ
2! 3! 2! 3! 4!
𝜋 𝜋 𝑓′′(𝜋/4) 𝜋 2 𝑓′′′(𝜋/4) 𝜋 3 𝑓′′′′(𝜋/4) 𝜋 4
𝑓′′′ 𝜋/3 = 𝑓(𝜋/4) +𝑓 ′
𝜋 𝜋
( )+
𝑓′′(𝜋/4) 𝜋 2 𝑓′′′(𝜋/4) 𝜋 3
( ) + ( ) 𝑓′′′ 𝜋/3 = 𝑓(𝜋/4) +𝑓 ′ (12) + (12) + 3! (12) + (12)
4 12 2! 12 3! 12 4 2! 4!
𝜋 𝜋 𝜋
𝜋 𝜋 𝜋 𝜋 π 𝜋 − cos( ) 𝜋 sin( ) 𝜋 cos( ) 𝜋
− cos( ) 𝜋 sin( ) 𝜋
𝑓′′′
𝜋 𝜋
= cos( 4 ) + (−sin
π 𝜋
)(12) + 4
(12)2 + 4
(12)3 𝑓′′′′ = cos( 4 ) + (−sin 4 )(12) + 2! (12) + 3! (12) + 4! 4 (12)4
4 2 4 3
3 4 2! 3! 3
𝝅 𝝅
′′′ ′′′′
𝒇 = 𝟎. 𝟒𝟗𝟗𝟖𝟔𝟗𝟏𝟒𝟔𝟗
𝟑 𝒇 𝟑 = 𝟎. 𝟓𝟎𝟎𝟎𝟎𝟕𝟓𝟓𝟎𝟖
Note: use up to 9 decimal places Note: use up to 9 decimal places

REPEAT PROCESS UP TO 6TH TERM


EXAMPLE #1

Step 4. Solve for the true value of 𝑓 𝑥𝑖+1 and compute the Percent Relative Error in each term
𝜋
𝑓 𝑥𝑖+1 = cos = 0.5
3
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛
𝜀𝑡 = 100%
𝑡𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒
0.5 − 0.707106781
𝜀𝑡 = 100%
0.5

𝜺𝒕 = 𝟒𝟏. 𝟒 %
Repeat Process up to 6th term
EXAMPLE #1
Step 5. Tabulate the your answers as a summary
Order (n) 𝒇𝒏 (𝒙) 𝝅
𝒇 𝒙𝒊+𝟏 = 𝒇( ) 𝜺𝒕
𝟑
0 Cos x 0.707106781 41.4 %
1 - Sin x 0.521986659 4.40 %
2 - Cos x 0.497754491 0.449 %
3 Sin x 0.499869147 0.0262 %
4 Cos x 0.500007551 0.00151 %
5 - Sin x 0.500000304 0.0000608 %
6 - Cos x 0.499999988 0.00000244 %
Notice that the derivatives never go to zero as would be the case for a polynomial. Therefore, each additional term results in some
improvement in the estimate. However, also notice how most of the improvement comes with the initial terms. For this case, by the time
we have added the third term, the error is reduced to 0.0262%, which means that we have attained 99.974% of the true value.
Consequently, although the addition of more terms will reduce the error further, the improvement becomes negligible.

You might also like