CE304 Unit 2 Lec1 Jumah2018
CE304 Unit 2 Lec1 Jumah2018
PART 2
ROOTS OF EQUATIONS
Nonlinear Equation
Solvers
Simple fixed
Graphical
Newton Raphson
Bisection
Secant method
False Position
Multiple roots
Roots of polynomials, Using computers, MATLAB & EXCEL
1
2/10/2019
Roots of Equations
Root of an equation: is the value of the equation variable
which makes the equations = 0.0 (zeros)
f ( X ) ax 2 bx c
b b 2 4ac
for f ( x) 0.0 x
2a
• Classical methods:
Exact solution (not always available)
Trial and Error (non systematic procedures)
Graphical solution (inaccurate)
• Numerical systematic methods suitable for computers
(3)
-Graphical Solution
• Plot the function f(x)
f(x)
roots
f(x)=0
f(x)=0 f(x)=0 x
(4)
2
2/10/2019
(5)
(6)
3
2/10/2019
f(x) f(x)
f(xl)=+ve f(xl)=+ve
2 roots 3 roots
f(xu)=+ve
x x
xl xu xl f(xu)=-ve
f(x) xu
f(x)
6 roots f(xl)=+ve
5 roots (odd)
x x
xl xu xl xu f(xu)=-ve
(7)
the interval is divided in half with the root lies in the midpoint
of the subinterval. This process is repeated to obtained refined
estimates.
(8)
4
2/10/2019
(9)
f(xr2) f(xu)
5
2/10/2019
c
f(c) mg t
f (c) (1 e ) v
m
c
6.067
667.38
f (c ) (1 e 0.146843c ) 40
c
1.569
c Assume xl = 12 and xu=16
12 14 16
-2.269
(11)
f(x)
Assume xl = 12 and xu=16
f(xl)=6.067 and f(xu)=-2.269<0 6.067
estimate root: xr=(xl+xu)/2= 14
f(12).f(14) =6.067•1.569=9.517 >0; 1.569
the root lies in [14, 16]. 12 14 16
x
-2.269
Assume xl = 14 and xu=16, the new root
xr=(14+ 16)/2= 15 f(x)
(f(12).f(14)>0): xl = 14
f(14).f(15) =1.569•-0.425=-0.666 <0;
the root lies in [14, 15].
Assume xl = 14 and xu=15, thus the new
root xr=(14+ 15)/2= 14.5 1.569
15
and repeat until ea < es 14 16
x
(12) -0.425 -2.269
6
2/10/2019
(13)
Bracketing Methods:
2. False-position Method
A shortcoming to the bisection method is that, in dividing the
interval xl to xu into equal halves, no account is taking of the
magnitudes of f(xl) and f(xu). For example if f(xl) is closer to zero
than f(xu), then it is more likely that the root will be closer to f(xl).
An alternative method is join f(xl) and f(xu) by a straight line. The
intersection of this line with the x-axis represents and improved
estimate of the root.
f ( xl ) f ( xu ) f(x) f(xl) root
xr xl xr xu
f ( xu )( xl xu )
xr xu xl f(xr1) xu
f ( xl ) f ( xu ) x
(20) xr f(xu)
7
2/10/2019
c
mg t
f (c) (1 e m ) v
c
667.38
f (c) (1 e 0.146843c ) 40
c
(22)
8
2/10/2019
f(12)f(16)<0
6.067
The first estimate for the root:
14.91
2.2688(12 16)
xr 16 14.9113
6.0669 (2.2688)
f(12).f(14.9113) =-1.5426<0; the root x
12 16
lies in the first subinterval [12,14.9113].
14.79 -2.269
Update xl = 12 and xu=14.9113,
0.2543(12 14.9113)
xr 14.9113 14.7942
6.0669 (0.2543)
The 2nd estimate is xr= 14.7942
This has an approximate error of 0.79%
(23)
(24)
9
2/10/2019
Ch 6. Open Methods
For bracketing methods the root is located within an interval
prescribed by a lower and an upper bounds.
These methods are convergent to the root.
Open methods are based on formulas that require only a
single starting value of x or two starting values that do not
necessarily bracket the root.
These method sometimes diverge or move away from the true
root as the computation progresses
However, when they converge, they converge very quickly
compared to the bracketing methods.
(25)
Converging
increments
Bracketing methods
(26)
Open Methods
10
2/10/2019
Open Methods:
1. Simple Fixed-Point Iteration
The function f(x)=0 is rearranged such that x on the left-hand side of
the equation f ( x) 0 g ( x) x
xi 1 g ( xi ) xo given, i 0,1, 2, ...
Ei+1 = g’ (ƺ) Ei
11
2/10/2019
f 2 ( x) e x
x
xr
(30)
12
2/10/2019
Two alternative
graphical methods
(Fig. 6.2)
(31)
Convergence &
Divergence of
Fixed–point
iteration
(32)
13
2/10/2019
Open Methods
2. The Newton Raphson Method
Newton's method is an iterative method
f(x)
for root finding. That is, starting from
some guess at the root, x0; one iteration of
the algorithm produces a number x1; f(xi)
which is supposed to be closer to a root;
guesses x2; x3; : : : ; xn follow identically. Slope f /(xi)
f(xi+1) xi
Newton's method uses “linearization” to
Root xi+1
find an approximate root. Recalling
Taylor's Theorem, we know that
f ( xi 1 ) f ( xi ) f ' ( xi )( xi 1 xi )
f ( xi 1 ) f ( xi )
f ( xi ) 0 f (x )
f / ( xi ) xi 1 xi / i
x i xi 1 f ( xi ) x i1 xi
(33)
f ( xr ) 2
E t , i 1 Et , i
2 f ( x r )
(34)
14
2/10/2019
Example 6.3
Use N-R method to estimate the root of f(x)=e-x-x employing
an initial guess of xo=0.
I xi |e t |i
f ( x ) e x 1
0 0 100
xi
e xi 1 0.500000000 11.8
Then, xi 1 xi e xi 1 2 0.566311003 0.147
slope f ( x ) 3 0.567143165 0.0000220
4 0.567143290 <10-8
f ( xi )
f ( xi ) 0
xi 1
The true Root:
xi
0.56714329
xi x i 1
(35)
Poor convergence
(36)
15
2/10/2019
Open Methods
3. The Secant Method
N-R method requires the f(x)
evaluation of the derivative of the f(xi-1) f ( x i 1 ) f ( x i )
Example:
Use Secant method to estimate the root of f(x)=e-x-x
employing an initial guess of x 0, and x 1
1 0
First iteration, The true Root:
0.63212(0 1) 0.56714329
x1 1 0.61270 e t 8.0%
1 ( .63212)
Second iteration:
0.0708(1 0.61270)
x2 0.61270 0.56384 e t 0.58%
.63212 ( 0.07081)
Third iteration:
0.00518(0.61270 0.56384)
x3 0.56384 0.56717 e t 0.0048%
0.07081 (0.00518)
(39)
16
2/10/2019
Example:
Use modified Secant method to estimate the root of f(x)=e-x-x
use a value of 0.01 for and start with x0 1 The true Root:
First iteration, x0 1 f ( x0 ) 0.63212 0.56714329
x0 x0 1.01 f ( x0 x0 ) 0.64578
Then, 0.01(0.63212)
x1 1 0.537263 e t 5.3%
0.64578 ( .63212)
Second iteration:
0.005373(0.047083)
x2 0.537263 0.56701 e t 0.0236%
0.038579 0.047083
Third iteration:
0.00567(0.000209)
x3 0.56701 0.567143 e t 2.365 105%
0.00867 0.000209
17