Ch4 Truncation Errors Taylor Series

Post on 14-Jul-2016

41 views 0 download

description

Ch4 Truncation Errors Taylor Series

Transcript of Ch4 Truncation Errors Taylor Series

The Islamic University of Gaza

Faculty of Engineering

Civil Engineering Department

Numerical Analysis

ECIV 3306

Chapter 4

1

Truncation Errors and Taylor Series

Introduction

Truncation errors

• Result when approximations are used to represent exact mathematical procedure

• For example:

2

3

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

- its derivatives at another point

Taylor’s Theorem

Where:

ii xxh 1

1)1(

)!1(

)(

n

n

n hn

fR

4

n

n

i

n

iiiii R

n

hxfhxfhxfhxfxfxf

!

)(.......

!3

)(

!2

)('')()()(

)(3)3(2'

1

General Expression

Rn is the remainder term to account

for all terms from n+1 to infinity.

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

Taylor’s Theorem

)()( 1 ii xfxf

!2

)('')()()(

2'

1

hxfhxfxfxf i

iii

5

Zero-order approximation: only true if xi+1 and xi are very close to each other

First-order approximation: in form of a straight line

Second-order approximation:

Any smooth function can be approximated as

a polynomial

hxfxfxf iii )()()( '

1

Taylor’s Theorem - Remainder Term

Remainder Term: What is ξ?

h

Rf o)(' oii Rxfxf )()1(

6

If Zero-order approximation:

Taylor Series - ExampleUse 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

Et = 0.2 – 1.2 = -1.0

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

)()1( ii xfxf

hxfxfxf iii )()()1( '

7

3 2 '

'( ) 0.4 - 0.45 - - 0.25 , (0) 0.25

( 1) 1.2 - 0.25 0.95

0.2 0.95 - 0.75

i

t

f x x x x f

f x h

E

Taylor Series - Example• Second- order approximation (n=2) f(xi+1)= 0.45

Third-order approximation (n=3) f(xi+1)= 0.3

!2

)('')()()1(

2' hxf

hxfxfxf iiii

2 (3) 3

' ''( ) ( )( 1) ( ) ( )

2! 3!

i i

i i i

f x h f x hf x f x f x h

8

2 ''

2

''( ) -1.2 - 0.9 -1 , (0) -1

( 1) 1.2 - 0.25 - 0.5 0.45

0.2 0.45 - 0.25t

f x x x f

f xi h h

E

3 3

2 3

( ) - 2.4 - 0.9 , (0) 0.9

( 1) 1.2 - 0.25 - 0.5 - 0.15 0.3

0.2 - 0.3 - 0.1t

f x x f

f xi h h h

E

Taylor Series - Example

• Fourth-order approximation (n = 4) f(xi+1)= 0.2

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

Et = 0.2 – 0.2 = 0

The remainder term (R4) = 0

because the fifth derivative of the fourth-order polynomial is zero.

!4

)(

!3

)(

!2

)('')()()1(

4)4(3)3(2' hxfhxfhxf

hxfxfxf iiiiii

5)5(

4!5

)(h

fR

9

10

Approximation using Taylor Series Expansion

The nth-order Approximation

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 ofterms will not yield an exact estimate. Each additionalterm will contribute some improvement.

Truncation error is decreased by addition of terms tothe Taylor series.

If h is sufficiently small, only a few terms may berequired to obtain an approximation close enough tothe actual value for practical purposes.

11

12

13

Example 2

14

Example 2

15

Example 2

16

Example 3

Example 3

17

x h one term two terms three terms four terms five terms six terms3.0 0.0 170 170.0 170.00 170.00 170.00 170.003.2 0.2 170 234.8 244.52 245.22 245.24 245.243.4 0.4 170 299.6 338.48 344.05 344.43 344.44

3.6 0.6 170 364.4 451.88 470.67 472.62 472.693.8 0.8 170 429.2 584.72 629.26 635.41 635.744.0 1.0 170 494.0 737.00 824.00 839.00 840.004.2 1.2 170 558.8 908.72 1059.06 1090.16 1092.654.4 1.4 170 623.6 1099.88 1338.61 1396.23 1401.614.6 1.6 170 688.4 1310.48 1666.83 1765.14 1775.62

4.8 1.8 170 753.2 1540.52 2047.90 2205.37 2224.265.0 2.0 170 818.0 1790.00 2486.00 2726.00 2758.005.2 2.2 170 882.8 2058.92 2985.30 3336.68 3388.225.4 2.4 170 947.6 2347.28 3549.97 4047.63 4127.265.6 2.6 170 1012.4 2655.08 4184.19 4869.66 4988.47

5.8 2.8 170 1077.2 2982.32 4892.14 5814.13 5986.236.0 3.0 170 1142.0 3329.00 5678.00 6893.00 7136.006.2 3.2 170 1206.8 3695.12 6545.94 8118.80 8454.346.4 3.4 170 1271.6 4080.68 7500.13 9504.63 9958.996.6 3.6 170 1336.4 4485.68 8544.75 11064.18 11668.846.8 3.8 170 1401.2 4910.12 9683.98 12811.69 13604.047.0 4.0 170 1466.0 5354.00 10922.00 14762.00 15786.00

18

Example 3