GAUSS JORDAN METHOD:EXPLANATION,ALGORITHM AND EXPLANATION

 Gauss jordan method

Gauss Jordan method is commonly used to find the solution of linear simultaneous equations. In science and engineering, it is used to find the output of a chemical plant, examine a network under sinusoidal steady rate, etc.

Here’s a simple algorithm for Gauss Jordan Method along with flowchart, which show how a system of linear equations is reduced to diagonal matrix form by elementary row operations. The solution is directly and conveniently obtained by this method but requires a little more calculation.

Gauss Jordan method is a modified version of the Gauss elimination method. The Gauss Jordan algorithm and flowchart is also similar in many aspects to the elimination method. Compared to the elimination method, this method reduces effort and time taken to perform back substitutions for finding the unknowns.

Gauss Jordan Method Algorithm:

  1. Start
  2. Read the order of the matrix ‘n’ and read the coefficients of the linear equations.
  3. Do for k=1 to n
    Do for l=k+1 to n+1
    a[k][l] = a[k][l] / a[k][k]
    End for l
    Set a[k][k] = 1
    Do for i=1 to n
    if (i not equal to k) then,
    Do for j=k+1 to n+1
    a[i][j] = a[i][j] – (a[k][j] * a[i][k])
    End for j
    End for i
  4. End for k
  5. Do for m=1 to n
    x[m] = a[m][n+1]
    Display x[m]
    End for m
  6. Stop

FLOWCHART:






C PROGRAM FOR GAUSS JORDAN METHOD:

#include<stdio.h>
int main()
{
    int i,j,k,n;
    float A[20][20],c,x[10];
    printf("\nEnter the size of matrix: ");
    scanf("%d",&n);
    printf("\nEnter the elements of augmented matrix row-wise:\n");
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=(n+1); j++)
        {
            printf(" A[%d][%d]:", i,j);
            scanf("%f",&A[i][j]);
        }
    }
    /* Now finding the elements of diagonal matrix */
    for(j=1; j<=n; j++)
    {
        for(i=1; i<=n; i++)
        {
            if(i!=j)
            {
                c=A[i][j]/A[j][j];
                for(k=1; k<=n+1; k++)
                {
A[i][k]=A[i][k]-c*A[j][k];
                }
            }
        }
    }
    printf("\nThe solution is:\n");
    for(i=1; i<=n; i++)
    {
        x[i]=A[i][n+1]/A[i][i];
        printf("\n x%d=%f\n",i,x[i]);
    }
    return(0);
}

Comments

Popular posts from this blog

Newton Raphson Method:Explanation, algorithm and flowchart

GAUSS ELIMINATION METHOD:EXPLANATION,ALGORITHM AND FLOWCHART

EULER METHOD:Explanation,algorithm,flowchart