Gauss–Seidel method

Jacobi method中,\(x^{(n+1)}\)是由\(x^{(n)}\)全部一口氣帶入原式求得,而Gauss–Seidel method則是依序將已知的\(x_{j}^{(n+1)}\)帶入得到新的\(x_{j+1}^{(n+1)}\)。

如果讀者對machine learning還有些印象,就好比batch (Jacobi method)和online (Gauss–Seidel method) learning的差別,方便做理解記憶

假設有一方程組

\[Ax=b\]

 

這邊我們舉例同Jacobi method

\[\begin{bmatrix}{A}_{11}&{A}_{12}&{A}_{13}\\{A}_{21}&{A}_{22}&{A}_{23}\\{A}_{31}&{A}_{32}&{A}_{33}\end{bmatrix}\begin{bmatrix}{x}_{1}\\{x}_{2}\\{x}_{3}\end{bmatrix}=\begin{bmatrix}{b}_{1}\\{b}_{2}\\{b}_{3}\end{bmatrix}\]

Jacobi method的最後式子如下,帶入舊的\(x^{(n)}\)的到新的\(x^{(n+1)}\)

\({x_{1}^{(n+1)}}=\frac{1}{{A_{11}}}\left(b_{1}-{A_{12}}{x_{2}^{(n)}}-{A_{13}}{x_{3}^{(n)}}\right)\)

\({x_{2}^{(n+1)}}=\frac{1}{{A_{22}}}\left(b_{2}-{A_{21}}{x_{1}^{(n)}}-{A_{23}}{x_{3}^{(n)}}\right)\)

\({x_{3}^{(n+1)}}=\frac{1}{{A_{33}}}\left(b_{3}-{A_{31}}{x_{1}^{(n)}}-{A_{32}}{x_{2}^{(n)}}\right)\)

Gauss–Seidel method將最後的式子修改

\({x_{1}^{(n+1)}}=\frac{1}{{A_{11}}}\left(b_{1}-{A_{12}}{x_{2}^{(n)}}-{A_{13}}{x_{3}^{(n)}}\right)\)

\({x_{2}^{(n+1)}}=\frac{1}{{A_{22}}}\left(b_{2}-{A_{21}}{x_{1}^{(n+1)}}-{A_{23}}{x_{3}^{(n)}}\right)\)

\({x_{3}^{(n+1)}}=\frac{1}{{A_{33}}}\left(b_{3}-{A_{31}}{x_{1}^{(n+1)}}-{A_{32}}{x_{2}^{(n+1)}}\right)\)

注意等號右邊的\(x_{j}^{(n)}\)逐式被換成已知的\(x_{j}^{(n+1)}\)

將其整理成matrix form,將\(x^{(n+1)}\)項移到等號左邊,\(x^{(n)}\)項在等號右邊

\[L_*x^{(n+1)}=b-Ux^{(n)}\]

\[x^{(n+1)}=L_*^{-1}\left(b-Ux^{(n)}\right)\]

\[A={L}_{*}+U\]

其中\({L}_{*}\)表包含主對角線之下三角矩陣,\(U\)則表不含主對角線之上三角矩陣

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *