Quant / Finance and numerics

Numerical linear algebra

· Latest

Direct vs indirect methods, vector norms, Gauss–Seidel and SOR with convergence checks, and Crout LU.

Definition / formulaKey factsSteps

43. Direct or indirect method, and what are the lpl_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=1n∣xi∣p)1/p,∥x∥∞=max⁡i∣xi∣.\|\mathbf x\|_p=\Big(\sum_{i=1}^n|x_i|^p\Big)^{1/p},\qquad \|\mathbf x\|_\infty=\max_i|x_i|.
Key facts · example x=(12,−20,17,2)\mathbf x=(12,-20,17,2)
  • ∥x∥1=51\|\mathbf x\|_1=51, ∥x∥2=837=28.93\|\mathbf x\|_2=\sqrt{837}=28.93, ∥x∥∞=20\|\mathbf x\|_\infty=20.
Steps
  1. Define each method, name one example each.
  2. Write the norm definition; compute the three norms using absolute values.

44. How do I run Gauss–Seidel and check convergence?

Gauss–Seidel
xi(k+1)=1aii(bi−∑j<iaijxj(k+1)−∑j>iaijxj(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).

Stop when ∥x(k+1)−x(k)∥∞/∥x(k+1)∥∞<ε\|\mathbf x^{(k+1)}-\mathbf x^{(k)}\|_\infty/\|\mathbf x^{(k+1)}\|_\infty<\varepsilon. Strictly diagonally dominant: ∣aii∣>∑j≠i∣aij∣|a_{ii}|>\sum_{j\ne i}|a_{ij}| for every row; this guarantees convergence.

SOR: xinew=(1−ω)xiold+ω xiGSx_i^{\text{new}}=(1-\omega)x_i^{\text{old}}+\omega\,x_i^{\text{GS}}, 1<ω<21<\omega<2, to speed up convergence.

Key facts · worked systems
  • System 1: A=(10−10−110−20−210)A=\begin{pmatrix}10&-1&0\\-1&10&-2\\0&-2&10\end{pmatrix}, b=(9,7,6)\mathbf b=(9,7,6), x(0)=0\mathbf x^{(0)}=\mathbf 0.
  • System 2: 3x1+x2+x3=63x_1+x_2+x_3=6, 2x2+x3=52x_2+x_3=5, x1+2x2+4x3=9x_1+2x_2+4x_3=9, x(0)=(1,1,1)\mathbf x^{(0)}=(1,1,1).
Systemx(1)\mathbf x^{(1)}x(2)\mathbf x^{(2)}Relative changeExact
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; the usual check divides by the newer iterate. Use whichever the question states.
Steps
  1. Rearrange each equation for its diagonal unknown.
  2. Sweep top to bottom, using each new value immediately.
  3. After each sweep, compute the difference and its ∞\infty-norm; divide by the stated norm.
  4. Check diagonal dominance to justify convergence.

45. How do I solve a system with Crout’s LU method?

Definition

Crout: A=LUA=LU with LL lower triangular and UU unit upper triangular (ones on the diagonal). Then solve Lv=bL\mathbf v=\mathbf b forward and Ux=vU\mathbf x=\mathbf v backward.

Key facts · example A=(1−624)A=\begin{pmatrix}1&-6\\2&4\end{pmatrix}, b=(−3,−10)\mathbf b=(-3,-10)
L=(10216),U=(1−601),v=(−3,−14),x=(−92,−14).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).
  • Doolittle is the other convention: unit diagonal on LL instead.
Steps
  1. Multiply out LULU and match entries row by row: l11=1l_{11}=1, u12=−6u_{12}=-6, l21=2l_{21}=2, l22=4+12=16l_{22}=4+12=16.
  2. Forward: v1=−3v_1=-3; 2(−3)+16v2=−102(-3)+16v_2=-10 → v2=−14v_2=-\tfrac14.
  3. Back: x2=−14x_2=-\tfrac14; x1−6(−14)=−3x_1-6(-\tfrac14)=-3 → x1=−92x_1=-\tfrac92.
  4. Check in the original equations.
Jasmine Nguyen