0% found this document useful (0 votes)
60 views17 pages

CE304 Unit 2 Lec1 Jumah2018

The document discusses numerical methods for finding the roots or zeros of equations. It begins by defining what a root of an equation is and mentions classical graphical and trial-and-error methods. It then introduces bracketing methods, which use two initial guesses to bracket the root. The bisection method is presented, which works by repeatedly bisecting the interval and narrowing in on the root. An example applying the bisection method to find the drag coefficient of a parachute is shown step-by-step.

Uploaded by

Abdallah Alhasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views17 pages

CE304 Unit 2 Lec1 Jumah2018

The document discusses numerical methods for finding the roots or zeros of equations. It begins by defining what a root of an equation is and mentions classical graphical and trial-and-error methods. It then introduces bracketing methods, which use two initial guesses to bracket the root. The bisection method is presented, which works by repeatedly bisecting the interval and narrowing in on the root. An example applying the bisection method to find the drag coefficient of a parachute is shown step-by-step.

Uploaded by

Abdallah Alhasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

2/10/2019

PART 2
ROOTS OF EQUATIONS

Nonlinear Equation
Solvers

Bracketing Open Methods

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

• The roots exist where f(x) intersect with the x-axis.

(4)

2
2/10/2019

Graphical Solution: Example


c
mg  t
 The parachutist velocity is v (1  e m )
c
• What is the drag coefficient c needed to reach a velocity of 40 m/s if
m =68.1 kg, t=10 s, g= 9.8 m/s2
c
c F(c) mg  t
f (c)  (1  e )  v
m
f(c) 4 34.115 c
8 17.653
667.38
12 6.067 f (c )  (1  e 0.146843c )  40
16 -2.269 c
20 -8.401 Check: F (14.75) = 0.059 ~ 0.0

Root c v (c=14.75) = 40.059 ~ 40 m/s


c=14.75

(5)

Numerical Systematic Methods


I. Bracketing Methods
 The function changes sign in the neighborhood of a root. Two
initial guesses (xl and xu) are proposed to bracket the root (s).

 If one root of a real and continuous function, f(x)=0, is


bounded by values x=xl, x =xu then
f(xl) . f(xu) <0. (The function changes sign on opposite sides of the root)

 Graphical reading of the function can expedite and improve


efforts to find the roots.

(6)

3
2/10/2019

No roots or even number of roots Root(s) exist, Odd number of roots

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)

Bracketing Methods (Or, two point methods for finding roots)


1. Bisection Method (Interval Halving)
 Generally if f(x) is real and continuous in the interval xl to xu and

f (xl).f(xu)<0, then there is at least one real root between xl and xu


to this function.

 The interval at which the function changes sign is located. Then

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

1: Pick lower xl and upper xu guesses for the root f(x)


such that the function changes sign over the xr = ( xl + xu )/2
interval, i.e f(xl).f(xu)<0
f(xl)
2: An estimate of the root is:
xr = ( xl + xu )/2 f(xr1)

3: Make the following evaluations to determine in xl xr1 xu


x
which subinterval the root lies:
f(xu)
*If (f(xl).f(xr)<0) the root lies in the lower
subinterval; xu = xr and return to step 2. f(x) (f(xl).f(xr) >0): xl = xr
xr = ( xl + xu )/2
*If (f(xl).f(xr)>0) the root lies in the upper
subinterval; xl = xr and return to step 2.
*If (f(xl).f(xr)=0) the root is xr and stop.
f(xl)
4: Compare ea to es.
5: If ea < es, stop. xl
xr2 x x
Otherwise repeat the process. u

(9)
f(xr2) f(xu)

Error Estimation and number of iteration


True Error : Approximate Error :
X  X approximate X rnew  X rold
e t  true  100 ea   100
X true X rnew

 Interval size, I, after n steps xun  xln xu  xl


I 
2 2n
 The interval size at any given iteration also corresponds to the maximum
error in xr, xu  xl
e an 
2n
 you wish to limit the error to e s then
xu  xl xu  xl ln(( xu  xl ) / e )
e  2 n
  n 
2n e ln 2
n  1.443ln(( xu  xl ) / e )
(10)

5
2/10/2019

Bisection method: Example c


mg  t
 The parachutist velocity is v (1  e m )
c
• What is the drag coefficient c needed to reach a velocity of 40 m/s if
m =68.1 kg, t=10 s, g= 9.8 m/s2

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

• In the previous example, if the stopping criterion is es =


0.5%; what is the root? (Cexact = 14.7802)
Iteration Xl Xu Xr ea % et %
1 12 16 14 5.279
2 14 16 15 6.667 1.487
3 14 15 14.5 3.448 1.896
4 14.5 15 14.75 1.695 0.204
5 14.75 15 14.875 0.84 0.641
6 14.74 14.875 14.813 0.422 0.291

(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

1: Pick lower xl and upper xu guesses for the


root such that the function changes sign over
f(x) f(xu) root
the interval, i.e f(xl).f(xu)<0
2: An estimate of the root is
f ( xu )( xl  xu ) xl f(xr1) xu
xr  xu  x
f ( xl )  f ( xu )
xr f(xu)
3: Make the following evaluations to
determine in which subinterval the root lies:
If (f(xl).f(xr)<0) the root lies in the lower x  x  f ( xu )( xl  xu )
r u
f ( xl )  f ( xu )
subinterval; xu = xr and return to step 2.
If (f(xl).f(xr)>0) the root lies in the upper
subinterval; xl = xr and return to step 2. 4: Compare ea to es.
If (f(xl).f(xr)=0) the root is xr and stop. 5: If ea < es, stop.
Otherwise repeat the
(21)
process.

False position method: Example


c
mg  t

 EX 5.5: The parachutist velocity is v (1  e m )


c
What is the drag coefficient c needed to reach a velocity of 40 m/s if m
=68.1 kg, t=10 s, g= 9.8 m/s2

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

 Choose xl = 12 and xu=16 such that f(x)

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)

 Although the false-position method would seem to always be


the right choice, there are cases where it performs poorly.
See Example 5.6:
Roots of f ( x)  x10  1 [0,1.3]
Bisection 5 iteration: xr=1.015625 error = 4.0%
False-position 5 iteration: xr=0.40788 error =17.1%

(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)

Convergence and Divergence Concepts


Diverging
increments

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, ...

f(x)=x2-2x+3=0 x=(x2+3)/2 (manipulation)


f(x)= sin x = 0 x = sin x +x (adding x to both sides)
 Thus, given an initial guess at root xi then xi+1 can be estimated as
expressed by the iterative formula
xi+1 = g(xi)
 This continues until
xi 1  xi
ea  100%  e s
xi 1
(27)

For Simple Fixed-Point Iteration,

It can be shown that the error for any


iteration is linearly proportional to the
error from the previous iteration
multiplied by the absolute value of the
slope of g;

Ei+1 = g’ (ƺ) Ei

11
2/10/2019

Simple Fixed-Point Iteration: Example 6.1


 Use the simple fixed point iteration to locate the root of f(x)=e-x-x.
The function can be rearranged as f ( x)  0 
i xi ea % et %
g ( x)  x
0 0 100
1 1 100 76.3 xi 1  e xi
2 0.36788 171.8 35.1
3 0.6922 46.9 22.1
4 0.50047 38.3 11.8 Initial guess
5 0.60624 17.4 6.89 X0=0.0
6 0.5454 11.2 3.83
7 0.57961 5.9 2.2 The true Root:
8 0.56012 3.48 1.24 0.56714329
9 0.57114 1.93 0.705
(29)
10 0.56488 1.11 0.399

An alternative graphical approach is to separate the


equation into two component parts as
f1 ( x )  f 2 ( x)
Then the two equations can
x=e-x
be plotted Separately. The x or: e-x-x = 0
value corresponding to the
f(x)
intersections of these f1 ( x )  x
Functions represent the
roots of f ( x)  0 g(x)=e-x

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

(see Fig. 6.3)

(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 i1  xi
(33)

A tangent to f(x) at the initial point xi is extended till it meets


the x-axis at the improved estimate of the root xi+1.
0  f ( xi )  f ( xi )( xi 1  xi )
f ( )
0  f ( xi )  f ( xi )( xr  xi )  ( xr  xi )2
2!
f ( )
0  f ( xi )( xr  xi 1 )  ( x r  xi ) 2
2!
f ( ) 2
E t , i  1  xr  xi  1 0  f ( x i ) E t , i  1  Et ,i
2!

 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 )

function. Sometimes derivatives x i1  x i


may be difficult or inconvenient to
evaluate. For these cases The
derivative f /(x) can be
approximated by a backward finite f(xi)
divided difference
f ( xi 1 )  f ( xi ) x
f / ( xi ) 
xi 1  xi xi
xi+1 xi-1
This yields the following equation:
f ( xi )( xi 1  xi )
xi 1  xi  Root
f ( xi 1 )  f ( xi )
(38)

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

Modified Secant Method


 Rather than using two arbitrary values to estimate the derivative, an
alternative approach involves a fractional perturbation of the
independent variable to estimate f /(x) ,
f ( x i   x i )  f ( xi )
f / ( xi ) 
 xi
 Where   a small perturbation fraction. This approximation can be
substituted in the Secant formula to yield
f ( xi ) xi
xi 1  xi 
f ( x i   xi )  f ( xi )

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  105%
0.00867  0.000209

17

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy