Numerical Methods On Finding The Roots
Numerical Methods On Finding The Roots
Numerical Methods On Finding The Roots
I. Linear Equations
The quadratic formula provides roots for simple quadratic equations. Roots are x values that yield
y=0, and so they may also be referred to as Zeroes. There are, however, some functions, polynomial or
non-polynomial it may be, would give a harder time for their roots to be found. In such cases, numerical
methods can be used, which give approximate values of their roots. A root is where the values of f(x)
changes sign (from + to – or vice versa). These values are the boundaries of an interval chosen within the
function [1]. As a generalization:
• When the two boundaries in a given interval have opposite signs, the number of roots within that
interval is odd; that is, at least 1 root can be found.
• When they have same signs, the number of roots is even, and this include 0 (no roots in that
interval).
However, there are cases in which this generalization cannot be applied. Such cases include when
the function is Tangent on the x-axis or if it is Discontinuous on the given interval [1].
A. Bracket Methods
Bisection Method
This method utilizes the 1st generalization, in which at least one root exists between an interval
of two boundaries (upper bound xu and lower bound xl) whose f(x) values have different signs. That is, at
least one root exists when 𝑓(𝑥𝑢 ) ∙ 𝑓(𝑥𝑙 ) < 0. The Incremental Search Methods locates an interval where
f(x) changes sign, then the location of the sign change is identified more precisely by dividing that interval
into a number of subintervals. The process is repeated until a refined root estimate is obtained [1].
In the bisection method, which is also called Binary Chopping, Interval Halving, or Bolzano’s
Method, the interval is always divided into half. A midpoint (xr) is found between an interval, and two new
sub intervals would be searched for the sign change (between xu and xr, and between xl and xr). The
midpoint is found with the formula given below [1]. The following rules would be applied:
• When 𝑓(𝑥𝑟 ) ∙ 𝑓(𝑥𝑙 ) < 0, that is, a sign change occurred between xr and xl, then the root must be
in that interval. Make 𝑥𝑟 = 𝑥𝑢 and continue the iteration using the interval [xl,xr].
• When 𝑓(𝑥𝑟 ) ∙ 𝑓(𝑥𝑙 ) > 0, that is, , a sign change did NOT occurred between xr and xl, then the root
must NOT be in that interval. Make 𝑥𝑟 = 𝑥𝑙 and continue the iteration using the interval [xr,xu].
• When 𝑓(𝑥𝑟 ) ∙ 𝑓(𝑥𝑙 ) = 0, that is, 𝑓 (𝑥𝑟 ) = 0 since 𝑓(𝑥𝑙 ) ≠ 0, then xr is already the root. Terminate
the iterations.
𝒙𝒖 + 𝒙𝒍
𝒙𝒓 = 𝒙𝒏𝒆𝒘
𝒓 =
𝟐
The new signifies that a new midpoint as a candidate for a more refined root is obtained from a
previous iteration. Because the new sub-interval is half of the interval of the previous iteration, then:
𝒙𝒖 − 𝒙𝒍
𝒙𝒏𝒆𝒘
𝒓 − 𝒙𝒐𝒍𝒅
𝒓 =
𝟐
The iterations are terminated once when the root has been obtained or when the desired
absolute error has been reached. The True Relative Error (et) can only be computed if the actual root is
known. But for practical and obvious reasons, this is hardly obtained since the purpose of numerical
methods is to give approximate root values for functions whose root cannot absolutely be determined. In
such case, the Approximate Relative Error (ea) is often used for the evaluation [1].
𝑥 −𝑥
|𝒙𝒏𝒆𝒘
𝒓 − 𝒙𝒐𝒍𝒅
𝒓 |
| 𝑢 2 𝑙| |𝒙𝒖 − 𝒙𝒍 |
𝜺𝒂 = 𝒏𝒆𝒘 𝒙𝟏𝟎𝟎 → 𝜀𝑎 = 𝑥 + 𝑥 𝑥100 → 𝜺𝒂 = 𝒙𝟏𝟎𝟎
𝒙𝒓 𝑢 𝑙 𝒙𝒖 + 𝒙𝒍
2
The absolute error (E) at the beginning (0th iteration) is 𝐸𝑎0 = 𝑥𝑢0 − 𝑥𝑙0 = ∆𝑥 0 . Since for the
bisection method, the sub-interval, which will be used for the next iteration (1st iteration), will have its
0 −𝑥 0
𝑥𝑢 ∆𝑥 0
absolute error half of it: 𝐸𝑎1 = 𝑥𝑢1 − 𝑥𝑙1 = 2
𝑙
= 2
. The iterations would use half of the interval used
0 −𝑥 0
𝑥𝑢 ∆𝑥 0
from the previous iteration. Then, for an nth iteration: 𝐸𝑎𝑛 = 𝑥𝑢𝑛 − 𝑥𝑙𝑛 = 𝑙
2𝑛
= 2𝑛
. This last equation
becomes useful because it could be used to obtain the number or iterations (n+1 including 0th iteration)
or to what iteration the computation must stop to achieve the desired absolute error [1].
∆𝒙𝟎
∆𝒙𝟎 ∆𝑥 0 ∆𝑥 0
𝐥𝐨𝐠 ( 𝑬𝒏 )
∆𝑥 0 𝒂 ⁄
𝑬𝒏𝒂 = 𝟐𝒏
→ 𝑙𝑜𝑔 [2𝑛 = 𝐸𝑛 ] → log(2𝑛 ) = log ( 𝐸𝑛 ) → nlog(2) = log ( 𝐸𝑛 ) → 𝒏 = 𝐥𝐨𝐠(𝟐)
𝑎 𝑎 𝑎
The approximate relative error (ea) is always greater than the true relative error (et). The
approximate relative error (ea) is computed using the upper and lower bound of the interval of interest
for a given iteration. But the true relative error (e t) is computed using the True Root (xr,t) and the
Approximated Root or the estimate we computed. The true root would always be between the interval of
interest. And since the approximate root is the midpoint of the two boundaries, then [1]:
Sample #1: Determine the real roots of 𝑓 (𝑥) = −0.6 𝑥 2 + 2.4𝑥 + 5.5
n=1:
7.5 + 5
𝑥𝑟1 = = 6.25; 𝑓 (6.25) − 0.6 (6.25)2 + 2.4(6.25) + 5.5 = −2.9375
2
- 𝐵𝑒𝑐𝑎𝑢𝑠𝑒 𝑓 (6.25) ∙ 𝑓 (5) = −; 𝑡ℎ𝑒𝑛 𝑥𝑢 = 6.25
n=2:
6.25 + 5
𝑥𝑟2 = = 𝟓. 𝟔𝟐𝟓; 𝑓(5.625) − 0.6 (6.25)2 + 2.4(6.25) + 5.5 = 𝟎. 𝟎𝟏𝟓𝟔𝟐𝟓
2
- 𝐵𝑒𝑐𝑎𝑢𝑠𝑒 𝑓 (6.25) ∙ 𝑓 (5) = +; 𝑡ℎ𝑒𝑛 𝑥𝑙 = 5.625 𝑎𝑛𝑑 𝑥𝑢 =
6.25. 𝑇ℎ𝑖𝑠 𝑖𝑠𝑓𝑜𝑟 𝑡ℎ𝑒 𝑛𝑒𝑥𝑡 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 (𝑛 = 3)
Sample #2: Determine the real roots of 𝑓 (𝑥) = 4𝑥 3 − 6𝑥 2 + 7𝑥 − 2.3 Using bisection to locate the root.
Employ initial guesses of xl = 0 and xu = 1 and iterate until the estimated error εa falls below a level of εs =
10%.
n xl xu xr ea yl yr yryl
0 0 1 0.5 100 -2.3 0.2 -0.46
1 0 0.5 0.25 100 -2.3 -0.8625 1.98375
2 0.25 0.5 0.375 33.33333 -0.8625 -0.30781 0.265488
3 0.375 0.5 0.4375 14.28571 -0.30781 -0.05098 0.015691
4 0.4375 0.5 0.46875 6.666667 -0.05098 0.074878 -0.00382
-The following data were calculated using Excel software. The computation is up to n=4 (5 iterations)
and the approximate root is x=0.46875.
Sample #3: The saturation concentration of dissolved oxygen in freshwater can be calculated with the
equation (APHA, 1992) below, where osf = the saturation concentration of dissolved oxygen in freshwater
at 1 atm (mg/L) and Ta = absolute temperature (K). Remember that Ta = T + 273.15, where T = temperature
(◦C). According to this equation, saturation decreases with increasing temperature. For typical natural
waters in temperate climates, the equation can be used to determine that oxygen concentration ranges
from 14.621 mg/L at 0◦C to 6.413 mg/L at 40◦C. Given a value of oxygen concentration, this formula and
the bisection method can be used to solve for temperature in ◦C.
b. What temperature of the freshwater would have a zero concentration of oxygen if the desired
absolute error is that in part a?
-The following data were computed using Excel software. The computation is up to n=9 (10
iterations) and the approximate temperature for 0 concentration of oxygen is 313.1109, with an
absolute error of 𝐸𝑎9 = |313.1109 − 313.0719| = 𝟎. 𝟎𝟑𝟗𝟏𝟗.
Regula-Falsi Method
The problem with the Bisection method is that it is relatively inefficient given that the
approximate relative errors go down at a slow rate as the iterations continue to progress. Also, the
Bisection method only evaluates the distance of the boundaries (xl and xu) to xr,t, not highlighting the
magnitude of the their f(x) values (yl and yu). A generalization could be made that when the f(x) values of
either the lower bound l or the upper bound u is nearer to the f(x) value of the true root, then its x value
must also then be nearer to xr,t [1].
𝑥𝑢 𝑦𝑙 − 𝑥𝑙 𝑦𝑢 𝑥𝑢 𝑦𝑙 − 𝑥𝑙 𝑦𝑢 𝑥𝑢 𝑦𝑙 𝑥𝑙 𝑦𝑢
→ 𝑥𝑟 = → 𝑥𝑟 − 𝑥𝑢 = − 𝑥𝑢 → 𝑥𝑟 = 𝑥𝑢 + − 𝑥𝑢 −
(𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 )
𝑥𝑢 𝑦𝑙 − 𝑥𝑢 𝑦𝑙 + 𝑥𝑢 𝑦𝑢 𝑥𝑙 𝑦𝑢 𝑥𝑢 𝑦𝑢 𝑥𝑙 𝑦𝑢
→ 𝑥𝑟 = 𝑥𝑢 + − → 𝑥𝑟 = 𝑥𝑢 + −
(𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 ) (𝑦𝑙 − 𝑦𝑢 )
𝒚𝒖 (𝒙𝒍 − 𝒙𝒖 )
→ 𝒙𝒓 = 𝒙𝒖 −
(𝒚𝒍 − 𝒚𝒖 )
Sample #1: Determine the real root of 𝑓 (𝑥) = −26 + 85𝑥 − 91𝑥 2 + 44𝑥 3 − 8𝑥 4 + 𝑥 5 up to
below 𝜀 = 0.20% with 𝑥𝑙 = 0.5 and 𝑥𝑢 = 1.0
n=0:
𝑦𝑙 = 𝑓(0.5) = −26 + (85 ∙ 0.5) − (91 ∙ 0.52 ) + (44 ∙ 0.53 ) − (8 ∙ 0.54 ) + 0.55 = −1.21875
𝑦𝑢 = 𝑓 (1.0) = −26 + (85 ∙ 1.0) − (91 ∙ 1.02 ) + (44 ∙ 1.03 ) − (8 ∙ 1.04 ) + 1.05 = 5
𝑦𝑢 (𝑥𝑙 − 𝑥𝑢 ) 5(0.5 − 1)
𝑥𝑟 = 𝑥𝑢 − = 1− = 𝟎. 𝟓𝟗𝟕𝟗𝟗; 𝑓(0.59799) = 0.75057
(𝑦𝑙 − 𝑦𝑢 ) (−1.21875 − 5)
n=1:
n=2:
n=3:
Sample #2: Determine the positive real root of ln(𝑥 4 ) = 0.70 using ten iterations of the bisection method
and as well as the regula-falsi with 𝑥𝑙 = 0.5 and 𝑥𝑢 = 2.0 as the initial guess.
Bisection method
n xl xu xr ea yl yr yryl
0 0.5 2 1.25 60 -3.472588722 0.192574 -0.66873
1 0.5 1.25 0.875 42.85714 -3.472588722 -1.23413 4.285611
2 0.875 1.25 1.0625 17.64706 -1.23412557 -0.4575 0.564614
3 1.0625 1.25 1.15625 8.108108 -0.457501513 -0.11927 0.054567
4 1.15625 1.25 1.203125 3.896104 -0.119271961 0.039689 -0.00473
5 1.15625 1.203125 1.179688 1.986755 -0.119271961 -0.039 0.004652
6 1.179688 1.203125 1.191406 0.983607 -0.039001708 0.000537 -2.1E-05
7 1.179688 1.191406 1.185547 0.494234 -0.039001708 -0.01918 0.000748
8 1.185547 1.191406 1.188477 0.246508 -0.019183336 -0.00931 0.000179
9 1.188477 1.191406 1.189941 0.123102 -0.00931085 -0.00438 4.08E-05
10 1.189941 1.191406 1.190674 0.061513 -0.00438373 -0.00192 8.43E-06
|𝑥𝑟,𝑡 − 𝑥𝑟10 |
𝜀𝑡, = 𝑥100
𝑥𝑟,𝑡
|1.191 − 1.190674|
𝜀𝑡,𝑏𝑖𝑠𝑒𝑐𝑡𝑖𝑜𝑛 = 𝑥100
1.191
= 𝟎. 𝟎𝟐𝟕%
|1.191 − 1.19125|
𝜀𝑡,𝑟𝑒𝑔𝑢𝑙𝑎 𝑓𝑎𝑙𝑠𝑖 = 𝑥100
1.191
= 𝟎. 𝟎𝟐𝟏%
Sample #3: The velocity v of a falling parachutist is given by the following equation below, where g = 9.8
m/s2. For a parachutist with a drag coefficient c = 15 kg/s, compute the mass m so that the velocity is v = 35 m/s at t
9 s. Use the false-position method to determine m to a level of εa = 0.001%.
𝑔𝑚 𝑐 𝑔𝑚 𝑐
h m f(m) 𝑣= (1 − 𝑒 −𝑚𝑡 ) → 𝑓 (𝑚 ) = (1 − 𝑒 −𝑚𝑡 ) − 𝑣
5 5 -31.7333 𝑐 𝑐
15
10 -28.4667 9.8𝑚
→ 𝑓(𝑚 ) = (1 − 𝑒 − 𝑚 ∙9 ) − 35
15
15 -25.2012
20 -21.9486
25 -18.7404
-We first need to determine the initial guess. Since it is mass, only
30 -15.6177 positive values are allowed. Also, the mass is of a person, so large
35 -12.6165 values are expected to be used. The sign of f(m) changes at m = 55 and
40 -9.7609 m = 60. We will use these as our initial guess boundaries.
45 -7.06374
-The table below shows the computed data using Excel software. The
50 -4.52871
approximate root is mr = 55.0000040 with a very small relative error
ml= 55 -2.15342
of ea = 0.0001111. The value is very close to the lower boundary. This
mu= 60 0.06835
example recognizes the benefit of the regula falsi method of
65 2.144948
acknowledging one of the boundaries being close to the true root. But
70 4.085733 of course, not all equations or problems will yield such same result.
75 5.900354
80 7.598305
B. Open Methods
Newton-Raphson method
This Newton-Raphson formula can also be derived using the Taylor series expansion. If derived
this way, it can be also shown that the true absolute error (𝐸𝑡,𝑖+1 ) is roughly proportional to the square of
the true absolute error of the previous iteration (𝐸𝑡,𝑖 ). This then results in the error having approximately
Sample #1: You are designing a spherical tank (Fig. P6.30) to hold water for a small village in a developing
country. The volume of liquid it can hold can be computed as follows. 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.
(3𝑅 − ℎ ) (3𝑅 − ℎ )
𝑉 = 𝜋ℎ 2 → 𝑓(ℎ ) = 𝜋ℎ 2 −𝑉
3 3
(9 − ℎ ) ℎ3
→ 𝑓(ℎ ) = 𝜋ℎ 2 ( ) 2
− 30 → 𝑓 ℎ = 3𝜋ℎ − − 30
3 3
→ 𝑓 ′ (ℎ ) = 6𝜋ℎ − ℎ 2
i=0:
-Since the value of R would always converge, we take h0 = 3 as our initial guess.
(3)3
3𝜋 (3)2 − 3 − 30⁄
ℎ1 = 3 − = 2.06103
6𝜋(3) − 𝜋 (3)2
|2.06103 − 3|
𝜀𝑎 = 𝑥100 = 45.56%
2.06103
i=1:
(2.06103)3
3𝜋(2.06103)2 − − 30⁄
ℎ2 = 2.06103 − 3
6𝜋(2.06103) − 𝜋(2.06103)2 = 2.02704
|2.02704 − 2.06103|
𝜀𝑎 = 𝑥100 = 1.68%
2.0270
i=2:
(2.0270)3
3𝜋 (2.0270)2 − 3 − 30⁄
ℎ3 = 2.0270 − = 𝟐. 𝟎𝟐𝟔𝟗𝟏
6𝜋(2.0270) − 𝜋(2.0270)2
|2.02691 − 2.02704|
𝜀𝑎 = 𝑥100 = 𝟎. 𝟎𝟎𝟔𝟒%
2.02691
Sample #2: Given the following function, use the Newton-Raphson method to determine its maximum.
Use an initial guess of xi = 1 and perform the iterations until the true root has been obtained or the relative
error reaches 0%.
-Because we are finding the root where f’(x) = 0 (maxima), our primary
function is then f’(x) and its 1st derivative is f’’(x). The following data
were computed using excel.
Sample #3: Apply the Newton-Raphson method to the function shown below to evaluate its known real
root at x = 3. Use an initial guess of x0 = 3.2 and take a minimum of four iterations. (b) Did the method
exhibit convergence onto its real root? Sketch the plot with the results for each iteration shown.
𝐭𝐚𝐧𝐡 (𝒙𝟐 − 𝟗)
𝑓(𝑥) = tanh (𝑥 2 − 9) → 𝑓 ′ (𝑥) = 2x ∙ sech2 (𝑥 2 − 9) → 𝒙𝒊+𝟏 = 𝒙𝒊 −
𝟐𝐱 ∙ 𝐬𝐞𝐜𝐡𝟐 (𝒙𝟐 − 𝟗)
i x ea et
3.2000 6.6667
0 2.7368 16.9242 8.7728
1 2.1783 25.6425 27.3915
2 1.7323 25.7438 42.2568
3 1.3817 25.3769 53.9443
4 1.1198 23.3811 62.6720
5 0.9526 17.5600 68.2477
6 0.8826 7.9246 70.5792
7 0.8717 1.2587 70.9449
8 0.8714 0.0278 70.9530
9 0.8714 0.0000 70.9530
-The approximate root clearly Diverges. As seen in the plot, the true root is an inflection point. So
approximate roots would always tend to diverge from it. Even though the approximate relative error
progresses downward, the true relative progresses upward.
Rather than using two initial guesses, a modified approach is to use a fractional perturbation of
the independent variable (x) to estimate f’(x). The value of this fractional perturbation (𝛿) must be
appropriate to provide an efficient converging result. If it is too small, it could be hijacked by round off
errors caused by the subtraction in the denominator. If it is too big, it could become inefficiently slow and
may even diverge [1].
𝑓 (𝑥𝑖 + 𝛿𝑥𝑖 ) − 𝑓(𝑥𝑖 ) 𝑓(𝑥𝑖 ) 𝜹𝒙𝒊 ∙ 𝒇(𝒙𝒊 )
𝑓 ′ (𝑥𝑖 ) ≅ → 𝑥𝑖+1 = 𝑥𝑖 − → 𝒙𝒊+𝟏 = 𝒙𝒊 −
𝛿𝑥𝑖 𝑓(𝑥𝑖 + 𝛿𝑥𝑖 ) − 𝑓(𝑥𝑖 ) 𝒇(𝒙𝒊 + 𝜹𝒙𝒊 ) − 𝒇(𝒙𝒊 )
𝛿𝑥𝑖
Sample calculations:
i=0:
Sample #2: A mass balance for a pollutant in a well-mixed lake can be written by the given equation below.
Given the parameter values V = 1 × 106 m3, Q = 1 × 105 m3/yr, W = 1 × 106 g/yr, and k = 0.25 m0.5/g0.5/yr,
use the modified secant method to solve for the steady-state concentration. Employ an initial guess of
c = 4 g/m3 and δ = 0.5. Perform three iterations and determine the percent relative error after the third
iteration.
𝑑𝑐
𝑉 = 𝑊 − 𝑄𝑐 − 𝑘𝑉√𝑐 → 𝑊 − 𝑄𝑐 − 𝑘𝑉√𝑐 = 0 → 𝑓(𝑐) = 1𝑥106 − 1𝑥105 𝑐 − (0.25 ∙ 1𝑥106 )√𝑐
𝑑𝑡
i=0:
|4.6241 − 4.6235|
𝜀𝑎 = 𝑥100 = 𝟎. 𝟎𝟏𝟐𝟗𝟖%
4.6241
Sample #3: Determine the highest real root of the given function using the Secant method. Compare the
results using Newton-Raphson method (xi = 3.5) and the Modified Secant method (xi = 3.5 and 𝛿 = 0.01).
Use xi-1 = 2.5 and xi = 3.5 and perform iterations until the true root has been obtained or ea = 0 (max of 10
iterations).
𝑥𝑖+1
𝛿𝑥𝑖 ∙ (0.95𝑥𝑖 3 − 5.9𝑥𝑖 2 + 10.9𝑥𝑖 − 6)
= 𝑥𝑖 −
(0.95(𝑥𝑖 + 𝛿𝑥𝑖 )3 − 5.9(𝑥𝑖 + 𝛿𝑥𝑖 )2 + 10.9(𝑥𝑖 + 𝛿𝑥𝑖 ) − 6) − (0.95𝑥𝑖 3 − 5.9𝑥𝑖 2 + 10.9𝑥𝑖 − 6)
-In this method, the true root has been at the same rate but with much smaller relative errors compared
to that of the secant method but slower compared to the Newton-Raphson method.
For equations that cannot be expressed in the form given below, they are considered Non-Linear
equations. Suppose we have two non-linear equations 𝑢(𝑥, 𝑦) and 𝑣(𝑥, 𝑦) with two unknowns, x and y.
Then the solution for such a system of two non-linear equations would be the values of x and y that will
make both u and v equal to 0 [1].
𝑓 (𝑥) = 𝑎1 𝑥1 + 𝑎2 𝑥2 + ⋯ + 𝑎𝑛 𝑥𝑛 − 𝑏 = 0
Newton-Raphson Method
The equation developed for a single variable linear equation is based on a 1st-order Taylor series
expansion 𝑓 (𝑥𝑖+1 ) = 𝑓(𝑥𝑖 ) + (𝑥𝑖+1 − 𝑥𝑖 )𝑓 ′ (𝑥𝑖 ). If the solved root 𝑥𝑖+1 is where the slope function
intercepts the x-axis, then 𝑓(𝑥𝑖+1 ) = 0, yielding this expansion to be 𝑓(𝑥𝑖 ) + (𝑥𝑖+1 − 𝑥𝑖 )𝑓 ′ (𝑥𝑖 ) = 0. For
a two-variable case, a 1st-order Taylor series can be written for both the two equations (𝑓1 = 𝑢 𝑎𝑛𝑑 𝑓2 =
𝑣), accounting of course both the variables(𝑥 𝑎𝑛𝑑 𝑦) in each equation [1].
and
The right-hand side of both equations are constants. Thus, we can use Cramer’s Rule in finding the
unknowns 𝑥𝑖+1 and 𝑦𝑖+1 [1]:
Cramer’s Rule:
𝜕𝑢𝑖 𝜕𝑢𝑖 𝜕𝑢𝑖 𝜕𝑢𝑖
𝑥 + 𝑦 = −𝑢𝑖 + 𝑥𝑖 + 𝑦𝑖 𝐷𝑥
𝜕𝑥 𝑖+1 𝜕𝑦 𝑖+1 𝜕𝑥 𝜕𝑦 𝑥𝑖+1 = 𝑖+1
𝐷
𝜕𝑣𝑖 𝜕𝑣𝑖 𝜕𝑣𝑖 𝜕𝑣𝑖
𝑥 + 𝑦 = −𝑣𝑖 + 𝑥𝑖 + 𝑦𝑖 𝐷𝑦
𝜕𝑥 𝑖+1 𝜕𝑦 𝑖+1 𝜕𝑥 𝜕𝑦 𝑦𝑖+1 = 𝑖+1
𝐷
𝜕𝑣𝑖 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣 𝜕𝑢 𝝏𝒗 𝝏𝒖
𝐷𝑥𝑖+1 −𝑢𝑖 + 𝑣𝑖 𝑖 + 𝑥𝑖 ( 𝑖 𝑖 − 𝑖 𝑖 ) 𝒖𝒊 𝒊 − 𝒗𝒊 𝒊
𝜕𝑦 𝜕𝑦 𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦 𝝏𝒚 𝝏𝒚
𝑥𝑖+1 = = → 𝒙𝒊+𝟏 = 𝒙𝒊 −
𝐷 𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢_𝑖 𝜕𝑣𝑖 𝝏𝒖𝒊 𝝏𝒗𝒊 𝝏𝒖𝒊 𝝏𝒗𝒊
𝜕𝑥 𝜕𝑦 − 𝜕𝑦 𝜕𝑥 𝝏𝒙 𝝏𝒚 − 𝝏𝒚 𝝏𝒙
𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑣𝑖 𝜕𝑢𝑖 𝜕𝑢𝑖 𝜕𝑣𝑖 𝝏𝒖 𝝏𝒗
𝐷𝑦𝑖+1 −𝑣𝑖 𝜕𝑥 + 𝑢𝑖 𝜕𝑥 + 𝑦𝑖 ( 𝜕𝑦 𝜕𝑥 − 𝜕𝑦 𝜕𝑥 ) 𝒗𝒊 𝝏𝒙𝒊 − 𝒖𝒊 𝝏𝒙𝒊
𝑦𝑖+1 = = → 𝒚𝒊+𝟏 = 𝒚𝒊 −
𝐷 𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢_𝑖 𝜕𝑣𝑖 𝝏𝒖𝒊 𝝏𝒗𝒊 𝝏𝒖𝒊 𝝏𝒗𝒊
− −
𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥 𝝏𝒙 𝝏𝒚 𝝏𝒚 𝝏𝒙
Sample #1: Solve the given system of nonlinear equations with an initial guess of x=2 and y=4 using the
Newton-Raphson method.
𝑥 2 + 𝑦 2 = 16 → 𝑣(𝑥, 𝑦) = 𝑥 2 + 𝑦 2 − 16 = 0
𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
= 2(𝑥 − 4) = 2(𝑦 − 4) = 2𝑥 = 2𝑦
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦
|1.75 − 2|
𝜀𝑎,𝑥,0 = ∙ 100 = 𝟏𝟒. 𝟐𝟗%
1.75
|3.625 − 4|
𝜀𝑎,𝑦,0 = ∙ 100 = 𝟏𝟎. 𝟑𝟒%
3.625
𝒙𝟐 = 𝟏. 𝟖𝟎𝟒𝟐
𝒚𝟐 = 𝟑. 𝟓𝟕𝟎𝟖
|1.8042 − 1.75|
𝜀𝑎,𝑥,0 = ∙ 100 = 𝟑. 𝟎𝟎%
1.8042
|3.5708 − 3.625|
𝜀𝑎,𝑦,0 = ∙ 100 = 𝟏. 𝟓𝟐%
3.5708
𝜕𝑣 𝜕𝑢
𝑢𝑖 𝜕𝑦𝑖 − 𝑣𝑖 𝜕𝑦𝑖
𝑥𝑖+1 = 𝑥𝑖 −
𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢𝑖 𝜕𝑣𝑖
−
𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑥
(5.7503𝑥10−3 )(7.1416 ) − (5.7503𝑥10−3 )(−0.8584)
→ 𝑥3 = 1.8042 −
(−4.3916 )(7.1416) − (−0.8584)(3.6084 )
→ 𝒙𝟑 = 𝟏. 𝟖𝟎𝟓𝟖
𝜕𝑢 𝜕𝑣
𝑣𝑖 𝜕𝑥𝑖 − 𝑢𝑖 𝜕𝑥𝑖
𝑦𝑖+1 = 𝑦𝑖 −
𝜕𝑢𝑖 𝜕𝑣𝑖 𝜕𝑢𝑖 𝜕𝑣𝑖
𝜕𝑥 𝜕𝑦 − 𝜕𝑦 𝜕𝑥
(5.7503𝑥10−3 )(−4.3916) − (5.7503𝑥10−3 )(3.647)
→ 𝑦3 = 3.5708 −
(−4.3916 )(7.1416) − (−0.8584)(3.6084 )
→ 𝒚𝟑 = 𝟑. 𝟓𝟔𝟗𝟐
|1.8058 − 1.8042|
𝜀𝑎,𝑥,0 = ∙ 100 = 𝟎. 𝟎𝟖𝟗%
1.8042
|3.5692 − 3.5708|
𝜀𝑎,𝑦,0 = ∙ 100 = 𝟎. 𝟎𝟒𝟓%
3.5708
Newton-Raphson:
*plotted using Matlab. The red curve is 𝑢(𝑥, 𝑦), while the blue curve is 𝑣(𝑥, 𝑦)
A different root was solved using MOSS. In this example it can be shown the general superiority of the
Newton-Raphson method over MOSS in solving systems of nonlinear equations. The problem with MOSS
is that it is so restrictive in its convergence criterion, making it not always applicable to any system of
nonlinear equations. However, its application becomes quite useful in solving systems of linear equations,
which is in the form of the Gauss-Seidel method.
Sample #3: A liquid is said to be stable when it is below its boiling point at a given pressure, while it is said
to be metastable and superheated when it is above its boiling point. The condition for metastability is
𝜕𝑃 𝜕𝑃
( ) < 0, such that a liquid is said to be unstable when ( ) > 0. The boundary between metastability
𝜕𝑉 𝑇 𝜕𝑉 𝑇
𝜕𝑃
and instability for a liquid is the Spinodal state, where (𝜕𝑉 ) = 0. The constant temperature for the
𝑇
spinodal state is called Spinodal temperature (𝑇𝑠 ), and it is relative to the pressure (each pressure has a
designated spinodal temperature) [2]. Using the Redlich-Kwong equation of state, what is the spinodal
temperature and its corresponding molar volume of H2O at 1 atm? Use initial guesses of 𝑉𝑚 = 0.30 𝐿 and
Starting equations:
5
𝑅2 𝑇𝑐 2
𝑎= 1 [2]
9(23 − 1)𝑃𝑐
1
(23 − 1) 𝑅𝑇𝑐
𝑏= [2]
3𝑃𝑐
𝑅𝑇 𝑎
𝑃= − [2]
𝑉𝑚 − 𝑏 √𝑇𝑉𝑚 (𝑉𝑚 + 𝑏)
Solution:
1 1
(23 − 1) 𝑅𝑇𝑐 (23 − 1) (0.08205)(647.4)
𝑏= = = 0.02108 𝐿3 ∙ 𝑚𝑜𝑙 −1
3𝑃𝑐 3(218.3)
Develop the two equations that will be used for the Newton-Raphson iteration process:
𝑅𝑇 𝑎 0.08205𝑇𝑠 140.59
𝑃= − → 𝑢(𝑉𝑚 , 𝑇𝑠 ) = − −1=0
𝑉𝑚 − 𝑏 √𝑇𝑉𝑚 (𝑉𝑚 + 𝑏) 𝑉𝑚 − 0.02108 √𝑇𝑠 𝑉𝑚 (𝑉𝑚 + 0.02108 )
The functions 𝑢(𝑉𝑚 , 𝑇𝑠 ) and 𝑣(𝑉𝑚 , 𝑇𝑠 ) will be used for solving 𝑉𝑚 (treated as x) and 𝑇𝑠 (treated as y) using
the Newton-Raphson method for solving nonlinear systems of equations with initial guesses of 𝑉𝑚 =
0.30 𝐿 and 𝑇𝑠 = 300 𝐾. The following numerical computations were done using Matlab, with a tolerance
set to 0.00001%. The numerical computations using the Newton-Rhapson method for solving nonlinear
systems of equations showed the following results after 14 iterations with tolerance=0.00001%:
𝑻𝑺 = 𝟗𝟐. 𝟒𝟑𝟕𝟑 𝑲
𝑽𝒎 = 𝟑. 𝟕𝟖𝟏𝟓 𝑳
[1] Chapra, S. C., & Canale, R. P. (2010). Numerical methods for engineers: with software and
programming applications (6th ed.). Boston: McGraw-Hill.
[2] Eberhart, J. G. (1994). Solving Nonlinear Simultaneous Equations by the Method of Successive
Substitution: Applications to Equations of State. Journal of Chemical Education, 71(12), 1038. doi:
10.1021/ed071p1038
[3] Atkins, P., & Paula, J. (2014). Physical Chemistry Thermodynamics, Structure, and Change (10th ed.).
New York,NY: Oxford University Press.