Lesson 3-Roots and Optimization
Lesson 3-Roots and Optimization
Numerical Methods
for Engineers
Lesson-03
Roots and Optimization
Roots
A function of a single variable illustrating the difference between roots and optima
3
Methods
Roots
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
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.
11
Bisection Method
Theorem
If a function changes sign over an interval, the function
value at the midpoint is evaluated.
12
Bisection Method
13
Bisection Method
Approximate percent relative error
14
Bisection Method
Example 1
Use bisection method to estimate 𝑥 3 = 20. Take 𝑥𝑙 = 1, 𝑥𝑢 =
4 for 5 iterations.
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
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.
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 i1
f (x i )
x i1 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.
27
The Secant Methods
f (x i1 ) f (x i )
f (x i )
'
x i1 x i
28
The Secant Methods
• Substitution of this approximation for the derivative to the
Newton-Raphson method equation gives:
f (x i )x i1 x i
x i1 x i
f (x i1 ) f (x i )
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