Professional Documents
Culture Documents
This study note covers the following three methods that can be found in the prescribed book in
chapter 6:
Remember: you will never be asked to derive a method but you must know how to use them! You
should know formulas too!
Open methods employ a formula to predict the root you are searching for. In the case of fixed-point
iteration, we rearrange the function f(x) = 0 so that x is on the left-hand side of the equation: x = g(x).
You then start with a good guess of the root, set that equal to xi and determine g(xi). Then let xi equal
g(xi) and iterate again.
Example 6.1
Answer:
As you can see from the plot, the root is near 0.5. The root is actually 0.567
Step B. Rearrange f(x) = 0 ie rearrange e-x – x = 0 so that x is on the LHS of the equation. In this case it
is easy: x = e-x. Thus g(x) = e-x.
Step C. Set up a table like the following (you must do this in a test) and populate, using a starting guess
xi = 0 (because it is close enough to the root). Always choose a starting guess close to the actual root
– a good reason to graph the function.
Iteration xi g(xi)
1 0 1
2 1 0.368
3 0.368 0.692
4 0.692 0.5
5 0.5 0.607
6 0.607 0.545
7 0.545 0.58
8 0.58 0.56
9 0.56 0.571
10 0.571 0.565
We can stop after 10 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 1.06%. As mentioned earlier, the actual root is 0.567 and this is 0.35% different!
Problem 6.1 (from the Problems section at the end of the book chapter. These next three examples
are very similar to what you can expect in the tests)
Question: Locate the (non-zero) root of f(x) = 𝑆𝑖𝑛 √𝑥 − 𝑥 with an initial guess of 0.5
Answer:
0.2
0.1
0.1
As you can see from this plot, there are two roots. We are looking for the non-zero root and we can
see that that root is near x = 0.8. The root is actually 0.768
Iteration xi g(xi)
1 0.5 0.65
2 0.65 0.722
3 0.722 0.751
4 0.751 0.762
5 0.762 0.766
6 0.766 0.768
We can stop after 6 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 0.26%
Problem 6.2 (from the Problems section at the end of the book chapter)
Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3
Answer:
40
20
2 1 1 2 3 4 5
20
40
60
As you can see from this plot, there are three roots. We are looking for highest root and we can see
that that root is near x = 3.5. The root is actually 3.56
Iteration xi g(xi)
1 3 3.181
2 3.181 3.334
3 3.334 3.443
4 3.443 3.507
5 3.507 3.539
6 3.539 3.553
7 3.553 3.558
We can stop after 7 iterations because the error looks small. In fact, Error = x 100% =
. .
X 100% = 0.14%.
.
Problem 6.3 (from the Problems section at the end of the book chapter)
Answer:
2 1 1 2 3
As you can see from this plot, there are two roots. We are looking for the root closest to the initial
guess of x0 = 5 and we can see that that root is near x = 2.8. The root is actually 2.86
Iteration xi g(xi)
1 5 11.76
2 11.76 71.75
3 STOP: ANSWER
DIVERGING
As you can see the answer is diverging. When this happens, try an alternative arrangement of the
. .
original equation and start again. Let’s give x = .
…. a go!
Iteration xi g(xi)
1 5 3.496
2 3.496 3.063
3 3.063 2.926
4 2.926 2.882
5 2.882 2.867
6 2.867 2.862
We can stop after 6 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 0.17%.
Example 6.3
Question: Locate the root of f(x) = e-x – x with a starting guess of xi = 0
Answer:
As you can see from the plot, the root is near 0.5. The root is actually 0.567
Step B. Find the first derivative of f(x) with respect to x. Here, f’(xi) = - e-x – 1. Then, the NR formula
here becomes 𝑥 = xi – (e-xi – xi)/(-e-xi – 1)
C. Set up a table like the following (you must do this in a test) and populate
Iteration xi NR
1 0 0.5
2 0.5 0.566
3 0.566 0.567
4 0.567 0.567
We can stop after 4 iterations because the error looks small. You can see the convergence was rapid!
Problem 6.2 (from the Problems section at the end of the book chapter)
Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3
Answer:
40
20
2 1 1 2 3 4 5
20
40
60
As you can see from this plot, there are three roots. We are looking for highest root and we can see
that that root is near x = 3.5. The root is actually 3.56
Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) = 6x 2 – 23.4x + 17.7. Then, the NR
formula here becomes NR = x – (2x3 – 11.7x2 + 17.7x – 5)/(6x2 – 23.4x + 17.7)
C. Set up a table like the following (you must do this in a test) and populate
Iteration xi NR
1 3 5.133
2 5.133 4.27
3 4.27 3.793
4 3.793 3.6
5 3.6 3.564
6 3.564 3.563
Problem 6.3 (from the Problems section at the end of the book chapter)
Answer:
2 1 1 2 3
As you can see from this plot, there are two roots. We are looking for the root closest to the initial
guess of x0 = 5 and we can see that that root is near x = 2.8. The root is actually 2.86
Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) =-1.8x + 1.7. Then, the NR formula
here becomes NR = x – (-0.9x2 + 1.7x + 2.5)/(-1.8x + 1.7).
Iteration xi NR
1 5 3.425
2 3.425 2.924
3 2.924 2.861
4 2.861 2.86
We can stop after 4 iterations because the error looks small.
Problem 6.4 (from the Problems section at the end of the book chapter)
Answer:
10
2 4 6
10
As you can see from this plot, there are three roots. We are looking for the middle root and we can
see that that root is near x = 1.5. The root is actually 1.48
Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) =1.5x 2 – 8x + 5.5. Then, the NR
formula here becomes NR = x – (-1 + 5.5x – 4x2 + 0.5x3)/( 1.5x2 – 8x + 5.5).
Step C. Create the table with starting guess close to the middle root – use a value of 1…
Iteration xi NR
1 1 2
2 2 1.556
3 1.556 1.483
4 1.483 1.48
In a nutshell, if it is tricky to find the first derivative of a function, using the NR method becomes
inconvenient. The Secant method is used to estimate the root by extrapolating a tangent of the
function to the x-axis (see Figure 6.7 below, taken from the text book). If you look at the caption you
will see a nice description of the difference between the NR method and Secant method
( )( )
The formula for the Secant method is: 𝑥 =𝑥 − ( ) ( )
( )( )
I find it easier to use a layman’s version: 𝑙𝑎𝑡𝑒𝑠𝑡 = 𝑛𝑒𝑤 − ( ) ( )
Example 6.6
Question: Use the Secant method to estimate the root of f(x) = e-x – x with starting estimates xi-1 = 0
and x0 = 1
Answer:
As you can see from the plot, the root is near 0.5. The root is actually 0.567
Step B. Step C. Set up a table like the following (you must do this in a test) and populate (in a test you
do not need the “Comment” column). The guess that is lower in value is “old” and the larger guess is
“new”…
Example 6.7
Question: Use the Secant method to estimate the root of f(x) = ln(x) with starting estimates of 0.5 and
5
Answer:
1 2 3 4 5 6
As you can see from the plot, the root is near 1. The root is actually 1
Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3
and 4
Answer:
40
20
2 1 1 2 3 4 5
20
40
60
As you can know, there are three roots. We are looking for highest root and the root is actually 3.56
Problem 6.6 (from the Problems section at the end of the book chapter)
Question: Determine the lowest real root of f(x) = -12 – 21x + 18x2 – 2.4x3
Answer:
50
2 2 4 6
50
100
As you can know, there are three roots. We are looking for lowest root and that root is actually -
0.415
Step B. Step C. Set up a table and populate. Use guesses -0.5 and -0.6 (straddle the root):
Problem 6.7b (from the Problems section at the end of the book chapter)
Question: Locate the second positive root of f(x) = Sin(x) + Cos(1 + x2) – 1 where x is in radians and
with guesses of 1.5 and 2.5 (actually the question asks for the first positive root but with these
guesses we will end up with the second positive root!)
Answer:
1 1 2 3
0.5
1.0
1.5
2.0
As you can know see the highest root is near 2.5. The root is actually 2.53