IMPLEMENTATION
Gauss-Jordan elimination
Solving sets of linear equations using Gauss-Jordan elimination produces both the solution of the equations and
the inverse of the coefficient matrix. The Gauss-Jordan elimination process requires
two steps. The first step, called the forward elimination, reduces a given system to either triangular or
echelon form, or results in a degenerate equation indicating that the system has no solution. This is
accomplished through the use of elementary operations. The second step, called the backward elimination, uses
back-substitution to find the solution of the linear equations.
Iteration Algorithm Creation
In this method, the value of unknowns for triangulated equations are found, which can be done by using
back-substitution. Starting with the last equation, which contains the single unknowns, a solution can be found
immediately. This value may be substituted into the second last equation in order to calculate the next unknown. The
process is repeated until all unknowns are found.
Testing Gauss-Jordan elimination Method
In order to test the method as defined above, a new TestGaussJordan()
static method has been added and executed. Supporting code and methods are not shown.
A set of initial equations for the test has been defined for Matrix A and Vector b.
static void TestGaussJordan();
{
ListBox1.Items.Clear();
LinearSystem ls = new LinearSystem();
MatrixR A = new MatrixR(new double[3, 3] { { t1, t2, t3 }, { t4, t5, t6 }, { t7, t8, t9 } });
VectorR b = new VectorR(new double[3] { t10, t11, t12 });
VectorR x = ls.GaussJordan(A, b);
ListBox1.Items.Add("(" + x[0] + "," + x[1] + "," + x[2] + ")");
}
|