Here is the program for Gauss elimination method
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{float a[6][6],b[6],x[6],t,s;
int i,j,n,k;
clrscr();
cout<<"Enter the maximum no. of matrix"<<endl;
cin>>n;
cout<<"Enter th elements of matrix"<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
cout<<"enter the right constant"<<endl;
for(i=0;i<n;i++)
{
cin>>b[i];
}
for(k=0;k<n-1;k++)
{
for(i=k+1;i<n;i++)
{
t=a[i][k]/a[k][k];
a[i][k]=0;
for(j=k;j<n;j++)
{
a[i][j]=a[i][j]-(t*a[k][i]);
}
b[i]=b[i]-(t*b[k]);
}
}
x[n-1]=b[n-1]/a[n-1][n-1];
for(i=n-1;i>=0;i--)
{
s=0;
for(j=i+1;j<n;j++)
{s=s+(a[i][j]*x[j]);
}
x[i]=(b[i]-s)/a[i][i];
}
cout<<"the solution is"<<endl;
for(i=0;i<n;i++)
{
cout<<"x["<<i<<"]="<<x[i]<<endl;
}
getch();
}
C program for Gauss Jordan method:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{float a[6][6],b[6],x[6],t,s;
int i,j,n,k;
clrscr();
cout<<"Enter the maximum no. of matrix"<<endl;
cin>>n;
cout<<"Enter th elements of matrix"<<endl;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
cout<<"enter the right constant"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i][n];
}
for(k=0;k<n;k++)
{
for(i=0;i<n;i++)
if(i!=k)
{
for(j=k+1;j<n+1;j++)
{
a[i][j]=a[i][j]-(a[i][k]/a[k][k])*a[k][j]);
cout<<"the solution is"<<endl;
for(i=0;i<n;i++)
{
x[i]=(a[i][n]/a[i][i]);
cout<<"x["<<i<<"]="<<x[i]<<endl;
}
getch();
}
Solve the following systems of simultaneous linear equations using Gauss elimination method and Gauss-Seidel Method 2x1+3x2+7x3 = 12 -----(1) x1-4x2+5x3 = 2 -----(2) 4x1+5x2-12x3= -3 ----(3) Answer: I'm not here to answer your university/college assignment questions. Please refer to the related question below and use the algorithm, which you should have in your notes anyway, to do the work yourself.
gauss
Gauss Elimination
It will solve the solution "exactly", but will take a very very long time for large matrices. Gauss Jordan method will require O(n^3) multiplication/divisions and O(n^3) additions and subtractions. Gauss seidel in reality you may not know when you have reached a solution. So, you may have to define the difference between succesive iterations as a tolerance for error. But, most of the time GS is much prefured in cases of large matrices.
The matrix is singular because the last equation is the same as the second equation (simply multiplying every term in an equation by the same number (in this case, 2) does not produce an equation with new information). for example 1) 3x=3y 2) 2x=2y has no useful solution beyond the information from 1) that x=y You would get a singular matrix for this. The Gauss-Jordan method will not solve equations which cannot be solved by the old "elimination method".
There are no answer for that..
Gaussian elimination as well as Gauss Jordan elimination are used to solve systems of linear equations. If, using elementary row operations, the augmented matrix is reduced to row echelon form, then the process is called Gaussian elimination. If the matrix is reduced to reduced row echelon form, the process is called Gauss Jordan elimination. In the case of Gaussian elimination, assuming that the system is consistent, the solution set can be obtained by back substitution whereas, if the matrix is in reduced row echelon form, the solution set can usually be obtained directly from the final matrix or at most by a few additional simple steps.
yes it is possible.not only columns but also rows can be transformed.
Too complex to show here as a Wiki.Answer hoy pareha ta way i answer.......... pag sure uie.........
Solve the following systems of simultaneous linear equations using Gauss elimination method and Gauss-Seidel Method 2x1+3x2+7x3 = 12 -----(1) x1-4x2+5x3 = 2 -----(2) 4x1+5x2-12x3= -3 ----(3) Answer: I'm not here to answer your university/college assignment questions. Please refer to the related question below and use the algorithm, which you should have in your notes anyway, to do the work yourself.
gauss
Gauss Elimination
u can use gauss jorden or gauss elimination method for solving linear equation u also use simple subtraction method for small linear equation also.. after that also there are many methods are available but above are most used
It will solve the solution "exactly", but will take a very very long time for large matrices. Gauss Jordan method will require O(n^3) multiplication/divisions and O(n^3) additions and subtractions. Gauss seidel in reality you may not know when you have reached a solution. So, you may have to define the difference between succesive iterations as a tolerance for error. But, most of the time GS is much prefured in cases of large matrices.
The matrix is singular because the last equation is the same as the second equation (simply multiplying every term in an equation by the same number (in this case, 2) does not produce an equation with new information). for example 1) 3x=3y 2) 2x=2y has no useful solution beyond the information from 1) that x=y You would get a singular matrix for this. The Gauss-Jordan method will not solve equations which cannot be solved by the old "elimination method".
kuta panchod ha ya method....................................sala
the method of adding all the numbers from 1~100