0% found this document useful (0 votes)
79 views25 pages

EEPC102 Module II

II. Roots of Equations • Iterative Bracketing Methods • Iterative Non -Bracketing/Open Methods • Roots of Polynomials

Uploaded by

Elizabeth Gomez
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)
79 views25 pages

EEPC102 Module II

II. Roots of Equations • Iterative Bracketing Methods • Iterative Non -Bracketing/Open Methods • Roots of Polynomials

Uploaded by

Elizabeth Gomez
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/ 25

MODULE II

INTRODUCTION

Lesson 1 Iterative Bracketing


Methods

Lesson 2 Iterative Non-


Bracketing/Open
Methods

Lesson 3 Roots of Polynomials

Module II
2

MODULE II

ROOTS OF EQUATIONS

 INTRODUCTION

This chapter on roots of equations deals with methods that exploit the
fact that a function typically changes sign in the vicinity of a root. These
techniques are called bracketing methods because two initial guesses for the
root are required. As the name implies, these guesses must “bracket,” or be
on either side of, the root.
In contrast, the open methods described in this chapter are based on
formulas that require only a single starting value of x or two starting values
that do not necessarily bracket the root. As such, they sometimes diverge or
move away from the true root as the computation progresses. They usually
do so much more quickly than the bracketing methods.

OBJECTIVES

After studying the module, you should be able to:

1. Solve for the roots/”zeros’ of equations that will equate to zero when
substituted.
2. Discuss, Explain and Demonstrate the different Methods used in Solving
Roots of Equations.
3. Solve for several values of x that when substituted will satisfy
equations simultaneously.
4. Implement numerical methods with the use of Microsoft Excel.

 DIRECTIONS/ MODULE ORGANIZER

There are three lessons in the module. Read each lesson carefully then
answer the exercises/activities to find out how much you have benefited from

EEPC102 Module II
3

it. Work on these exercises carefully and submit your output to your
instructor.
In case you encounter difficulty, discuss this with your instructor during
the face-to-face meeting.

EEPC102 Module II
4

Lesson 1

 Iterative Bracketing Methods

A. Graphical Methods

A simple method for obtaining an 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. This point, which represents the x value for which f(x) = 0, provides a
rough approximation of the root.
• Graphical method is the simplest method
• The given function is plotted on Cartesian coordinate and 𝑥𝑥 −values
(roots) that satisfying 𝑓𝑓(𝑥𝑥)=0 is identified.
• 𝑥𝑥 −values (roots) satisfying 𝑓𝑓(𝑥𝑥) = 0 provide approximation roots for
the underlying equations.
• 𝑓𝑓(𝑥𝑥) can have one or possibly many root(s).

EEPC102 Module II
5

Example 1. Use the graphical approach to determine the drag coefficient


𝑐𝑐 needed for a parachutist of mass 𝑚𝑚 = 68.1 kg to have a velocity of 40 m/s
after free falling for time t = 10 s. Note: The acceleration due to gravity is
9.81 m/s2.
Solution:
𝑔𝑔𝑔𝑔 𝑐𝑐 9.81(68.1) 𝑐𝑐
𝑓𝑓 (𝑐𝑐 ) = �1 − 𝑒𝑒 −�𝑚𝑚�𝑡𝑡 � − 𝑣𝑣 = �1 − 𝑒𝑒 −�68.1�10 � − 40
𝑐𝑐 𝑐𝑐

Various values of c can be substituted into the right-hand side of this


equation to compute
𝑐𝑐 𝑓𝑓(𝑐𝑐)
4 34.190
8 17.712
12 6.114
16 -2.230
20 -8.368

These points are plotted in Figure below. The resulting curve crosses
the c axis between 12 and 16. Visual inspection of the plot provides a rough
estimate of the root of 14.75. The validity of the graphical estimate can be
checked by substituting it into equation above to yield
9.81(68.1) 14.75
𝑓𝑓 (14.75) = �1 − 𝑒𝑒 −� 68.1 �10 � − 40 = 0.09983
14.75
Which is very close to zero.

EEPC102 Module II
6

Plotting will lead to,

B. The Bisection Method


The bisection method, which is alternatively called binary
chopping, interval halving, or Bolzano’s method, is one type of
incremental search method in which the interval is always divided in
half. 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 at the midpoint of the subinterval within which the sign change
occurs. The process is repeated to obtain refined estimates.
Algorithm
For the continuous equation of one variable, 𝑓𝑓(𝑥𝑥 ) = 0,
Step 1: Choose the lower guess, 𝑥𝑥𝑙𝑙 and the upper guess, 𝑥𝑥𝑢𝑢 that bracket the root
such that the function has opposite sign over the interval, 𝑥𝑥𝑙𝑙 ≤ 𝑥𝑥 ≤ 𝑥𝑥𝑢𝑢.
Step 2: The estimation root, 𝑥𝑥𝑥𝑥 is computed by using
𝑥𝑥𝑙𝑙 + 𝑥𝑥𝑢𝑢
𝑥𝑥𝑟𝑟 =
2
Step 3: Use the following evaluations to identify the subinterval that the root lies
 If 𝑓𝑓 (𝑥𝑥𝑥𝑥 )∙ 𝑓𝑓( 𝑥𝑥𝑥𝑥) < 0, then the root lies in the lower subinterval. Therefore,
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.

EEPC102 Module II
7

 If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) > 0, then the root lies in the upper subinterval. Therefore
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.
 If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) = 0, then the root is equal to 𝑥𝑥𝑥𝑥. Terminate the
computation.
• Step 4: Calculate the approximate percent relative error,

𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
• Step 5: Compare with. If 𝜀𝜀𝜀𝜀 < 𝜀𝜀𝜀𝜀, then stop the computation. Otherwise go to
Step 2 and repeat the process by using the new interval.

Figure B.2 A graphical depiction of the bisection method. This plot conforms
to the first three iterations from Example 1.

Example 2. Use bisection to solve the same problem approached graphically


in Example 1.
Solution:
The first step in bisection is to guess two values of the unknown (in the
present problem, c that give values for f(c) with different signs. From Fig.
B.2, we can see that the function changes sign between values of 12 and 16.
Therefore, the initial estimate of the root xr lies at the midpoint of the
interval
𝑥𝑥𝑙𝑙 + 𝑥𝑥𝑢𝑢 12 + 16
𝑥𝑥𝑟𝑟 = = = 14
2 2

Using excel,

EEPC102 Module II
8

*for 𝑥𝑥𝑟𝑟
𝑥𝑥𝑙𝑙 + 𝑥𝑥𝑢𝑢
𝑥𝑥𝑟𝑟 =
2
Using step 3, you can evaluate the new intervals and continue to next
iterations.
*for 𝜀𝜀𝑎𝑎

𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
*for 𝜀𝜀𝑡𝑡
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 − 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴
𝜀𝜀𝑡𝑡 = � � 𝑥𝑥 100%
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

Using six iterations, it is approximated that the root of the equation is


14.8125. You can continue the iterations to have the most accurate answer.

C. The False-Position Method

Although bisection is a perfectly valid technique for determining roots, its


“brute-force” approach is relatively inefficient. False position is an
alternative based on a graphical insight.
A shortcoming of the bisection method is that, in dividing the interval
from 𝑥𝑥𝑙𝑙 to 𝑥𝑥𝑢𝑢 into equal halves, no account is taken of the magnitudes of
𝑓𝑓(𝑥𝑥𝑙𝑙 ) and 𝑓𝑓(𝑥𝑥𝑢𝑢 ). For example, if 𝑓𝑓(𝑥𝑥𝑙𝑙 ) is much closer to zero than 𝑓𝑓(𝑥𝑥𝑢𝑢 )., it
is likely that the root is closer to 𝑥𝑥𝑙𝑙 than to 𝑥𝑥𝑢𝑢 (Fig. C.1). An alternative
method that exploits this graphical insight is to join 𝑓𝑓(𝑥𝑥𝑙𝑙 ) and 𝑓𝑓(𝑥𝑥𝑢𝑢 ) by a
straight line. The intersection of this line with the x axis represents an
improved estimate of the root. The fact that the replacement of the curve by
a straight line gives a “false position” of the root is the origin of the name,

EEPC102 Module II
9

method of false position, or in Latin, regula falsi. It is also called the linear
interpolation method.
Using similar triangles (Fig. C.1), the intersection of the straight line with the
x axis can be estimated as
𝑓𝑓(𝑥𝑥𝑙𝑙 ) 𝑓𝑓(𝑥𝑥𝑢𝑢 )
=
𝑥𝑥𝑟𝑟 − 𝑥𝑥𝑙𝑙 𝑥𝑥𝑟𝑟 − 𝑥𝑥𝑢𝑢
By manipulating we will derived to
𝑓𝑓 (𝑥𝑥𝑢𝑢 )(𝑥𝑥𝑙𝑙 − 𝑥𝑥𝑢𝑢 )
𝑥𝑥𝑟𝑟 = 𝑥𝑥𝑢𝑢 −
𝑓𝑓 (𝑥𝑥𝑙𝑙 ) − 𝑓𝑓(𝑥𝑥𝑢𝑢 )
This is the false-position formula.

FIGURE C.1 A graphical depiction of the method of false position. Similar


triangles used to derive the formula for the method are shaded.
Algorithm
For the continuous equation of one variable, 𝑓𝑓(𝑥𝑥 ) = 0,
Step 1: Choose the lower guess, 𝑥𝑥𝑙𝑙 and the upper guess, 𝑥𝑥𝑢𝑢 that bracket the root
such that the function has opposite sign over the interval, 𝑥𝑥𝑙𝑙 ≤ 𝑥𝑥 ≤ 𝑥𝑥𝑢𝑢.
Step 2: The estimation root, 𝑥𝑥𝑥𝑥 is computed by using
𝑓𝑓 (𝑥𝑥𝑢𝑢 )(𝑥𝑥𝑙𝑙 − 𝑥𝑥𝑢𝑢 )
𝑥𝑥𝑟𝑟 = 𝑥𝑥𝑢𝑢 −
𝑓𝑓 (𝑥𝑥𝑙𝑙 ) − 𝑓𝑓(𝑥𝑥𝑢𝑢 )
Step 3: Use the following evaluations to identify the subinterval that the root lies
 If 𝑓𝑓 (𝑥𝑥𝑥𝑥 )∙ 𝑓𝑓( 𝑥𝑥𝑥𝑥) < 0, then the root lies in the lower subinterval. Therefore,
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.

EEPC102 Module II
10

 If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) > 0, then the root lies in the upper subinterval. Therefore
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.
 If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) = 0, then the root is equal to 𝑥𝑥𝑥𝑥. Terminate the
computation.
• Step 4: Calculate the approximate percent relative error,

𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
• Step 5: Compare with. If 𝜀𝜀𝜀𝜀 < 𝜀𝜀𝜀𝜀, then stop the computation. Otherwise go to
Step 2 and repeat the process by using the new interval.

Example 3. Use the false-position method to determine the root of the same
equation investigated in Example 1.
Solution:
As in Example 2, initiate the computation with guesses of 𝑥𝑥𝑙𝑙 = 12 and 𝑥𝑥𝑢𝑢 =16.
Using excel,

*for 𝑥𝑥𝑟𝑟
𝑓𝑓 (𝑥𝑥𝑢𝑢 )(𝑥𝑥𝑙𝑙 − 𝑥𝑥𝑢𝑢 )
𝑥𝑥𝑟𝑟 = 𝑥𝑥𝑢𝑢 −
𝑓𝑓 (𝑥𝑥𝑙𝑙 ) − 𝑓𝑓(𝑥𝑥𝑢𝑢 )
Using step 3, you can evaluate the new intervals and continue to next
iterations.
*for 𝜀𝜀𝑎𝑎

𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
*for 𝜀𝜀𝑡𝑡
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 − 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴
𝜀𝜀𝑡𝑡 = � � 𝑥𝑥 100%
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

EEPC102 Module II
11

Using six iterations, it is approximated that the root of the equation is


14.8011. As you can see the approximated root is equal to the true value.

INCREMENTAL SEARCHES AND DETERMINING INITIAL GUESSES

Besides checking an individual answer, you must determine whether all


possible roots have been located. As mentioned previously, a plot of the
function is usually very useful in guiding you in this task. Another option is to
incorporate an incremental search at the beginning of the computer program.
This consists of starting at one end of the region of interest and then making
function evaluations at small increments across the region. When the function
changes sign, it is assumed that a root falls within the increment. The x values
at the beginning and the end of the increment can then serve as the initial
guesses for one of the bracketing techniques described in this chapter.
A potential problem with an incremental search is the choice of the
increment length. If the length is too small, the search can be very time
consuming. On the other hand, if the length is too great, there is a possibility
that closely spaced roots might be missed (Fig. D). The problem is
compounded by the possible existence of multiple roots. A partial remedy for
such cases is to compute the first derivative of the function f'(x) at the
beginning and the end of each interval. If the derivative changes sign, it
suggests that a minimum or maximum may have occurred and that the interval
should be examined more closely for the existence of a possible root.
Although such modifications or the employment of a very fine increment
can alleviate the problem, it should be clear that brute-force methods such
as incremental search are not foolproof. You would be wise to supplement
such automatic techniques with any other information that provides insight
into the location of the roots. Such information can be found in plotting and
in understanding the physical problem from which the equation originated.

FIGURE D Cases where roots could be missed because the increment length
of the search procedure is too large. Note that the last root on the right is
multiple and would be missed regardless of increment length.

EEPC102 Module II
12

Learning Activity

1. Determine the real root of 𝑓𝑓(𝑥𝑥 ) = 5𝑥𝑥 3 − 5𝑥𝑥 2 + 6𝑥𝑥 − 2


a. Graphically
b. Using bisection to locate the root. Employ initial guesses of 𝑥𝑥𝑙𝑙 = 0 and
𝑥𝑥𝑢𝑢 =1 and iterate until the estimated error 𝜀𝜀𝑎𝑎 falls below a level of
𝜀𝜀𝑠𝑠 =10%.

2. Determine the real root of 𝑓𝑓(𝑥𝑥 ) = −25 + 82𝑥𝑥 − 90𝑥𝑥 2 + 44𝑥𝑥 3 − 8𝑥𝑥 4 +
0.7𝑥𝑥 5
a. Graphically
b. Using bisection to determine the root to 𝜀𝜀𝑠𝑠 = 10%. Employ initial guesses
of 𝑥𝑥𝑙𝑙 = 0.5 and 𝑥𝑥𝑢𝑢 =1.0.
c. Perform the same computation as in (b) but use the false-position
method and 𝜀𝜀𝑠𝑠 = 0.2%.

EEPC102 Module II
13

Lesson 2

 Iterative Non-Bracketing/Open
Methods

A. Simple Fixed-Point Iteration


Open methods employ a formula to predict the root. Such a formula
can be developed for simple fixed-point iteration (or, as it is also called, one-
point iteration or successive substitution) by rearranging the function f(x)= 0
so that x is on the left-hand side of the equation:
𝒙𝒙 = 𝒈𝒈(𝒙𝒙) (A.1)
This transformation can be accomplished either by algebraic manipulation
or by simply adding x to both sides of the original equation. For example,
𝑥𝑥 2 − 2𝑥𝑥 + 3 = 0
Can be simply manipulated to yield
𝑥𝑥 2 +3
𝑥𝑥 =
2

whereas 𝑠𝑠𝑠𝑠𝑠𝑠 𝑥𝑥 = 0 could be put into the form of Eq. (A.1) by adding 𝑥𝑥 to
both sides to yield
𝑥𝑥 = 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑥𝑥
The utility of Eq. (A.1) is that it provides a formula to predict a new value of
𝑥𝑥 as a function of an old value of 𝑥𝑥. Thus, given an initial guess at the root
𝑥𝑥𝑖𝑖 , Eq. (A.1) can be used to compute a new estimate 𝑥𝑥𝑖𝑖+1 as expressed by the
iterative formula
𝒙𝒙𝒊𝒊+𝟏𝟏 = 𝒈𝒈(𝒙𝒙𝒊𝒊 ) (A.2)
As with other iterative formulas, the approximate error for this equation
can be determined using the error estimator
𝒙𝒙𝒊𝒊+𝟏𝟏 − 𝒙𝒙𝒊𝒊
𝜺𝜺𝒂𝒂 = � � ∗ 𝟏𝟏𝟏𝟏𝟏𝟏%
𝒙𝒙𝒊𝒊+𝟏𝟏

Example.4 Use simple fixed-point iteration to locate the root of


𝑓𝑓 (𝑥𝑥 ) = 𝑒𝑒 −𝑥𝑥 − 𝑥𝑥.

EEPC102 Module II
14

Solution:
The function can be separated directly and expressed in the form of Eq. (A.2)
as 𝑥𝑥𝑖𝑖+1 = 𝑒𝑒 −𝑥𝑥𝑖𝑖
Starting with an initial guess of 𝑥𝑥0 = 0, this iterative equation can be applied
to compute

Thus, each iteration brings the estimate closer to the true value of the root:
0.56714329.

B. The Newton-Raphson Method


Perhaps the most widely used of all root-locating formulas is the
Newton-Raphson equation (Fig. B). If the initial guess at the root is 𝑥𝑥𝑖𝑖 , a
tangent can be extended from the point [𝑥𝑥𝑖𝑖 , 𝑓𝑓(𝑥𝑥𝑖𝑖 )]. The point where this
tangent crosses the 𝑥𝑥 axis usually represents an improved estimate of the
root.
The Newton-Raphson method can be derived on the basis of this
geometrical interpretation. As in Fig. B, the first derivative at 𝑥𝑥 is equivalent
to the slope:
𝒇𝒇(𝒙𝒙𝒊𝒊 )−𝟎𝟎
𝒇𝒇′ (𝒙𝒙𝒊𝒊 ) = B.1
𝒙𝒙𝒊𝒊 −𝒙𝒙𝒊𝒊+𝟏𝟏

Which can be yield to


𝒇𝒇(𝒙𝒙 )
𝒙𝒙𝒊𝒊+𝟏𝟏 = 𝒙𝒙𝒊𝒊 − 𝒇𝒇′(𝒙𝒙𝒊𝒊 ) B.2
𝒊𝒊

which is called the Newton-Raphson formula.

EEPC102 Module II
15

FIGURE B.1 Graphical depiction of the Newton-Raphson method. A tangent


to the function of 𝑥𝑥𝑖𝑖 [that is, 𝑓𝑓′(𝑥𝑥𝑖𝑖 )] is extrapolated down to the 𝑥𝑥 axis to
provide an estimate of the root at 𝒙𝒙𝒊𝒊+𝟏𝟏.

Example 5. Use Newton-Raphson method to estimate the root of


𝑓𝑓 (𝑥𝑥 ) = 𝑒𝑒 −𝑥𝑥 − 𝑥𝑥, employing an initial guess of 𝑥𝑥0 = 0.

Solution: The first derivative of the function can be evaluated as


𝑓𝑓 ′(𝑥𝑥 ) = −𝑒𝑒 −𝑥𝑥 − 1
which can be substituted along with the original function into Eq. (B.2) to give
𝑒𝑒 −𝑥𝑥𝑖𝑖 − 𝑥𝑥
𝑥𝑥𝑖𝑖+1 = 𝒙𝒙𝒊𝒊 − −𝑒𝑒 −𝑥𝑥𝑖𝑖 −1𝑖𝑖

Starting with an initial guess of𝑥𝑥0 = 0, this iterative equation can be applied
to compute

Thus, the approach rapidly converges on the true root. Notice that the true
percent relative error at each iteration decreases much faster than it does
in simple fixed-point iteration (compare with Example 4).

EEPC102 Module II
16

C. The Secant Method


A potential problem in implementing the Newton-Raphson method is
the evaluation of the derivative. Although this is not inconvenient for
polynomials and many other functions, there are certain functions whose
derivatives may be extremely difficult or inconvenient to evaluate. For these
cases, the derivative can be approximated by a backward finite divided
difference, as in (Fig. C)
𝑓𝑓(𝑥𝑥𝑖𝑖−1 ) − 𝑓𝑓(𝑥𝑥𝑖𝑖 )
𝑓𝑓 ′(𝑥𝑥𝑖𝑖 ) ≅
𝑥𝑥𝑖𝑖−1 − 𝑥𝑥𝑖𝑖
This approximation can be substituted into Eq. (B.2) to yield the following
iterative equation:

𝑓𝑓(𝑥𝑥𝑖𝑖 )( 𝑥𝑥𝑖𝑖−1 − 𝑥𝑥𝑖𝑖 )


𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 −
𝑓𝑓 (𝑥𝑥𝑖𝑖−1 ) − 𝑓𝑓(𝑥𝑥𝑖𝑖 )
This equation is the formula for the secant method. Notice that the approach
requires two initial estimates of 𝑥𝑥. However, because 𝑓𝑓(𝑥𝑥) is not required to
change signs between the estimates, it is not classified as a bracketing
method

FIGURE C Graphical depiction of the secant method. This technique is


similar to the Newton-Raphson technique (Fig. B) in the sense that an
estimate of the root is predicted by extrapolating a tangent of the function
to the 𝑥𝑥 axis. However, the secant method uses a difference rather than a
derivative to estimate the slope.

EEPC102 Module II
17

Example 6. Use the secant method to estimate the root of 𝑓𝑓 (𝑥𝑥 ) = 𝑒𝑒 −𝑥𝑥 − 𝑥𝑥.
Start with initial estimates of 𝑥𝑥−1 = 0 and 𝑥𝑥0 =1.0.
Solution: Recall that the true root is 0.56714329. . . .

For 6 iterations we have arrived to the exact root of the equation which is
0.56714329.

D. Modified Newton-Raphson method for Multiple Roots


A multiple root corresponds to a point where a function is tangent to
the 𝑥𝑥 axis. For example, a double root results from
𝑓𝑓 (𝑥𝑥 ) = (𝑥𝑥 − 3)(𝑥𝑥 − 1)(𝑥𝑥 − 1) D.1
or, multiplying terms, 𝑓𝑓(𝑥𝑥 ) = 𝑥𝑥 3 − 5𝑥𝑥 2 + 7𝑥𝑥 − 3. The equation has a double
root because one value of x makes two terms in Eq. (D.1) equal to zero.
Graphically, this corresponds to the curve touching the 𝑥𝑥 axis tangentially at
the double root.
A triple root corresponds to the case where one x value makes three
terms in an equation equal to zero, as in
𝑓𝑓 (𝑥𝑥 ) = (𝑥𝑥 − 3)(𝑥𝑥 − 1)(𝑥𝑥 − 1)(𝑥𝑥 − 1)
or, multiplying terms 𝑓𝑓(𝑥𝑥 ) = 𝑥𝑥 4 − 6𝑥𝑥 3 + 12𝑥𝑥 2 − 10𝑥𝑥 − 3, In general, odd
multiple roots cross the axis, whereas even ones do not.

Multiple roots pose some difficulties for many of the numerical methods such
as:
1. The fact that the function does not change sign at even multiple roots
precludes the use of the reliable bracketing methods that were discussed in
this module.
2. Another possible problem is related to the fact that not only 𝑓𝑓(𝑥𝑥) but also
𝑓𝑓′(𝑥𝑥) goes to zero at the root. This poses problems for both the Newton-
Raphson and secant methods, which both contain the derivative (or its
estimate) in the denominator of their respective formulas. This could result
in division by zero when the solution converges very close to the root. A simple
way to circumvent these problems is based on the fact that it can be
demonstrated theoretically (Ralston and Rabinowitz, 1978) that 𝑓𝑓(𝑥𝑥 ) will
always reach zero before 𝑓𝑓′(𝑥𝑥) . Therefore, if a zero check for 𝑓𝑓(𝑥𝑥) is

EEPC102 Module II
18

incorporated into the computer program, the computation can be terminated


before 𝑓𝑓′(𝑥𝑥) reaches zero.
3. It can be demonstrated that the Newton-Raphson and secant methods are
linearly, rather than quadratically, convergent for multiple roots (Ralston and
Rabinowitz, 1978). Modifications have been proposed to alleviate this
problem. Ralston and Rabinowitz (1978) have indicated that a slight change
in the formulation returns it to quadratic convergence, as in
𝑓𝑓(𝑥𝑥 )
𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 − 𝑚𝑚 𝑓𝑓′(𝑥𝑥𝑖𝑖 ) D.2
𝑖𝑖

where 𝑚𝑚 is the multiplicity of the root (that is, m= 2 for a double root, m= 3
for a triple root, etc.). Of course, this may be an unsatisfactory alternative
because it hinges on fore knowledge of the multiplicity of the root.
Another alternative, also suggested by Ralston and Rabinowitz (1978), is to
define a new function 𝑢𝑢(𝑥𝑥), that is, the ratio of the function to its derivative,
as in
𝑓𝑓(𝑥𝑥)
𝑢𝑢(𝑥𝑥) = 𝑓𝑓′(𝑥𝑥)
D.3

It can be shown that this function has roots at all the same locations as the
original function. Therefore, Eq. (D.3) can be substituted into Eq. (B.2) to
develop an alternative form of the Newton-Raphson method:
𝑢𝑢(𝑥𝑥 )
𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 − 𝑢𝑢′(𝑥𝑥𝑖𝑖 ) D.4
𝑖𝑖

Equation (D.3) can be differentiated to give


𝑓𝑓′ (𝑥𝑥)𝑓𝑓′ (𝑥𝑥)−𝑓𝑓(𝑥𝑥)𝑓𝑓"(𝑥𝑥)
𝑢𝑢′ (𝑥𝑥) = D.5
[𝑓𝑓′ (𝑥𝑥)]2

Equations (D.3) and (D.15) can be substituted into Eq. (D.4) and the result
simplified to yield
𝑓𝑓(𝑥𝑥𝑖𝑖 )𝑓𝑓′(𝑥𝑥𝑖𝑖 )
𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 − [𝑓𝑓′( D.6
𝑥𝑥𝑖𝑖 )]2 −𝑓𝑓(𝑥𝑥𝑖𝑖 )𝑓𝑓"(𝑥𝑥𝑖𝑖 )

Example 7. Use modified Newton-Raphson methods to evaluate the


multiple root of 𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 3 − 5𝑥𝑥 2 + 7𝑥𝑥 − 3, with an initial guess of 𝑥𝑥0 = 0.

Solution:
The first derivative of the equation is 3𝑥𝑥 2 − 10𝑥𝑥 + 7
The second derivative of the equation is 6𝑥𝑥 − 10
Substituting values to eqn. 6

EEPC102 Module II
19

(𝑥𝑥𝑖𝑖 3 − 5𝑥𝑥𝑖𝑖 2 + 7𝑥𝑥𝑖𝑖 − 3)(3𝑥𝑥𝑖𝑖 2 − 10𝑥𝑥𝑖𝑖 + 7)


𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 −
[3𝑥𝑥𝑖𝑖 2 − 10𝑥𝑥𝑖𝑖 + 7]2 − (𝑥𝑥𝑖𝑖 3 − 5𝑥𝑥𝑖𝑖 2 + 7𝑥𝑥𝑖𝑖 − 3)(6𝑥𝑥𝑖𝑖 − 10)
which can be solved for

Thus, the modified formula is quadratically convergent. We can also use the
method to search for the single root at x = 3. Using an initial guess of 𝑥𝑥0 = 4
gives the following results:

Learning Activity
1. Determine the highest real root of 𝑓𝑓 (𝑥𝑥 ) = 2𝑥𝑥 3 − 11𝑥𝑥 2 + 17.7𝑥𝑥 − 5 .
Compute the approximate percent relative error, 𝜀𝜀𝑎𝑎 and true percent
relative error, 𝜀𝜀𝑡𝑡 after each iteration.
a. Fixed-point iteration method (three iterations, 𝑥𝑥0 = 3)
b. Newton-Raphson method (three iterations, 𝑥𝑥0 = 3).
c. Secant method (three iterations, 𝑥𝑥−𝑖𝑖 = 3 𝑥𝑥0 = 4).
2. Locate the first positive root of 𝑓𝑓 (𝑥𝑥 ) = sin 𝑥𝑥 + cos (1 + 𝑥𝑥 2 -1)
where x is in radians. Compute the approximate percent relative
error, 𝜀𝜀𝑎𝑎 and true percent relative error, 𝜀𝜀𝑡𝑡 after each iteration. Use
four iterations of the secant method with initial guesses of
a. 𝑥𝑥𝑖𝑖−1 = 1 𝑥𝑥0 = 3.0
b. 𝑥𝑥𝑖𝑖−1 = 1.5 𝑥𝑥0 = 2.5

EEPC102 Module II
20

3. The function 𝑥𝑥 3 − 2𝑥𝑥 2 − 4𝑥𝑥 + 8 has a double root at 𝑥𝑥 = 2. Use (a) the
standard Newton-Raphson, (b) the modified Newton-Raphson [to solve
for the root at 𝑥𝑥 = 2. Compare and discuss the rate of convergence
using an initial guess of 𝑥𝑥0 = 1.2.
4. You are designing a spherical tank (Figure below) to hold water for a small
village in a developing country. The volume of liquid it can hold can be
computed as

[3𝑅𝑅 − ℎ]
𝑉𝑉 = 𝜋𝜋ℎ2
3
where V = volume (m3), h = depth of water in tank (m), and R = the
tank radius (m). If R = 3 m, what depth must the tank be filled to so
that it holds 30 m3? Use three iterations of the Newton-Raphson method
to determine your answer. Determine the approximate relative error
after each iteration. Note that an initial guess of R will always
converge.

EEPC102 Module II
21

Lesson 3

 Roots of Polynomials

Mullers Method
Recall that the secant method obtains a root estimate by projecting a
straight line to the x axis through two function values (Fig. 3a). Muller’s
method takes a similar approach, but projects a parabola through three points
(Fig. 3b).
The method consists of deriving the coefficients of the parabola that
goes through the three points. These coefficients can then be substituted into
the quadratic formula to obtain the point where the parabola intercepts the
𝑥𝑥 axis—that is, the root estimate. The approach is facilitated by writing the
parabolic equation in a convenient form,
𝑓𝑓2 (𝑥𝑥 ) = 𝑎𝑎(𝑥𝑥 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥 − 𝑥𝑥2 ) + 𝑐𝑐 3.1

We want this parabola to intersect the three points [𝑥𝑥0 , 𝑓𝑓(𝑥𝑥0 )], [𝑥𝑥1 , 𝑓𝑓(𝑥𝑥1 )],
and [𝑥𝑥2 , 𝑓𝑓(𝑥𝑥2 )]. The coefficients of Eq. (3.1) can be evaluated by
substituting each of the three points to give

𝑓𝑓 (𝑥𝑥0 ) = 𝑎𝑎(𝑥𝑥0 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥0 − 𝑥𝑥2 ) + 𝑐𝑐 3.2


𝑓𝑓 (𝑥𝑥1 ) = 𝑎𝑎(𝑥𝑥1 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥1 − 𝑥𝑥2 ) + 𝑐𝑐 3.3
𝑓𝑓 (𝑥𝑥2 ) = 𝑎𝑎(𝑥𝑥2 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥2 − 𝑥𝑥2 ) + 𝑐𝑐 3.4

FIGURE 3 A comparison of two related approaches for locating roots: (a) the
secant method and (b) Müller’s method

EEPC102 Module II
22

Note that we have dropped the subscript “2” from the function for
conciseness. Because we have three equations, we can solve for the three
unknown coefficients, 𝑎𝑎, 𝑏𝑏, and 𝑐𝑐. Because two of the terms in Eq. (3.4) are
zero, it can be immediately solved for 𝑐𝑐 = 𝑓𝑓(𝑥𝑥2 ). Thus, the coeffi cient 𝑐𝑐 is
merely equal to the function value evaluated at the third guess, 𝑥𝑥2 . This
result can then be substituted into Eqs. (3.2) and (3.3) to yield two equations
with two unknowns:

𝑓𝑓 (𝑥𝑥0 ) − 𝑓𝑓 (𝑥𝑥2 ) = 𝑎𝑎(𝑥𝑥0 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥0 − 𝑥𝑥2 ) 3.5


𝑓𝑓 (𝑥𝑥1 ) − 𝑓𝑓 (𝑥𝑥2 ) = 𝑎𝑎(𝑥𝑥1 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥1 − 𝑥𝑥2 ) 3.6

Algebraic manipulation can then be used to solve for the remaining


coefficients, 𝑎𝑎 and 𝑏𝑏 . One way to do this involves defining a number of
differences,
ℎ0 = 𝑥𝑥1 − 𝑥𝑥0 ℎ1 = 𝑥𝑥2 − 𝑥𝑥1 3.7
𝑓𝑓(𝑥𝑥1 ) − 𝑓𝑓(𝑥𝑥0 ) 𝑓𝑓 (𝑥𝑥2 ) − 𝑓𝑓(𝑥𝑥1 )
𝛿𝛿0 = 𝛿𝛿1 =
𝑥𝑥1 − 𝑥𝑥0 𝑥𝑥2 − 𝑥𝑥1

These can be substituted into Eqs. (3.5) and (3.6) to give


(ℎ0 + ℎ1 )𝑏𝑏 − (ℎ0 + ℎ1 )2 𝑎𝑎 = ℎ0 𝛿𝛿0 + ℎ1 𝛿𝛿1
ℎ1 𝑏𝑏 − ℎ1 2 𝑎𝑎 = ℎ1 𝛿𝛿1

which can be solved for 𝑎𝑎 and 𝑏𝑏. The results can be summarized as
𝛿𝛿1 −𝛿𝛿0
𝑎𝑎 = 3.8
ℎ1 +ℎ0
𝑏𝑏 = 𝑎𝑎ℎ1 + 𝛿𝛿1 3.9
𝑐𝑐 = 𝑓𝑓(𝑥𝑥2 ) 3.10

To find the root, we apply the quadratic formula to Eq. (3.1). However,
because of potential round-off error, rather than using the conventional form,
we use the alternative formulation to yield
−2𝑐𝑐
𝑥𝑥3 − 𝑥𝑥2 = 3.11a
𝑏𝑏 ±√𝑏𝑏2 −4𝑎𝑎𝑎𝑎

or isolating the unknown 𝑥𝑥3 on the left side of the equal sign,
−2𝑐𝑐
𝑥𝑥3 = 𝑥𝑥2 + 3.11b
𝑏𝑏 ±√𝑏𝑏2 −4𝑎𝑎𝑎𝑎

Note that the use of the quadratic formula means that both real and complex
roots can be located. This is a major benefi t of the method.
In addition, Eq. (3.11a) provides a neat means to determine the
approximate error. Because the left side represents the difference between
the present (𝑥𝑥3 ) and the previous (𝑥𝑥2 ) root estimate, the error can be
calculated as

EEPC102 Module II
23

𝑥𝑥3 − 𝑥𝑥2
𝜀𝜀𝑎𝑎 = � � ∗ 100%
𝑥𝑥3

Now, a problem with Eq. (3.11a) is that it yields two roots,


corresponding to the 6 term in the denominator. In Muller’s method, the sign
is chosen to agree with the sign of b. This choice will result in the largest
denominator, and hence, will give the root estimate that is closest to 𝑥𝑥2 .
Once 𝑥𝑥3 is determined, the process is repeated. This brings up the
issue of which point is discarded. Two general strategies are typically used:
1. If only real roots are being located, we choose the two original points
that are nearest the new root estimate, 𝑥𝑥3 .
2. If both real and complex roots are being evaluated, a sequential
approach is employed. That is, just like the secant method, 𝑥𝑥1 , 𝑥𝑥2 ,
and 𝑥𝑥3 take the place of 𝑥𝑥0 , 𝑥𝑥1 , and 𝑥𝑥2 .

Example 8. Use Müller’s method with guesses of 𝑥𝑥0 , 𝑥𝑥1 , and 𝑥𝑥2 = 4.5, 5.5,
and 5, respectively, to determine a root of the equation

𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 3 − 13𝑥𝑥 − 12
Note that the roots of this equation are -3, -1, and 4.

Solution: First, we evaluate the function at the guesses


Using MS Excel,

For 𝑥𝑥3 , why?


The square root of the discriminant can be evaluated as
�62.252 − 4(15)(48) = 31.54461
|62.25 + 31.54461| > |62.25 − 31.544451|
a positive sign is employed in the denominator of Eq. (3.11b), and the new
root estimate can be determined as
−2𝑐𝑐 −2(48)
𝑥𝑥3 = 𝑥𝑥2 + =5+ = 𝟑𝟑. 𝟗𝟗𝟗𝟗𝟗𝟗𝟗𝟗𝟗𝟗𝟗𝟗
𝑏𝑏 + √𝑏𝑏2 − 4𝑎𝑎𝑎𝑎 62.25 + 31.54451

EEPC102 Module II
24

For,
ℎ𝑖𝑖 = 𝑥𝑥𝑖𝑖+1 − 𝑥𝑥𝑖𝑖 = 5.5 − 4.5 = 1 ℎ𝑖𝑖+1 = 𝑥𝑥𝑖𝑖+2 − 𝑥𝑥𝑖𝑖+1 = 5 − 5.5 = −0.5

𝑓𝑓 (𝑥𝑥𝑖𝑖+1 ) − 𝑓𝑓(𝑥𝑥𝑖𝑖 ) 82.875 − 20.625


𝛿𝛿𝑖𝑖 = = = 62.25
𝑥𝑥𝑖𝑖+1 − 𝑥𝑥𝑖𝑖 5.5 − 4.5
𝑓𝑓 (𝑥𝑥𝑖𝑖+2 ) − 𝑓𝑓(𝑥𝑥𝑖𝑖+1 ) 48 − 82.875
𝛿𝛿𝑖𝑖+1 = = = 69.75
𝑥𝑥𝑖𝑖+2 − 𝑥𝑥𝑖𝑖+1 5 − 5.5
𝛿𝛿𝑖𝑖+1 −𝛿𝛿𝑖𝑖 69.75−62.25
𝑎𝑎 = = = 15
ℎ𝑖𝑖+1 +ℎ𝑖𝑖 −0.5+1
𝑏𝑏 = 𝑎𝑎ℎ𝑖𝑖+1 + 𝛿𝛿𝑖𝑖+1 = 15(−0.5) + 69.75 = 62.25
𝑐𝑐 = 𝑓𝑓(𝑥𝑥𝑖𝑖+2 ) = 48

Then continue to next iterations.


The results, tabulated above, show that the method converges rapidly on the
root, 𝑥𝑥𝑟𝑟 = 4:

Learning Activity

Use Muller’s method to determine the positive real root of


a. 𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 3 + 𝑥𝑥 2 − 4𝑥𝑥 − 4
b. 𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 3 − 0.5𝑥𝑥 2 + 4𝑥𝑥 − 2
c. 𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 4 − 2𝑥𝑥 3 + 6𝑥𝑥 2 − 2𝑥𝑥 + 5

Summative Test

1. Use bisection and false position method to determine the drag


coefficient needed so that an 82-kg parachutist has a velocity of 36
m/s after 4 s of free fall. Note: The acceleration of gravity is 9.81 m/s2.
Start with initial guesses of 𝑥𝑥𝑙𝑙 = 3 and 𝑥𝑥𝑢𝑢 = 5 and iterate until the
approximate relative error falls below 2%. Also perform an error check
by substituting your fi nal answer into the original equation.

EEPC102 Module II
25

2. Given
𝑓𝑓 (𝑥𝑥 ) = −2𝑥𝑥 6 − 1.5𝑥𝑥 4 + 10𝑥𝑥 + 2
Use a root location technique to determine the maximum of this
function. Perform iterations until the approximate relative error falls
below 5%. If you use a bracketing method, use initial guesses of 𝑥𝑥𝑙𝑙 = 0
and 𝑥𝑥𝑢𝑢 = 1. If you use the Newton-Raphson , use an initial guess of 𝑥𝑥𝑖𝑖 =
1. If you use the secant method, use initial guesses of 𝑥𝑥𝑖𝑖−1 = 0 and 𝑥𝑥𝑖𝑖 =
1. Assuming that convergence is not an issue, choose the technique
that is best suited to this problem. Justify your choice.

3. Use Muller’s method to determine the positive real root of


𝑓𝑓 (𝑥𝑥 ) = 9.34 − 21.97𝑥𝑥 + 16.3𝑥𝑥 2 − 3.704𝑥𝑥 3

 MODULE SUMMARY

In module II, you have learned the Roots of Equations through the use
of Bracketing and Open Methods.

Lesson 1 deals with Iterative Bracketing Methods namely, graphical


Methods, Bisection and False-Position Method.
Lesson 2 deals with Iterative Open Methods in solving roots of
equations. The methods use in this chapter are Simple Fixed-point Iteration,
Newton-Raphson Method, Secant method and the Modified Newton-Raphson
Method.
Lesson 3 deals with the roots of polynomials through the use of Muller’s
method.

Congratulations! You have just studied Module II.

EEPC102 Module II

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