Lecture 3 - Errors in Numerical Computation

Download as ppsx, pdf, or txt
Download as ppsx, pdf, or txt
You are on page 1of 15

Errors in Numerical Computation

Error
• For many engineering problems, we cannot obtain analytical solutions.
• Numerical methods yield approximate results, results that are close to the
analytical solution.
• If there's something that comes with an approximation, it's an error.
Error
•Analytical approach example:
Find the root of f(x)=x−5.
Analytical solution: f(x)=x−5=0, add +5 to both sides to get the answer x=5
•Numerical solution:
let's guess x=1: f(1)=1−5=−4. A negative number. Let's guess x=6:
f(6)=6−5=1. A positive number. The answer must be between 1 and 6.
•There are different types of errors
•Absolute error
•Relative Error
•Approximation error
Absolute Error
• Absolute error or Absolute true error is a measure of how far 'off’ an estimated
value is from a true value.
Absolute Error = Actual Value - Estimated Value
Relative Error
• You first need to determine absolute error to calculate relative error. Relative
error expresses how large the absolute error is compared with the total size of
the object you are measuring. Relative error is expressed as a fraction or is
multiplied by 100 and expressed as a percent.
Relative Error = (Absolute Error / Known Value)*100
Problem - Absolut Error and Relative Error

• But the problem with absolute error and relative error is that we
don't know what the exact true value is when we solve real life
problems. The true value will be known only when we deal with
functions that can be solved analytically (simple systems). So instead
we use Approximation error.
Approximation Error

• When performing numerical computation, we use an iterative process. When


performing these iterations, the approximate relative error as follows

Ɛα = Present approximation - Previous approximation ⁄ Present approximation * 100

can be used to determine if we are performing successively better computations.

The signs of these errors can be either positive or negative dependent on the
situation, so it is customary to take the absolute value of the error calculations as it’s
only the magnitude of error that we are concerned with.
Approximation Error
• There are 2 types of approximation error:

• Truncation error is the error made by truncating an infinite sum and


approximating it by a finite sum.
• Round-off error is the difference between an approximation of a number
used in computation and its exact (correct) value.
Truncation Error
• For example, the infinite series 1/2 + 1/4 + 1/8 + 1/16 + 1/32 ... adds
up to exactly 1.
• However, if we truncate the series to only the first four terms, we get
1/2 + 1/4 + 1/8 + 1/16 = 15/16, producing a truncation error of 1 -
15/16, or 1/16.
• Usually in evaluating logarithms, exponentials, trigonometric
functions, hyperbolic functions etc., an infinite series is replaced by a
finite series. Thus a truncation error is introduced in the computation.
Error - Example
Round-off Error
• Roundoff error occurs because computers cannot represent some
quantities exactly.
• Round-off error occurs because computers use fixed number of bits
and hence fixed number of binary digits to represent numbers.
• Knowledge of roundoff error is important because they can lead to
incorrect results.
• When the number of bits required for representing a number are less
then the number is usually rounded to fit the available number of
bits. This is done either by chopping or by symmetric rounding.
Round-off Error
Chopping
• Rounding a number by chopping amounts to dropping the extra digits. Here the given number is
truncated. Suppose that we are using a computer with a fixed word length of four digits. Then the
truncated representation of the number 72.32451 will be 72.32. The digits 451 will be dropped.
Now to evaluate the error due to chopping let us consider the normalized representation of the
given number i.e.

• Therefore, chopping error is representing


• So in general if a number x is the true value of a given number and fx * 10E is the normalized form
of the rounded (chopped) number x and gx * 10 E-dis the normalized form of the chopping error then
Round-off Error
Symmetric Round-off Error
The rounded rules are the following:

4
Round-off Error
Symmetric Round-off Error
• For example let x=72.918671 and y=18.63421 be two given numbers to be rounded to five
digit numbers. The normalized form x and y are 0.7291867*10^2 and 0.1863421*10^2. On
rounding these numbers to five digits we get 0.72919*10^2 and 0.18634*102 respectively.

x = 72.918671 = 0.7291867*10^2
= (0.72919+0.0000067)*10^2
= (0.72919 + 0.67*10^-5)*10^2

= (0.67 – 1) * 10^2-5
Round-off Error
Symmetric Round-off Error
y = 18.63421 = 0.1863421*10^2
= (0.18634+0.0000021)*10^2
= (0.18634 + 0.21*10^-5)*10^2

= (0.21) * 10^2-5

You might also like