Approximations and Errors in Numerical Analysis: Dr. Ammar Isam Edress
Approximations and Errors in Numerical Analysis: Dr. Ammar Isam Edress
Approximations and Errors in Numerical Analysis: Dr. Ammar Isam Edress
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ALGORITHMS
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Exercise
Find the answer for the following to four decimal places.
For n = 1 to 5
1
𝑥1 = 0.5 𝑥𝑛+1 = 𝑥𝑛 −
2𝑥𝑛
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Exercise
Find the square root of 2 to four decimal places. More than one
algorithm, using only the four basic operations of arithmetic, exists.
The favourite is without much doubt
𝑥1 = 1 1 2
𝑥𝑛+1 = (𝑥𝑛 + )
2 𝑥𝑛
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
What Is Numerical Analysis?
ERROR
• The numerical optimist asks how accurate are the computed results ?
• The numerical pessimist asks how much error has been introduced ?
• Only rarely will the given data be exact, since it often originates in
measurement processes. So there is probably error in the input
information, and usually the algorithm itself introduces error,
perhaps unavoidable roundoffs.
• The output information will then contain error from both of these
sources.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Precision and Accuracy
Two terms are commonly associated with any discussion of error:
"precision" and "accuracy".
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Precision and Accuracy
If the centre of the target is the "true value", then
• A is neither precise nor accurate.
• Target B is precise (reproducible) but not accurate.
• The average of target C's marks give an accurate result but precision
is poor.
• Target D demonstrates both precision and accuracy - which is the
goal in lab.
Fig. 1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Accuracy. How close is a computed or measured
value to the true value
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Summary
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 1:
The error is then at most five units in the fifth place, or half a unit
in the fourth. In such a case the approximation is said to have four
significant digits.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 2:
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Errors
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Random Errors
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
This positive and negative scattering of data is characteristic of
random errors. The estimated standard deviation (the error range for
a data set) is often reported with measurements because random
errors are difficult to eliminate. Also, a "best-fit line" is drawn
through graphed data in order to "smooth out" random error.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Systematic errors
Systematic (or determinate) errors are instrumental, methodological,
or personal mistakes causing "lopsided" (Unbalanced) data, which is
consistently deviated in one direction from the true value.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Systematic errors
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Gross Error
Gross errors are caused by experimenter carelessness or equipment
failure. These "outliers" are so far above or below the true value that
they are usually discarded when assessing data.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Precision of a Set of Measurements
(Mean)
σ𝑖=1
𝑛 𝑥𝑖
𝑥ҧ = … (1)
𝑁
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Precision (reproducibility) is quantified by calculating the
average deviation (for data sets with 4 or fewer repetitive
measurements) or the standard deviation (for data sets
with 5 or more measurements). Precision is the opposite of
uncertainty Widely scattered data results in a large
average or standard deviation indicating poor precision.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Definitions
True error
true error
True fractional relative error
true value
true error
True percent relative error, t 100%
true value
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• For numerical methods, the true value will be
known only when we deal with functions that can
be solved analytically (simple systems). In real
world applications, we usually not know the answer
a priori. Then
Approximate error
a 100%
Approximation
• Iterative approach, example Newton’s method
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Many numerical methods are interative, that is they
involve repeating the same calculation many times. In
terms of error analysis, two types of error emerge, local
and global errors. The local error is the error introduced
during one operation of the iterative process. The global
error is the accumulative error over many iterations.
• Note that the global error is not simply the sum of the
local errors due to the nonlinear nature of many problems
although often it is assumed to be so because of the
difficulties in measuring the global error.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Sources of Errors in Numerical Calculations
• There are at least two sources of errors in numerical calculations:
1. Rounding Errors
2. Truncation (chopping) Errors
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Round-off Errors
• Numbers such as p, e, or 7 cannot be expressed
by a fixed number of significant figures.
• Computers use a base-2 representation, they cannot
precisely represent certain exact base-10 numbers.
• Fractional quantities are typically represented in
computer using “floating point” form, e.g.,
Integer part
exponent
m.be
mantissa Base of the number system
used
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 3
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chopping
Example:
p=3.14159265358 to be stored on a base-10 system
carrying 7 significant digits.
p=3.141592 chopping error t=0.00000065
If rounded
p=3.141593 t=0.00000035
• Some machines use chopping, because rounding adds
to the computational overhead. Since number of
significant figures is large enough, resulting chopping
error is negligible.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.