In linear algebra, Gaussian Jordan method is an algorithm for solving systems of linear equations. It is usually understood as a sequence of operations performed on the associated matrix of coefficients. This method can also be used to find the rank of a matrix, to calculate the determinant of a matrix, and to calculate the inverse of an invertible square matrix.

We can implement this method in C using the following source code:

Enjoy coding!!!

We can implement this method in C using the following source code:

`//Implementation of Gauss Jordan Method, @author: +Jivan Nepali, @URL: codeplustech`

```
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define Max 10
int main()
{
float a[Max][Max+1],t,det=1;
int i,j,k,N;
printf("Enter the number of unknowwns : ");
scanf("%d",&N);
```

```
printf("\nEnter the elements of the augmented matrix :\n");
for(i=0;i<N;i++)
for(j=0;j<N+1;j++)
scanf("%f",&a[i][j]);
for(i=0;i<N;i++)
for(j=0;j<N;j++)
if(i!=j)
{
t=a[j][i]/a[i][i];
for(k=0;k<N+1;k++)
a[j][k]-=a[i][k]*t;
}
for(i=0;i<N;i++)
det*=a[i][i];
printf("\nDeterminant = %.4f\n",det);
if(det==0){
printf("\nThe matrix is singular .\n");
exit(1);
}
printf("\nThe Gauss-Jordan Matrix is :\n\n");
for(i=0;i<N;i++)
{
for(j=0;j<N+1;j++)
printf("%.4f ",a[i][j]);
printf("\n");
}
printf("\nThe solution is :\n\n");
for(i=0;i<N;i++)
printf("x[ %d]=%.4f\n",i+1,a[i][N]/a[i][i]);
getch();
return 0;
}
```

Enjoy coding!!!

I read your blog.I thought it was great.. Hope you have a great day. God bless.

ReplyDeleteRica

www.imarksweb.org

Cosas interesantes que tienes y nos mantienes actualizándonos a todos. Metodo pose

ReplyDelete