MEC500 Numerical Methods With Applications: Roots of Equations

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

MEC500

Numerical Methods with


Applications
Chapter 2
Roots of Equations
DR. AHMAD SUFIAN BIN ABDULLAH Faculty of Mechanical Engineering
Ph.D The University of Manchester University Teknologi MARA PPinang
M.Eng (Hons) The University of Manchester
Room : BKM Floor 1, Room 1.24
Mechanical Engineering
Phone : 04-3823155/019-3112204
E-mail : sufian@ppinang.uitm.edu.my

1
Learning Outcome
• Understand what root problems are and where they occur in
engineering and science

• Knowing how to determine a root graphically

• Understanding the incremental search method and its


shortcomings

• Knowing how to solve a roots problem with bisection method.

• Knowing how to estimate the error of bisection and why it differs


from error estimates for other types of root location algorithms

• Understanding false position and how it differs from bisection

2
Introduction to Roots of Equations
In engineering, “Roots” problems occur when some function f can be
written in terms of one or more dependent variables x, where the
solutions to f(x) = 0 yields the solution to the problem.

Fundamental principles used in engineering design problems


Fundamental Dependent variable Independent Parameters
principle variable
Newton’s law Acceleration, velocity Time and Mass, system geometry,
of motion or location position and dissipative
parameters
Energy Charges in the kinetic Time and Thermal properties,
balance and potential energy position mass, system geometry
states of the system
Force balance Magnitude and Time and Strength of material,
direction forces position structural properties,
geometry of the system
3
Introduction to Roots of Equations
Previously known methods to solve roots of equations:
−𝒃 ± 𝒃𝟐 − 𝟒𝒂𝒄
𝒂𝒙𝟐 + 𝒃𝒙 + 𝒄 = 𝟎 → 𝒙=
𝟐𝒂
▪ this is direct method
▪ trial and error method (guessing)

How about
𝒂𝒙𝟗 + 𝒃𝒙𝟔 − 𝒄𝒙𝟒 + 𝒅𝒙𝟑 + 𝒆𝒙𝟐 − 𝒇𝒙 = 𝟎
𝒆−𝒙 − 𝒙 = 𝟎
𝒔𝒊𝒏𝒙 + 𝒙 = 𝟎 ??

Explicit and implicit expressions;

e.g. of explicit expression: implicit expression?


𝒈𝒎 −
𝒄
𝒕 𝒙 = 𝒔𝒊𝒏(𝒙)
𝒗= 𝟏−𝒆 𝒎
𝒄
4
Topics in Chapter 2

5
Graphical Method
▪ Used to solve root of equations

▪ The function f(x) is plotted against x and the location(s) where it


crosses the x axis provides a rough approximation of the root(s).

# Example 1 (Graphical Method)


𝑔 = 9.81 𝑚/𝑠 2
𝑚 = 69.1 𝑘𝑔
𝑡 = 2.0 𝑠
𝑣 = 1 𝑚/𝑠
▪ Initial Remarks?
▪ It is just an estimation and not precise
▪ Inefficient to be implemented in computer similar to direct and trial and
error method

6
Graphical Method
However….

▪ Graphs can also indicate where roots may be and where some
root-finding methods may fail.

▪ The bracketing bounds may give general idea about the number
of the roots

▪ But there is also type of function that does not imply this
generalisation such as: function that tangential to x-axis (multiple
roots) and discontinuous function

# Example 2 (Graphical Method)

This function has several roots between x = 0 to x = 5.


7
Remarks on Graphical Method
✓ The estimation is not precise

✓ Can be used as initial guesses for use in


advance numerical methods in solving roots of
equations

✓ Allow us to understand better on the properties


of the function

✓ Allow us to anticipate the pitfall of the


numerical methods
8
MEC500
Numerical Methods with
Applications
Chapter 2.1 – Bracketing Methods
Roots of Equations
DR. AHMAD SUFIAN BIN ABDULLAH Faculty of Mechanical Engineering
Ph.D The University of Manchester University Teknologi MARA PPinang
M.Eng (Hons) The University of Manchester
Room : BKM Floor 1, Room 1.24
Mechanical Engineering
Phone : 04-3823155/019-3112204
E-mail : sufian@ppinang.uitm.edu.my

9
2.1 Bracketing Methods

- Because two initial guesses for the root are


required

- General guides (with few exceptions):


Let
xu be an upper bound of the interval => f(xu)
xl be a lower bound of the interval => f(xl)

1. If f(xu) & f(xl) in opposite signs, there is an odd


number of roots in the interval.
2. If f(xu) & f(xl) in same signs, there is either no
root or an even number of roots.
Figure 2.1-1: General correlation
between sign of bounds and number of
roots 10
2.1 Bracketing Methods
Exceptions to these general rules:
(i) When the functions are tangential to the x axis such as f(x) = (x-
3)(x-2)(x-2) = 0 as shown in figure 2.1-2and
(ii) When the functions are discontinuous, as shown in figure 2.1-2

Figure 2.1-2: Exceptions from the general guide


11
2.1 (a) Bisection Method
From the graphical method, we found that when a function 𝑓(𝑥) is continuous and
real in the interval from 𝑥𝑙 to 𝑥𝑢 , and 𝑓(𝑥𝑙 ) and 𝑓(𝑥𝑢 ) has opposite signs, that is

Then there is at least one real root between 𝑥𝑙 and 𝑥𝑢 .

Steps:
1. Guess or select an interval [𝑥𝑙 , 𝑥𝑢 ] that contains the root:
𝑓 𝑥𝑙 . 𝑓 𝑥𝑢 < 0
𝒙𝒍 +𝒙𝒖
2. Estimate the root 𝑥𝑟 where 𝒙𝒓 = (2.1-2)
𝟐
3. Evaluate the products:
if 𝑓 𝑥𝑙 . 𝑓 𝑥𝑟 < 0, set 𝑥𝑟 = 𝑛𝑒𝑤 𝑥𝑢
if 𝑓 𝑥𝑢 . 𝑓 𝑥𝑟 < 0, set 𝑥𝑟 = 𝑛𝑒𝑤𝑥𝑙
4. Check for convergence:
if satisfies pre-specified tolerence, 𝜀𝑠 , Stop!!
else, repeat step 2 and 3.

12
2.1 (a) Bisection Method
Convergence Criterion.
Since the process of finding the roots of the equation is iterative, it
is important to specify a convergence criterion, 𝜀𝑠 (or a tolerance)
in order to terminate the iterations.
𝑥𝑟𝑖+1 − 𝑥𝑟𝑖
𝜀𝑎 = 100% (2.1-3)
𝑥𝑟𝑖+1

where 𝑥𝑟𝑖+1 = 𝑥𝑟𝑛𝑒𝑤 and 𝑥𝑟𝑖 = 𝑥𝑟𝑜𝑙𝑑

when 𝜀𝑎 < 𝜀𝑠 , then stop the iteration procedures.

13
2.1 (a) Bisection Method
#Example 2.1(a)
Find the root of the 3rd-order polynomial
𝒇 𝒙 = 𝒙𝟑 − 𝒙𝟐 − 𝟏𝟎𝒙 − 𝟖 = 𝟎
in the interval [3.75,5]. The tolerance 𝜀𝑠 is 0.5%.

14
2.1 (a) Bisection Method
We stop the iteration since 𝜀𝑎 is less than 𝜀𝑠 .

Therefore, the root is x = 4.004 which is pretty close to the true


value if 4.0.

Note: 𝜀𝑎 is always greater than 𝜀𝑡 for the bisection method.

Remark:

1. After 𝑛 steps of bisection, the interval will have the size of


𝑥𝑢 −𝑥𝑙
.
2𝑛
2. The method will always converge on the root, provided that
only one root lies in the interval.
3. Rate of convergence is relatively slow.
15
2.1 (b) False-Position Method
Unlike the bisection method, the false-position method takes into
account the magnitudes of the function at the lower and upper
bounds, 𝑓 𝑥𝑙 and 𝑓 𝑥𝑢 . For example, if 𝑓 𝑥𝑙 is closer to zero
than 𝑓 𝑥𝑢 then 𝑥𝑙 is likely to be closer to the root 𝑥𝑟 than 𝑥𝑢 is.
This results in an improved estimate of the root. It is also called
linear interpolation method.

A straight line is drawn connecting points


(𝑥𝑙 , 𝑓 𝑥𝑙 ) and (𝑥𝑢 , 𝑓 𝑥𝑢 ). Clearly 𝑥𝑙 is
closer to 𝑥𝑟 . Thus using similar triangle we
can write,
𝑓(𝑥𝑙 ) 𝑓(𝑥𝑢 )
= (2.1-4)
𝑥𝑟 − 𝑥𝑙 𝑥𝑟 − 𝑥𝑢
Solving for 𝒙𝒓 , yields
Figure 2.1-4: False-position method
(𝒙𝒍 − 𝒙𝒖 )
𝒙𝒓 = 𝒙𝒖 − 𝒇(𝒙𝒖 ) (2.1-5)
𝒇 𝒙𝒍 − 𝒇(𝒙𝒖 )
16
2.1 (b) False-Position Method
#Example 2.1(b)

Compute 𝑥𝑟 , and replace it with whichever of the initial guesses, 𝑥𝑙 or 𝑥𝑢 , that


has a function of the same sign as 𝑓 𝑥𝑟 . In this way the interval [𝑥𝑙 , 𝑥𝑢 ] always
bracket the true root. The process is repeated until the root converge.

The steps for this method are similar to that of the bisection method with equation
2.1-5 replacing equation 2.1-2 in Step 2. The stopping criterion (or pre-specified
error) is also the same as before

Using the false-position method,


find the root of the 3rd-order polynomial
𝒇 𝒙 = 𝒙𝟑 − 𝒙𝟐 − 𝟏𝟎𝒙 − 𝟖 = 𝟎
in the interval [3.75,5]. The tolerance 𝜀𝑠 is 0.5%.

17
2.1 (b) False-Position Method
Solution of Example 2.1(b). Analytical solution yields x = 4.0 (true
root)

In this example, we need only 3 iterations as compared to 6


iterations for the bisection method.

In general, the false-position method converges faster than the


bisection and that 𝜀𝑎 is not always greater than 𝜀𝑡 for this method.
18
NEXT
Open Methods

19

You might also like