You are on page 1of 28

I ERROR ANALYSIS

Text: Ch 4

Objective:
Understand:
Measures of Error used in numerical
computation
Causes of Error in Numerical
Computation
Some measure to reduce errors in
computation
2

Introduction
Numerical Analysis:-

Inexact mathematics
Effective together with computer

Source of Error

Machine number representation


Arithmetic Error
Mathematical Approximation

Challenges of NA

Identification of Error
Quantification of Error
Control/limit within pre-specified error
3

1.1 Error Analysis: Measures


of Error

Measures of True Error

Et p p ;

True Error

(1)

p True value ; p Approx.


Absolute Error

E p p ;

(2)

True Relative Error

p p

p
t

(3)

Approximate Error
True value (p)- not available in real problems
(p)- available only when dealing analytically
solvable function
If (p) is not known, use the best approx.
available

Approximate Relative error; for 1 step


Approximat ion Error
process

100%
Approximat ion

p p
Error; for
100%
Approx.
Iterative Process
p
i 1

(4)

(5)

Error Control/Limitation in Numerical Analysis

a s
Criteria

s 0.5 10 2 n %

Scarboroug h

s 10 / 2
Others
s Pr e specified / Tolerable value
n significant number desired
n

Example 1:
Find the Error & Relative Error

a) p 3.142857, p 3.14
b) p 10000 , p 9996,
c) p 0.00002, p 0.000015,
a)

Et 0.002857

b) Et 4
c)

Et 0.000005

t 9.09 10 %
2

t 4 10 %
t 25%
2

Example 2: Function
Approximation
Approximate ex for x=0.5 correct to 3
significant digits, p= e0.5 =1.648721
Function Approx.

x x
x
e 1 x
2! 3! n!
2

Error Criteria
s 0.5 10 23% 0.05%

1.648721 (e )
( )
100%;
1.648721
x

(e ) (e )
( )
100%
(e )
x

i 1

# of Terms

(ex )i

t %

a %

1
2
3
4
5
6

1
1.5
1.625
1.6458333
1.6484375
1.648697917

39.3
9.02
1.44
0.175
0.0172
0.00142

33.3
7.69
1.27
0.158
0.0152

With 6 terms a < s =0.05


Result accurate to 4 significant digits considering 6 terms
9

Significant Digits
Def.: The number of leading digits of an
approximation that is correct to the
corresponding digits in the true value
counting right ward from the 1st non-zero
digit
Indicates the level of Confidence
a ) p 0.222
p 0.2222 3 significant digits
Example:
b) p 35.496
p 35.494 4
c) p 0.0356
p 0.0358 2
10

Relative Error () -An indicator of


the correct number of significant
digits
a)
b)
c)

0.2222 0.222
0.2222
23.494 23.496
23.494

0.9 10 3
0.85 10 4

0.02144 0.02138
0.02144

0.28 10 2

Exp of 10 indicates the # accuracy of the


significant digits
11

1.2 Finite Arithmetic


Def.:
Precision- indicates how repetitive
Accuracy- how near to the actual/true value

12

1.2.1 Causes of Error: Number


systems used In Computers
Limited Range of Numbers (Max and
Min)
Over the realmax- overflow (NaN)
Less than realmin-underflow (0)
Finite number can be Represented
(step b/n numbers x) & Increase with
the number x+ x
Example (hypothetical)
0.125 0.135
0.148
Error Et proportional to x
13

1.2.2 Errors: Due to Chopping


& Rounding
All numbers CANNOT be represented exactly
Error is introduced in numerical computation
Approximation made by Rounding /Chopping
Chopping- # stored to the lower end of
interval
Example- p=0.3333 stored as 0.3125 -0.3430,
x=0.0305, Max Error=- x (Biased!!)
Rounding-# stored to the Lower or Upper
Example- p=0.3333 stored as 0.3125 -0.3430,
x=0.0305, Max Error= x/2 (Unbiased!!)
14

1.3 Finite Precision


Arithmetic
Limited/Finite Numbers
Round off Error (Rounding/Chopping) in
every operation (+ - * /)
Control Remedies
Do smarter computation
Do fewer calculations

Higher precision costs more and time


(double precision instead of single
precision)
15

Example -Smart/Fewer calculations


using 3-digits rounding Arithmetic
Form (a )
P( x) 3 2 x 4 x 7 x 5 x
10 multiplication & 4 additions
2

P (1.25) 5.24
Form (b)
Q ( x) 3 x(2 x(4 x(7 5 x)))
4 multiplication & 4 additions
Q (1.25) 5.29

True value 5.2851625


16

1.3.1

Truncation Error: Replacing

a complex function by a simpler


function
0.5 x
2

Example: f ( x) 0 e dx 0.54498710484 p
Taylor Series
x 4 x 6 x8
x 2n
e Pn ( x) 1 x
2! 3! 4!
n!
x2

4
6
x
x
P6 ( x) 1 x 2 ;
2! 3!

0 .5

x
x
x

P6 dx x

3 2!(5) 3!(7)

0 .5

0.544977678
0

t 0.110 4
17

Order of Approximation O(hn)


Example:

2
3
h
h
e h 1 h O(h 4 )
2! 3!
h2 h4
cos(h) 1 O (h 6 )
2! 4!

Approx. of Sums;
e h cos(h)

h3 h 4
2 h O(h 4 ) O(h 6 )
3! 4!
h3
2 h O(h 4 )
3!

Approx. of Products;
3
h
e cos(h) 1 h O(h 4 )
3!
h

18

1.3.2 Loss of Significance/


Subtractive Cancellation
Example: Evaluate the function using 6
digit rounding for x=500
f ( x) x( x 1 x ) 11.1500
x
b)
g ( x)
11.1748
x 1 x
6 digits True value of a & b 11.1747
a)

g ( x) involves less error 8.95 10 %


f ( x) has a loss factor
0.22%
19

Example: Subtractive
cancellation
Reorder the expressions to obtain a
form that is not sensitive to subtractive cancellation
(a)

x y

(b) ln x ln y
1
(c )
1; x 0
1 x

20

1.4Error Propagation
Results of calculations made with numbers
containing ERROR
Errors due to Ordinary Arithmetic
Operations
x & y True values; x & y Approximat e values
Errors y y E y ; x x E x
Addition
x y ( x E x ) ( y E y ) ( x y ) ( E x E y )
Multiplication
x y ( x E x ) ( y E y ) ( x y ) y E x xE y E x E y

21

Example: Arithmetic Operation Error


Given: x=10/13; y=0.769201; z=98765.9;
w=0.000111111, determine the absolute and the
relative error of the operation using 5 digit
arithmetic
Operation

Exact

(x-y)

2.9769x10-5

(x-y)/w

2.6792x10-1

(x-y)*z

3.0141x10-10

y+z

9.8766669x104

Approx.

Abs. Error

Rel. Error

22

Propagation Error
Large Number computation
Series Computation

x 1 x x
n

Adding small and large numbers


n 10 6

1 / x 1 1 / 4 1 / 9 1.644...877
n

n 1

n 10 6

1 / x 1 / n 1 /( n 1) 1 /( n 2) 1.644...873
n

n 1

23

Error: Single Variable Function


Evaluation
f ( x) func. value for the indep. variable
x an approx. value
Error Estimate f ( x ) f ( x) f ( x )
f ' ( x )( x x ) f ' ( x ) x
Function Value
f ( x) f ( x ) Error

24

Error: More than one Variable


Function Evaluation
Taylor Series
f
f
f ( x, y ) f ( x, y ) ( x x ) ( y y )
x
y
f
f
Error Estimate f ( x , y ) x y
x
y
General
f
f
f
f
f ( x , y , z, t ) x y z t
x
y
z
t
25

Examples
1) If the error introduced with g is g 0.002 m/s when
using g 9.81 m/s . Estimate the error on the mass (m)
2

on a body weighing 1 N.
2) Deflection of cantilever beam subjected to a point load
F at the tip. Estimate the error on the defelection given the
following?
F 500 N
F 1 N
L 1.5 m
L 0.01m
E 2.1 10 N / m E 0.05 10 N / m
11

I 6.6 10 m
8

11

I 0.01 10 m
8

26

1.6Condition
Def.
Sensitivity of the Dependent variable to
Changes in the Independent variable
f ' ( x)
Condition Number x
f ( x)
Cond. #=1, relative error is identical to the
relative
error in x
Cond. #>1, relative error is magnified
|Cond. #|<1, relative error is attenuated
27

1.7Error Control
Not possible to determine exact error
Control Strategies
Avoid subtractive cancellation
Rearrange/ Reformulate the problem
Use extended precision
Add smallest number first
Carry out numerical experiments
For critical numerical computation should be done
by 2 or more independent groups
28

You might also like