0% found this document useful (0 votes)
10 views20 pages

Mws - Gen - Aae - Spe - Pptmeasuringerrors 2

The document discusses the importance of measuring errors in numerical calculations, highlighting true error, relative true error, approximate error, and relative approximate error. It provides examples of calculating these errors using a specific function and outlines how to use absolute relative error as a stopping criterion in iterative algorithms. Additionally, it includes a table of values demonstrating the effects of varying step sizes on the calculated derivative and associated errors.

Uploaded by

Srijita Banerjee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views20 pages

Mws - Gen - Aae - Spe - Pptmeasuringerrors 2

The document discusses the importance of measuring errors in numerical calculations, highlighting true error, relative true error, approximate error, and relative approximate error. It provides examples of calculating these errors using a specific function and outlines how to use absolute relative error as a stopping criterion in iterative algorithms. Additionally, it includes a table of values demonstrating the effects of varying step sizes on the calculated derivative and associated errors.

Uploaded by

Srijita Banerjee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

Measuring Errors

1
Measuring Errors

2
Why measure errors?
1) To determine the accuracy of
numerical results.
2) To develop stopping criteria for
iterative algorithms.

3
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
Example—True Error
The f (x) of a f (x) can be
derivative,
approximated by the function
equation,
f ( x  h)  f ( x)
f ' ( x) 
h

If f ( x) 7e an h 0.3
0. 5 x

a) Find dthe approximate f ' ( 2)


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

5
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
7 e 0 .5 ( 2 .3 )  7 e 0 .5 ( 2 )

0.3
22.107  19.028
 10.263
0.3

6
Example (cont.)
Solution
: b) The exact value f ' ( 2) can be found by
of knowledge of differential
our usingcalculus.
f ( x )  7 e 0.5 x
f ' ( x ) 7 0.5 e 0.5 x
3.5e 0.5 x
So the true value f ' ( 2) is
0.5( 2 )
of f ' ( 2 )  3.5e
9.5140
True error is calculated as
Et  True Value – Approximate
9.Value
5140  10.263  0.722

7
Relative True Error
 Defined as the ratio between the
true error, and the true value.
True Error
Relative True Error(t ) =
True Value

8
Example—Relative True
Error
Following from the previous example for true
error,
find the relative true error f ( x) 7e 0.5 x at f ' (2)
for h 0.3
wit
h From the previous example,
Et  0.722
Relative True Error is defined
as t  True Error
True Value
 0.722
  0.075888
9.5140
as a percentage,
t  0.075888 100%  7.5888%

9
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 E a ) = Present Approximation – Previous
Error ( Approximation

10
Example—Approximate
Error
For f ( x) 7e 0.5 x at x 2 find the
a) f (2) usin h 0.3 following,
b) f (2) gusin h 0.15
c) approximateg error for the f (2) for part
value of
Solution: b)
a) x 2 and h 0.3
For f ' ( x )  f ( x  h )  f ( x )
h
f ( 2  0.3)  f ( 2)
f ' ( 2) 
0.3

11
Example (cont.)
Solution: (cont.)
f (2.3)  f (2)

0.3
7 e 0 .5 ( 2 .3 )  7 e 0 .5 ( 2 )

0.3
22.107  19.028
 10.263
0.3
b) x 2 and h 0.15
For f ' (2) 
f (2  0.15)  f (2)
0.15
f (2.15)  f (2)

0.15

12
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 E a is
error,
Ea Present Approximation – Previous
9Approximation
.8800  10.263
 0.38300

13
Relative Approximate Error
 Defined as the ratio between the
approximate error and the present
approximation.
Approximate Error
Relative Approximate a) =
Error ( Present Approximation

14
Example—Relative Approximate
Error
For f ( x) 7e 0.5 x
at x 2 , find the relative
error using values approximate
h 0.3 and h 0.15
from
Solution:
From Example 3, the approximate f (2) 10.263
value
usin hof
0.3 and f (2) 9.8800 usin h 0.15
g Ea  Present Approximationg– Previous
9Approximation
.8800  10.263
 0.38300

15
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
How is Absolute Relative Error used
as a stopping criterion?
If |a | s wher s is a pre-specified tolerance,
no further e iterations
then 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
Table of Values
0.5 x
For f ( x) 7e at x 2 with varying step h
size,
h f (2) a m
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

18
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

19
THE END

20

You might also like