100% found this document useful (1 vote)
228 views20 pages

Measuring Errors

The document discusses different types of errors in numerical calculations: 1) True error is the difference between the true value and approximate value found using numerical methods. 2) Relative true error is the ratio of the true error to the true value. 3) Approximate error is the difference between the present approximation and previous approximation. 4) Relative approximate error is the ratio of the approximate error to the present approximation. Measuring errors helps determine accuracy and develop stopping criteria for iterative algorithms.
Copyright
© Attribution Non-Commercial (BY-NC)
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
100% found this document useful (1 vote)
228 views20 pages

Measuring Errors

The document discusses different types of errors in numerical calculations: 1) True error is the difference between the true value and approximate value found using numerical methods. 2) Relative true error is the ratio of the true error to the true value. 3) Approximate error is the difference between the present approximation and previous approximation. 4) Relative approximate error is the ratio of the approximate error to the present approximation. Measuring errors helps determine accuracy and develop stopping criteria for iterative algorithms.
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 20

Measuring Errors

Major: All Engineering Majors

Authors: Autar Kaw, Luke Snyder


http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates

1/11/2010 http://numericalmethods.eng.usf.edu 1
Measuring Errors

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

3 http://numericalmethods.eng.usf.edu
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

4 http://numericalmethods.eng.usf.edu
Example—True Error
The derivative, f ′(x) of a function f (x) can be
approximated by the equation,
f ( x + h) − f ( x)
f ' ( x) ≈
h

If f ( x) = 7e and h = 0.3
0.5 x

a) Find the approximate value of f ' (2)


b) True value of f ' (2)
c) True error for part (a)

5 http://numericalmethods.eng.usf.edu
Example (cont.)
Solution:
a) For x = 2 and h = 0.3
f ( 2 + 0.3) − f ( 2)
f ' ( 2) ≈
0.3
f (2.3) − f (2)
=
0.3
7e 0.5( 2.3) − 7e 0.5( 2 )
=
0.3
22.107 − 19.028
= = 10.263
0.3

6 http://numericalmethods.eng.usf.edu
Example (cont.)
Solution:
b) The exact value of f ' (2) can be found by using
our knowledge of differential calculus.
f ( x) = 7e 0.5 x
f ' ( x ) = 7 × 0.5 × e 0.5 x
= 3.5e 0.5 x
So the true value of f ' ( 2) is
f ' ( 2) = 3.5e 0.5( 2 )
= 9.5140
True error is calculated as
Et = True Value – Approximate Value
= 9.5140 − 10.263 = −0.722

7 http://numericalmethods.eng.usf.edu
Relative True Error
 Defined as the ratio between the true
error, and the true value.
True Error
Relative True Error ( ∈t ) =
True Value

8 http://numericalmethods.eng.usf.edu
Example—Relative True Error
Following from the previous example for true error,
find the relative true error for f ( x) = 7e 0.5 x at f ' (2)
with h = 0.3
From the previous example,
Et = −0.722
Relative True Error is defined as
True Error
∈t =
True Value
− 0.722
= = −0.075888
9.5140
as a percentage,
∈t = −0.075888 × 100% = −7.5888%

9 http://numericalmethods.eng.usf.edu
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 ( E a ) = Present Approximation – Previous Approximation

10 http://numericalmethods.eng.usf.edu
Example—Approximate Error
For f ( x) = 7e 0.5 x at x = 2 find the following,
a) f ′(2) using h = 0.3
b) f ′(2) using h = 0.15
c) approximate error for the value of f ′(2) for part b)
Solution:
a) For x = 2 and h = 0.3
f ( x + h) − f ( x)
f ' ( x) ≈
h
f ( 2 + 0.3) − f ( 2)
f ' ( 2) ≈
0.3

11 http://numericalmethods.eng.usf.edu
Example (cont.)
Solution: (cont.)
f (2.3) − f (2)
=
0.3
7e 0.5( 2.3) − 7e 0.5( 2 )
=
0.3
22.107 − 19.028
= = 10.263
0.3
b) For x = 2 and h = 0.15
f (2 + 0.15) − f (2)
f ' ( 2) ≈
0.15
f (2.15) − f (2)
=
0.15

12 http://numericalmethods.eng.usf.edu
Example (cont.)
Solution: (cont.)
7e 0.5( 2.15) − 7e 0.5( 2 )
=
0.15
20.50 − 19.028
= = 9.8800
0.15

c) So the approximate error, E a is


Ea = Present Approximation – Previous Approximation
= 9.8800 − 10.263
= −0.38300

13 http://numericalmethods.eng.usf.edu
Relative Approximate Error
 Defined as the ratio between the
approximate error and the present
approximation.
Approximate Error
Relative Approximate Error ( ∈a) =
Present Approximation

14 http://numericalmethods.eng.usf.edu
Example—Relative Approximate Error
For f ( x) = 7e 0.5 x
at x = 2 , find the relative approximate
error using values from h = 0.3 and h = 0.15
Solution:
From Example 3, the approximate value of f ′(2) = 10.263
using h = 0.3 and f ′(2) = 9.8800 using h = 0.15
Ea = Present Approximation – Previous Approximation
= 9.8800 − 10.263
= −0.38300

15 http://numericalmethods.eng.usf.edu
Example (cont.)
Solution: (cont.)
Approximate Error
∈a =
Present Approximation
− 0.38300
= = −0.038765
9.8800
as a percentage,
∈a = −0.038765 × 100% = −3.8765%

Absolute relative approximate errors may also need to


be calculated,
∈a =| −0.038765 | = 0.038765 or 3.8765 %

16 http://numericalmethods.eng.usf.edu
How is Absolute Relative Error used as a
stopping criterion?
If |∈a | ≤ ∈s where ∈s 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
|∈a |≤ 0.5 × 10 2−m %

17 http://numericalmethods.eng.usf.edu
Table of Values
For f ( x) = 7e at x = 2 with varying step size, h
0.5 x

h f ′(2) ∈a m
0.3 10.263 N/A 0

0.15 9.8800 0.038765% 3

0.10 9.7558 0.012731% 3

0.01 9.5378 0.024953% 3

0.001 9.5164 0.002248% 4

18 http://numericalmethods.eng.usf.edu
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

You might also like