FOR FREE MATERIALS

Gauss Jacobi

Back to Programming

Description

It is used to solve linear algebraic equations by using the iteration method. It is an indirect method and it is based on finding the better successive information of the unknown of equations using iteration formulae. The convergence of iteration depends upon the sufficient conditions that the system must be diagonally dominant.

 

PROCEDURE

Let us consider a system diagonally dominant equation as:

The above system of the equation can be written as

Now assuming any arbitrary initial solutions, we get 1st approximation as:

Again using these values the 2nd approximation is done. Therefore after (k + 1)th iteration, we get (k + 1)th approximations as:

Algorithm

INPUT: 

A matrix.

 

OUTPUT: 

The values after solving it using gauss jacobi method

 

PROCESS:

Step 1: [Take the matrix from user]
	Read n [the order of the 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: [Initializing the values of the unknowns]
	for i = 0 to n - 1 repeat
		Set x[i] ← 0.0
		Set y[i] ← 0.0
	[End of ‘for’ loop]

Step 3: [Gauss Jacobi iteration method]
	Step 3.1: Set flag ← 0
	Step 3.2: 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] × y[j]
			[end of ‘for’ loop]
			Set x[i] ← x[i]/a[i][i]
		[End of ‘for’ loop]
		Set flag ← 0
		for i = 0 to n - 1 repeat
			If absolute value of(x[i] - y[i]) > .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]
While flag = 1 repeat Step 3.2
[End of gauss jacobi method]

Code

ADVANTAGES

1. It is a simple method.

2. This method is numerically robust.

3. The iterations of this method are quite fast.

 

DISADVANTAGES

1. Many iterations might be required in the case of this method.

2. Less efficient than Gauss-Seidel.

3. It is generally used to solve the linear systems in which the coefficient matrix is diagonally dominant.

 

APPLICATIONS

1. This method is used to solve a strictly diagonally dominant system of linear equations.