Gauss-Seidel Method

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

TITLE:

Determination of the solution of linear system of equation by Gauss- Seidel method.

BACKGROUND:
In numerical liner algebra, the Gauss-Seidel method is an iterative method used to solve a linear
system of equations. It is named after German mathematician Carl Friedrich Gauss and Ludwig von
Seidel.

OBJECTIVE:
To determine the solution of linear system of equation.

THEORY:
Gauss-Seidel method is a technique for solving the equations of linear system of equation one at a
time in sequence, and uses previously computed results as soon as they are available,

(𝑘) (𝑘−1)
𝑏𝑖 − ∑𝑖>𝑗 𝑎𝑖𝑗 𝑥𝑗 − ∑𝑗<𝑖 𝑎𝑖𝑗 𝑥𝑗
(k)
xi =
𝑎𝑖𝑖

There are two important characteristics of the Gauss-Seidel method should be noted. Firstly, the
computations appear to be serial. Since each component of the new iterate depends upon all
previously computed components, the updates cannot be done simultaneously as in the Jacobi method.
Secondly, the new iterates depends upon the order in which the equations were examined. If this
ordering is changed, the components of the new iterates will also change.
In terms of matrices, the definition of the gauss-Seidel method can be expressed as,

𝑥 (𝑘) = (𝐷 − 𝐿)−1 (𝑈𝑥 (𝑘−1) + 𝑏)


Where, D, L and U represent the diagonal, strictly lower triangular, strictly upper triangular parts of x
respectively.
The Gauss-Seidel method is applicable to strictly diagonally dominant, or symmetric positive definite
matrices.

METHODOLOGY:
The Gauss-Seidel method is an iterative method for solving a square system of a linear equations of
unknown x:

𝑳𝒙(𝒌+𝟏) = 𝒃 − 𝑼𝒙(𝒌)
Where x(k) is the kth approximation or iteration of x, x(k+1) is the (k+1) iteration. Then the
decomposition of A into its lower triangular component and its strictly upper triangular components:

𝑨=𝑳+𝑼
Where,
𝒂𝟏𝟏 𝒂𝟏𝟐 ⋯ 𝒂𝟏𝒏 𝟎 𝒂𝟏𝟐 ⋯ 𝒂𝟏𝒏
𝒂𝟐𝟏 𝒂𝟐𝟐 ⋯ 𝒂𝟐𝒏 𝟎 𝟎 ⋮ 𝒂𝟐𝒏
𝑳= [ ⋮ ⋮ ⋱ ⋮ ] , 𝑼= [ ]
⋮ ⋮ ⋱ ⋮
𝒂𝒏𝟏 𝒂𝒏𝟐 ⋯ 𝒂𝒏𝒏 𝟎 𝟎 ⋯ 𝟎
The system of linear equation may be rewritten as :
𝑳𝒙 = 𝒃 − 𝑼𝒙
The Gauss-Seidel method now solves the left hand side of the expression for x, using previous value
for x on the right hand side. Analytically

𝒙(𝒌+𝟏) = 𝑳−𝟏 (𝒃 − 𝑼𝒙𝒌 )


Using forward substitution, previously computed results as soon as they are available,

(𝒌) (𝒌−𝟏)
𝒃𝒊 − ∑𝒊>𝒋 𝒂𝒊𝒋 𝒙𝒋 − ∑𝒋<𝒊 𝒂𝒊𝒋 𝒙𝒋
(k)
xi =
𝒂𝒊𝒊

The procedure is generally continued until the changes is made by an iteration are below some
tolerance, such as sufficiently small residual.

PRACTICAL EEE APPLICATION:


Here is an electrical circuit to be solved,

The mesh equation will be,


3i1 –i2 =3
(5)
4i2 –i1 =0
(6)
To solve this equation by the iterative method, we rewrite them as follows,
i1= (3+i2)/3
i2 = i1/4
Now according to the Gauss-Seidel theorem, we determine the initial value of i1 as 0 and put it (5) and
get a new value of i2, and we repeat this process:

n i1 i2
1 1 0
2 6.25 1/4
3 1.52083 1.5625
4 1.1267 0.3802
5 1.0938 0.2816
6 1.0911 0.2735
7 1.0909 0.2727
8 1.0909 0.2727

So from the method we determined,


i1= 1.0909 amp
i2= 0.2727 amp

ALGORITHM:
1. Start

2. Declare the variables and read the order of the matrix n

3. Read the stopping criteria err

4. Read the coefficients as

Do for i=1 to n

Do for j=1 to n

Read a[i][j]

Repeat for j

Repeat for i
5. Read the coefficient b[i] fori =1 to n

6. Initialize xo[i]=0 for i=1 to n

7. Set key = 0

8. For i=1 to n

Set sum = b[i]

9. For j=1 to n

If(j is not equal to i)

Set sum = sum –a[i][j]*x0[j]

Repeat j

x[i] = sum / a[i][i]

If absolute value of ((x[i] – x0[i] ) / x[i])> err then

Set key = 1

Set x0[i] = x[i]

Repeat i

10. If key = 1then

Goto step 6

Otherwise print results.

FLOWCHART:

START

Input n

For i=1,n

For j=1,n+1

Input a(i,j)

T
T

x(i)=0

y(i)=0

itr =0

itr=itr+1

x(i) = a(i, n+1)

For i = 1,n

If i = j

x(i)=x(i) – a(i,j)*x(j)

x(i)=x(i)/a(i,i)

For k= 1,n

If abs(x(k)-
y(k))>.0001

Print itr

For i=1,n

y(i)=x(i)

Print x(i)

STOP
SIMULTION IN MATLAB PROGRAMMING ENVIRONMENT:

clc

clear

x1(1)=0;

x2(1)=0;

x3(1)=0;

for i=1:100;

x1(i+1)=(5-x2(i)-x3(i))/2;

x2(i+1)=(15-3*x1(i+1)-2*x3(i))/5;

x3(i+1)=(8-2*x1(i+1)-x2(i+1))/4;

if abs(x1(i+1)-x1(i))<.0001 &&abs(x2(i+1)-x2(i))<.0001 &&abs(x3(i+1)-


x3(i))<.0001;

break

end

end

d=[(1:i+1)' x1' x2' x3'];

OUTPUT:

1.0000 0 0 0

2.0000 2.5000 1.5000 0.3750

3.0000 1.5625 1.9125 0.7406

4.0000 1.1734 1.9997 0.9134

5.0000 1.0435 2.0086 0.9761

6.0000 1.0077 2.0050 0.9949


7.0000 1.0001 2.0020 0.9995

8.0000 0.9993 2.0007 1.0002

9.0000 0.9996 2.0002 1.0002

10.0000 0.9998 2.0000 1.0001

11.0000 0.9999 2.0000 1.0000

12.0000 1.0000 2.0000 1.0000

DISCUSSION:
From the example and programme, we found that the Gauss-Seidel method is much accurate then
other methods.

CONCLUSION:
Gauss-Seidel method is very much important in both mathematical and engineering field.

PRACTICAL APPLICATION AREA:


It is used in:
1. Circuit solution
2. Mathematics
3. Any engineering sector

You might also like