Lecture 6
Lecture 6
Iterative Convergence
Numerical Methods
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Use of Numerical Methods
• For understanding chemical process, modeling equations need to be
solved.
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Types of Numerical Methods
Iterative
Convergence
Numerical
Numerical Integration for
Methods ODEs
Numerical
Solution for PDEs
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Numerical Methods
Bisection method
Iterative
Secant Method
Convergence
Newton–Raphson
Method
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Bisection Method
• For a given function f(x),the Bisection Method
algorithm works as follows:
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Bisection Method
• if f(c) = 0 means that we found the root of the function, which is c
•
The algorithm ends when the values of f(c) is less than a defined
tolerance (e.g. 0.001). In this case we say that c is close enough to
be the root of the function for which f(c) ~= 0.
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Secant Method
• Instead of using the average of the interval
endpoints to select the next root estimate, it is
required to construct a secant line and find its x-
intercept as the next root estimate
• For xk+1
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Secant Method
• Put yk+1 = 0
• Simplifying
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Newton–Raphson Method
• Using Taylor Series
• Limit to first order and neglect the second order and above
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section Method
f(x) = 1 – 2ex
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section Method
Bi-Section Method
•For a given function f(x),the Bisection Method
algorithm works as follows:
•
The algorithm ends when the values of f(c) is less than a defined
tolerance (e.g. 0.001). In this case we say that c is close enough to
be the root of the function for which f(c) ~= 0.
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section Method
Solution
• Take two guesses, as these are not provided, suppose a = -1 and b = 2
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section Method
Solution
• Take two guesses, as these are not provided, suppose a = -1 and b = 2
Bi-Section Method
Iteration a b f(a) f(b) c f(c)
1 -1.00 2.00 0.2642 -13.7781 0.50 -2.2974
2 -1.00 0.50 0.2642 -2.2974 -0.25 -0.5576
3 -1.00 -0.25 0.2642 -0.5576 -0.63 -0.0705
4 -1.00 -0.63 0.2642 -0.0705 -0.81 0.1125
5 -0.81 -0.63 0.1125 -0.0705 -0.72 0.0253
6 -0.72 -0.63 0.0253 -0.0705 -0.67 -0.0215
7 -0.72 -0.67 0.0253 -0.0215 -0.70 0.0022
8 -0.70 -0.67 0.0022 -0.0215 -0.68 -0.0096
9 -0.70 -0.68 0.0022 -0.0096 -0.69 -0.0037
10 -0.70 -0.69 0.0022 -0.0037 -0.69 -0.0008
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section & Secant Methods
f(x) = x3 – 5x2 + 6x – 1
employing the
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section & Secant Methods
• Instead of using the average of the interval Secant Method
endpoints to select the next root estimate, it is
required to construct a secant line and find its x-
intercept as the next root estimate
• For xk+1
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section & Secant Methods
• Put yk+1 = 0
• Simplifying
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section & Secant Methods
Solution (Secant Method)
• Take two guesses, as these are not provided, suppose xk-1 = -0.25 and xk = 0.50
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section & Secant Methods
Solution (Secant Method)
• Take two guesses, as these are not provided, suppose xk-1 = -0.25 and xk = 0.50
Secant Method
Iteration (k) xk-1 xK xk+1 f(xk+1) Error
f(xk-1) f(xk)
1 -0.25 0.5 -2.82813 0.8750 0.3228 0.4494 0.5490
2 0.5 0.3228 0.875 0.4494 0.1357 -0.2755 1.3792
3 0.3228 0.1357 0.4494 -0.2755 0.2068 0.0358 0.3439
4 0.1357 0.2068 -0.2755 0.0358 0.1986 0.0023 0.0411
5 0.2068 0.1986 0.0358 0.0023 0.1981 0.0000 0.0028
6 0.1986 0.1981 0.0023 0.0000 0.1981 0.0000 0.0000
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section, Secant & Newton Raphson
(a) f(x) = x3 – 5x + 1
using the
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section, Secant & Newton Raphson
Methods
Class Discussion
• Newton Raphson Method for f(x) = x3 – 5x + 1
Home Work
• Apply Bi-Section & Secant Methods for f(x) = x3 – 5x + 1; ranges 1.5 to 4.5
• Apply Bi-Section, Secant & Newton Raphson Methods for f(x) = x2ex – 1; ranges -
5 to 5
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section, Secant & Newton Raphson
• Using Taylor Series Methods
Newton–Raphson Method
• Limit to first order and neglect the second order and above
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section, Secant & Newton Raphson
Methods Method
Solution for (a) using Newton–Raphson
• Take two guesses, as these are not provided, suppose xk = 4.5
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Application of Bi-Section, Secant & Newton Raphson
Methods Method
Solution for (a) using Newton–Raphson
• Take two guesses, as these are not provided, suppose xk = 4.5
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Methods
Estimate the isothermal volume of a real gas composing 100% benzene with
tolerance of 0.0001 using the van der waals equation at 4,727C and 200 atm using:
• Bi-section method (initial guess is -1 to 2.5)
The van der waals constants for benzene are a = 18.82 & b = 0.1193.
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Solution
The function is given as
f(x) = 0
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Solution
Bi-Section Method Secant Method
Iteration a b f(a) f(b) c f(c) Vk-1 VK f(Vk-1) f(Vk) Vk+1 f(Vk+1) Error
Iteration (k)
1 -1 2.5 -654.925 458.1798 0.7500 -147.8015 1 -1.0 2.0 -654.9252 -100.0452 2.5409 525.4006 0.2129
2 0.75 2.5 -147.801 458.1798 1.6250 -259.1212
2 2.0 2.5409 -100.0452 525.4006 2.0865 -35.0531 0.2178
3 1.625 2.5 -259.121 458.1798 2.0625 -54.2924
3 2.5409 2.0865 525.4006 -35.0531 2.1149 -11.0717 0.0134
4 2.0625 2.5 -54.2924 458.1798 2.2813 157.2077
4 2.0865 2.1149 -35.0531 -11.0717 2.1281 0.4535 0.0062
5 2.28125 2.5 157.2077 458.1798 2.3906 295.7247
5 2.1149 2.1281 -11.0717 0.4535 2.1275 -0.0055 0.0002
6 2.28125 2.5 157.2077 458.1798 2.3906 295.7247
7 2.28125 2.5 157.2077 458.1798 2.3906 295.7247 6 2.1281 2.1275 0.4535 -0.0055 2.1276 0.0000 0.0000
8 2.28125 2.5 157.2077 458.1798 2.3906 295.7247 7 2.1275 2.1276 -0.0055 0.0000 2.1276 0.0000 0.0000
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
There is a spherical storage tank containing oil. The tank has a diameter of 6 ft.
You are required to calculate the height, h, to which a dipstick 8 ft long would be
wet with oil when immersed in the tank when it contains 4 ft3 of oil.
Dipstick
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
The equation that gives the height, h, of liquid in the spherical tank for the given volume and
radius is given by
h3 – 9h2 + 3.8197 = 0
Find the roots of equations to find the height, h, to which the dipstick is wet with oil such that
the tolerance error is 0.01. Make estimations using:
• Bi-section method (initial guess is -0.1 to 6)
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Solution
f(x) = 0
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Solution
Bi-Section Method Secant Method
Iteration a b f(a) f(b) c f(c) Iteration (k) hk-1 hK f(hk-1) f(hk) hk+1 f(hk+1) Error
1 -0.1 3 3.7287 -50.1803 1.4500 -12.0542 1 -0.5 1.0 1.4447 -4.1803 -0.1147 3.6997 9.7149
2 -0.1 1.4500 3.7287 -12.0542 0.6750 0.0266 2 1.0 -0.1147 -4.1803 3.6997 0.4086 2.3851 1.2808
3 0.675 1.4500 0.0266 -12.0542 1.0625 -5.1410 3 -0.1147 0.4086 3.6997 2.3851 1.3582 -10.2778 0.6991
4 0.6750 1.0625 0.0266 -5.1410 0.8688 -2.3172 4 0.4086 1.3582 2.3851 -10.2778 0.5875 0.9161 1.3119
5 0.6750 0.8688 0.0266 -2.3172 0.7719 -1.0825 5 1.3582 0.5875 -10.2778 0.9161 0.6506 0.2859 0.0970
6 0.6750 0.7719 0.0266 -1.0825 0.7234 -0.5119 6 0.5875 0.6506 0.9161 0.2859 0.6792 -0.0186 0.0421
7 0.6750 0.7234 0.0266 -0.5119 0.6992 -0.2386 7 0.6506 0.6792 0.2859 -0.0186 0.6774 0.0003 0.0026
8 0.6750 0.6992 0.0266 -0.2386 0.6871 -0.1050
8 0.6792 0.6774 -0.0186 0.0003 0.6775 0.0000 0.0000
9 0.6750 0.6871 0.0266 -0.1050 0.6811 -0.0389
10 0.6750 0.6811 0.0266 -0.0389 0.6780 -0.0061
11 0.6750 0.6780 0.0266 -0.0061 0.6765 0.0103
12 0.6750 0.6765 0.0266 0.0103 0.6758 0.0185
13 0.6750 0.6765 0.0266 0.0103 0.6758 0.0185
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering
Iterative Convergence (Chemical Engineering Problems)
Solution
Newton Raphson Method
Iteration
h f(hk) f'(hk) hk+1 f(hk+1)
(k)
0 2.0000 -24.1803 -24.00 0.9925 -4.0680
1 0.9925 -4.0680 -14.91 0.7196 -0.4686
2 0.7196 -0.4686 -11.40 0.6785 -0.0116
3 0.6785 -0.0116 -10.83 0.6775 0.0000
4 0.6775 0.0000 -10.82 0.6775 0.0000
Course:
Course: Modeling, Process Modeling
Simulation and Simulation
and Optimization | Lecture:
for Chemical Process Modeling
Engineering