Documente Academic
Documente Profesional
Documente Cultură
Chapter 02
Dr Baljit Singh
Faculty of Mechanical Engineering
Universiti Teknologi MARA (UiTM)
Office: T1-A18-1C
Derive the equation that would let you find the time the car takes to
cover 200 m distance?
2
Solution..
Given data;
s = ut + 0.5at2
200 = 25t + (0.5)(10t2)
5t2 + 25t -200 = 0
f(t) = 5t2 + 25t -200
3
Learning outcome
Understanding what roots problems are and where they occur in
engineering and science.
Knowing how to estimate the error of bisection and why it differs from
error estimates for other types of root location algorithms.
4
Roots of equations - Introduction
Why NM?
b b 2 4ac
f(x) ax bx c 0
2
x
2a
But! ax 5 bx 4 cx 3 dx 2 ex f 0 x ?
sinx x 0 x ?
f(x) e - x x x ?
Many functions cannot be solved analytically!!!
5
Roots of equations Why NM?
Recall the parachutists velocity:
v(t)
gm
c
1 e (c/m)t
Solution method:
V is an explicit variable can be solved analytically Graphical
Trial & error
Supposed, we want to find C NM
No way we can express C explicitly C = ???????
C is an implicit function (C on both side of equal sign)
Thus we need to re-express the equation as
f(c)
gm
c
1 e (c/m)t v y e -2x .Sin(3x 5)
The value of c that makes f (c) = 0 is, therefore, the root of the
equation
NM can be used to solve this implicit function!
Nonlinear Equation
Solvers
NM process:
Find approximate solution by plotting graph and estimate the roots
(Find the point where the graph cross the x-axis)
Apply numerical method to determine more accurate solution.
Some stopping criterion is applied to decide when solution is
accurate enough
7
1. Graphical Method
A simple method for obtaining the rough estimate
of the root of the equation f(x)=0 observe where
it crosses the x-axis.
Theorem
An equation f(x)=0, where f(x) is a real
continuous function, has at least one root
between xl and xu if f(xl) f(xu) < 0.
Problems:
Increment length too small time consuming
Increment length too big miss closely paced roots & multiple roots.
10
Bisection methods
The bisection method is a
bracketing method in which the
interval is always divided in half.
11
Algorithm for Bisection method
THEOREM:
An equation f(x)=0, where f(x) is a real
continuous function, has at least one root
between xl and xu if f(xl) f(xu) < 0.
x x Interval
xr l u
2
12
Algorithm for Bisection method
STEP 3 : Evaluate f(xl).f(xr)
Evaluate f(xl).f(xr) to locate where root lies in
the subinterval
Remarks
Each succeeding iteration halves
0 the error. Thus, the relationship
E = absolute error
xof iteration
between error and number a
is
Ea
n
n
n = iteration number
2 x0 = zero iteration error =
xu - x l
14
Example: Root finding using graphical method
Estimate the root (i.e. c value) using graphical method
v gm 1e-(c/m)t
c
f(c) gm 1e-(c/m)t v
c
IF t=10, g=9.8 , v = 40 & m = 68.1
c f(c)
4 34.115
8 17.653
Root
12 6.067
16 -2.269
20 -8.401
15
Example: Root finding using Bisection Method
From the graph, the root, c is between 12 &
16
[Note: True root = 14.7802]
s = 0.5%.
xll xuu
Choose xl = 12 and xu = 16 [initial guesses]
First estimate:
xr = (12 + 16)/2 = 14 xll xr xuu
t = {(14.7802 14)/14.7802}x100% =
5.3%
Evaluate f(xl).f(xr)
f(xl).f(xr) = f(12).f(16) = 9.517 ,i.e. > 0
Root is in upper subinterval!
Set xl = xr & xu = xu for next iteration
xl = 14 & xu = 16 for next iteration
16
Example
Choose xl = 14 and xu = 16 xu
xl
Second estimate:
xr = (14 + 16)/2 = 15
t = {(14.7802 15)/14.7802}x100% = 1.5%
xl x
xrr xu
Evaluate f(xl).f(xr)
f(xl).f(xr) = f(14).f(15) = -0.666, i.e. < 0
Root is in lower subinterval!
Set xl = xl & xu = xr for next iteration
xl = 14 & xu = 15 for next iteration
17
Example
Choose xl = 14 and xu = 15
xl xu
Third estimate:
xr = (14 + 15)/2 = 14.5
t = {(14.7802 14.5)/14.7802}x100% = 1.9%
xl xr xu
Evaluate f(xl).f(xr)
f(xl).f(xr) = f(14).f(15) = ?????????
So when to stop? In this example error estimate is based on true value but
in practice this is not possible!
SO stop When a s!
18
Example stopping criteria & error estimate
For the previous example, find the root when s = 0.5%
new old
a X r - X r 100% X new
r = root for present iteration
X new X old
r = root from previous iteration
r
19
Example stopping criteria & error estimate
In table form
20
Pros & cons
Pros
Easy
The bisection method is always convergent. Since the method brackets
the root, the method is guaranteed to converge.
As an iteration is conducted, the interval gets halved. So one can
guarantee the error in the solution of the equation.
Number of iterations required to attain an absolute error can be
computed a priori.
Cons
Slow convergent
If one of the initial guesses is close to the root, the convergence is slower
Multiple roots cannot find lower & upper guesses!
No account is taken of f(xl) and f(xu), if f(xl) is closer to zero, it is likely
that root is closer to xl .
21
False position method
(a.k.a. linear interpolation method)
22
False position method
The false position method is another bracketing method.
The value of xr then replaces whichever of the two initial guesses yields a
function value with the same sign as f(xr).
f(x u )(x l x u )
xr xu
f(x l ) f(x u )
23
Algorithm for False Position method
1. Choose a pair of values of xl and xu such that they always bracket the
root. (i.e. f(xl).f(xu) <0).
f(x u )(x l x u )
xr xu LOWER Sub UPPER Sub
f(x l ) f(x u ) Interval Interval
xl xr xu
4. Repeat #2 & #3 until you reach to close enough. Apply same stopping
criterion
24
COMPARISON BISECTION Vs. FALSE POSITION
25
Advantages
Why this method?
Faster
Always converge for a single root
Disadvantages
One-sideness one bracketing point will tend
to stay fixed
can lead to poor convergence, especially
for functions with significant curvature.
End
Class dismissed!
28