Chapter 03.07: Newton-Raphson Method For Solving Simultaneous Nonlinear Equations
Learning Objectives
After reading this chapter, you should be able to:
1) derive the Newton-Raphson method formula for simultaneous nonlinear equations,
2) develop the algorithm of the Newton-Raphson method for solving simultaneous nonlinear equations,
3) use the Newton-Raphson method to solve a set of simultaneous nonlinear equations,
4) model a real-life problem that results in a set of simultaneous nonlinear equations.
Introduction
Several physical systems result in a mathematical model in terms of simultaneous nonlinear equations. A set of such equations can be written as
f1(x1,x2,...,xn)=0......fn(x1,x2,...,xn)=0(1)
The solution to these simultaneous nonlinear equations are values of x1,x2,...,xn which satisfy all the above n equations. The number of set of solutions to these equations could be none, unique, more than one but finite, or infinite. In this chapter, we use the Newton-Raphson method to solve these equations.
The Newton-Raphson method of solving a single nonlinear equation, f(x)=0, can be derived using first-order Taylor series (first two terms of Taylor series) and are given by
f(xi+1)=f(xi)+f′(xi)(xi+1−xi)(2)
where
xi=previous estimate of root
xi+1=present estimate of root
Since we are looking for xi+1where f(xi+1) becomes zero, Equation (2) can be re-written as
0=f(xi)+f′(xi)(xi+1−xi)
and then as a recursive formula as
xi+1=xi−f(xi)f′(xi)(3)
Derivation
Now how do we extend the same to simultaneous nonlinear equations? For sake of simplicity, let us limit the number of nonlinear equations to two as
u(x,y)=0(4a)
v(x,y)=0(4b)
The first order Taylor-series for nonlinear equation is (4a) & (4b) are
u(xi+1,yi+1)=u(xi,yi)+∂u∂x|xi,yi(xi+1−xi)+∂u∂y|xi,yi(yi+1−yi)(5a)
v(xi+1,yi+1)=v(xi,yi)+∂v∂x|xi,yi(xi+1−xi)+∂v∂y|xi,yi(yi+1−yi)(5b)
We are looking for (xi+1,yi+1) where u(xi+1,yi+1) and v(xi+1,yi+1) are zero. Hence
0=u(xi,yi)+∂u∂x|xi,yi(xi+1−xi)+∂u∂y|xi,yi(yi+1−yi)(6a)
0=v(xi,yi)+∂v∂x|xi,yi(xi+1−xi)+∂v∂y|xi,yi(yi+1−yi)(6b)
Writing
xi+1−xi=Δx(7a)
yi+1−yi=Δy(7b)
we get
0=u(xi,yi)+∂u∂x|xi,yiΔx+∂u∂y|xi,yiΔy(8a)
0=v(xi,yi)+∂v∂x|xi,yiΔx+∂v∂y|xi,yiΔy(8b)
Rewriting Equations (8a) and (8b)
∂u∂x|xi,yiΔx+∂u∂y|xi,yiΔy=−u(xi,yi)(9a)
∂v∂x|xi,yiΔx+∂v∂y|xi,yiΔy=−v(xi,yi)(9b)
and then in the matrix form
[∂u∂x|xi,yi∂u∂y|xi,yi∂v∂x|xi,yi∂v∂y|xi,yi][ΔxΔy]=[−u(xi,yi)−v(xi,yi)](10)
Solving Equation (10) would give us Δx and Δy. Since the previous estimate of the root is (xi,yi), one can find from Equation (7)
xi+1=xi+Δx(11a)
yi+1=yi+Δy(11b)
This process is repeated till one obtains the root of the equation within a prespecified tolerance,εs such that
|εa|x=|xi+1−xixi+1|×100<εs
|εa|y=|yi+1−yiyi+1|×100<εs
Example 1
Find the roots of the simultaneous nonlinear equations
x2+y2=50x−y=10
Use an initial guess of (x,y)=(2,−4). Conduct two iterations.
Solution
First put the equations in the form
u(x,y)=0
v(x,y)=0
to give
u(x,y)=x2+y2−50=0 v(x,y)=x−y−10=0
Now
∂u∂x=2x
∂u∂y=2y
∂v∂x=1
∂v∂y=−1
Hence from Equation (10)
[∂u∂x|xi,yi∂u∂y|xi,yi∂v∂x|xi,yi∂v∂y|xi,yi][Δx⋮Δy]=[−u(xi,yi)⋮−v(xi,yi)]
[2xi2yi1−1][ΔxΔy]=[−xi2−y2i+50−xi+yi+10]
Iteration 1
The initial guess
(xi,yi)=(2,−4)
Hence
[2(2)2(−4)1−1][ΔxΔy]=[−(2)2−(−4)2+50−(2)+(−4)+10]
[4−81−1][ΔxΔy]=[304]
Solving the equations by any method of your choice, we get
Δx=0.5000Δy=−3.500
Since
Δx=x2−x1=0.5000Δy=y2−y1=−3.500
we get
x2=x1+0.5000=2+0.5000=2.5000
y2=y1+(−3.500)=−4+(−3.500)=−7.500
The absolute relative approximate errors at the end of the first iteration are
|εa|x=|x2−x1x2|×100=|2.500−2.0002.500|×100=20.00%
|εa|y=|y2−y1y2|×100=|−7.500−(−4.000)−7.500|×100
Iteration 2
The estimate of the root at the end of iteration#1 is
(x2,y2)=(2.500−7.500)
Hence
[2(2.500)2(−7.500)1−1][ΔxΔy]=[−(2.500)2−(−7.500)2+50−(2.500)+(−7.500)+10]
[5−151−1][ΔxΔy]=[−12.500]
Solving the above equations by any method of your choice gives
Δx=1.250
Δy=1.250
Since
Δx=x3−x2=1.250
Δy=y3−y2=1.250
giving
x3=x2+1.250=2.500+1.250=3.750
y3=y2+1.250=−7.500+1.250=−6.250
The absolute relative approximate error at the end of the second iteration is
|ϵa|x=|x3−x2x3|×100=|3.750−2.53.750|×100=33.33%
|ϵa|y=|y3−y2y3|×100=|−6.250−(−7.500)−6.250|×100=20.00%
Although not asked in the example problem statement, the estimated values of the root and the absolute relative approximate errors are given below in Table 1.
Table 1: Estimate of the root and absolute relative approximate error.
Iteration number, i | xi | yi | |ϵa|x% | |ϵa|y% |
---|---|---|---|---|
1 | 2.500 | −7.500 | 20.00 | 46.67 |
2 | 3.750 | −6.250 | 33.33 | 20.00 |
3 | 4.375 | −5.625 | 14.29 | 11.11 |
4 | 4.688 | −5.312 | 6.667 | 5.882 |
5 | 4.844 | −5.156 | 3.226 | 3.030 |
6 | 4.922 | −5.078 | 1.587 | 1.538 |
The exact solution to which the above scheme is converging to is (x,y)=(5,−5)
Example 2
A 5 m long gutter is made from a flat sheet of aluminum which is 5 m×0.21 m. The shape of the gutter cross-section is shown in Figure 1 and is made by bending the sheet at two locations at an angle θ (Figure 2). What are the values of s and θ, that will maximize the volume capacity of the gutter so that it drains water quickly during a heavy rainfall?
Figure 1 Sheet metal bent to form a gutter
Figure 2: Labeling the parameters and points of the gutter
Solution
One needs to maximize the cross-sectional area of the gutter. The cross-sectional area G of the gutter is given by
G=Area of trapezoid ABCD=12(AB+CD)(FC)(E2.1)
where
AB = L−2 s(E2.2)
CD=AB+EA+BF=(L−2s)+scos(θ)+scos(θ)=(L−2s) + 2scos(θ)(E2.3)
FC=BCsin(θ)=ssin(θ)(E2.4)
hence
G=12(AB +CD)(DE)
G(s,θ)=12[(L−2s)+(L−2s)+2scos(θ)]ssin(θ)=[L−2s+scos(θ)] ssin(θ)(E2.5)
For example, for θ=0∘, the cross-sectional area of the gutter becomes
G=0
as it represents a flat sheet, for θ=180∘, the cross-sectional area of the gutter becomes
G=0
as it represents an overlapped sheet, and for θ=90∘, it represents a rectangular cross-sectional area with
G=(L−2s)s
For the given L=0.21 m,
G(s,θ)=(0.21−2s+scosθ)ssinθ
Then
∂G∂s=−s2sin2θ+(0.21−2s+scosθ)scosθ
∂G∂θ=(−2+cosθ)ssinθ+(0.21+2s+scosθ)sinθ
By solving the equations
f1(s,θ)=−ssin2θ+(0.21−2s+scosθ)scosθ=0
f2(s,θ)=(−2+cosθ)ssinθ+(0.21−2s+scosθ)sinθ=0
we can find the local minimas and maximas of G(s,θ). One of the local maximas may also be the absolute maximum. The values of s and θ that correspond to the maximum of G(s,θ) are what we are looking for. Can you solve the equations to find the corresponding values of s and θ for maximum value of G? Intuitively, what do you think would be these values of s and θ?
Appendix A: General matrix form of solving simultaneous nonlinear equations.
The general system of equations is given by
f1(x1,x2,...,xn)=0f2(x1,x2,...,xn)=0.........fn(x1,x2,...,xn)=0(A.1)
We can rewrite in a form as
F(∧x)=ˆ0(A.2)
where
F(∧x)=[f1(∧x)f2(∧x)..fn(∧x)](A.3)
∧0=[00..0](A.4)
∧x=[x1x2..xn]T(A.5)
The Jacobian of the system of equations by using Newton-Raphson method then is
J(x1,x2,...,xn)=[∂f1∂x1…∂f1∂xn.…..…..….∂fn∂x1…∂fn∂xn](A.6)
Using the Jacobian for the Newton-Raphson method guess
[J]Δ∧x=−F(∧x)(A.7)
where
Δ∧x=∧xnew−∧xold(A.8)
Hence
Δ∧x=−[J]−1F(∧x)
∧xnew−∧xold=−[J]−1F(∧x)
∧xnew=∧xold−[J]−1F(∧x)(A.10)
Evaluating the inverse of [J] in Equation (A.10) is computationally more intensive than solving Equation (A.7) for Δ∧xand calculating ∧xnew as
∧xnew=∧xold+Δ∧x(A.11)
Problem Set
(1). Solve the following set of nonlinear equations using Newton-Raphson method.
xy=2
x2+y=5 Start with an initial guess of (3,4).
(2). Write the drawbacks of Newton-Raphson method and how you would address them.
(3). The following simultaneous nonlinear equations are found while modeling two continuous non-alcoholic stirred tank reactions
f1=(1−R)[D10(1+β1)−φ1]exp(10φ11+10φ1/γ)−φ1 f2=φ1−(1+β2)φ2+(1−R)×[D10−β1φ1−(1+β2)φ2]exp(10φ21+10φ2/γ)
Given γ=1000, D=22, β1=2, β2=2, R=0.935, find a suitable solution for (φ1,φ2), given that φi∈[0,1],i=1,2
Source: Michael J. Hirsch, Panos M. Pardalos, Mauricio G.C Resende, Solving systems of nonlinear equations with continuous GRASP, Nonlinear Analysis: Real World Applications, Volume 10, Issue 4, August 2009, Pages 2000-2006, ISSN 1468-1218, http://dx.doi.org/10.1016/j.nonrwa.2008.03.006
(4). The Lorenz equations are given by
dxdt=σ(y−x)
dydt=x(p−z)−y
dzdt=xy−βz
Assuming σ=3, p=26, β=1, the steady state equations are written as
0=3(y−x) 0=x(26−z)−y 0=xy−z
Write the Jacobian for the above system of equations.
(5). Use MATLAB or equivalent program to find the solution to the problem stated in Example 2.