Upload
alicia-briggs
View
236
Download
2
Embed Size (px)
Citation preview
1
Truncation Error and the Taylor Series
Lecture NotesDr. Rakhmad Arief SiregarUniversiti Malaysia Perlis
Applied Numerical Method for Engineers
Chapter 4
2
Background
Truncation error are those that results from using an approximation in place of an exact mathematical procedure.
A truncation error was introduce 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
3
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
where remainder Rn is defined as
2)(!2
)())(()()( ax
afaxafafxf
...)(!3
)( 3)3(
axaf
nn
n
Raxn
af )(
!
)()(
x
a
nn
n dttfn
txR )(
!
)( )1(
4
Taylor’s Theorem
It is often convenient to simplify the Tailor series by defining a step size h = xi+1 - xi
where remainder Rn is defined as
is a value of x that lies somewhere between xi and xi+1
This value will be discussed later
nni
nii
iii Rhn
xfh
xfh
xfhxfxfxf
!
)(...
!3
)(
!2
)()()()(
)(3
)3(2
1
1)1(
)!1(
)(
n
n
n hn
fR
5
Ex. 4.1 Taylor Approximation of a Polynomial
Use zero-through fourth-order Taylor series expansion to approximate the function
From xi = 0 with h = 1. That is, predict the function’s value at xi+1 = 1
2.125.05.015.01.0)( 234 xxxxxf
6
Ex. 4.1 Taylor Approximation of a Polynomial
Solution 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 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
2.125.05.015.01.0)( 234 xxxxxf
2.1)()( 1 ii xfxf
195.025.02.1)()( 1 hifhxfxf ii
7
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
Truncation error: Et = true value – approximation
Et = 0.2 -0.45 = -0.25 at x= 1
145.05.025.02.1)( 21 hifhhxf i
8
Taylor series expansion
9
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.
10
Ex.4.1x
Find the truncation error in approximating the function
(a)
(b)
(c)
(d)
over the range 0 x 1
xxy )(12
2 2
1)( xxxy
4323 4
1
3
1
2
1)( xxxxxy
323 3
1
2
1)( xxxxy
)1ln()(2 xxy
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
(a)
(b)
5.0)5.0(1 y
375.0)5.0(2
1)5.0()5.0( 2
2 y
405465108.0)5.1ln()1ln()(2 xxy
0094544892.05.0405465108.0 eT
030465108.0375.0405465108.0 eT
12
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
(c)
(d)
416666667.0)5.0(3
1)5.0(
2
1)5.0()5.0( 32
3 y
405465108.0)5.1ln()1ln()(2 xxy
011201559.0416666667.0405465108.0 eT
004423441.0401041667.0405465108.0 eT
401041667.0)5.0(4
1)5.0(
3
1)5.0(
2
1)5.0()5.0( 432
4 y
13
Truncation error
-0.4
-0.2
0
0.2
0.4
0.6
0.8
0 0.2 0.4 0.6 0.8 1 1.2
y(x)
Te1
Te2
Te3
Te4
14
Error Propagation
The purpose of this section is to study how error in numbers can propagate through mathematical functions
Assuming is an approximation of x, we would like to assess the effect of the discrepancy between x and on the value of the function.
We estimate
We can use Taylor can be employed, why?
Dropping the second and high order terms and rearranging yields
x~x~
)~()()~( xfxfxf
...)~(2
)~()~)(~()~()(
xx
xfxxxfxfxf
)~)(~()~()~()( xxxfxfxfxf
15
Error Propagation
Dropping the second and high order terms and rearranging yields
Or can be rewrite as:
where: an estimate of the error of the function
an estimate of the error of x
)~)(~()~()~()( xxxfxfxfxf
)~()~()~( xxxfxf
)~()~()~( xxxfxf
xxx ~~
16
Graphical depiction of the first-order error propagation
17
Error Propagation in a function of a single variable
Given a value of = 2.5 with an error of = 0.01, estimate resulting error in the function f(x) = x3
Solution
We predict for = 2.5
x~
)~()~()~( xxxfxf
x~
1875.0)01.0()5.2(3)~( 2 xf
625.15)5.2( f
x~
1875.0625.15)5.2( f
18
Function of more than one variable
For n independent variable having error following general relationship holds
nn
n xx
fx
x
fx
x
fxxxf ~...~~)~,...,~,~( 2
21
121
nxxx ~,...,~,~ 21
nxxx ~,...,~,~ 21
19
Ex. 4.6x
Modified the question
20
Total Numerical Error
Total Numerical error is the summation of the truncation and round-off errors
To minimize round error is to increase the number of significant figure of the computer
The truncation error can be reduce by decreasing the step size
However the truncation errors are decrease as the round-off errors are increase
In actual cases, such situation relatively uncommon because most computer carry enough significant figures that round-off error do not redominate
21
22
Blunders
Blunders or gross error could attributed to human imperfection
Occurs in computer programs, also can occurs in any stage of mathematical modeling.
Blunders are usually disregarded in discussion of numerical methods
23
Formulation Errors
Formulation or model error relate to incomplete mathematical models.
Ex. A negligible formulation error is the fact that Newton’s second law does not account for relativistic problem.
24
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