Professional Documents
Culture Documents
4
What is Numerical Method
• Powerful analysis tool in problem solving and
understanding problem in mathematical language
• Techniques by which mathematical problems are
formulated, so that they can be solved with
arithmetic operations
• The role of numerical method in solving engineering
problem:
PROBLEM
INTERPRETATION
FORMULATION SOLUTION
The results obtained can
Fundamental laws are used to Suitable numerical methods
then be used to
develop mathematical are then selected to solve
predict/analyze/understand
equations that can represent the mathematical equations
the specific problem better
the specific problem
5
Mathematical modeling
Is the use of mathematics to
• Describe real world phenomena
• Investigate important questions about the observed world
• Explain real world phenomena
• Test ideas
• Make predictions about the real world
6
• A mathematical model is represented as a functional
relationship of the form
7
• Dependent variable
Observed behaviour/state/phenomenon of a system
Characteristic that reflects behaviour or state of the system
i.e. y, f(x), f(t)
• Independent variable
Dimension that determine a system i.e. time, t , x
• Parameter
Quantity that serves to relate to functions and variables
Reflective of the system’s properties or composition
• Forcing functions
External influence that acts on system i.e. acceleration gravity, g
8
Example
10
Example
Assume that interested to predict the velocity of the falling parachutist with time
F = ma
11
dv
acceleration a
dt
F FD FU
dv F
FD downwardforceof gravity
dt m
FU upward forceof air resistance
FD mg
FU cv
dv mg cv c
g v
dt m m
(differential equation)
12
Exact or analytical solution: it exactly satisfies the original equation
forcing functions t,s v,(m/s)
dependent variable 0 0.00
2 16.40
4 27.77
6 35.64
8 41.10
10 44.87
12 47.87
53.39
parameter
independent variable
13
Unfortunately, there are many mathematical
models that cannot be solved exactly.
14
dv mg cv c
g v
dt m m
dv v v( t v( t )
i 1 ) i
dt t ti 1 ti
v( t v( t )
i 1 ) i c
g v(t )
ti 1 ti m i
c
v(ti1 ) v(ti ) g v(ti ) (ti 1 ti )
m The use of finite difference to approximate the
first derivative of v with respect to t
Approximate or
numerical solution
15
Numerical solution
t,s v,(m/s)
0 0.00
2 19.60
4 32.00
6 39.85
8 44.82
10 47.97
12 49.96
53.39
16
Approximation and Roundoff Errors
• Significant figures
Numbers to be used in confidence
98 2 significant figures
17
Important of significance figures in numerical methods:
18
• Accuracy and Precision How closely a computed
or measured value agree
Increasing accuracy with the true value
Increasing precision
19
• Error definitions
Truncation errors ~ result
when approximations are
used to represent exact
Error mathematical procedures
Approximation
value
True value = Error + Approximation value
20
True value = error + approximation value (1)
(3)
21
Calculation of errors
True value of length of a bridge is 10,000 cm.
When you measure, the length recorded is
9,999 cm. Compute the true error and true
percentage relative error of the bridge.
22
Answer: 1 cm and 0.01%
However, in actual situation, true value is rarely available.
Therefore, need to estimate the true value approximation
(4)
n is significant figures.
23
Error estimates for iterative method
Suppose that we have exponential function as,
25
• Round-off errors Results when numbers having limited significant
figures are used to represent exact numbers
27
Truncation errors and Taylor series
• Truncation errors
• Truncation error is the discrepancy introduced by the fact that
numerical methods may employ approximations to represent exact
mathematical operations and quantities.
28
• Taylor series
Provides a means to predict a function value at one point in terms of the
function value and its derivative at another point
Zero order
First order
Second
order
nth order
29
Taylor series by defining a step size h = xi+1 - xi
(6)
f ( n 1) ( ) n 1
Rn h (7)
(n 1)!
30
31
• Remainder for the Taylor series Expansion
Remainder term, Rn, accounts for all terms from (n+1) to infinity.
f ( n 1) ( ) n 1
Rn h
(n 1)!
It also usually expressed as:
Rn O(h n1 )
Let say we truncated the Taylor series expansion after zero-order term to
yield f ( xi1 ) f ( xi )
Remainder term, Rn for zero order version
f 3( xi ) 3
f ' '( xi )
R0 f '( xi ) h h 2
h ...
2! 3!
Let truncate the remainder itself,
R0 f '( xi ) h
This result is still inexact because neglected second and higher order terms.
32
Remainder for the Taylor series Expansion
33
Alternative simplification that tranforms the approximation into an
equivalence based on graphical insight
derivative mean-value theorem states that if a function f(x) and its
derivative are continous over interval from xi to xi+1,
there exist at least one point on the function that has a slope, designated by
f’(ξ), parallel to line joining f (xi) and f(xi+1)
Thus,
So,
Zero order version
34
• Numerical
differentiation
35
Forward finite divided difference approximation of first derivative
(14) Where,
(15)
(17)
Where, h xi 1 xi xi xi 1
36
Example
at x = 0.5 using a step size h = 0.5. Repeat using h = 0.25. Also calculate the
true percent relative error for each approximation.
37
Exercise
Use forward and backward and a centered difference to estimate the first
derivative of the function
at x = 0.5 using a step size h=0.5. Repeat using h = 0.25. Also calculate the
true percent relative error for each approximation.
Ans:
h=0.5
FDM:1.525 41.9%
BDM:0.875 18.60%
CDM:1.200 11.63%
h=0.25
FDM:1.26875 18.02%
BDM:0.94375 12.21%
CDM:1.10625 2.91%
38
• Higher derivatives
39
• Error propagation
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.
If a function f is dependent on
(a) a single independent variable x : f(x)
(b) two independent variables x and y : f(x, y)
(c) several independent variables x1, x2, x3, ... ,xn : f(x1 , x2 ,..., xn ).
40
Function of a single variable.
Let x be the true value and
x* be an approximate value of x
Solution
f(x*) f ' (x*) x *
So,
f(x*) 3(2.5) 2 (0.01) 0.1875
Because f (2.5) 15.625, it can predict that
f( 2.5 ) 15.625 0.1875
Or the true value lies between 15.4375 and 15.8125. In fact, if x ~2.49,
f(x) could be 15.4382 and if x ~ 2.51, it would be 15.8132.
The first order error analysis provides a fairly close estimate of the true error.
42
Exercise
Knowing a value of x* = 2.0 with an error of Δx* = 0.01, estimate the resulting
error in the function
f(x) = 0.5x3-0.1x2+0.8x-0.7
43
Function of a more than One variable.
(22)
(23)
44
• Relative error
• Condition number
𝑥 = 𝑎𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑖𝑜𝑛 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝑥
𝑓 𝑥 = 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑤𝑖𝑡ℎ 𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝑜𝑓 𝑥
45
• Condition no equals 1 indicates that function’s
relative error is identical to the relative error in
x
• Condition no greater than 1 indicates relative
error is amplified.
• Condition no less than 1 indicates relative
error is attenuated.
• Function with very large values are said to be
ill-conditioned.
46
• Total Numerical Error
Total numerical errors = truncation error + round off error
Roundoff error ↓ by increase no. of significant figures or
reduce no. of computation in analysis
Truncation error ↓ by decreasing step size (h) or increase
no. of computation in analysis
47
Control numerical error
avoid subtract 2 nearly equal numbers to
avoid loss of significance
Use Taylor series for truncation and roundoff
error analysis
Perform numerical experiments
- repeat computation with different step size or method
and compare results
48