CH332 29jan
CH332 29jan
Computational Chemistry
o Bracketing methods
o start with two initial guesses that bracket the root
o Systematically reduce the width of the bracket to reach the solution
o Two popular methods under this category
o Bisection method
o False position method
o Open-end methods
o Single initial guess
o Two initial guesses are possible but that may not bracket the root
o Iterative methods that fall under this category are
o Newton-Raphson method
o Secant method
o Muller’s method
o Fixed-point method
o Bairstow’s method
Choosing initial guesses and criteria to stop the iterations
o Search intervals that contain the real roots: o The maximum absolute value of the root:
𝑎'"% ( 𝑎'"(
( ∗
𝑥)*+ = −2
𝑎'"% 𝑎'"(
𝑥∗ ≤ −2 𝑎' 𝑎'
𝑎' 𝑎'
𝑎#$! −9
The largest possible root is given by: 𝑥!∗ = − =− =3
𝑎# 3
( (
𝑎'"% 𝑎'"( −9 6
𝑥∗ ≤ −2 = −2 = 5
𝑎' 𝑎' 3 3
𝒙𝟏 /𝒙𝟐 𝑥! 𝑥&
Let’s define a point 𝒙𝟎 =
𝟐 𝑥
0 𝑥%
Bisection method:
𝑓(𝑥)
𝑥! 𝑥&
𝑥
0 𝑥%
𝑥!
𝑥! 𝑥&
𝑥
0 𝑥& 𝑥%
For the above function 𝑓 𝑥0 ×𝑓 𝑥% < 0 suggests that the root lies between 𝑥0 and 𝑥% .
o Now 𝑥( becomes 𝑥0
o Further divide this subinterval into two halves to locate a new subinterval containing the root
Overview of Bisection method
o 𝑓(𝑥) s real and continuous in the interval 𝑥% < 𝑥 < 𝑥( 𝑓(𝑥)
o If 𝑓(𝑥% ) and 𝑓(𝑥( ) are of opposite signs: 𝑓(𝑥% ) 𝑓 𝑥( < 0
𝑥!
o If 𝑓 𝑥0 = 0, we have root at 𝑥0 𝑥! 𝑥&
o If 𝑓 𝑥0 ×𝑓 𝑥% < 0, there is a root between 𝑥0 and 𝑥% 𝑥
0 𝑥& 𝑥%
o If 𝑓 𝑥0 ×𝑓 𝑥( < 0, there is a root between 𝑥0 and 𝑥(
𝑓 𝑥& ×𝑓 𝑥% < 0 suggests that the root lies between 𝑥& and 𝑥%
o Now 𝑥% becomes 𝑥0
o If 𝑓 𝑥0 ×𝑓 𝑥% < 0, there is a root between 𝑥0 and 𝑥%
o If 𝑓 𝑥0 ×𝑓 𝑥( < 0, there is a root between 𝑥0 and 𝑥(
x -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
f(x) 50 35 22 11 2 -4 -10 -13 -14 -13 -10 -5 2
Graphical method to get an idea of the nature of the function
140
2
120 x −4x−10
100
80
f (x)
60
40 Root 1 Root 2
20
0
−20
−10−8 −6 −4 −2 0 2 4 6 8 10
x
Now let’s calculate the root between the interval -2 and -1.5
Convergence of Bisection method
o From the above discussion, we know that in the bisection method, the interval containing
the root is reduced by a factor of 2. The same procedure is repeated multiple times.
o Let’s consider that we repeat the procedure n times. Then the interval containing the
root is
𝒙𝟐 − 𝒙𝟏 ∆𝒙
𝒏 = 𝒏
𝟐 𝟐
∆𝒙 ∆𝒙
o So, the root must lie between - to
𝟐𝒏 𝟐𝒏
∆𝑥
𝐸
o Now the error bound at n-th iteration is # =
2#
𝒙𝒏𝒆𝒘
𝒓 − 𝒙𝒐𝒍𝒅
𝒓
𝜺𝒂 = 𝒏𝒆𝒘 𝟏𝟎𝟎%
𝒙𝒓
𝒙𝒓 − 𝒙𝒊𝒓
𝜺𝒕 = 𝟏𝟎𝟎% 𝜺𝒂 captures the general trend, not exact
𝒙𝒓
where xr is the actual root of the equation, Note: the above plot is for a specific example. We will be
𝒙𝒊𝒓 is the root estimate at ith iteration. evaluating this example in practical class.
False Position method
Although the bisection method is a good technique to determine the root of an equation
It has some drawbacks:
o The brute-force nature makes it inefficient
o It divides the interval from 𝑥! to 𝑥% into equal halves: the root may be close to one of the points
𝑓(𝑥% )
An alternative method is
𝑥!
𝑥 “False-position method”
𝑥& 𝑥%
𝑓(𝑥! )
False Position method
𝑓(𝑥% )
𝑥!
𝑥
𝑥& 𝑥%
𝑓(𝑥! )
Join the points x1 and x2 by a line: The intersection point to the x-axis is an
improved estimate of the root.
𝑥!
𝑥
𝑥& 𝑥%
𝑓(𝑥! )
x -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
f(x) 50 35 22 11 2 -5 -10 -13 -14 -13 -10 -5 2
140 2
120 x2−4x−10
1
100 0
80
−1
f (x)
f (x)
60
Root 1 Root 2 −2
40
20 −3
0 −4
−20 −5
−10−8 −6 −4 −2 0 2 4 6 8 10 −2 −1.8 −1.6 −1.4 −1.2 −1
x x
zoomed in near the root 1
Example
0.57142
𝑥C = −2 − = −2 + 0.25926 = −1.74074
−2.204050
A FORTRAN code for False Position method
A FORTRAN code for False Position method
A FORTRAN code for False Position method
A FORTRAN code for False Position method
A FORTRAN code for False Position method
Error estimate: comparison with Bisection method
𝒙𝒓 − 𝒙𝒊𝒓
𝜺𝒕 = 𝟏𝟎𝟎%
𝒙𝒓
Converged in 21 iterations
Convergence of False Position method
Similar to the Bisection method, the False position method converges linearly
o Bracketing methods
o start with two initial guesses that bracket the root
o Systematically reduce the width of the bracket to reach the solution
o Two popular methods under this category
o Bisection method
o False position method
o Open-end methods
o Single initial guess
o Two initial guesses are possible but that may not bracket the root
o Iterative methods that fall under this category are
o Newton-Raphson method
o Secant method
o Muller’s method
o Fixed-point method
o Bairstow’s method
Newton-Raphson method
𝒇 𝒙𝟐 = 𝟎
x -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
f(x) 50 35 22 11 2 -5 -10 -13 -14 -13 -10 -5 2
In the vicinity of -1
After a few iterations Newton-Raphson method gives a result
close to the Bisection method
𝒇 𝒙 = 𝒙𝟐 − 𝟒𝒙 − 𝟏𝟎 𝒇4 𝒙 = 𝟐𝒙 − 𝟒
𝑓(𝑥% ) 𝑥! = −1 𝑓 −1 = (−1)( −4 ∗ −1 − 10
Newton-Raphson formula: 𝑥( = 𝑥% − 4
𝑓 (𝑥% ) =-5
−5 𝑓 4 −1 = 2 ∗ −1 − 4
𝑥( = −1 −
−6 =-6
= -1.8333
Newton-Raphson Method after 4 iterations: -1.741657 Bisection Method after 7 iterations: -1.7416
Convergence of Newton-Raphson method
o Error is roughly proportional to the square of the error in the previous iteration
𝒇” (𝑹) 𝟐
𝑬𝒏/𝟏 = F 𝑬𝒏
𝟐𝒇 (𝒙𝒏 )
o Newton-Raphson may not converge if your initial guess is too far from the
expected root. When it does converge, it converges faster than the Bisection
method.
A FORTRAN code for Newton-Raphson Method
A FORTRAN code for Newton-Raphson Method
A FORTRAN code for Newton-Raphson Method
Limitation of Newton-Raphson method
o In some situations, division by zero may occur.
o The initial guess should not be too far from the expected root.
o A particular value in the iteration sequence may repeat. This leads to an infinite
loop.
Process and Job-control
THANK YOU!