0% found this document useful (0 votes)
119 views

Lesson 3-Roots and Optimization

This document discusses numerical methods for finding roots of equations, specifically: 1. Graphical methods can be used to find roots by plotting the function and finding where it crosses the x-axis. 2. Bracketing methods like bisection and false position iteratively narrow down the range that contains a root. 3. Open methods like Newton-Raphson and secant methods make successive approximations using derivatives or divided differences to zero in on roots, requiring only a single starting value.
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)
119 views

Lesson 3-Roots and Optimization

This document discusses numerical methods for finding roots of equations, specifically: 1. Graphical methods can be used to find roots by plotting the function and finding where it crosses the x-axis. 2. Bracketing methods like bisection and false position iteratively narrow down the range that contains a root. 3. Open methods like Newton-Raphson and secant methods make successive approximations using derivatives or divided differences to zero in on roots, requiring only a single starting value.
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/ 30

CHE 358

Numerical Methods
for Engineers

Dr. Martinson Addo Nartey


Credit: Dr. K. Mensah-Darkwa

Lesson-03
Roots and Optimization
Roots

A function of a single variable illustrating the difference between roots and optima

b  b 2  4ac Thus Roots


x ; therefore become
Back in the day, 2a the zeros an
f ( x)  ax 2  bx  c  0 equation
2
Roots
• “Roots” problems occur when some function f can be
written in terms of one or more dependent variables x

• The value of x that makes f(x) = 0, is the root of the


equation

• These problems often occur when a design problem presents


an implicit equation for a required parameter.

3
Methods

Roots

Graphical Bracketing Open

False Newton- Secant


Bisection
Position Raphson Method

4
Fundamental principles used in design problems

5
6

Graphical Methods
Graphical Methods
• A simple method for obtaining the estimate of the root of
the equation f(x)=0 is to make a plot of the function and
observe where it crosses the x-axis.
• Illustration of a number of general ways that a root may
occur in an interval prescribed by a lower bound xl and
an upper bound xu

a) Same sign, no roots


b) Different sign, one root
c) Same sign, two roots
d) Different sign, three roots

7
Graphical Methods
• Same sign, no roots • Same sign, two roots

If both 𝑓(𝑥𝑙 ) and 𝑓(𝑥𝑢 ) have same sign, either there will be no roots or there will be
an even number of roots
8
Graphical Methods
• Different sign, one root • Different sign, three root

If the function has different signs at the end points, there will be an odd number of
roots.
9
10

Bracketing Method
Bracketing Method
• Bracketing methods are based on making two initial guesses
that “bracket” the root - that is, are on either side of the root.

• Brackets are formed by finding two guesses xl and xu where


the sign of the function changes; that is,
where f(xl) f(xu) < 0

11
Bisection Method
Theorem
 If a function changes sign over an interval, the function
value at the midpoint is evaluated.

 The location of the root is then determined as lying within


the subinterval where the sign change occurs.
i.e.. f(xl) f(xu) < 0

o The absolute error is reduced by a factor of 2 for each


iteration.

12
Bisection Method

13
Bisection Method
Approximate percent relative error

A benefit of the bisection method is that the number of


iterations required to attain an absolute error can be
computed before starting the computation, using

14
Bisection Method
Example 1
Use bisection method to estimate 𝑥 3 = 20. Take 𝑥𝑙 = 1, 𝑥𝑢 =
4 for 5 iterations.

• Try to find the roots of 2 using 1 and 2 as the initial


guesses.

15
False Position
The false position method is another bracketing method, also
called linear interpolation

Theorem
 It determines the next guess not by splitting the bracket in
half but by connecting the endpoints with a straight line and
determining the location of the intercept of the straight line
(xr).
 The value of xr then replaces whichever of the two initial
guesses yields a function value with the same sign as f(xr).

16
False Position
 False-position formula f (x u )(x l  x u )
xr  xu 
f (x l )  f (x u )



17
Bisection vs. False Position
• Bisection does not take into account the shape of the
function; this can be good or bad depending on the function!
f (x)  x 110 𝑎𝑡 𝑥𝑙 = 0; 𝑥𝑢 = 1.3

𝐵𝑖𝑠𝑒𝑐𝑡𝑖𝑜𝑛 𝑦𝑖𝑒𝑙𝑑𝑠:

𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑜𝑛 𝑦𝑖𝑒𝑙𝑑𝑠:

18
False Position
Example
 Given the function below, use the false position approach to
determine the root(s) of the function. [𝑐𝑑 = 0.25 𝑘𝑔/𝑚,
𝑡 = 4𝑠; 𝑣 = 36 𝑚/𝑠; 𝑔 = 9.81 𝑚/𝑠 ]

 Solution:

f (x u )(x l  x u )
xr  xu 
f (x l )  f (x u )

19
Homework
Determine the roots of the equation below
(a) Bisection Method
(b) False Position Method
Submission date: 27/05/21 before 12noon

f ( x)  12  21x  18 x  2.75 x 2 3

xl  1
xu  0
 s  1% 20
21

Open Method
Open Methods
• 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.

o Open methods may diverge as the computation progresses,


but when they do converge, they usually do so much faster
than bracketing methods.

22
Newton-Raphson Method
Based on forming a tangent line to the f(x) curve at some
guess value x, then following the tangent line to where it
crosses the x-axis.

23
Newton-Raphson Method

f (x i )  0
f (x i ) 
'

x i  x i1
f (x i )
x i1  x i  '
f (x i )
xi 1  xi
a  100%
xi 1 24
Newton-Raphson Method
Example:
Using the N-R method, compute the root of 𝑥 3 − 20. Take
𝑥𝑜 = 3

Solution

25
The Secant Methods
• 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:

27
The Secant Methods

f (x i1 )  f (x i )
f (x i ) 
'

x i1  x i



28
The Secant Methods
• Substitution of this approximation for the derivative to the
Newton-Raphson method equation gives:

f (x i )x i1  x i 
x i1  x i 
f (x i1 )  f (x i )

• NB - this method requires two initial estimates of x but does


not require an analytical expression of the derivative.
29
Modified Secant Methods
• 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);

d xi f (xi )
xi+1 = xi -
f (xi + d xi ) - f (xi )
 where δ = a small perturbation fraction

30
Secant Methods
• Example
Estimate the roots of 𝒇 𝒙 = 𝒙𝟑 − 𝟐𝟎. Take x0 = 4; x1 = 5.

• Solution
i=1; x2 = 3.353; relative approximate error = 63.92%
i=2; x3 = 3.059; relative approximate error = 9.691%

31

You might also like