Hands-on- Solving Sets of Equations with MATLAB II

  1. Factorization with Pivoting, $PA=LU$ ($A$ is a non-singular matrix, $P$ is permutation matrix).
    (a)
    Solve the following linear system by LU-decomposition of coefficient matrix;
    $
\begin{array}{r}
x_1+2x_2+4x_3+x_4=21\\
2x_1+8x_2+6x_3+4x_4=52\\
3x_1+10x_2+8x_3+8x_4=79\\
4x_1+12x_2+10x_3+6x_4=82\\
\end{array}$ Solution:                                      Download the file http://siber.cankaya.edu.tr/ozdogan/NumericalComputations/mfiles/chapter2/lufact.m lufact.m.            LU-decomposition

     $$
    LU-decomposition
    >> [X,Y]=lufact(A,B')
    
    The obtained $X$ and $Y$ are the following $x$ and $y$.
     ${}$
    $Ax=b$
     ${}$
    $LUx=b$
     ${}$
    defining $y=Ux$ then solving two systems:
    1
    solve by hand $Ly=b$ for $y$ by using forward-substitution method
    2
    solve by hand $Ux=y$ for $x$ by using back-substitution method
     $$
    Check and compare your result with
    >> GEPivshow(A,B')
    
    (b)
    Download the files http://siber.cankaya.edu.tr/ozdogan/NumericalComputations/mfiles/chapter2/luNopiv.m luNopiv.m, http://siber.cankaya.edu.tr/ozdogan/NumericalComputations/mfiles/chapter2/luPiv.m luPiv.m.
    • Try the following commands to see $L$ and $U$ explicitly.
      >> [L,U] = luNopiv(A)
      >> [L,U,pv] = luPiv(A)
      
      are the results different? Why?
    (c)
    Now, assume that $B$ is changed as $BB=2*B$. We are given $L$ and $U$. Find new $X$ and $Y$ by hand. Check your results by
    >> BB=2*B
    >> [X,Y]=lufact(A,BB')
    >> GEPivshow(A,BB')
    
  2. The http://siber.cankaya.edu.tr/ozdogan/NumericalComputations/mfiles/chapter2/jacobi.m jacobi.m MATLAB code is given for Jacobi Iteration.
  3. Modify the code given in the previous item for Gauss-Seidel method. Solve the same linear system and compare your results. Is convergence accelerated?
Cem Ozdogan 2010-11-17