You are on page 1of 25

SIMULTANEOUS

NON-LINEAR EQUATIONS
Methods for Solving Simultaneous
Non-Linear Equations

• Gauss-Jacobi
• Gauss-Seidel
• Newton-Raphson
Gauss-Jacobi Method
The method/algorithm is the same as solving
systems of linear equations wherein we

• solve for one variable at a time


• set initial values for each variable
• use the previous values of the variables to solve
for the next values
• continue doing the process until we satisfy the
termination or convergence test.
Gauss-Jacobi Method
• Example: Solve for x1 and x2 in the following non-
linear equations. Assume a tolerable error of
0.001 and initial values x10 = 1.2 and x20 = 0.2.

• Solution: The equations are already written in


terms of each variable and initial values are
already indicated above.
Gauss-Jacobi Method
• So for the first iteration k=1, substitute the initial
values x10 = 1.2 and x20 = 0.2 to

to get

where
Gauss-Jacobi Method
• For the second iteration k=2, use the values
obtained from the first iteration:

• Continue the process until the termination test is


satisfied. Summary of iterations is shown on the
table below. The solution converges at k=11.
Gauss-Jacobi Method
• Summary of Iterations:
k x1 x2 Error Error
0 1.2 0.2
1 1.221403 0.301194 0.021403 0.101194
2 1.351472 0.294816 0.130069 0.006378
3 1.34288 0.258859 0.008592 0.035957
4 1.295451 0.261093 0.047429 0.002234
5 1.298348 0.273774 0.002897 0.012682
6 1.314918 0.272982 0.016570 0.000792
7 1.313877 0.268496 0.001041 0.004486
8 1.307996 0.268776 0.005881 0.000280 Final answer:
9 1.308362 0.270361 0.000366 0.001585
10 1.310438 0.270262 0.002076 0.000099
x1 = 1.310308
11 1.310308 0.269702 0.000130 0.000560 x2 = 0.269702
12 1.309574 0.269737 0.000734 0.000035
Gauss-Seidel Method
• This utilizes the same principle as Gauss-Jacobi
except that the most recent value of a variable is
used to compute for the value of the other
variables within the same iteration.
Gauss-Seidel Method
• Example: Solve for x1 and x2 in the following non-
linear equations. Assume a tolerable error of
0.001 and initial values x10 = 1.2 and x20 = 0.2.

• At k=1:
Gauss-Seidel Method
• At k=2:

• Continue the process until the termination test is


satisfied. Summary of iterations is shown on the
table below. The solution converges at k=7.
Gauss-Seidel Method
• Summary of Iterations:
k x1 x2 Error Error
0 1.2 0.2
1 1.221403 0.294816 0.021403 0.094816
2 1.34288 0.261093 0.121477 0.033724
3 1.298348 0.272982 0.044532 0.011890
4 1.313877 0.268776 0.015529 0.004206
5 1.308362 0.270262 0.005515 0.001486
6 1.310308 0.269737 0.001946 0.000525
7 1.30962 0.269923 0.000688 0.000186
8 1.309863 0.269857 0.000243 0.000066

• Final answer:
x1 = 1.30962
x2 = 0.269923
Newton or Newton-Raphson Method

Recall the Newton-Raphson iterative formula for one


variable where f ’ is the derivative of f.

Extending this to simultaneous non-linear equations in


n variables, the iterative formula is
𝑓(𝑥 𝑘 )
𝑥 𝑘+1 = 𝑥𝑘 − 𝑘
𝐽
Where 𝐽 is the Jacobian matrix (a matrix consisting of
all the partial derivatives with respect to each
variable)
Newton-Raphson Method
𝑓1 𝑥1 , 𝑥2 , … , 𝑥𝑛 = 0
𝑓2 𝑥1 , 𝑥2 , … , 𝑥𝑛 = 0
That is, if we have the system

𝑓𝑛 𝑥1 , 𝑥2 , … , 𝑥𝑛 = 0

𝜕𝑓1 𝜕𝑓1 𝜕𝑓1



𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
𝜕𝑓2 𝜕𝑓2 𝜕𝑓2

Then its Jacobian matrix is 𝐽= 𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛

𝜕𝑓𝑛 𝜕𝑓𝑛 𝜕𝑓𝑛

𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
Newton-Raphson Method
The first row of the matrix consists of partial derivatives of
the first function f1 with respect to the first variable x1 ,
second variable x2 , up to the nth variable xn.

The second row of the matrix consists of partial derivatives


of the second function f2 with respect to the first variable
x1 , second variable x2 , up to the nth variable xn.

And so on up to the nth function.


Newton-Raphson Method
Note that the formula
𝑓(𝑥 𝑘 )
𝑥 𝑘+1 = 𝑥𝑘 − 𝑘
𝐽

can also be written as

𝑘+1 𝑘 𝑘 −1
𝑥 =𝑥 − 𝐽 𝑓(𝑥 𝑘 )

𝑘 −1
where 𝐽 is the inverse of the Jacobian matrix.
Newton-Raphson Method
But if we don’t want to compute for the inverse of
Jacobian matrix, we can also write
𝑓(𝑥 𝑘)
𝑥 𝑘+1 = 𝑥 𝑘 − 𝑘
𝐽
𝑓 𝑥𝑘
as 𝑥 𝑘+1 − 𝑥𝑘 =−
𝐽𝑘
⟹ 𝐽𝑘 𝑥 𝑘+1 − 𝑥 𝑘 = −𝑓 𝑥 𝑘
⟹ 𝐽𝑘 Δ𝑥 𝑘+1 = 𝐹 𝑥 𝑘

where Δ𝑥 𝑘+1 = 𝑥 𝑘+1 − 𝑥 𝑘


and 𝐹 𝑥 𝑘 = −𝑓 𝑥 𝑘
Newton-Raphson Method
Algorithm:

1) Initialize: Set initial values x10, x20,…, xn0

𝑘+1 𝑘 𝑘 −1
2) Iterate: 𝑥𝑗 = 𝑥𝑗 − 𝐽 𝑓 𝑥𝑗𝑘
or solve for 𝑥 𝑘+1 in 𝐽𝑘 𝑥 𝑘+1
− 𝑥 𝑘 = −𝑓 𝑥 𝑘
which is the same as 𝐽𝑘 Δ𝑥 𝑘+1 = 𝐹 𝑥 𝑘
3) Stop: (termination test)
Newton-Raphson Method
Example: Solve for x1 and x2 in the following system
of non-linear equations. Assume a tolerable error of
0.001, and initial values x10 = 1.2 and x20 = 0.2.

Soln: Let and


First we compute the partial derivatives
Newton-Raphson Method
Using the formula 𝐽𝑘 Δ𝑥 𝑘+1 = 𝐹 𝑥 𝑘

1
1 −𝑒 𝑥2 Δx1 −𝑥1 + 𝑒 𝑥2
We have = −𝑥1
𝑒 −𝑥1 1 Δx12 𝑒 − 𝑥2

Substitute the initial values of x10 = 1.2 and x20 = 0.2


to find the values of Δx11 and Δx12 :

1
1 −1.2214 Δx1 0.021403
=
0.301194 1 Δx12 0.101194
Newton-Raphson Method
By performing matrix multiplication on the left side
of the equation, then solving the resulting system for
Δx11 and Δx12 , we will get Δx11 = 0.106005
Δx12 = 0.069266
Hence, since Δx11 = x11 - x10
then, x11 = x10 + Δx11
Similarly, x21 = x20 + Δx12
Therefore,
At k =1:
x11 = 1.2 + 0.106005 = 1.306005
x21 = 0.2 + 0.069266 = 0.269266
Newton-Raphson Method
Solve for the new Δx12 and Δx22 using
𝐽𝑘 Δ𝑥 𝑘+1 = 𝐹 𝑥 𝑘
Use x11 = 1.306005 and x21 = 0.269266.

Continue the process until you satisfy the


termination test.

The table shows the summary of iterations. The


solution converges at k=3 where errors are less
than 0.001.
Newton-Raphson Method
• Summary of Iterations:

k x1 x2 Delta x1 Delta x2 Error Error


0 1.2 0.2 0.106005 0.069266
1 1.306005 0.269266 0.003793 0.000607 0.106005 0.069266
2 1.309798 0.269873 0.000002 0.000001 0.003793 0.000607
3 1.3098 0.269874 0.000000 0.000000 0.000002 0.000001

x1 = 1.3098
Final answer: x2 = 0.269874
Newton-Raphson Method
1 −𝑒 𝑥2
Using the other iterative formula, J =
𝑒 −𝑥1 1
At the initial values x10 = 1.2 and x20 = 0.2 ,
1 −1.2214
𝐽0 =
0.301194 1

0.7311 0.8929
And 𝐽0 −1 =
−0.22 0.7311
−1
Using the formula 𝑥𝑗𝑘+1 = 𝑥𝑗𝑘 − 𝐽𝑘 𝑓 𝑥𝑗𝑘

x11 1.2 0.7311 0.8929 −0.0214 1.306


We have 1 = − =
x2 0.2 −0.22 0.7311 −0.1012 0.2693
Newton-Raphson Method
So x11 = 1.306 and x21 = 0.2693.

Substitute these values to J to get 𝐽1 and 𝐽1 −1

−1
Use again the formula 𝑥𝑗𝑘+1 = 𝑥𝑗𝑘 − 𝐽 𝑘 𝑓 𝑥𝑗𝑘
to get x12 and x22 .

Continue doing the process until you reach the termination


test.
Newton-Raphson Method
Below is a summary of the results using Excel.

f1=x1-e^x2 1.000000 -e^(X2)


f2=x2-e^(-x1) e^(-x1) 1.000000

x1, x2 J J^-1= f1, f2 J^-1xf errorx1 errorx2


k=0 1.200000 1.000000 -1.221403 0.731059 0.892917 -0.021403 -0.106005
0.200000 0.301194 1.000000 -0.220191 0.731059 -0.101194 -0.069266
k=1 1.306005 1.000000 -1.309004 0.738220 0.966333 -0.002999 -0.003793 0.106005 0.069266
0.269266 0.270900 1.000000 -0.199984 0.738220 -0.001634 -0.000607
k=2 1.309798 1.000000 -1.309798 0.738835 0.967725 0.000000 -0.000002 0.003793 0.000607
0.269873 0.269875 1.000000 -0.199393 0.738835 -0.000002 -0.000001
k=3 1.309800 1.000000 -1.309800 0.738836 0.967727 0.000000 0.000000 0.000002 0.000001
0.269874 0.269874 1.000000 -0.199393 0.738836 0.000000 0.000000

You might also like