Lec 1
Lec 1
Introduction
Numerical Methods
Algorithms that are used to obtain numerical solutions of a mathematical problem.
Why do we need them?
• No analytical solution exists,
• An analytical solution is difficult to obtain or not practical.
Basic Needs in the Numerical Methods:
Practical:
Can be computed in a reasonable amount of time.
Accurate:
• Good approximate to the true value,
• Information about the approximation error (Bounds, error order,… ).
Definition 2 (Numerical Error). Let x be the exact solution of the underlying problem and x∗
its approximate solution, then the error (denoted by e) in solving this problem is
𝑒 = 𝑥 − 𝑥∗
1.2 Sources of Error in Numerical Computations
Definition 4 (Relative Error). The relative error 𝑒̌ of the error e is defined as the ratio between
the absolute error 𝑒̂ and the absolute value of the exact solution x
𝑒̂ |𝑥 − 𝑥 ∗ |
𝑒̌ = = ,𝑥 ≠ 0
|𝑥| |𝑥|
Example 2.
Let x = 3.141592653589793 is the value of the constant ratio π correct to 15 decimal places
and x ∗ = 3.14159265 be an approximation of x. Compute the following quantities:
a. The error.
b. The absolute error.
c. The relative error.
1.4 Roundoff and Truncation Errors
Computers represent numbers in finite number of digits and hence some quantities cannot be
represented exactly. The error caused by replacing a number a by its closest machine number
is called the roundoff error and the process is called correct rounding.
Truncation errors also sometimes called chopping errors are occurred when chopping an
infinite number and replaced it by a finite number or by truncated a series after finite number
of terms.
Example 3. Approximate the following decimal numbers to three digits by using rounding and
chopping (truncation) rules: