Numerical Analysis I
(Math 311)
For: Rift Valley University
Second Year Computer Science
Student
By:Habtamu Garoma
Email address: [email protected]
Chapter 1
Basic concepts in error
estimation
Numerical analysis
o is the branch of mathematics that is used to
find approximations to difficult problems
such as:
finding the roots of non−linear equations
integration involving complex expressions
solving differential equations for which
analytical solutions do not exist
o It is applied to a wide variety of disciplines
such as :
-business,
-all fields of engineering,
-computer science,
-education,
-geology,
-meteorology and others.
o It is the area of mathematics and computer
science that creates, analyzes, and
implements algorithms for solving numerically
the problems of continuous mathematics.
Chapter 1
Basic concepts in error
estimation
Source of Error
1.1. Sources of error
Numerical errors arise from the use of approximations to
represent exact mathematical operations and quantities.
Truncation errors: which result when
approximations are used to represent exact
mathematical procedures.
Round-off errors: which result when numbers
having limited significant figures are used to represent
exact numbers.
Round off Error
which result when numbers having
limited significant figures are used to
represent exact numbers.
Caused by representing a number
approximately.
Example:
For both types, the relationship
between the exact result and the
approximation can be formulated as:
True value = approximation + error
Et = true value − approximation
where is used to designate the exact
value of the error
Truncation error
• Error caused by truncating or
approximating a mathematical
procedure.
Example of Truncation Error
1. Taking only a few terms of a
Maclaurin series to
If only 3 terms are used,
2. Using a finite to approximate
• Using finite rectangles to approximate
an integral.
Example 1: Maclaurin series
Calculate the value of with an absolute
relative approximate error of less than 1%.
6 terms are required. How many are required
to get at least 1 significant digit correct in
your answer?
Example 2: Diffrentiation
Find for using
and
The actual value is
Truncation error is then,
Can you find the truncation error with
?
Example 2: Integrations
Use two rectangles of equal width to
approximate the area under the curve
for f ( x) x 2 over the interval
Integration example (cont.)
• Choosing a width of 3, we have
Actual value is given by
Truncation error is then
Can you find the truncation error with 4
rectangles?
Approximations and Round-Off Errors
• For many engineering problems, we cannot
obtain analytical solutions.
• Numerical methods yield approximate results,
results that are close to the exact analytical
solution. We cannot exactly compute the errors
associated with numerical methods.
– Only rarely given data are exact, since they
originate from measurements. Therefore
there is probably error in the input
information.
Cont’d
o Algorithm itself usually introduces errors as
well, e.g., unavoidable round-offs, etc
o The output information will then contain
error from both of these sources.
• How confident we are in our approximate
result?
• The question is “how much error is
present in our calculation and is it
tolerable?”
• Accuracy: How close is a computed or
measured value to the true value
• Precision (or reproducibility): How close is a
computed or measured value to previously
computed or measured values.
• Inaccuracy (or bias): A systematic deviation
from the actual value.
• Imprecision (or uncertainty): Magnitude of
scatter.
Significant Figures
Number of significant figures indicates
precision. Significant digits of a number are
those that can be used with confidence.
e.g., the number of certain digits plus one
estimated digit.
53,800 How many significant figures?
5.38 x 104 3
5.380 x 104 4
5.3800 x 104 5
Zeros are sometimes used to locate the
decimal point not significant figures.
0.00001753 4
0.0001753 4
0.001753 4
Error Definitions
True Value = Approximation + Error
Et = True value – Approximation (+/-)
True error
• 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
Con’d
Iterative Approach, example Newton's
method
• Use absolute value.
• Computations are repeated until
stopping criterion is satisfied
• If the following criterion is met
you can be sure that the result is correct to at
least n significant figures.
Round-off Errors
Numbers such as p, e, or cannot be expressed
by a fixed number of significant figures.
Accuracy and Precision
The errors associated with both calculations
and measurements can be characterized with
regard to their accuracy and precision.
Accuracy: refers to how closely a computed or
measured value agrees with the true value.
Precision: refers to how closely individual
computed or measured values agree with
each other.
FIGURE 3.2: An example from marksmanship illustrating the concepts of
accuracy and precision. (a) Inaccurate and imprecise; (b) accurate and
imprecise; (c) inaccurate and precise; (d) accurate and precise.
Absolute and Relative Errors
Absolute Error ( Ea )
Absolute error= Exact value Approximate value
Relative Errors ( Er )
Exact value Approximate value
Er x 100%
Exact value
current approximation previous approximation
a X 100%
current approximation
Round of Errors
Round-off errors: originate from the fact that
computers retain only a fixed number of
significant figures during a calculation.
Numbers such as π, e, or 7 cannot be
expressed by a fixed number of significant
figures.
Therefore, they cannot be represented
exactly by the computer.
Propagation of Error
The purpose of this section is to study how
errors in numbers can propagate through
mathematical functions.
If we multiply two numbers that have errors,
we would like to estimate the error in the
product.
* Functions of a Single Variable
* Functions of More than One Variable
Suppose that we have a function f (x) that is
dependent on a single independent variable x.
Assume that x is an approximation of x.
to assess the effect of the discrepancy between
x and on the value of the function.
We would like to estimate by
f ( x) f ( x) f ( x)
By expansion of Taylor’s series, we obtain:
f ( x) f ' ( x) x, where x x x
FIGURE 4.7
Graphical depiction of first order error propagation
Example: Given a value of x = 2.5 with an
error of x= 0.01, estimate the resulting error
in the function f ( x) x3 .
n
Ans: f(2.5) = 15.625 ± 0.1875
Functions of More than One Variable
For n independent variables x1 , x2 ,...., xn
having errors x , x ,..., x the following
1 2 n
general relationship holds:
f f f
f ( x1 , x2 ,..., xn ) x1 x2 ... xn
x1 x2 xn