Direct vs indirect methods, vector norms, Gauss–Seidel and SOR with convergence checks, and Crout LU.
Definition / formula Key facts Steps
43. Direct or indirect method, and what are the l p l_p l p norms?
Definitions
Direct : performed once to get the solution (Gaussian elimination, LU). Indirect : iterate from a guess until a tolerance is met (Jacobi, Gauss–Seidel, SOR).
∥ x ∥ p = ( ∑ i = 1 n ∣ x i ∣ p ) 1 / p , ∥ x ∥ ∞ = max i ∣ x i ∣ . \|\mathbf x\|_p=\Big(\sum_{i=1}^n|x_i|^p\Big)^{1/p},\qquad \|\mathbf x\|_\infty=\max_i|x_i|. ∥ x ∥ p = ( i = 1 ∑ n ∣ x i ∣ p ) 1/ p , ∥ x ∥ ∞ = i max ∣ x i ∣.
Key facts · example
x = ( 12 , − 20 , 17 , 2 ) \mathbf x=(12,-20,17,2) x = ( 12 , − 20 , 17 , 2 )
∥ x ∥ 1 = 51 \|\mathbf x\|_1=51 ∥ x ∥ 1 = 51 , ∥ x ∥ 2 = 837 = 28.93 \|\mathbf x\|_2=\sqrt{837}=28.93 ∥ x ∥ 2 = 837 = 28.93 , ∥ x ∥ ∞ = 20 \|\mathbf x\|_\infty=20 ∥ x ∥ ∞ = 20 .
Steps
Define each method, name one example each.
Write the norm definition; compute the three norms using absolute values.
44. How do I run Gauss–Seidel and check convergence?
Gauss–Seidel
x i ( k + 1 ) = 1 a i i ( b i − ∑ j < i a i j x j ( k + 1 ) − ∑ j > i a i j x j ( k ) ) . x_i^{(k+1)}=\frac1{a_{ii}}\Big(b_i-\sum_{j<i}a_{ij}x_j^{(k+1)}-\sum_{j>i}a_{ij}x_j^{(k)}\Big). x i ( k + 1 ) = a ii 1 ( b i − j < i ∑ a ij x j ( k + 1 ) − j > i ∑ a ij x j ( k ) ) . Stop when ∥ x ( k + 1 ) − x ( k ) ∥ ∞ / ∥ x ( k + 1 ) ∥ ∞ < ε \|\mathbf x^{(k+1)}-\mathbf x^{(k)}\|_\infty/\|\mathbf x^{(k+1)}\|_\infty<\varepsilon ∥ x ( k + 1 ) − x ( k ) ∥ ∞ /∥ x ( k + 1 ) ∥ ∞ < ε . Strictly diagonally dominant : ∣ a i i ∣ > ∑ j ≠ i ∣ a i j ∣ |a_{ii}|>\sum_{j\ne i}|a_{ij}| ∣ a ii ∣ > ∑ j = i ∣ a ij ∣ for every row; this guarantees convergence.
SOR : x i new = ( 1 − ω ) x i old + ω x i GS x_i^{\text{new}}=(1-\omega)x_i^{\text{old}}+\omega\,x_i^{\text{GS}} x i new = ( 1 − ω ) x i old + ω x i GS , 1 < ω < 2 1<\omega<2 1 < ω < 2 , to speed up convergence.
Key facts · worked systems
System 1: A = ( 10 − 1 0 − 1 10 − 2 0 − 2 10 ) A=\begin{pmatrix}10&-1&0\\-1&10&-2\\0&-2&10\end{pmatrix} A = 10 − 1 0 − 1 10 − 2 0 − 2 10 , b = ( 9 , 7 , 6 ) \mathbf b=(9,7,6) b = ( 9 , 7 , 6 ) , x ( 0 ) = 0 \mathbf x^{(0)}=\mathbf 0 x ( 0 ) = 0 .
System 2: 3 x 1 + x 2 + x 3 = 6 3x_1+x_2+x_3=6 3 x 1 + x 2 + x 3 = 6 , 2 x 2 + x 3 = 5 2x_2+x_3=5 2 x 2 + x 3 = 5 , x 1 + 2 x 2 + 4 x 3 = 9 x_1+2x_2+4x_3=9 x 1 + 2 x 2 + 4 x 3 = 9 , x ( 0 ) = ( 1 , 1 , 1 ) \mathbf x^{(0)}=(1,1,1) x ( 0 ) = ( 1 , 1 , 1 ) .
System x ( 1 ) \mathbf x^{(1)} x ( 1 ) x ( 2 ) \mathbf x^{(2)} x ( 2 ) Relative change Exact 1 (0.9, 0.79, 0.758) (0.979, 0.9495, 0.7899) 0.1595 / 0.979 = 0.163 (0.9958, 0.9579, 0.7916) 2 (1.3333, 2, 0.9167) (1.0278, 2.0417, 0.9722) 0.3056 / 2 = 0.1528 (1, 2, 1)
System 2 divides by ∥ x ( 1 ) ∥ ∞ \|x^{(1)}\|_\infty ∥ x ( 1 ) ∥ ∞ ; the usual check divides by the newer iterate. Use whichever the question states.
Steps
Rearrange each equation for its diagonal unknown.
Sweep top to bottom, using each new value immediately.
After each sweep, compute the difference and its ∞ \infty ∞ -norm; divide by the stated norm.
Check diagonal dominance to justify convergence.
45. How do I solve a system with Crout’s LU method?
Definition
Crout : A = L U A=LU A = LU with L L L lower triangular and U U U unit upper triangular (ones on the diagonal). Then solve L v = b L\mathbf v=\mathbf b L v = b forward and U x = v U\mathbf x=\mathbf v U x = v backward.
Key facts · example
A = ( 1 − 6 2 4 ) A=\begin{pmatrix}1&-6\\2&4\end{pmatrix} A = ( 1 2 − 6 4 ) ,
b = ( − 3 , − 10 ) \mathbf b=(-3,-10) b = ( − 3 , − 10 ) L = ( 1 0 2 16 ) , U = ( 1 − 6 0 1 ) , v = ( − 3 , − 1 4 ) , x = ( − 9 2 , − 1 4 ) . L=\begin{pmatrix}1&0\\2&16\end{pmatrix},\quad U=\begin{pmatrix}1&-6\\0&1\end{pmatrix},\quad \mathbf v=(-3,-\tfrac14),\quad \mathbf x=(-\tfrac92,-\tfrac14). L = ( 1 2 0 16 ) , U = ( 1 0 − 6 1 ) , v = ( − 3 , − 4 1 ) , x = ( − 2 9 , − 4 1 ) .
Doolittle is the other convention: unit diagonal on L L L instead.
Steps
Multiply out L U LU LU and match entries row by row: l 11 = 1 l_{11}=1 l 11 = 1 , u 12 = − 6 u_{12}=-6 u 12 = − 6 , l 21 = 2 l_{21}=2 l 21 = 2 , l 22 = 4 + 12 = 16 l_{22}=4+12=16 l 22 = 4 + 12 = 16 .
Forward: v 1 = − 3 v_1=-3 v 1 = − 3 ; 2 ( − 3 ) + 16 v 2 = − 10 2(-3)+16v_2=-10 2 ( − 3 ) + 16 v 2 = − 10 → v 2 = − 1 4 v_2=-\tfrac14 v 2 = − 4 1 .
Back: x 2 = − 1 4 x_2=-\tfrac14 x 2 = − 4 1 ; x 1 − 6 ( − 1 4 ) = − 3 x_1-6(-\tfrac14)=-3 x 1 − 6 ( − 4 1 ) = − 3 → x 1 = − 9 2 x_1=-\tfrac92 x 1 = − 2 9 .
Check in the original equations.