I've been looking into the Tridiagonal matrix algorithm. There's theory everywhere but not a lot of real-world applications and examples of tridiagonal matrices. I understand it is a pretty simple and must be found in plenty of places. I hoped that someone could give me a fun example here.
Thanks.
It's used in partial differential equations. One example is the heat equation. You end up with a tridiagonal matrix. The heat equation is
$$ \frac{\partial u}{\partial t} = k \frac{\partial^{2}u}{\partial x^{2}} \tag{1}$$
you use backward difference to approximate $\frac{\partial u}{\partial t}$
$$ \frac{\partial u}{\partial t}\Big|_{t_{k} x_{i}} \approx \frac{u_{i}^{k} - u_{i}^{k-1}}{\Delta t} \tag{2}$$
using central difference for $k \frac{\partial^{2}u}{\partial x^{2}} $
$$ \frac{\partial^{2}u}{\partial x^{2}}\Big|_{t_{k},x_{i}} \approx \frac{u_{i-1}^{k} -2u_{i}^{k} + u_{i+1}^{k}}{\Delta x^{2}} \tag{4}$$
this can be represented as a matrix
$$ \begin{bmatrix} a_{1} & b_{1} & 0 & 0 & 0 & 0 \\ c_{2} & a_{2} & b_{2} & 0 & 0 & 0 \\ 0 & c_{3} & a_{3} & b_{3} & 0 & 0 \\ 0 & 0 & \ddots & \ddots & \ddots & 0 \\ 0 & 0 & 0 & c_{nx-1} & a_{nx-1} & b_{nx-1} \\ 0 & 0 & 0 & 0 & c_{nx} & a_{nx} \\\end{bmatrix} \tag{5}$$
if you read the document you use LU decomp to solve, there is a special form of the LU decomp for tridiagonal matrices.