You are on page 1of 19

Intro to Numerical Methods and

Source of Errors
Dr. Mus’ab Abdul Razak
Intro to Numerical Methods

dv cd 2
t   g  v
dt m
gm  gcd 
v t   tanh  t 
cd  m 

Euler’s Method
ti 1  ti  h
dv
vi 1  vi  h  ti , vi 
dt
Intro to Numerical Methods
Intro to Numerical Methods

Analytical Methods – Exact Solution


Numerical Methods – Approximate Solution
– Since it is approximate there will be errors.

Common characteristic, numerical methods


involve large numbers of tedious arithmetic
calculations.
COMPUTERS
Topics to be covered
Mathematical Modelling

Real World Problem


Assumptions
Modelling
Approximation

Mathematical Model

Example: Mass and


Energy Balance
Mathematical Modelling

• Requires understanding of engineering systems


– By observation and experiment
– Theoretical analysis and generalization
• Computers are great tools, however, without
fundamental understanding of engineering problems,
they will be useless.
Mathematical Modelling

Notes: Since modelling involve assumptions and


approximations, there are errors due to
modelling. However, as long as the assumptions
and approximations are reasonable enough, it
will be useful to solve the real world problem.

“how much error is present in our calculation and is


it tolerable?”
Source of Errors

Modelling Errors
▪ Blunders
▪ Data Uncertainty

Numerical Errors
▪ Truncation Errors
▪ Roundoff Errors
• Quantization errors
• Numerical manipulations
Accuracy and Precision
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
Definition of Error (Numerical Errors)

True value  Approximation  True error


True error = True value - Approximation
True error
True relative error  %  =  T = 100
True value

But, most of the time , we don’t know True error.


Definition of Error (Numerical Errors)
We can do the same for approximate error
Approx. error
Approx. relative error  %  =  A = 100
Approx. value

But, what is approximate error and value?


Approx. error = Current approx. - Previous approx.
Approx. value = Current approx.

The idea is to get a very small  A value, and we can do this by


using iterative refinement
Numerical Errors - Roundoff Errors

To know what it is, we need to know how numbers is


represented in computer first.
• Computers use a base-2 representation, they cannot
precisely represent certain exact base-10 numbers.
Numerical Errors - Roundoff Errors
Quantization errors
• Overflow errors
• Underflow errors

Numerical Manipulation errors


Rounding off Arithmetic calculations
• Chopping error
• Subtraction cancelation
Numerical Errors – Truncation Errors

• Occurs when truncate an infinite series


For example:
Taylor and Maclaurin series

f n a
f  x    x  a
n

n 0 n!
Numerical Errors – Truncation Errors
Numerical Errors – Truncation Errors
Example:
To get the cos(x) for small x:
2 4 6
x x x
cos x  1     
2! 4! 6!
If x=0.5
cos(0.5) =1-0.125+0.0026041-0.0000127+ …
=0.877582
From the supporting theory, for this series, the error is
no greater than the first omitted term.
x8
 for x  0.5  0.0000001
8!

You might also like