0% found this document useful (0 votes)
73 views36 pages

KIL1005: Numerical Methods For Engineering

This document provides an overview of numerical methods for finding roots of equations. It discusses graphical methods, bracketing methods like bisection and false position, and open methods like fixed-point iteration and Newton-Raphson. Examples are provided to illustrate each method. Bracketing methods require initial guesses that bracket the root, while open methods only require a single starting value. The Newton-Raphson and secant methods are discussed as powerful root-finding algorithms, though they may not converge for all functions. Handling multiple roots is also addressed.

Uploaded by

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

KIL1005: Numerical Methods For Engineering

This document provides an overview of numerical methods for finding roots of equations. It discusses graphical methods, bracketing methods like bisection and false position, and open methods like fixed-point iteration and Newton-Raphson. Examples are provided to illustrate each method. Bracketing methods require initial guesses that bracket the root, while open methods only require a single starting value. The Newton-Raphson and secant methods are discussed as powerful root-finding algorithms, though they may not converge for all functions. Handling multiple roots is also addressed.

Uploaded by

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

KIL1005: Numerical Methods for Engineering

Semester 2, Session 2019/2020


Lecture 2: Finding Roots of Equations
27 Feb 2020

Dr. Mahar Diana Hamid


Department of Chemical Engineering
University Malaya
Roots of Equations
Root of quadratic formula for f(x)=0

•Known
 b  b 2  4ac
ax  bx  c  0 
2
x
2a

•But
ax 5  bx 4  cx 3  dx 2  ex  f  0  x  ?
sin x  x  0  x  ?

2
Nonlinear Equation
Solvers

Graphical Bracketing Open Methods

All Iterative
3
Bracketing Methods

› Two initial guesses for the root are


required. These guesses must “bracket”
or be on either side of the root.

== > Fig. 5.1

› 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) 4
Graphical Method: Example 1
  the graphical approach to determine the drag coefficient
›Use
needed for a parachutist with mass m = 68.1 kg to have a
velocity of 40 m/s after the free-falling for t = 10 s. The
acceleration due to gravity is 9.81 m/s2. Show step where you
check the answer by substituting c into the original equation.

Tip: Start with c = 0 and increase the value by 2, i.e. 0, 2, 4,


6,..,20
Figure 5.2 Figure 5.3

6
Figure 5.4b

Figure 5.4a

Figure 5.4c

7
The Bisection Method
For the arbitrary equation of one variable, f(x)=0
1. Pick xl and xu such that they bound the root of interest,
check if f(xl).f(xu) <0.

2. Estimate the root by evaluating f[(xl+xu)/2].

3. Find the pair


• If f(xl). f[(xl+xu)/2]<0, root lies in the lower interval, then
xu=(xl+xu)/2 and go to step 2.

8
• If f(xl). f[(xl+xu)/2]>0, root
lies in the upper interval, then
xl= [(xl+xu)/2, go to step 2.

xl  xu
• xl 
If f(xl). f[(xl+xu)/2]=0, then 2
100%
root is (xl+xu)/2 and xl  xu
terminate. 2
or

4. Compare e s with ea xl  xu
xu 
2
100%
xl  xu
5. If ea< es, stop. Otherwise 2
repeat the process.

9
Figure 5.6

10
Evaluation of Method
Pros
Cons
› Slow
Easy
› Know
Alwaysa find
and broot
that bound root
› Multiple roots

11
Termination Criteria
 
› Without a termination criteria, the iteration will continue infinitely.
› Stopping criterion, εs – decide when to terminate the iteration.
› Happen when
εs = approximate relative error , εa

= root for the present iteration


= root for previous iteration
Example 2
Use Bisection method to solve problem in Example 1 using
xl=12 and xu=16. Calculate the root until the approximate
error falls below a stopping criterion of 0.5%.
Exercise 1
1.  Determine the root of:

(a) Graphically
(b) Using quadratic formula
(c) Using three iteration of the bisection method. Employ initial guesses of xl=5 and
xu=10. Compute the approximate relative error after each iteration.

1. 2. Determine the root of:

(a) Graphically
(b) Using the bisection method. Employ initial guesses of xl=0 and xu=1. Iterate until the
approximate relative error after each iteration falls below a stopping criterion of 10%.
The False-Position Method
(Regula-Falsi)
› If a real root is bounded
by xl and xu of f(x)=0,
then we can
approximate the
solution by doing a
linear interpolation
between the points [xl,
f(xl)] and [xu, f(xu)] to
find the xr value such
that l(xr)=0, l(x) is the
linear approximation of
f(x).

== > Fig. 5.12

15
Procedure
›1.  Find a pair of values of x, xl and xu such that
fl=f(xl) <0 and fu=f(xu) >0 or fl=f(xl) >0 and
fu=f(xu) <0. E.g. f(xl). f(xu) < 0.
2. Estimate the value of the root from the
following formula (Refer to Box 5.1)
=
and evaluate f(xr).

16
3. Use the new point to replace one of the original points,
keeping the two points on opposite sides of the x axis.

If f(xl).f(xr)<0 then root lies in the first subinterval and


xr becomes the upper limit for the next iteration.

If f(xl).f(xr)> 0 then root lies in the second subinterval


and xr becomes the lower limit for the next iteration.

If f(xr)=0 then you have found the root and need go no


further!

17
4. See if the new xl and xu are close enough for
convergence to be declared. If they are not go back
to step 2.

› Why this method?


– Faster
– Always converges for a single root.

See Sec.5.3.1, Pitfalls of the False-Position Method


Note: Always check by substituting estimated root in the
original equation to determine whether f(xr) ≈ 0.

18
Exercise 2
Solve the following problems using Regula-Falsi method.
- Example 2
- Exercise 3
Open Methods
Figure 6.1
› 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.

20
Simple Fixed-point Iteration
•Rearrange the function so that x is on
the left side of the equation:
f ( x)  0  g ( x)  x
xk  g ( xk 1 ) xo given , k  1, 2, ...
•Bracketing methods are “convergent”.
•Fixed-point methods may sometime
“diverge”, depending on the stating point
(initial guess) and how the function
behaves. 21
Example 4

2
 𝑥 − 2 𝑥+3=0
Can be manipulated to yield
2
 𝑥= 𝑥 +3
2

22
Example 5
Use simple fixed point iteration to locate the root of
f(x) = e-x - x
Figure 6.2
Convergence

x=g(x) can be expressed as a


pair of equations:
y1=x
y2=g(x) (component
equations)
Plot them separately.

24
Example 6
Separate the equation in Example 5 into two parts and
determine its roots graphically.
Newton-Raphson Method
› Most widely used method.
› Based on Taylor series expansion:
x 2
f ( xi 1 )  f ( xi )  f ( xi )x  f ( xi )  Ox 3
2!
The root is the value of x i 1 when f(x i 1 )  0
Rearrangin g,
Solve for
 i )( xi 1  xi )
0  f(x i )  f (x
f ( xi )
xi 1  xi  Newton-Raphson
f ( xi )
formula
26
Fig. 6.5

› A convenient method for


functions whose
derivatives can be
evaluated analytically. It
may not be convenient
for functions whose
derivatives cannot be
evaluated analytically.

27
Fig. 6.6

Pitfalls of the
Newton-Raphson
Method

28
Example 7
Use the Newton Raphson method to estimate the root of
Example 5. Employ an initial guess of x0 = 0. Calculate
until the fifth iteration.
The Secant Method
›  slight variation of Newton’s method for functions
A
whose derivatives are difficult to evaluate. For these
cases the derivative can be approximated by a
backward finite divided difference.

Substitute the above equation into the Newton Raphson


equation will give us the Secant equation:

30
Fig. 6.7
• Requires two initial
estimates of x , e.g, xo, x1.
However, because f(x) is
not required to change
signs between estimates,
it is not classified as a
“bracketing” method.
• The Secant method has
the same properties as
Newton’s method.
Convergence is not
guaranteed for all xo, f(x).

31
Fig. 6.8

32
Example 8
Use the Secant method to estimate the root of Example 5
with initial estimates of 0 and 1.
Multiple Roots
› None of the methods deal with multiple roots
efficiently, however, one way to deal with problems
is as follows:
f ( xi )
Set u ( xi )  This function has
f ( xi ) roots at all the
same locations as
u ( xi ) the original
Then find xi 1
u ( xi ) function

34
Fig. 6.13

35
› “Multiple root” corresponds to a point where a
function is tangent to the x axis.
› Difficulties
– Function does not change sign at the multiple root,
therefore, cannot use bracketing methods.
– Both f(x) and f′(x)=0, division by zero with Newton’s and
Secant methods.

36

You might also like