Introduction To Numerical Analysis With Examples
Introduction To Numerical Analysis With Examples
NUMERICAL ANALYSIS
Two Methods in Solving a Problem
Roots of p pz c0 c1 z c2 z c3 z c5 z
2 3 4
The Need for Numerical
Computation
Problems that can be solved in principle by
a finite sequence of elementary operations:
(1) Solve a system of n linear equations in n
unknowns.
(2) Minimize a linear function of n variables
subject to m linear constraints.
(3) Find the shortest tour between n cities.
The Need for Numerical
Computation
A Babylonian tablet
(approx 1000 – 2000 BC)
which is an approximation to
2
(accurate to 6 decimal places)
Examples
1. The Martini glass filled to a depth of 6cm
216
contains about of wine. How deep do
3
you need to fill the red wine glass below in
order to ensure that it contain the same
amount of wine?
Examples
2. Finding solution to the general form of the
Navier-Stokes equations for the conservation
Dv
of momentum which is P f
Dt
N an an 1 a1a0 2
n 1
an 2 an 1 2
n
a1 2 a0 2
1 0
n 1 1 2
x an 2 an 1 2
n
a1 2 a0 2 b1 2 b2 2
1 0
Representation of Numbers
Base 10
1 2
257.76 2 10 5 10 7 10 7 10 6 10
2 1 0
Base 2
(1 23 0 2 2 1 21 1 20 )
(1011.0011) 2 1 2 3 4
( 0 2 0 2 1 2 1 2 ) 10
11.1875
Numerical Error
Defined as the difference between the
true value in a calculation and the approximate
value found using a numerical method
y m 2e
sign of number 0 for ve, 1 for - ve
m mantissa 12 m 102
x 2 0.001
Example
y 2.003 0.001
Let z x y
z 0.001 0.001
= 0.6667 = 66.67%
z | 2 2.003 |
Horner’s method
Pn x an x an 1 x
n n 1
... a1 x a0
1
Pn x an x n 3
an 1 x n4
... a3 x a2 x a1 x a0
P x 3x 4 x 2 x 2 x 1
5 4 3
# of addition: 4
# of multiplication: 13
P x 3 x 4 4 x 3 2 x 2 2 x 1
P x 3 x 3 4 x 2 2 x x 2 x 1
P x 3 x 2
4x 2 x x 2 x 1
P x 3 x 4 x 2 x x 2 x 1
Nested Multiplication
# of addition: 4
# of multiplication: 5
P x 3x5 4 x 4 2 x3 2 x 1 P x 3 x 4 x 2 x x 2 x 1
P x 3x5 4 x 4 2 x3 2 x 1
P x 3x5 4 x 4 2 x3 2 x 1
Every operation you performed, you round-off to 3 significant digits
P x 3 x 4 x 2 x x 2 x 1
Every operation you performed, you round-off to 3 significant digits
P x 3x5 4 x 4 2 x3 2 x 1
Every operation you performed, you truncate to 3 significant digits
P x 3 x 4 x 2 x x 2 x 1
Every operation you performed, you round-off to 3 significant digits