Matakuliah Tahun : S0262-Analisis Numerik : 2010 Linear Algebraic Equation System Pertemuan 6 Material Outline • Linear Algebraic Equations System – Gauss Seidel method – Jacobi method • Sys. of Linear Algebraic equation a11x1 a12 x2 a1n xn b1 a21x1 a22 x2 a2 n x n b2 Ax b an1 x1 an 2 x2 ann xn bn In which: a11 a A 21 an1 a12 a 22 a1n a2 n an 2 ann b1 x1 b x ; B 2 ; x 2 b n xn 4 • Gauss-Seidel Method Gauss Seidel Meth Is an iterative or approximate method. Ax b 1. Step-1: write the system of linear equations to the following form (you may need to interchange the rows if necessary) x1 b1 a12 x2 a13 x3 a1n xn a11 x2 b2 a21 x1 a 23 x3 a2 n xn a22 xn bn an1 x1 a n 2 x2 ann1 xn 1 ann 5 • Gauss-Seidel Method 2. Step-2: Choose initial for all x’s 3. Step-3: Use the previous set of equations to refine guess of the values of x’s start with x1. Then the refine value of x1 together with all other x’s will be used to refine the value of x2 etc. This process will be done iteratively until the predetermined convergence criteria is achieved. Convergence Criteria: a ,i xij xij 1 100% s j xi Note: xj = x at jth iteration s= tolerance 6 • Gauss-Seidel Method Then the iteration can be written as: b1 a12 x2j 1 a13 x3j 1 a1n xnj 1 x a11 j 1 j 1 23 3 j 1 2n n b2 a x a x a x x a22 j 21 1 j 2 Initial values : x10 ; x20 ; x30 xn0 are given j j j 1 b a x a x a x 32 2 3n n x3j 3 31 1 a33 bn an1 x1j an 2 x2j ann1 xnj1 x ann j n Note: xij = the values of xi at iteration j 7 • Gauss Seidel Method Example: Solve the following linear system using Gauss Seidel Method. Use your first guess for x’s equal to zero. 3 0.1 0.2 x1 7.85 0.1 7 0 . 3 x 19 . 3 2 0.3 0.2 10 x3 71.4 28-Jun-16 Paston Sidauruk 8 • Jacobi method Al most the same procedure as Gauss-Siedel method. In Jacobi method, however, the new values of x is not immediately updated until the current iteration completed. 9 • Jacobi Method Then the iteration for Jacobi method can be written as: j 1 j 1 j 1 b a x a x a x 13 3 1n n x1j 1 12 2 a11 x2j j 1 21 1 b2 a x j 1 23 3 j 1 2n n a x a x a22 Initial values : x10 ; x20 ; x30 xn0 are given j 1 j 1 j 1 b a x a x a x 32 2 3n n x3j 3 31 1 a33 bn an1 x1j 1 an 2 x2j 1 ann1 xnj1 x ann j n Note: xij = the values of xi at iteration j 10 • Jacobi Method Jacobi stopping criteria will be the same as GaussSeidel method Convergence Criteria: a ,i xij xij 1 100% s j xi Note: xj = x at jth iteration s= tolerance 11 • Jacobi Method Example: Solve the following linear system using Jacobi Method. Use your first guess for x’s equal to zero. 3 0.1 0.2 x1 7.85 0.1 7 0 . 3 x 19 . 3 2 0.3 0.2 10 x3 71.4 28-Jun-16 Paston Sidauruk 12 • Comment on Convergence To guarantee the convergence of Gauss-Seidel and jacobi methods, the diagonal element of the matrix at each row must be greater than the sum off-diagonal elements. It is recommended than to re arrange the rows as much as possible to fulfill the following criteria aii 28-Jun-16 n a j , j i Paston Sidauruk i, j 13