Professional Documents
Culture Documents
5
Bisection method
False-position method
Newton-Raphson Method
Secant Method
Simple Fixed-Point Iteration
6
Root of an equation can be defined as “ the
value of x that makes f(x) = 0 or can be called
as the zeros of the equation.
2𝑥 2 = 9 + 𝑥
ln 𝑦 = 𝑦𝑥 + 3𝑦
𝑣 = 𝑚𝑥 + 3𝑡
11
The quadratic formula normally used to
calculate the roots of equation analytically,
f(x) = ax2 + bx +c = 0
−𝑏± 𝑏2 −4𝑎𝑐
𝑥=
2𝑎
• Use calculator
• Use formula
f(xl ) and f(xu ) having same sign f(xl ) and f(xu ) having different sign
15
Requirements:
f(x) is real and continuous in the interval of xl
and xu
f(xl ) and f(xu ) having opposite sign that is
f(xl) f(xu) < 0 (- ve)
Characteristic
incremental search method in which the interval
is divided in half
if a function changes sign over an interval, the
function value at midpoint is evaluated
16
17
1. Rearrange the equation to be equal to zero, f(x)=0
2. Choose the lower xl and upper xu guesses for the root, such
that f(xl ) f(xu ) < 0
𝒙𝒍 + 𝒙𝒖
3. Estimate the roots, xr 𝒙𝒓 =
𝟐
… 𝐄𝐪. (𝟏. 𝟏)
18
Determine the real root of
𝑓 𝑥 = 𝑥 3 − 13𝑥 − 12 = 0
using
a) Analytically
b) The bisection method, with initial guesses of xl = 2 and
xu = 5, and εs=0.05%,
Solution
a) Analytical method
𝑓 𝑥 = 𝑥 3 − 13𝑥 − 12 = 0
Using calculator, x= 4, -3, -1
19
b) Bisection method
Iteration 1
𝑥 3 − 13𝑥 − 12 = 0
𝑥𝑙 = 2, 𝑓 2 = 23 − 13 2 − 12 = −30
𝑥𝑢 = 5, 𝑓 5 = 53 − 13 5 − 12 = 48
2+5
𝑥𝑟 = = 3.500 𝑓 3.5 = 3.5003 − 13 3.500 − 12 = −14.6250
2
𝑓(𝑥𝑙 )𝑓(𝑥𝑟 ) > 0, ∴ 𝑥𝑙 = 𝑥𝑟
𝜀𝑎 = −
20
b) Bisection method
Iteration 2
𝑥𝑙 = 3.5, 𝑓 3.5 = −14.6250
𝑥𝑢 = 5, 𝑓 5 = 48
3.5 + 5
𝑥𝑟 = = 4.2500 𝑓 4.2500 = 4.25003 − 13 4.2500 − 12 = 9.5156
2
𝑓(𝑥𝑙 )𝑓(𝑥𝑟 ) < 0, ∴ 𝑥𝑢 = 𝑥𝑟
21
f(xl)f(xr)
iter xl xr xu f(xl) f(xr) 𝜀𝑎
sign
∴ 𝑥𝑟 = 4.0625
22
Similar to bisection method
Use different strategy to
estimate root
Locate root by joining f(xl) and
f(xu) with a straight line.
The intersection of this line
with the x-axis is the estimated
root
𝑓 𝑥𝑢 𝑥𝑙 − 𝑥𝑢
𝑥𝑟 = 𝑥𝑢 − … 𝐸𝑞. (1.2)
𝑓 𝑥𝑙 − 𝑓 𝑥𝑢
24
Determine the positive real root of
𝑓 𝑥 = 𝑥 3 − 13𝑥 − 12 = 0
a) Analytically,
b) the bisection method, with initial guesses of xl
= 2 and xu = 5, and εs=0.05%,
c) the false-position method, with the same initial
guesses and condition as in (b).
25
Determine the positive real root of
ln(x2) = 0.7 using
a) Analytically,
b) the bisection method, with initial guesses of xl
= 0.5 and xu = 2, and εs=0.5%,
c) the false-position method, with the same initial
guesses and condition as in (b).
26
Bisection method
False-position method
Newton-Raphson method
Secant Method
Simple Fixed-Point Iteration
MATLAB
27
BRACKETING
METHOD
1. Bisection
2. False Position OPEN METHOD
1. Newton-Raphson
2. Secant
3. Simple Fixed-Point Iteration
GRAPHICAL
METHOD
28
Open methods differ from bracketing
methods, in that open methods require only
a single starting value or two starting values
that do not necessarily bracket a root.
Bracketing method
Based on forming the tangent line to the f(x)
curve at some guess x, then following the
tangent line to where it crosses the x-axis.
f ( xi ) 0
f ( xi )
'
xi xi 1
f ( xi )
xi 1 xi '
Eq.(1.3)
f ( xi )
1. Rearrange the equation to be equal to zero,
f(x)=0
2. Differentiate f(x) equation, f ’(x)
3. Guess the initial value for the root, xo
4. Estimate the new roots, xi+1 using Eq. (1.3)
5. Estimate the relative error, εa or εT .
6. Repeat steps 4-5 until |εa| < εs or meet the
stopping criterion
32
Use the Newton-Raphson Method to
estimate the root of the equation below
employing the initial guess of yo=0. Perform
iteration until the approximate relative error
falls below 0.05%
𝑒 −𝑦 = 2𝑦
Answer: Xr = 0.3517 33
1. f(y) = 𝑒 −𝑦 − 2𝑦 = 0
2. f‘(y) = −𝑒 −𝑦 − 2
3. Let yo=0 𝑓(𝑦𝑖 )
4. Estimate 𝑦𝑖+1 = 𝑦𝑖 − ′
𝑓 (𝑦𝑖 )
Iteration, 1 5. Estimate relative error
𝑒 −𝑦𝑜 − 2𝑦𝑜 𝑦1 − 𝑦0
𝑦1 = 𝑦𝑜 − 𝜀𝑎 = × 100
−𝑒 −𝑦𝑜 − 2 𝑦1
𝑒 −0 − 2 0 0.3333 − 0
𝑦1 = 0 − −0
= 0.3333 𝜀𝑎 = × 100
−𝑒 − 2 0.3333
= 100%
34
Repeat step 4. Iteration 2
𝑒 −𝑦1 − 2𝑦1
𝑦2 = 𝑦1 −
−𝑒 −𝑦1 − 2
𝑒 −0.3333 − 2 0.3333
𝑦2 = 0.3333 −
−𝑒 −0.3333 − 2
𝑦2 = 0.3517
5. Estimate relative error
𝑦2 − 𝑦1
𝜀𝑎 = × 100
𝑦2
0.3517 − 0.3333
𝜀𝑎 = × 100 = 5.2317%
0.3517
35
6. Continue the calculation until |εa |< εs
iteration yi εa (%)
0 0 -
1 0.3333 100
2 0.3517 5.2317
3 0.3517 0.0000
7. Therefore Xr = 0.3517
36
Determine the root of the following easily
differentiable function
𝑒 0.5𝑥 = 5 − 5𝑥
Using Newton-Raphson with initial guess of
xo=0. Perform iterations until approximative
relative error falls below 1%.
Answer: iteration x εa (%)
0 0 -
1 0.7273 100
2 0.7142 1.8341
3 0.7142 0.0008
37
Advantage Disadvantage
Difficulty in
Simple differentiation
38
Four cases where Newton-Raphson method shows
slow and poor convergence
Determine the root of the following easily differentiable
function
𝑒 0.5𝑥 = 5 − 5𝑥
Using Newton-Raphson with initial guess of xo=0. Perform
iterations until approximative relative error falls below 2%.
Answer: 10
0
-1 -0.5 0 0.5 1 1.5 2 2.5
-2
-4
-6
-8
40
Find the first root above x=0 for the following function with
an accuracy of 4 digits
𝑒 𝑥 = 4𝑥 2 + 3
Graphical Method
300
250
200
150
100
50
0
0 1 2 3 4 5 6 7
-50
41
iteration xi εa (%) iteration xi εa (%)
0 0.0000 0 3.0000
1 2.0000 100 1 -1.8319 263.7605
2 0.6516 206.9339 2 -0.7342 149.5198
3 -0.1922 438.9975 3 0.0018 40151.12
4 0.7908 124.3073 4 2.0260 99.9095
5 -0.0091 8826.069 5 0.6537 209.919
iteration xi εa (%)
0 4.000
1 4.5488 12.0647
2 4.3982 3.4235
3 4.3781 0.4601
4 4.3778 0.0076
5 4.3778 2E-06 42
Bisection method
False-position method
Newton-Raphson method
Secant Method
Simple Fixed-Point Iteration
43
A potential problem in implementing the
Newton-Raphson method is the evaluation of
the derivative - there are certain functions
whose derivatives may be difficult or
inconvenient to evaluate.
For these cases, the derivative can be
approximated by a backward finite divided
difference:
f (x i1 ) f (x i )
f (x i )
'
x i1 x i
Substitution of this approximation for the
derivative to the Newton-Raphson method
equation gives:
f ( xi ) xi 1 xi
xi 1 xi Eq.(1.4)
f ( xi 1 ) f ( xi )
Note - this method requires two initial estimates
of x but does not require an analytical
expression of the derivative.
1. Rearrange the equation to be equal to zero,
f(x)=0
2. Guess two initial values, xi and xi-1
4. Estimate the new roots, xi+1 using Eq.(1.4)
5. Estimate the relative error, εa or εT .
6. Repeat steps 4-5 until |εa| < εs or meet the
stopping criterion
47
Use the Secant Method to estimate the root
of the equation below employing the initial
guess of yo=0. Perform iteration until the
approximate relative error falls below 0.05%
𝑒 0.5𝑥 (4 − 𝑥) = 5
Answer: Xr = 1.0664 48
0.5𝑥
1. f(x) = 𝑒 4 − 𝑥 − 5=0
2. Let xo=0, x1=1,
f ( xi ) xi 1 xi
3. Estimate xi 1 xi Eq.(1.4)
f ( xi 1 ) f ( xi )
Iteration 1
𝑓 𝑥𝑜 = 𝑒 0.5 0 4 − 0 − 5 = −1 5. Estimate relative error
𝑓 𝑥1 = 𝑒 0.5 1 4 − 1 − 5 = −0.0538 𝑥2 − 𝑥1
𝜀𝑎 = × 100
𝑥2
𝑓(𝑥1 )(𝑥𝑜 − 𝑥1 )
𝑥2 = 𝑥1 − 1.0569 − 1
𝑓 𝑥𝑜 − 𝑓(𝑥1 ) 𝜀𝑎 = × 100
1.0569
0.0538(0 − 1)
𝑥2 = 1 + = 1.0569 = 100%
−1 + 0.0538 49
Repeat step 4. Iteration 2
𝑓 𝑥2 = 𝑒 0.5 1.0569 4 − 1.0569 − 5 = −7.6165 × 10−3
𝑓(𝑥2 )(𝑥1 − 𝑥2 )
𝑥3 = 𝑥2 −
𝑓 𝑥1 − 𝑓(𝑥2 )
0 0 -1 -
7. Therefore Xr = 1.0664
51
Repeat exercise 2 with Secant method.
Determine the root of the following easily
differentiable function
𝑒 0.5𝑥 = 5 − 5𝑥
Using Secant with initial guess of xo=0 and
x1=0.5. Perform iterations until approximative
relative error falls below 0.005%.
iteration xi f(xi) εa (%)
Answer:
0 0.0000 -4.0000
1 0.5000 -1.2160 100
2 0.7184 0.0241 30.3994
3 0.7141 -0.0002 0.5941
4 0.7142 -2.067E-08 0.0038 52
Determine the positive real root of
ln(x2) = 0.7 using
53
Bisection method
False-position method
Newton-Raphson method
Secant Method
Simple Fixed-Point Iteration
55
Rearrange the function f(x)=0 so that x is on
the left-hand side of the equation:
x=g(x)
Use the new function g to predict a new
value of x - that is,
xi+1=g(xi)
Answer: Xr = 0.5671
iteration xi εa (%)
0 0.0000
1 1.0000 100
2 0.3679 171.8282
3 0.6922 46.8536
4 0.5005 38.3091
5 0.6062 17.4468
6 0.5454 11.1566
7 0.5796 5.9034
8 0.5601 3.4809
9 0.5711 1.9308
10 0.5649 1.1089
11 0.5684 0.6244
12 0.5664 0.3556
58
Use the Simple Fixed-point Method to
estimate the root of the equation below by
employing the initial guess of xo=0.5.
Perform iteration until the approximate
relative error falls below 0.05%
𝑓 𝑥 = sin( x) − 𝑥
Answer: 0.7686 59
Convergence of the simple
fixed-point iteration method
requires that the derivative
of g(x) near the root has a
magnitude less than 1.
a) Convergent, 0≤g’<1
b) Convergent, -1<g’≤0
c) Divergent, g’>1
d) Divergent, g’<-1
Medical studies established that bungee jumper can
cause significant vertebrae injury if the free-fall velocity
exceeds 36 m/s after 4s of free fall. Given g=9.81 m/s2
cd=0.25 kg/m. Determine the mass at this criterion is
exceeded using different numerical method approach
𝑔𝑚 𝑔𝑐𝑑
𝑣 𝑡 = 𝑡𝑎𝑛ℎ 𝑡
𝑐𝑑 𝑚
i) Bisection method
ii) False-position method
iii) Newton Raphson method
iv) Secant method
61
For fluid flow in pipes, friction is describe by a dimensionless
number, the Fanning friction factor f. The Fanning friction factor
is dependent on a number of parameters related to the size of
the pipe and the fluid, which can all be represented by another
dimensionless quantity, the Reynolds number Re. A formula that
predicts f given Re is the von Karman equation:
1
= 4𝑙𝑜𝑔10 𝑅𝑒 𝑓 − 0.4
𝑓
Typical values for the Reynolds number for turbulent flow are
10,000 to 500,000 and for the Fanning friction factor are 0.001
to 0.01. Solve for f given a user-supplied value of Re between
2,500 and 1,000,000.
i) Bisection method
ii) False-position method
iii) Newton Raphson method
iv) Secant method
62
MATLAB FUNCTION:
fzero
roots (polynomials)
63
MATLAB’s fzero provides the best qualities of
both bracketing methods and open methods.
Command window
fun= @(x) x^10-1;
[x, fx] = fzero(fun, 0.5)
Answer:
Command window
x= 1
fx =0
Determine the positive real root of
ln(x2) = 0.7 using
66
Options may be passed to fzero as a third input
argument - the options are a data structure created by
the optimset command
70
MATLAB has a built in program called roots to
determine all the roots of a polynomial - including
imaginary and complex ones.
x = roots(c)
x is a column vector containing the roots
c is a row vector containing the polynomial coefficients
Example: Find the roots of
f(x)=x5-3.5x4+2.75x3+2.125x2-3.875x+1.25
Command window