Professional Documents
Culture Documents
What Is The Error ? How It Is Happened ?
What Is The Error ? How It Is Happened ?
How it is happened ?
1
Definition
• The Error in a computed quantity is defined
as:
4
Source of Error
• Truncation Error
– Caused by approximation used in the
mathematical formula of the scheme
• Round-off Error
– Caused by the limited number of digits that
represent numbers in a computer and
– The ways numbers are stored and additions and
substractions are performed in a computer
5
Background of
The Truncation Error
• Numerical solutions are mostly approximations for
exact solution
• Most numerical methods are based on approximating
function by polynomials
• How accurately the polynomial is approximating the
true function ?
• Comparing the polynomial to the exact solution it
becames possible to evaluate the error, called
truncation error
6
Taylor Series
• The most important polynomials used to derived
numerical schemes and analyze truncation errors
• With an infinite power series, it is exactly represents a
function within a certain radius about a given point
7
Taylor’s Theorem
(See Introduction to Real Analysis
by Bartle and Sherbert for proves)
which use the first two, three, four and five and
evaluate for x= 0.5, respectively.
Answer:
e 1 x ( x )
x 2 h x0
2
x x
e 1 x ( x )
x 3
2!
2 3
x x
e 1 x ( x 4 )
x
2! 3!
2 3 4
x x x
e x 1 x ( x 5 )
2! 3! 4! 12
e 0.5 1.648721..
e 0 .5
1.625 ( x )
3
( x ) 0.023721..
3
e 0 .5
1.64583.. ( x )
4
( x ) 0.002887..
4
e 0 .5
1.64843.. ( x )
5
( x ) 0.0002837..
5
13
Example 2:
Find the Taylor expansion of e about x0 0.25
x
which use the first two, three, four and five and
evaluate for x= 0.5, respectively.
Answer:
e x e 0.25 he 0.25 (h 2 ) h x 0.25
2
h 0.25 0.25
e e he e (h )
x 0.25 0.25 3
2!
2 3
h 0.25 h 0.25
e e he e e (h 4 )
x 0.25 0.25
2! 3!
2 3 4
h h h
e x e 0.25 he 0.25 e 0.25 e 0.25 e 0.25 ( h 5
)
2! 3! 4! 14
e 0 .5
1.60503.. (h )
2
(h ) 0.04368...
2
15
Summary from example 1 and 2:
Order of x0 0, h 0.5 x0 0.25, h 0.25 Ratio
Trunc. Er.
( h 2 ) 0.14872.. 0.04368.. 3.4
( h )
3 0.023721.. 0.00356.. 6.66
( h )
4 0.002887.. 2.1988..e-04 13.13
16
Numbers on Computers
• Computers do not use the decimal system in
computations and memory but use the binary
system
• It caused by computer memory consists of a
huge number of electronic and magnetic
recording devices, of which each element has
only “on” and “off” statuses
17
• Example: In a single precision, 4 bytes, or equivalently
32 bits, are used to store one real number. If a decimal
number is given by input, it first converted to the
closest binary in the normalized format:
0.abbbbb...bbb 2 x2 z
18
Numbers Store in Computer’s Memory for
Single Precision (IBM 370)
1 1111111
11111111
11111111
11111111
s e (7 bits ) m (24 bits )
21
• Double Precision (IBM 370)
In a double precision, 8 bytes, or equivalently 64
bits, are used to store one real number. In this
format 1 bit is used for sign, 7 bits are used for
exponent, and 56 bits are used for mantissa.
• Grouping
when the small numbers are computed, e.g. addition,
substraction, etc., grouping them helps to reduce
round-off errors. For example, to add 0.00001 to
unity ten thousand times one can grouped into 100
groups and each group consists of 100 small values.
22
• Taylor Expansions
as approaches 0, accuracy of a numerical
evaluation for
sin(1 ) sin(1)
f ( )
becomes very poor because round-off errors. By
using Taylor expansion, we can rewrite the equation
so that the accuracy for is improved as
2
f ( ) cos(1) 0.5 sin(1)
23
• Rewriting the equation to avoid substraction
consider the equation of
f ( x) x x 1 x
for an increasing of values x, the calculation of the
equation above has a loss-of-significance error.
To avoid this error one can reformulate it to get
x
f ( x)
x 1 x
24