Approximations, Errors and Their Analysis: AML702 Applied Computational Methods
Approximations, Errors and Their Analysis: AML702 Applied Computational Methods
I
I
T Lecture 03
Dc Approximations, Errors and
E Their Analysis
L
H
I
Approximations and Errors
2
Accuracy and Precision
Accuracy : It refers to how closely the measured or computed value
matches with the true value.
I Precision: It refers to how closely the computed or measured
I values agree with each other in repeated computation or
measurement.
T
Consider fig. 4.1 from Chapra,
as shown here
Dc
E
(a) inaccurate and imprecise,
L
(b) accurate and imprecise,
H (c) inaccurate and precise,
I (d) accurate and precise.
Errors in Computations
Error: The deviation from an expected or true
value. True value may not be known always!
I
I E.g. Area of a rectangle A= LxB=12x10=120 cm2
T But by measurement LmxBm=11.9x10.1
The computed value Ac= 120.19 cm2
D Error , E=|A- Ac |=0.19. This error is known as
E Absolute Error. When it is compared with the actual
L value or true value, it is known as relative error,
H Er = |A- Ac |/A=0.19/120.
I This is expressed in percentage as
Er = |A- Ac |/A*100=0.19/120*100 = 0.15%.
4
Floating Points and Machine Accuracy
5
Machine Representation
Representing Real numbers on digital computers
I Computers have finite amount of memory. Consider
representing π= 3.141592653589793…………….
I
Or the repeating fraction 1/3 = 0.333333333333333……
T
Any such number x ∈ℜ needs infinite digits for accurate
D representation.
E x = ±(1.d1d 2d 3d 4..............d1) × 2e
L Where di are binary digits having values 0 or 1 and e is
H an integer exponent. The mantissa can be expressed
I as d1 d 2 d 3 d 4
1.d1d 2d 3d 4.......... = 1 + + 2 + 3 + 4 .........
2 2 2 2
E.g. The binary number x is represented as:
6 x = −(1.11010.........) × 21 = −(1. 12 + 14 + 0 + 161 .........) × 2 = −3.62510
Floating Point Representation
Floating point representation requires finite digits
I Corresponding to a real number x its digital
counterpart will be fl(x) with some k bits
I
T fl ( x) = ±(1.d 1d 2d 3d 4..............d 1) × 2e
D Now storing this in memory will require k bits which is an
E approximation for storing x with infinite bits. It is
L interesting to know the accuracy of such a
H representation. Alternatively we wish to determine the
I relative error as: | fl ( x) − x |
| x|
The IEEE standard gives the confidence by estimating
1
this error to be η = 2 × 2−k where k is the number of
7
digits (bits) used in the representation
Floating Point and Machine Precision
10
Roundoff Errors
• Finite-precision causes roundoff errors in
I numerical computation
I • Roundoff errors accumulate slowly
T • Subtracting nearly equal numbers leads to
D severe loss of precision. A similar loss of
E precision occurs when two numbers
L separated by large differences in magnitude
H are added.
I • Roundoff errors are unavoidable, good
algorithms can minimize their effect
Truncation Errors
I
I
T
D
E
L
H
I
Total Numerical Error
• The total numerical error is the sum of the
truncation and roundoff errors.
I • The truncation error generally increases as the
I step size increases, while the roundoff error
T decreases as the step size increases - this leads
to a point of diminishing returns for step size.
D
E
L
H
I