ME 261: Numerical Analysis
Priom Das
Lecturer
Department of Mechanical Engineering, BUET
Lecture-2: Approximation and Errors
ME 261: Numerical Analysis
Significant Figures
Significant figures (also known as the significant digits, precision or resolution)
of a number in positional notation are digits in the number that are reliable and
necessary to indicate the quantity of something. The significant digits of a
number are those that can be used with confidence.
If a number expressing the result of a measurement (e.g., length, pressure,
volume, or mass) has more digits than the number of digits allowed by
the measurement resolution, then only as many digits as allowed by the
measurement resolution are reliable, and so only these can be significant figures.
For example, if a length measurement gives 114.5 mm while the smallest interval
between marks on the ruler used in the measurement is 1 mm, then the first three
digits (1, 1, and 4, showing 114 mm) are certain and so they are significant figures.
Digits which are uncertain but reliable are also considered significant figures. In
this example, the last digit (5, which adds 0.5 mm) is also considered a significant
figure even though there is uncertainty in it.
ME 261: Numerical Analysis 2
Significant Figures
Rules for Significant Digits:
1.All non-zero numbers ARE significant. The number 33.2 has THREE
significant figures because all of the digits present are non-zero.
2.Zeros between two non-zero digits ARE significant. 2051 has FOUR
significant figures. The zero is between a 2 and a 5.
3.Leading zeros are NOT significant. They're nothing more than "place holders."
The number 0.54 has only TWO significant figures. 0.0032 also has TWO
significant figures. All of the zeros are leading.
ME 261: Numerical Analysis 3
Significant Figures
Rules for Significant Digits:
4.Trailing zeros to the right of the decimal ARE significant. There are FOUR
significant figures in 92.00.
5.Exact numbers have an INFINITE number of significant figures. This rule
applies to numbers that are definitions. For example, 1 meter = 1.00 meters =
1.0000 meters = 1.0000000000000000000 meters, etc.
6.For a number in scientific notation: N x 10x, all digits comprising N are
significant by the first 5 rules; "10" and "x" are NOT significant. 5.02 x
104 has THREE significant figures: "5.02." "10 and "4" are not significant.
ME 261: Numerical Analysis 4
Significant Figures
By visual inspection of the speedometer, could you tell at what speed is this car
traveling?
▪ SD Correspond to the number of
certain digits plus one estimated
digit.
▪ For the speedometer, the two certain
digits are 48.
▪ Estimates of the third digit (or higher)
must be viewed as approximations.
▪ It is conventional to set the estimated
digit at one-half of the smallest scale
division on the measurement device.
▪ Speedometer =48.5 (3 significant
figures)
▪ Odometer =87,324.45 (7 significant
figures)
ME 261: Numerical Analysis 5
Error
Numerical errors arise from the use of approximation to represent exact
mathematical operations and quantities. The relation between the exact (or true)
value and approximation can be formulated as
True value = approximation + error
The numerical error (Et) is equal to the discrepancy between the truth and the
approximation, as in
Et = True value – approximation
Et is the exact value of the error. It is more frequently called as absolute error.
Error has no sign (it could be +ve or –ve depending on the approximation)
Case − a : X = 3.0 (exact) and X * = 3.1(approximation) Et = 3 − 3.1 = 0.1
Case − b : X = 0.0003 (exact) and X * = 0.00031(approximation) Et = 0.00001
Which approximation is more accurate ??
Case-a or Case-b??
ME 261: Numerical Analysis 6
Error
As a measure of accuracy, the absolute error can be misleading because it does
not consider the size of the exact value.
The relative error (εt) is of great important for error estimation since it accounts
the magnitude of the true value (exact) and it is defined as
Et True value − approximation
t = = 100%
True value True value
3.0 − 3.1
Case − a : X = 3.0 (exact) and X * = 3.1(approximation) t = = 3.33%
3.0
Case − b : X = 0.0003 (exact) and X * = 0.00031(approximation) t = 3.33%
So, both approximations are the
same order of accuracy though
absolute errors are different.
Always determine the relative error to estimate the error.
ME 261: Numerical Analysis 7
Error contd…
In real world applications, the true/exact answer is not obviously known a
priori. An alternative is to normalize the error using the best available estimate of
the true value, that is, to the approximation itself, as in
approximation error
a = 100%
approximation
where the subscript a signifies that the error is normalized by an approximate
value.
One of the challenges of numerical methods is to determine error estimates in the
absence of knowledge regarding the true value. For example, certain numerical
methods use an iterative approach to compute answers. This process is
performed repeatedly to successively compute the better and better
approximations. For such cases, the error is often estimated as the difference
between previous and current approximations. In this case-
current approximation − previous approximation
a = 100%
current approximation
ME 261: Numerical Analysis 8
Error contd…
While performing the iterative approach in numerical computation, we are
interested in whether the percent error is lower than a specified percent
tolerance, εs
Therefore, it is often useful to employ this tolerance as a stopping criteria of
iterative computation as
a s
If this relationship holds, results is assumed to be within the pre-specified
acceptable level, εs
It is also convenient to relate these errors to the number of significant
digits/figures in the approximation. It can be shown that the result can be said to
be correct to at least n significant digits/figures if
1 1
s = 10 − n = 10 2− n %
2 2
ME 261: Numerical Analysis 9
Error contd…
An example to estimate error in iterative approach:
Starts with some initial guess values:
ITERATION Approx. value Relative error (%)
1 1.3733 -
2 1.3653 0.586
3 1.3652 0.007
4 1.3652 0
Converged result
ME 261: Numerical Analysis 10
Error contd…
Problem
The number 3.1415927 is approximated as 3.1416. Find the followings
(a) error
(b) relative error, and
(c) number of significant digits of this approximation.
Answer
(a) - 0.73×10-5
(b) 0.000232366 %
(c) 5 significant digits.
ME 261: Numerical Analysis 11
Error contd…
Floating Point Arithmetic
The arithmetic performed by a calculator or computer is different from the
arithmetic in algebra and calculus courses. In our traditional mathematical
world, we permit numbers with an infinite number of digits. However, the
real-world computational platform could store a finite number of digits.
According to IEEE standard, a computer number has three parts
the sign (either + or -)
the fraction part (called the mantissa)
the exponent part
Sign Signed exponent Mantissa
(1 bit) (11 bit) (52 bit)
Total 64 bit
ME 261: Numerical Analysis 12
ME 261: Numerical Analysis 13
Error contd…
Example-
(suppose a system with 4 decimal places in the mantissa)
156.78 represents in floating point as 0.1567×103
1/34 = 0.029411764…. in floating point as 0.2941×10-1
The leading digit of the mantissa will be non-zero and in the range of
1 to 9
ME 261: Numerical Analysis 14
Error contd…
Common Arithmetic Operations on Computer
Suppose we need to add two numbers- 1.557 and 0.04381
The true/exact value of addition is 1.60081
1.557 represents in floating point as 0.1557×101
0.04381 represents in floating point as 0.4381×10-1
When two floating point numbers are added, the mantissa of the number with
smaller exponent is modified so that the exponents are the same.
(suppose a system with 4 decimal places in the mantissa)
0.1557 101
0.0043 101
0.1600 101
The result is chopped upto 4 decimal places. The computed value of addition
is 1.600 (compared to true value of 1.60081 !!!).
Notice how the last two digits of the second number essentially been lost
from the computation.
ME 261: Numerical Analysis 15
Error contd…
Adding a Large and a Small number
Suppose we need to add two numbers- 4000 and 0.0010
The true/exact value of addition is 4000.001
(suppose a system with 4 decimal places in the mantissa)
4000 represents in floating point as 0.4000×104
0.0010 represents in floating point as 0.1000×10-2
When two floating point numbers are added, the mantissa of the number with
smaller exponent is modified so that the exponents are the same.
0.4000 10 4 0.4000 10 4
0.0000001 10 4 0.0000 10 4
??? 0.4000 10 4
The result is chopped upto 4 decimal places. The computed value of addition
is 0.4000×104 (compared to true value of 4000.001 !!!).
Thus, we might as well have not performed the addition!!!.
This type of error can occur in the computation of an infinite series. The initial
terms in such series are often relatively large in comparison with the later terms.
ME 261: Numerical Analysis 16
Error contd…
Common Arithmetic Operations on Computer
Suppose we need to subtract two numbers- 26.86 from 36.41
The true/exact value of subtraction is 9.55
26.86 represents in floating point as 0.2686×102
36.41 represents in floating point as 0.3641×102
(suppose a system with 4 decimal places in the mantissa)
0.3641 10 2
− 0.2686 10 2
0.0955 10 2
For this case, the result is not normalized, and so we must shift the decimal one
place to the right to give 0.9550×101= 9.550.
Notice that the zero added to the end of the mantissa is not significant
rather is merely appended to fill the empty space created by the shift.
ME 261: Numerical Analysis 17
Error contd…
Common Arithmetic Operations on Computer
A dramatic result would be obtained when the numbers are very close.
(suppose a system with 4 decimal places in the mantissa)
0.7642 10 3
− 0.7641 10 3
0.0001 10 3
For this case, the result is not normalized, and so we must shift the three decimal
places to the right to give 0.1000×100= 0.1000.
Notice that the three non-significant zeros are appended. This introduces a
substantial computational error because subsequent manipulations would
act as if these zeros were significant. But adding to the end of the mantissa
is not significant rather is merely appended to fill the empty space created
by the shift.
ME 261: Numerical Analysis 18
Error contd…
Loss of Significant Figures (Subtractive Cancellation)
Loss of significance is an undesirable effect in numerical calculations using
floating-point arithmetic. The effect is that the number of significant digits in the
result is reduced unacceptably. There are a number of situations where it occurs-
for example in subtraction of two nearly equal number (Also known as
Catastrophic Cancellation)
Suppose we need to subtract two numbers- 0.372144 from 0.372019
The true/exact value of subtraction is 0.000125
(suppose a system with 4 decimal places in the mantissa)
0.3721 10 0
− 0.3720 10 0
0.0001 10 0
For this case, the result is not normalized, and so we must shift the three decimal
places to the right to give 0.1000×10-3= 0.0001 !!! (compared to 0.000125)
Notice that the computed difference has only one significant digit of
accuracy.
Thus, subtraction of two nearly equal numbers causes the loss of the
leading significant figure in many calculations.
ME 261: Numerical Analysis 19
Thank you