0% found this document useful (0 votes)
4 views23 pages

Trunction error

Chapter 4 discusses truncation errors arising from approximations in numerical methods, particularly through the use of Taylor series. It explains Taylor's theorem and provides examples of approximating functions and calculating truncation errors. Additionally, the chapter covers error propagation in mathematical functions and the total numerical error, which includes both truncation and round-off errors.

Uploaded by

AshishYadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views23 pages

Trunction error

Chapter 4 discusses truncation errors arising from approximations in numerical methods, particularly through the use of Taylor series. It explains Taylor's theorem and provides examples of approximating functions and calculating truncation errors. Additionally, the chapter covers error propagation in mathematical functions and the total numerical error, which includes both truncation and round-off errors.

Uploaded by

AshishYadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Chapter 4

Truncation Error and


the Taylor Series

Applied Computational Methods

1
Background

 Truncation error are those that results from


using an approximation in place of an exact
mathematical procedure.
 A truncation error is introduced into
numerical solution because difference
equation only approximates the true value of
the derivative.
 In order to gain insight into the properties of
truncation error, the Taylor function is used.
2
Taylor’s Theorem
 If the function f and its first n+1 derivatives are continuous
on an interval containing a and x, then the value of the
function at x is given by
f (a)

f ( x)  f (a)  f (a)( x  a)  ( x  a) 2
2!
( 3)
f (a)
 ( x  a)3  ...
3!
f ( n ) (a)
 ( x  a) n  Rn
n!
( x  t ) n ( n 1)
x

 where remainder Rn is defined as Rn   f (t )dt


a
n!
3
Taylor’s Theorem
 It is often convenient to simplify the Tailor series by
defining a step size h = xi+1 - xi
f ( xi ) 2 f (3) ( xi ) 3 f ( n ) ( xi ) n
f ( xi 1 )  f ( xi )  f ( xi )h  h  h  ...  h  Rn
2! 3! n!
 where remainder Rn is defined as

f ( n1) ( ) n1
Rn  h
(n  1)!

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


 This value will be discussed later

4
Ex. Taylor Approximation of a Polynomial

 Use zero-through fourth-order Taylor series


expansion to approximate the function

f ( x)  0.1x 0.15x 0.5x 0.25x  1.2


4 3 2

 From xi = 0 with h = 1. That is, predict the


function’s value at xi+1 = 1

5
Ex. 4.1 Taylor Approximation of a Polynomial

 Solution f ( x)  0.1x 4 0.15x3 0.5x 2 0.25x  1.2


 For x = 0 then f(0) = 1.2
 For x = 1 then f(1) = 0.2 this is the true that we are trying
to predict.
 Taylor series approximation with n = 0 f ( xi 1 )  f ( xi )  1.2
 Truncation error: Et = true value – approximation
Et = 0.2 -1.2 = -1.0 at x = 1
 n = 1, the first derivative
 f’(0) = -0.4(0)3- 0.45(0)2 - 1.0(0) - 0.25 = -0.25
 Taylor series approximation with n = 1
f ( xi 1 )  f ( xi )  1.2  0.25h  0.95 if h  1 6
Ex. 4.1 Taylor Approximation of a Polynomial

 Taylor series approximation with n = 1


 Truncation error: Et = true value – approximation
Et = 0.2 - 0.95 = - 0.75 at x = 1
 n = 2, the second derivative
 f’’(0) = -1.2(0)2- 0.9(0) - 1.0 = -1.0
 Taylor series approximation with n = 2

f ( xi 1 )  1.2  0.25h  0.5h2  0.45 if h  1


 Truncation error: Et = true value – approximation
Et = 0.2 -0.45 = -0.25 at x = 1

7
Taylor series expansion

8
Ex. 4.2

 Use Taylor series expansion with n = 0 to 6


to approximate f(x) = cos x, at xi+1 = /3 on
the bases of the value of f(x) and its
derivatives at xi = /4.
 Note this means that h = /3 - /4 = /12.

9
Ex.4.1x
 Find the truncation error in approximating the function
y2 ( x)  ln(1  x)
 (a) y1 ( x)  x
1 2
 (b) y2 ( x)  x  x
2
1 2 1 3
 (c) y3 ( x)  x  x  x
2 3
1 2 1 3 1 4
 (d) y3 ( x)  x  x  x  x
2 3 4
 over the range 0  x  1

10
Ex.4.1x (Solution)

 We consider a representative value of x, x = 0.5, and find the


truncation error. The exact value of the function is given by
y2 ( x)  ln(1  x)  ln(1.5)  0.405465108
 (a) y1 (0.5)  0.5

Te  0.405465108  0.5  0.0094544892


1
 (b) y2 (0.5)  (0.5)  (0.5) 2  0.375
2
Te  0.405465108  0.375  0.030465108

11
Ex.4.1x (Solution)

 We consider a representative value of x, x = 0.5, and find the


truncation error. The exact value of the function is given by
y2 ( x)  ln(1  x)  ln(1.5)  0.405465108
1 1
 (c) y3 (0.5)  (0.5)  (0.5)  (0.5)3  0.416666667
2

2 3
Te  0.405465108  0.416666667  0.011201559

1 1 1
 (d) y4 (0.5)  (0.5)  (0.5)  (0.5)  (0.5) 4  0.401041667
2 3

2 3 4
Te  0.405465108  0.401041667  0.004423441

12
Truncation error

0.8

y(x)
0.6
Te1
Te2
0.4 Te3
Te4

0.2

0
0 0.2 0.4 0.6 0.8 1 1.2

-0.2

-0.4

13
Error Propagation
 The purpose of this section is to study how error in numbers
can propagate through mathematical functions.
 Assuming ~ x is an approximation of x, we would like to assess
the effect of the discrepancy between x and ~ x on the value
of the function.
 We estimate f ( ~
x )  f ( x)  f ( ~
x)

 We can use Taylor series:


f ( ~
x)
~ ~ ~
f ( x)  f ( x )  f ( x )( x  x )  (x  ~
x )  ...
2
 Dropping the second and high order terms and rearranging
yields
f ( x)  f ( ~
x )  f (~ x )  f ( ~
x )( x  ~
x)
14
Error Propagation
 Dropping the second and high order terms and rearranging
yields
f ( x)  f ( ~
x )  f (~
x )  f ( ~
x )( x  ~
x)
 Or it can be rewritten as:

f ( ~
x )  f ( ~
x ) (x  ~
x)

 where
 f ( ~
x )  f ( ~
x ) (x  ~
x ) an estimate of the error of the function

 ~
x  x~
x an estimate of the error of x

15
Graphical depiction of the first-order error propagation

16
Error Propagation in a function of a single variable

 Given a value of ~x = 2.5 with an error of ~x = 0.01,


estimate resulting error in the function f(x) = x3
 Solution
f ( ~
x )  f ( ~
x ) (x  ~
x)

f ( ~
x )  3(2.5) 2 (0.01)  0.1875

f (2.5)  15.625


~
We predict for x = 2.5
f (2.5)  15.625  0.1875
17
Function of more than one variable

 For n independent variable ~ x1 , ~


x2 ,..., ~
xn having
error ~
x1 , ~
x2 ,..., ~
xn the following general relationship holds

~ ~ ~ f ~ f ~ f ~
f ( x1 , x2 ,..., xn )  x1  x2  ...  xn
x1 x2 xn

18
Total Numerical Error

 Total numerical error is the summation of the


truncation and round-off errors.
 To minimize round-off error is to increase the
number of significant figures of the computer.
 The truncation error can be reduce by decreasing
the step size.
 However the truncation errors decrease as the
round-off errors increase.
 In actual cases, such situation relatively uncommon
because most computer carry enough significant
figures that round-off errors do not dominate.

19
20
Gross error

 Gross error could be attributed to human


imperfection.
 Occurs in computer programs, also can occur
in any stage of mathematical modeling.

21
Formulation Errors

 Formulation or model error relate to


incomplete mathematical models.

22
Data uncertainty

 Errors sometimes enter into an analysis


because of uncertainty in the physical data.
 Ex. In the case of falling parachutist
 Our sensor of velocity can overestimate the
velocity, etc.

23

You might also like