You are on page 1of 5

9/5/2012

http://numericalmethods.eng.usf.edu 1

http://numericalmethods.eng.usf.edu 1
Why measure errors?
1) To determine the accuracy of
numerical results.
2) To develop stopping criteria for
iterative algorithms.

http://numericalmethods.eng.usf.edu 2
True Error
Defined as the difference between the true
value in a calculation and the approximate
value found using a numerical method etc.

True Error = True Value Approximate Value

http://numericalmethods.eng.usf.edu 3
ExampleTrue Error
The derivative,
) (x f '
of a function ) (x f can be
approximated by the equation,
h
x f h x f
x f
) ( ) (
) ( '
+
~
If
x
e x f
5 . 0
7 ) ( = and 3 . 0 = h
a) Find the approximate value of ) 2 ( ' f
b) True value of ) 2 ( ' f
c) True error for part (a)

http://numericalmethods.eng.usf.edu 4
Example (cont.)
Solution:
a) For 2 = x and
3 . 0 = h
3 . 0
) 2 ( ) 3 . 0 2 (
) 2 ( '
f f
f
+
~
3 . 0
) 2 ( ) 3 . 2 ( f f
=
3 . 0
7 7
) 2 ( 5 . 0 ) 3 . 2 ( 5 . 0
e e
=
3 . 0
028 . 19 107 . 22
= 263 . 10 =

http://numericalmethods.eng.usf.edu 5
Example (cont.)
Solution:
b) The exact value of ) 2 ( ' f can be found by using
our knowledge of differential calculus.
x
e x f
5 . 0
7 ) ( =
x
e x f
5 . 0
5 . 0 7 ) ( ' =
x
e
5 . 0
5 . 3 =
) 2 ( 5 . 0
5 . 3 ) 2 ( ' e f =
So the true value of
) 2 ( ' f
is
5140 . 9 =
True error is calculated as
=
t
E
True Value Approximate Value
722 . 0 263 . 10 5140 . 9 = =

http://numericalmethods.eng.usf.edu 6
Relative True Error
Defined as the ratio between the true
error, and the true value.

Relative True Error ( t
e ) =
True Error
True Value
9/5/2012
http://numericalmethods.eng.usf.edu 2

http://numericalmethods.eng.usf.edu 7
ExampleRelative True Error
Following from the previous example for true error,
find the relative true error for
x
e x f
5 . 0
7 ) ( = at
) 2 ( ' f
with 3 . 0 = h
722 . 0 =
t
E
From the previous example,
Value True
Error True
= e
t
Relative True Error is defined as
5140 . 9
722 . 0
= 075888 . 0 =
as a percentage,
% 100 075888 . 0 = e
t
% 5888 . 7 =

http://numericalmethods.eng.usf.edu 8
Approximate Error
What can be done if true values are not
known or are very difficult to obtain?
Approximate error is defined as the
difference between the present
approximation and the previous
approximation.

Approximate Error ( a
E
) = Present Approximation Previous Approximation

http://numericalmethods.eng.usf.edu 9
ExampleApproximate Error
For
x
e x f
5 . 0
7 ) ( = at 2 = x find the following,
a)
) 2 ( f '
using 3 . 0 = h
b)
) 2 ( f '
using 15 . 0 = h
c) approximate error for the value of
) 2 ( f '
for part b)
Solution:
a) For
h
x f h x f
x f
) ( ) (
) ( '
+
~
2 = x and 3 . 0 = h
3 . 0
) 2 ( ) 3 . 0 2 (
) 2 ( '
f f
f
+
~

http://numericalmethods.eng.usf.edu 10
Example (cont.)
3 . 0
) 2 ( ) 3 . 2 ( f f
=
Solution: (cont.)
3 . 0
7 7
) 2 ( 5 . 0 ) 3 . 2 ( 5 . 0
e e
=
3 . 0
028 . 19 107 . 22
= 263 . 10 =
b) For 2 = x and 15 . 0 = h
15 . 0
) 2 ( ) 15 . 0 2 (
) 2 (
'
f f
f
+
~
15 . 0
) 2 ( ) 15 . 2 ( f f
=

http://numericalmethods.eng.usf.edu 11
Example (cont.)
Solution: (cont.)
15 . 0
7 7
) 2 ( 5 . 0 ) 15 . 2 ( 5 . 0
e e
=
15 . 0
028 . 19 50 . 20
= 8800 . 9 =
c) So the approximate error,
a
E is
=
a
E Present Approximation Previous Approximation
263 . 10 8800 . 9 =
38300 . 0 =

http://numericalmethods.eng.usf.edu 12
Relative Approximate Error
Defined as the ratio between the
approximate error and the present
approximation.

Relative Approximate Error (
Approximate Error
Present Approximation
a
e
) =
9/5/2012
http://numericalmethods.eng.usf.edu 3

http://numericalmethods.eng.usf.edu 13
ExampleRelative Approximate Error
For
x
e x f
5 . 0
7 ) ( =
at 2 = x , find the relative approximate
error using values from
3 . 0 = h
and
15 . 0 = h
Solution:
From Example 3, the approximate value of
263 . 10 ) 2 ( = ' f
using
3 . 0 = h
and 8800 . 9 ) 2 ( = ' f using
15 . 0 = h
=
a
E Present Approximation Previous Approximation
263 . 10 8800 . 9 =
38300 . 0 =

http://numericalmethods.eng.usf.edu 14
Example (cont.)
Solution: (cont.)
= e
a
Approximate Error
Present Approximation
8800 . 9
38300 . 0
= 038765 . 0 =
as a percentage,
% 8765 . 3 % 100 038765 . 0 = = e
a
Absolute relative approximate errors may also need to
be calculated,
| 038765 . 0 | = e
a
% 8765 . 3 or 038765 . 0 =

http://numericalmethods.eng.usf.edu 15
How is Absolute Relative Error used as a
stopping criterion?
If
s a
e s e | | where
s
e is a pre-specified tolerance, then
no further iterations are necessary and the process is
stopped.
If at least m significant digits are required to be
correct in the final answer, then
% 10 5 . 0 | |
2 m
a

s e

http://numericalmethods.eng.usf.edu 16
Table of Values
For
x
e x f
5 . 0
7 ) ( =
at 2 = x with varying step size, h
0.3 10.263 N/A 0
0.15 9.8800 3.877% 1
0.10 9.7558 1.273% 1
0.01 9.5378 2.285% 1
0.001 9.5164 0.2249% 2
h
) 2 ( f '
a
e m

http://numericalmethods.eng.usf.edu 17
Propagation of Errors
In numerical methods, the calculations are not
made with exact numbers. How do these
inaccuracies propagate through the calculations?

http://numericalmethods.eng.usf.edu 18
Example 1:
Find the bounds for the propagation in adding two numbers. For example
if one is calculating X +Y where
X = 1.5 0.05
Y = 3.4 0.04
Solution
Maximum possible value of X = 1.55 and Y = 3.44

Maximum possible value of X + Y = 1.55 + 3.44 = 4.99

Minimum possible value of X = 1.45 and Y = 3.36.

Minimum possible value of X + Y = 1.45 + 3.36 = 4.81

Hence
4.81 X + Y 4.99.

9/5/2012
http://numericalmethods.eng.usf.edu 4

http://numericalmethods.eng.usf.edu 19
Propagation of Errors In Formulas
f
n n
X X X X X , ,......., , ,
1 3 2 1
f
n
n
n
n
X
X
f
X
X
f
X
X
f
X
X
f
f A
c
c
+ A
c
c
+ + A
c
c
+ A
c
c
~ A

1
1
2
2
1
1
.......
If is a function of several variables
then the maximum possible value of the error in is

http://numericalmethods.eng.usf.edu 20
Example 2:
The strain in an axial member of a square cross-
section is given by


Given




Find the maximum possible error in the measured
strain.

E h
F
2
e=
N 9 . 0 72 = F
mm 1 . 0 4 = h
GPa 5 . 1 70 = E

http://numericalmethods.eng.usf.edu 21
Example 2:
) 10 70 ( ) 10 4 (
72
9 2 3

e=

6
10 286 . 64

=
286 . 64 =
E
E
h
h
F
F
A
c
e c
+ A
c
e c
+ A
c
e c
e= A
Solution



http://numericalmethods.eng.usf.edu 22
Example 2:
E h F
2
1
=
c
e c
E h
F
h
3
2
=
c
e c
2 2
E h
F
E
=
c
e c
E
E h
F
h
E h
F
F
E h
E A + A + A = A
2 2 3 2
2 1
9
2 9 2 3
9 3 3 9 2 3
10 5 . 1
) 10 70 ( ) 10 4 (
72
0001 . 0
) 10 70 ( ) 10 4 (
72 2
9 . 0
) 10 70 ( ) 10 4 (
1


+



+

=


3955 . 5 =
Thus
Hence
) 3955 . 5 286 . 64 ( e=
Example 3:
Subtraction of numbers that are nearly equal can create unwanted
inaccuracies. Using the formula for error propagation, show that this is true.

Solution
Let

Then





So the relative change is



y x z =
y
y
z
x
x
z
z A
c
c
+ A
c
c
= A
y x A + A = ) 1 ( ) 1 (
y x A + A =
y x
y x
z
z

A + A
=
A

http://numericalmethods.eng.usf.edu 23
Example 3:
For example if

001 . 0 2 = x
001 . 0 003 . 2 = y
| 003 . 2 2 |
001 . 0 001 . 0

+
=
A
z
z
= 0.6667
= 66.67%

http://numericalmethods.eng.usf.edu 24
9/5/2012
http://numericalmethods.eng.usf.edu 5
Additional Resources
For all resources on this topic such as digital audiovisual
lectures, primers, textbook chapters, multiple-choice
tests, worksheets in MATLAB, MATHEMATICA, MathCad
and MAPLE, blogs, related physical problems, please
visit

http://numericalmethods.eng.usf.edu/topics/measuring
_errors.html

THE END



http://numericalmethods.eng.usf.edu


http://numericalmethods.eng.usf.edu 27

You might also like