| Gauss-Seidel Iteration Method The Gauss-Jacobi iteration is an improved version of the Gauss-Jacobi method.  
  The iteration equation has the form: 
| xj(k+1) = 1/Aij(bi - ∑j≠i Aij
  xj(k)) - ∑j≠i Aij
  xj(k)) |  
 
 Testing Iteration Methods In order to test the iteration methods as defined above, a new TestIterations() 
static method has been added and executed. Supporting code and methods are not shown. A set of equations for the test has been defined where it has an analytic solution of (1, 1, 1). The results of
the test show close approximations to the analytic solutions. The tolerance was set equal to 1.0E-4 and 
the maximum iterations to 10. 
 
           static void TestIterations();{
 ListBox1.Items.Clear();
 ListBox2.Items.Clear();
 ListBox3.Items.Clear();
 ListBox4.Items.Clear();
 ListBox5.Items.Clear();
 ListBox6.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 });
 MatrixR A1 = A.Clone();
 VectorR b1 = b.Clone();
 VectorR x = ls.GaussJacobi(A, b, 10, 1.0e-4);
 ListBox1.Items.Add(" " + x[0]);
 ListBox2.Items.Add(" " + x[1]);
 ListBox3.Items.Add(" " + x[1]);
 VectorR x1 = ls.GaussSeidel(A, b, 10, 1.0e-4);
 ListBox4.Items.Add(" " + x1[0]);
 ListBox5.Items.Add(" " + x1[1]);
 ListBox6.Items.Add(" " + x1[1]);
 }
 |