The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

21
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 4 1 Truncation Errors and Taylor Series

description

The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 4. Truncation Errors and Taylor Series. Introduction. Truncation errors Result when approximations are used to represent exact mathematical procedure - PowerPoint PPT Presentation

Transcript of The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Page 1: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

The Islamic University of Gaza

Faculty of Engineering

Civil Engineering Department

Numerical Analysis

ECIV 3306

Chapter 4

1

Truncation Errors and Taylor Series

Page 2: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Introduction

Truncation errors

• Result when approximations are used to represent exact mathematical procedure

• For example:

2

Page 3: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

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

Page 4: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Taylor’s Theorem

Where:

ii xxh 1

1)1(

)!1(

)(

n

n

n hn

fR

4

n

ni

nii

iiiR

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

Page 5: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Taylor’s Theorem

)()(1 ii

xfxf

!2

)('')()()(

2'

1

hxfhxfxfxf i

iii

hxfxfxf iii)()()( '

1

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

Page 6: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Taylor’s Theorem - Remainder Term

Remainder Term: What is ξ ?

h

Rf o)(' oii

Rxfxf

)()(1

6

If Zero- order approximation:

Page 7: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

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

Et = 0.2 – 1.2 = -1.0

• First- order approx. (n=1) f(xi+1)= 0.95 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

)()(1 ii

xfxf

hxfxfxf iii)()()( '

1

7

Page 8: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

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

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( xi+1)= 1.2 - 0.25h - 0.5 h2 – 0.15h3 = 0.3

Et = 0.2 – 0.3 = -0.1

!2

)('')()()(

2'

1

hxfhxfxfxf i

iii

!3

)(

!2

)('')()()(

3(3)2'

1

hxfhxfhxfxfxf ii

iii

8

Page 9: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

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

)('')()()(

4)4(3)3(2'

1

hxfhxfhxfhxfxfxf iii

iii

5)5(

4 !5

)(h

fR

9

Page 10: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

10

Approximation using Taylor Series Expansion

The nth-order Approximation

Page 11: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

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.

(see example 4.2)

11

Page 12: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Example 4.2

12

Page 13: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

13

Page 14: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Effect of non-linearity

14

Page 15: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

15

Page 16: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

16

Page 17: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

Taylor Series

• 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.

17

Page 18: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

18

Effect of step size

Page 19: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

19

Page 20: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

20

Page 21: The Islamic University of Gaza Faculty of Engineering Civil Engineering Department

21