CREATE OWN LIBRARY

Seidal Method

Back to Programming

Description

Slightly modifying the Gauss Jacobi method, the Gauss Seidal method was introduced. If the linear equations are strictly diagonally dominant then this method is also convergent. At each step of the iteration, the improved value from the previous step is used

 

DERIVATION

The iteration successively will be followed as:

Where,

 

Now, Gauss Seidal iteration can be written as,

 

And the stopping criteria of this method will be:

 

GRAPHICAL REPRESENTATION:

Algorithm

INPUT: 

A matrix 

 

OUTPUT: 

The values after solving the linear equations.

 

PROCESS:

Step 1: [Taking the inputs from the user]
	
	Read n [the order of matrix]
	
              for i = 0 to n - 1 repeat
                  for j = 0 to n repeat
		Read a[i][j]
                  [End of ‘for’ loop]
              [End of ‘for’ loop]

Step 2: [Gauss Seidal Method]

            Step 2.1: for i = 0 to n - 1 repeat

			Set x[i] ← 0.0

		Set y[i] ← 0.0
		[End of ‘for’ loop]

          Step 2.2:  Set iteration ← iteration + 1

	Print iteration

	for i = 0 to n - 1 repeat

		Set x[i] ← a[i][n]
		for j = 0 to n - 1 repeat

		         If i = j then

		continue

			         [End of ‘if’]
	Set x[i] ← x[i] - a[i][j] * x[j]
		[End of ‘for’ loop]

			Set  x[i]x[i]/a[i][i]
         [End of ‘for’ loop]

	             for i = 0 to n - 1 repeat

		Set flag ← 0

		if absolute value of(x[i] - y[i]) > 0.0005 ) then

			Set flag ←1

			for j = 0 to n - 1 repeat

			Set y[j] ← x[j]
				[End of ‘for’ loop]

			break
		[End of ‘if’]
	[End of ‘for’ loop]

		for j = 0 to n - 1 repeat

		Print x[j]

		While flag = 1 repeat 2.2
	[end of ‘gauss seidal’]
	

Code

ADVANTAGES

1. The calculation in this method is simple.

2. Programming for this method is easy.

3. The memory spaces required are less.

4. This method is useful for the small system of linear equations.

 

DISADVANTAGES

1. It requires a large number of iterations to reach convergence.

2. It is not efficient for a large system

3. If the size of the system increases, the convergence time also increases.

 

APPLICATIONS

1. It is used to solve linear equations with unknown variables.

2. It is used in digital computers for computing.