PROCESS SIMULATION AND
MODELING
Numerical Methods
NEWTON RAPHSON METHOD
Derivation
f(x)
AB
tan(
f(xi)
x f x
i, i
AC
f ( xi )
f ' ( xi )
xi xi 1
f(xi-1)
f ( xi )
xi+2 xi+1 xi X xi 1 xi
f ( xi )
NEWTON RAPHSON METHOD
f(xi )
xi 1 = xi -
f (xi )
Example:1
You are working for ‘DOWN THE TOILET COMPANY’ that makes
floats for ABC commodes. The floating ball has a specific gravity
of 0.6 and has a radius of 5.5 cm. You are asked to find the depth
to which the ball is submerged when floating in water.
NEWTON RAPHSON METHOD
The equation that gives the depth x in meters to which the ball is
submerged under water is given by
f x x 3 - 0 .165 x 2 + 3 .993 10 - 4
Use the Newton’s method of finding roots of equations to find
a) the depth ‘x’ to which the ball is submerged under water. Conduct
three iterations to estimate the root of the above equation.
b) The absolute relative approximate error at the end of each
iteration
NEWTON RAPHSON METHOD
Solve for
f x x 3-0.165 x 2+3.993 10- 4
f ' x 3x 2 -0.33x
Let us assume the initial guess of the root of
is x0 0.05m. .This is a reasonable guess (discuss why
x 0 and x 0.11m are not good choices) as the
extreme values of the depth x would be 0 and the
diameter (0.11 m) of the ball.
NEWTON RAPHSON METHOD
Iteration 1
The estimate of the root is
f x 0
x1 x 0
f ' x 0
0 . 05
0 . 05 3 0 . 165 0 . 05 2 3 .993 10 4
3 0 . 05 0 . 33 0 . 05
2
1 . 118 10 4
0.05
9 10 3
0.05 0 . 01242
0 . 06242
The absolute relative approximate error a at the end of Iteration 2 is
x1 x 0
a 100
x1
0 . 06242 0 . 05
100
0 . 06242
19 . 90 %
NEWTON RAPHSON METHOD
Iteration 1
The estimate of the root is
f x 0
x1 x 0
f ' x 0
0 . 05
0 . 05 3 0 . 165 0 . 05 2 3 .993 10 4
3 0 . 05 0 . 33 0 . 05
2
1 . 118 10 4
0.05
9 10 3
0.05 0 . 01242
0 . 06242
The absolute relative approximate error a at the end of Iteration 1 is
x1 x 0
a 100
x1
0 . 06242 0 . 05
100
0 . 06242
19 . 90 %
NEWTON RAPHSON METHOD
Iteration 2
The estimate of the root is
f x1
x 2 x1
f ' x1
0 . 06242
0 . 06242 3 0 . 165 0 . 06242 2 3 .993 10 4
3 0 . 06242 0 . 33 0 . 06242
2
3 . 97781 10 7
0 . 06242
8 . 90973 10 3
0 . 06242 4 . 4646 10 5
0 . 06238
The absolute relative approximate error a at the end of Iteration 2 is
x 2 x1
a 100
x2
0 . 06238 0 . 06242
100
0 . 06238
0 . 0716 %
NEWTON RAPHSON METHOD
Iteration 3
The estimate of the root is
f x 2
x3 x2
f ' x 2
0 . 06238
0 . 06238 3 0 . 165 0 . 06238 2 3 .993 10 4
3 0 . 06238 0 . 33 0 . 06238
2
4 . 44 10 11
0 . 06238
8 . 91171 10 3
0 . 06238 4 . 9822 10 9
0 . 06238
The absolute relative approximate error a at the end of Iteration 3 is
x 2 x1
a 100
x2
0 . 06238 0 . 06238
100
0 . 06238
0%
Regular Falsi/False Position Method
Based on two similar triangles, shown in above figure
Regular Falsi/False Position Method
Example 1
The floating ball has a specific gravity of 0.6 and has a
radius of 5.5cm.
You are asked to find the depth to which the ball is
submerged when floating in water.
The equation that gives the depth
submerged under water is given by
x 3 0.165 x 2 3.993 10 4 0
Regular Falsi/False Position Method
The floating ball has a specific gravity of 0.6 and has a radius of 5.5cm. You are
asked to find the depth to which the ball is submerged when floating in water.
The equation that gives the depth x in meters to which the ball is
submerged under water is given by
f x x 3 - 0 .165 x 2 + 3 .993 10 - 4
Use the false-position method of finding roots of
equations to find the depth x to which the ball is submerged under
water. Conduct three iterations to estimate the root of the above
equation. Find the absolute relative approximate error at the end of
each iteration.
Solution
From the physics of the problem
0 x 2R
0 x 2(0.055)
0 x 0.11
Regular Falsi/False Position Method
Let us assume
x L 0, xU 0.11
f x L f 0 0 0.1650 3.993 10 4 3.993 10 4
3 2
f xU f 0.11 0.11 0.1650.11 3.993 10 4 2.662 10 4
3 2
Hence,
f x L f xU f 0 f 0.11 3.993 10 4 2.662 10 4 0
Iteration 1
xU f x L x L f xU
xm
f x L f xU
0.11 3.993 10 4 0 2.662 10 4
3.993 10 4 2.662 10 4
0.0660
f xm f 0.0660 0.0660 0.1650.0660 3.993 104
3 2
3.1944 105
f x L f xm f 0 f 0.0660 0
x L 0, xU 0.0660
Iteration 2
xU f x L x L f xU
xm
f x L f xU
0.0660 3.993 10 4 0 3.1944 10 5
3.993 10 4 3.1944 10 5
0.0611
f xm f 0.0611 0.0611 0.1650.0611 3.993 104
3 2
1.1320 105
f x L f xm f 0 f 0.0611 0
Hence, x L 0.0611, xU 0.0660
0.0611 0.0660
a 100 8%
0.0611
Iteration 3
xU f x L x L f xU
xm
f x L f xU
0.0660 1.132 10 5 0.0611 3.1944 10 5
1.132 10 5 3.1944 10 5
0.0624
f xm 1.1313 10 7
f x L f xm f 0.0611 f 0.0624 0
Hence,
x L 0.0611, xU 0.0624
0.0624 0.0611
a 100 2.05%
0.0624
Table 1: Root of f x x 3 0.165 x 2 3.993 10 4 0
for False-Position Method.
Iteration xL xU xm a % f xm
1 0.0000 0.1100 0.0660 N/A -3.1944x10-5
2 0.0000 0.0660 0.0611 8.00 1.1320x10-5
3 0.0611 0.0660 0.0624 2.05 -1.1313x10-7
4 0.0611 0.0624 0.0632377619 0.02 -3.3471x10-10
Interval Halving/Bisection Method
Choose xl and xu as two guesses for the root such that f(xl)
f(xu) < 0, or in other words, f(x) changes sign between xl and
xu.
Estimate the root, xm of the equation f (x) = 0 as the mid point
between xl and xu as
x xu
xm =
2
Interval Halving/Bisection Method
Now check the following
a) If f xl f xm 0 , then the root lies between xl and
xm; then xl = xl ; xu = xm.
b) If f xl f xm 0 , then the root lies between xm and
xu; then xl = xm; xu = xu.
c) If f xl f xm 0 ; then the root is xm. Stop the
algorithm if this is true.
Interval Halving/Bisection Method
Find the new estimate of the root
x xu
xm =
2
Find the absolute relative approximate error
x new x old
m
a m
new
100
x m
where
xmold previous estimate of root
xmnew current estimate of root
Interval Halving/Bisection Method
The equation that gives the depth x to which the ball is
submerged under water is given by
x 3 0.165 x 2 3.993 10 4 0
a) Use the bisection method of finding roots of equations to find
the depth x to which the ball is submerged under water.
Conduct three iterations to estimate the root of the above
equation.
b) Find the absolute relative approximate error at the end of
each iteration.
Interval Halving/Bisection Method
From the physics of the problem, the ball would be
submerged between x = 0 and x = 2R,
where R = radius of the ball, that is
0 x 2R
0 x 20.055
0 x 0.11
Let us assume
x 0.00
xu 0.11
Check if the function changes sign between x and xu .
f xl f 0 0 0.1650 3.993 10 4 3.993 10 4
3 2
f xu f 0.11 0.11 0.1650.11 3.993 10 4 2.662 10 4
3 2
Interval Halving/Bisection Method
Hence
f xl f xu f 0 f 0.11 3.993 10 4 2.662 10 4 0
So there is at least on root between x and xu, that is between 0 and 0.11
Iteration 1 x xu 0 0.11
The estimate of the root is xm 0.055
2 2
f xm f 0.055 0.055 0.1650.055 3.993 10 4 6.655 10 5
3 2
f xl f xm f 0 f 0.055 3.993 10 4 6.655 10 5 0
Hence the root is bracketed between xm and xu, that is, between 0.055 and
0.11. So, the lower and upper limits of the new bracket are
xl 0.055, xu 0.11
At this point, the absolute relative approximate error cannot be
calculated as we do not have a previous approximation.
Interval Halving/Bisection Method
Iteration 2
x xu 0.055 0.11
The estimate of the root is xm 0.0825
2 2
f xm f 0.0825 0.0825 0.1650.0825 3.993 10 4 1.622 10 4
3 2
f xl f xm f 0.055 f (0.0825) 1.622 10 4 6.655 10 5 0
Hence the root is bracketed between x and xm, that is, between 0.055 and
0.0825. So, the lower and upper limits of the new bracket are
xl 0.055, xu 0.0825
The absolute relative approximate error a at the end of Iteration 2 is
xmnew xmold
a new
100
xm
0.0825 0.055
100
0.0825
33.333%
Interval Halving/Bisection Method
Iteration 3
x xu 0.055 0.0825
The estimate of the root is xm 0.06875
2 2
f xm f 0.06875 0.06875 0.1650.06875 3.993 10 4 5.563 10 5
3 2
f xl f xm f 0.055 f 0.06875 6.655 10 5 5.563 10 5 0
Hence the root is bracketed between x and xm, that is, between 0.055 and
0.06875. So, the lower and upper limits of the new bracket are
xl 0.055, xu 0.06875
The absolute relative approximate error a at the end of Iteration 3
is xmnew xmold
a new
100
xm
0.06875 0.0825
100
0.06875
20%
Interval Halving/Bisection Method
Table 1 Root of f(x)=0 as function of number of iterations for bisection
method.
Iteration x xu xm a % f(xm)
1 0.00000 0.11 0.055 ---------- 6.655×10−5
2 0.055 0.11 0.0825 33.33 −1.622×10−4
3 0.055 0.0825 0.06875 20.00 −5.563×10−5
4 0.055 0.06875 0.06188 11.11 4.484×10−6
5 0.06188 0.06875 0.06531 5.263 −2.593×10−5
6 0.06188 0.06531 0.06359 2.702 −1.0804×10−5
7 0.06188 0.06359 0.06273 1.370 −3.176×10−6
8 0.06188 0.06273 0.0623 0.6897 6.497×10−7
9 0.0623 0.06273 0.06252 0.3436 −1.265×10−6
10 0.0623 0.06252 0.06241 0.1721 −3.0768×10−7
Muller Method
Muller Method
The sign in the denominator is chosen so that it is the largest in
magnitude, guaranteeing that x3 is closest to x2.
Muller Method
Thus, computing x3 from the starting approximations x0, x1,
and x2 by Muller’s Method consists of the following two
steps:
Step 1. Find the parabola P passing through (x0, f(x0)), (x1,
f(x1)), and (x2, f(x2)).
Step 2. Solve the quadratic equation representing the
parabola P and take x3 as the root closest to x2.
(Note that even when x0, x1, and x2 are real, x3 can be
complex.)
• (Computing x4 and successive approximations.)
Example: 1
Muller Method
Perform three iterations of the Muller method to find out the
smallest root of the equation x3-5x+1=0
(initial approximations x0=0, x1=0.5 and x2=1)
Solution:
Iteration 1
a= 1.5
b= -2.5
C=-3
X3= 0.19185
Iteration 2
a= 1.691854
b= -5.1385
C=0.04777
X4= 0.201183
Muller Method
Iteration 3
a= 1.393112
b= -4.871483
C=0.00228
X5= 0.201640