Numerical Errors - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Numerical Errors

Description:

Mantissa or significand represents ... The mantissa is specified in the last three places. 1 x 2-1 0 x 2 ... numbers are developed by increasing the mantissa: ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 51
Provided by: Dal9150
Category:

less

Transcript and Presenter's Notes

Title: Numerical Errors


1
Numerical Errors
  • Class 3

2
Errors
  • Error concept is so important to the effective
    use of numerical methods.
  • For many applied engineering problems the
    analytical solution cannot be found.

3
Significant Figures or Digits
  • Significant digits are those that can be used
    with confidence.
  • They correspond to the number of certain digits
    plus one estimated digit.
  • Numerical methods yield approximate results.

4
Significant Figures or Digits
  • ? cannot be expressed exactly by a limited number
    of digits.
  • 3.141592653897932846 ...

5
Accuracy and Precision
  • Error associated with both calculations and
    measurements can be characterized with regard to
    their accuracy and precision.

6
Accuracy and Precision
  • Accuracy refers to how closely a computed or
    measured values agree with the true values.
  • Precision refers to how closely individual
    computed or measured values agree with others.

7
b) Accurate and imprecise
a) Inaccurate and imprecise
d) Accurate and precise
c) Inaccurate and precise
8
Error Definitions
Numerical errors arise from the use of
approximations to represent exact mathematical
operations and quantities.
9
Error Definitions
  • The relationship between the exact, or true value
    and approximation can be formulated as

TRUE VALUE APPROXIMATION ERROR
Et True value - Approximation
Where Et the exact value of the error. t
subscript indicates that this is the true error
10
Error Definitions
  • The exact value of the error takes no account of
    the order of magnitude of the value under
    examination.

Example
  • An error of a centimeter is much more significant
    if we are measuring a rivet rather than a bridge.

11
The True Percent Relative Error
One solution can be to normalize the error to
the true value and obtain the true percent
relative error (?t)
12
Example Obtain the true percent relative error
  • Measuring
  • The true length of the bridge is 10,000 cm.
  • The true length of the rivet 9 cm.
  • The measuring was 9999 and 9 cm, respectively.

13
Example Obtain the true percent relative error
True error Et(bridge) 10,000 9,999 1
cm Et(rivet) 10 9 1 cm
Et(bridge) Et(rivet) ?t(bridge) lt ?t (rivet)
True percent relative error ?t(bridge) (1/
(10,000)) 100 0.01 ?t(rivet) (1/ (10))
100 10
14
Error Definitions
For Numerical Methods, the true value (Et ) and
the true percent relative errors (?t) will be
known only when we deal with functions that can
be solved analytically.
Note In real-world applications the true
answers will not be known a priori.

15
Approximate Percent Relative Error
Normalize the error using the best available
estimate of the true value.

?a Approximate percent relative error.
16
Error Definitions
  • ?a can be positive or negative,
  • Usually absolute error is employed when
    relative errors are used.

?a
17
Stopping Criterion
The computation is repeated until ?a
lt ?s
  • ?a absolute error is related to
    the number of significant figures in the
    approximation.
  • ?s is the desired percent relative
    error.

18
Stopping Criterion
?s (0.5 x 102-n)
(Scarborough, 1996)
  • ?s is the desired percent relative error.
  • n is the number of significant figures.

19
Example of Error Estimates for Iterative Methods
  • The exponential can be represented by
    infinite series

( Maclaurin series expansion)
Consider x 0.5.
  • The approximation will be better if more terms
    are added in sequence.

20
Example of Error Estimates for Iterative Methods
?s (0.5 x 102-n) (0.5 x 102-3)
Consider three 0.05 significant
figures (n 3)
  • terms will be added to the series until
  • ?a lt ?s

True value of a function ex e0.5 1.648721
x 0.5
21
Example of Error Estimates for Iterative Methods
Estimate value
The first estimate ex ? 1 (
x 0.5)
The second estimate ex ? 1 x 1 0.5
1.5
?t ((1.648721 1.5) / 1.648721 ) 100 9.02
?a ((1.5 1) / 1.5 ) 100 33.3
?a gt ?t

Note More terms must be add, the calculations
will be repeated
22
Example of Error Estimates for Iterative Methods
(cont.)
?a 0.0158 lt ?s 0.05
23
Error Definitions
1. Round off errors which results when
numbers having limited significant figures are
used to represent exact numbers.
2. Truncation errors the approximations of the
results are used to represent exact mathematical
procedures.
24
Round-Off Errors
Computers retain a fixed number of significant
digits during a calculation
  • Some numbers cannot be represented exactly
    by the computer ( such as ?, e, and others).
  • The exact base- 10 representation is
    affected because computers use a base-2
    representation,.
  • This discrepancy introduced by the
    omission of significant figures is called
    ROUND-OFF error .

25
Errors
  • An error in software is called a bug.
  • The operation of removing bugs is called
    debugging.
  • The more effort is required to test for and
    remove the bugs in a software.

26
Input Data Errors
  • Uncertainty in the input data is another type of
    error affecting the results of numerical
    computations.
  • It is determined by the condition of the
    numerical computation.

27
Input Data Errors
A well- conditioned numerical computation will
be relatively insensitive to perturbations in
the input. A poorly conditioned
(ill-conditioned) computation will lead to
results suspect or totally worthless.
28
? An error in the least significant digit
29
? There is no apparent loss of precision (
finite arithmetic)
30
Number system is a convention for representing
quantities.
  • the decimal number representation
  • (10 digits from 0 to 9).
  • the binary number
  • representation
  • (2 digits 0 and 1).

31
Signed Magnitude Method
  • How base-10 numbers can be represented in
    binary form, they can also be represented on a
    computer.
  • the first bit to indicate the sign ( a 0 for
    positive and a 1 for negative).

?
(The representation of the decimal integer 173
on a 16-bit computer)
32
Example Range of Integers
Determine the range of integers in base-10 that
can be represented on a 16-bit computer.
Solution The first bit holds the sign. The
remaining 15 bits can hold binary numbers
from 0 to 11111111111111
33
Example Range of Integers
Digital computers are limited in their
capability to represent integers.
A 16-bit computer word can store decimal
integers from 32,768 to 32,767
34
Converting Decimal Number to Binary
25 16 8 1 24 23 20 (11001)2
dec2bin is a built-function converts from base
10 to base 2.
35
Floating-Point Representation
Fractional quantities are typically represented
in computers using floating-point form.
  • Mantissa or significand represents a
    fractional part.
  • exponent or characteristic represents an
    integer part.

36
Floating-Point Representation
M . Be where m mantissa b the base of
the number system used e the exponent
Example 156.78 0.15678 x 103 (
floating-point base-10 system)
37
Floating-Point Representation
Example Store in a floating-point base- 10
system with four decimal places 1 / 34
0.029411765
Normalization Remove the leading zero by
multiplying the mantissa by 10 and lowering the
exponent by 1 to give
1 / 34 0.0294 x 100 0.2941 x 10-1
38
Floating-Point Representation
??a 3.141592
??t 3.14159265358
Et true value approximation Et ??t -
??a 3.14159265358 - 3.141592 Et
0.00000065
This technique is known as truncation or
chopping
39
Example Hypothetical Set of Floating-Point
Representation
  • The initial 0 indicates the quantity is
    positive.
  • The 1 in the second place designates the
    exponent sign as a negative.

40
Example Hypothetical Set of Floating-Point
Representation
  • The 1s in the third and fourth places give a
    maximum value of the exponent of
  • 1 x 21 1 x 20 3 ? negative (-3).

41
Example Hypothetical Set of Floating-Point
Representation
  • The mantissa is specified in the last three
    places
  • 1 x 2-1 0 x 2-2 0 x 2-3 0.5

42
0111100 0.5 x 2- 3 (0.0625)10
? in the base-10 system
43
  • The next highest numbers are developed by
    increasing the mantissa

(1 x 2-1 0 x 2-2 1 x 2-3) x 2-3
(0.078125)10
(1 x 2-1 1 x 2-2 0 x 2-3) x 2-3
(0.093750)10
44
  • To continuing increasing, the exponent must
    be decreased to 10
  • 1 x 21 0 x 20 2 ? negative (-2)

1 x 2-1 0 x 2-2 1 x 2-3) x 2-2
(0.125000)10
45
1 x 2-1 0 x 2-2 1 x 2-3) x 2- 2
(0.156250)10
1 x 2-1 1 x 2-2 0 x 2-3) x 2- 2
(0.187500)10
46
1 x 2-1 1 x 2-2 1 x 2 -3) x 2 -2
(0.218750)10
. . .
1 x 2-1 1 x 2-2 1 x 2 -3) x 2 3
(7)10
47
Example Hypothetical Set of Floating-Point
Representation
Note The values are indicated by a tick mark.
Only the positive numbers are shown.
48
Floating-Point Representation
  • There is a limited range of quantities that
    may be represented.
  • There are only a finite number of quantities
    that can be represented within a range.

49
Floating-Point Representation
  • The interval between numbers, ?x, increases as
    the numbers grow in magnitude, so floating-point
    representation can preserve significant digits.
  • Quantizing errors will be proportional to the
    magnitude of the number being represented.

50
Summary
True error
Et True value Approximation
True percent relative error
?t True error approximation / true value x
100
Approximate percent relative error
(current approximation
previous approximation) ?a --------------------
--------------------------------------------------
-100 current approximation
?a lt ?s
? Stopping criterion
Write a Comment
User Comments (0)
About PowerShow.com