Método de diferencias finitas

Ecuación de Laplace

\begin{equation*} \frac{\partial^{2} T}{\partial x^{2}} + \frac{\partial^{2} T}{\partial y^{2}} = 0 \end{equation*}

Usando diferencias finitas centradas

\begin{align*} \frac{\partial^{2} T}{\partial x^{2}} &= \frac{T_{i+1, j} - 2 T_{i, j} + T_{i-1, j}}{\Delta x^{2}} \\ \frac{\partial^{2} T}{\partial y^{2}} &= \frac{T_{i, j+1} - 2 T_{i, j} + T_{i, j-1}}{\Delta y^{2}} \end{align*}

Sustituyendo

\begin{equation*} \frac{T_{i+1, j} - 2 T_{i, j} + T_{i-1, j}}{\Delta x^{2}} + \frac{T_{i, j+1} - 2 T_{i, j} + T_{i, j-1}}{\Delta y^{2}} = 0 \end{equation*}

Para una malla cuadrada $\Delta x^{2} = \Delta y^{2}$

\begin{equation*} \frac{T_{i+1, j} - 2 T_{i, j} + T_{i-1, j}}{\Delta x^{2}} + \frac{T_{i, j+1} - 2 T_{i, j} + T_{i, j-1}}{\Delta x^{2}} = 0 \end{equation*}

reordenando

\begin{equation*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} = 0 \end{equation*}

Condiciones de frontera de Dirichlet

\begin{align*} \frac{\partial^{2} T}{\partial x^{2}} + \frac{\partial^{2} T}{\partial y^{2}} &= 0 \\ T(0,y) &= 75 \\ T(4,y) &= 50 \\ T(x,4) &= 100 \\ T(x,0) &= 0 \end{align*}

Nodo (1,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 1} - 4 T_{1, 1} + T_{1+1, 1} + T_{1, 1-1} + T_{1, 1+1} &= 0 \\ T_{0, 1} - 4 T_{1, 1} + T_{2, 1} + T_{1, 0} + T_{1, 2} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 1} + T_{2, 1} + 0 + T_{1, 2} &= 0 \\ - 4 T_{1, 1} + T_{1, 2} + T_{2, 1} &= -75 \end{align*}

Nodo (2,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 1} - 4 T_{2, 1} + T_{2+1, 1} + T_{2, 1-1} + T_{2, 1+1} &= 0 \\ T_{1, 1} - 4 T_{2, 1} + T_{3, 1} + T_{2, 0} + T_{2, 2} &= 0 \end{align*}

\begin{align*} T_{1, 1} - 4 T_{2, 1} + T_{3, 1} + 0 + T_{2, 2} &= 0 \\ T_{1, 1} - 4 T_{2, 1} + T_{2, 2} + T_{3, 1} &= 0 \end{align*}

Nodo (3,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 1} - 4 T_{3, 1} + T_{3+1, 1} + T_{3, 1-1} + T_{3, 1+1} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{4, 1} + T_{3, 0} + T_{3, 2} &= 0 \end{align*}

\begin{align*} T_{2, 1} - 4 T_{3, 1} + 50 + 0 + T_{3, 2} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{3, 2} &= -50 \end{align*}

Nodo (1,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 2} - 4 T_{1, 2} + T_{1+1, 2} + T_{1, 2-1} + T_{1, 2+1} &= 0 \\ T_{0, 2} - 4 T_{1, 2} + T_{2, 2} + T_{1, 1} + T_{1, 3} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 2} + T_{2, 2} + T_{1, 1} + T_{1, 3} &= 0 \\ T_{1, 1} - 4 T_{1, 2} + T_{1, 3} + T_{2, 2} &= -75 \end{align*}

Nodo (2,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 2} - 4 T_{2, 2} + T_{2+1, 2} + T_{2, 2-1} + T_{2, 2+1} &= 0 \\ T_{1, 2} - 4 T_{2, 2} + T_{3, 2} + T_{2, 1} + T_{2, 3} &= 0 \end{align*}

\begin{align*} T_{1, 2} + T_{2, 1} - 4 T_{2, 2} + T_{2, 3} + T_{3, 2} &= 0 \end{align*}

Nodo (3,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 2} - 4 T_{3, 2} + T_{3+1, 2} + T_{3, 2-1} + T_{3, 2+1} &= 0 \\ T_{2, 2} - 4 T_{3, 2} + T_{4, 2} + T_{3, 1} + T_{3, 3} &= 0 \end{align*}

\begin{align*} T_{2, 2} - 4 T_{3, 2} + 50 + T_{3, 1} + T_{3, 3} &= 0 \\ T_{2, 2} + T_{3, 1} - 4 T_{3, 2} + T_{3, 3} &= -50 \end{align*}

Nodo (1,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 3} - 4 T_{1, 3} + T_{1+1, 3} + T_{1, 3-1} + T_{1, 3+1} &= 0 \\ T_{0, 3} - 4 T_{1, 3} + T_{2, 3} + T_{1, 2} + T_{1, 4} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 3} + T_{2, 3} + T_{1, 2} + 100 &= 0 \\ T_{1, 2} - 4 T_{1, 3} + T_{2, 3} &= -175 \end{align*}

Nodo (2,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 3} - 4 T_{2, 3} + T_{2+1, 3} + T_{2, 3-1} + T_{2, 3+1} &= 0 \\ T_{1, 3} - 4 T_{2, 3} + T_{3, 3} + T_{2, 2} + T_{2, 4} &= 0 \end{align*}

\begin{align*} T_{1, 3} - 4 T_{2, 3} + T_{3, 3} + T_{2, 2} + 100 &= 0 \\ T_{1, 3} + T_{2, 2} - 4 T_{2, 3} + T_{3, 3} &= -100 \end{align*}

Nodo (3,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 3} - 4 T_{3, 3} + T_{3+1, 3} + T_{3, 3-1} + T_{3, 3+1} &= 0 \\ T_{2, 3} - 4 T_{3, 3} + T_{4, 3} + T_{3, 2} + T_{3, 4} &= 0 \end{align*}

\begin{align*} T_{2, 3} - 4 T_{3, 3} + 50 + T_{3, 2} + 100 &= 0 \\ T_{2, 3} + T_{3, 2} - 4 T_{3, 3} &= -150 \end{align*}

Sistema de ecuaciones del problema

\begin{align*} - 4 T_{1, 1} + T_{1, 2} + T_{2, 1} &= -75 \\ T_{1, 1} - 4 T_{2, 1} + T_{2, 2} + T_{3, 1} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{3, 2} &= -50 \\ T_{1, 1} - 4 T_{1, 2} + T_{1, 3} + T_{2, 2} &= -75 \\ T_{1, 2} + T_{2, 1} - 4 T_{2, 2} + T_{2, 3} + T_{3, 2} &= 0 \\ T_{2, 2} + T_{3, 1} - 4 T_{3, 2} + T_{3, 3} &= -50 \\ T_{1, 2} - 4 T_{1, 3} + T_{2, 3} &= -175 \\ T_{1, 3} + T_{2, 2} - 4 T_{2, 3} + T_{3, 3} &= -100 \\ T_{2, 3} + T_{3, 2} - 4 T_{3, 3} &= -150 \end{align*}

en forma matricial presenta una matriz dispersa

\begin{equation*} \begin{bmatrix} -4 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & -4 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & -4 & 1 & 0 \\ 1 & -4 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & -4 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 1 & -4 & 1 \\ 0 & 1 & -4 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & -4 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1 & -4 \end{bmatrix} \begin{bmatrix} T_{1,1} \\ T_{1,2} \\ T_{1,3} \\ T_{2,1} \\ T_{2,2} \\ T_{2,3} \\ T_{3,1} \\ T_{3,2} \\ T_{3,3} \end{bmatrix} = \begin{bmatrix} -75 \\ 0 \\ -50 \\ -75 \\ 0 \\ -50 \\ -175 \\ -100 \\ -150 \end{bmatrix} \end{equation*}

en forma reducida

\begin{equation*} Ax = B \end{equation*}

In [1]:
A = [[-4 1 0 1 0 0 0 0 0],
    [ 1 0 0 -4 1 0 1 0 0],
    [0 0 0 1 0 0 -4 1 0],
    [1 -4 1 0 1 0 0 0 0],
    [0 1 0 1 -4 1 0 1 0],
    [0 0 0 0 1 0 1 -4 1],
    [0 1 -4 0 0 1 0 0 0],
    [0 0 1 0 1 -4 0 0 1],
    [0 0 0 0 0 1 0 1 -4]];

In [2]:
B = [[-75],
    [0],
    [-50],
    [-75],
    [0],
    [-50],
    [-175],
    [-100],
    [-150]];

In [3]:
x = inv(A)*B;

In [4]:
x = transpose(reshape(x,3,3))

for i=1:3
    for j=1:3
        println("T[$i,$j] = $(x[i,j])")
    end
end


T[1,1] = 42.85714285714286
T[1,2] = 63.16964285714287
T[1,3] = 78.57142857142857
T[2,1] = 33.25892857142858
T[2,2] = 56.25000000000001
T[2,3] = 76.11607142857143
T[3,1] = 33.92857142857144
T[3,2] = 52.45535714285715
T[3,3] = 69.64285714285714

Condiciones de frontera de Neumann

\begin{align*} \frac{\partial^{2} T}{\partial x^{2}} + \frac{\partial^{2} T}{\partial y^{2}} &= 0 \\ T(0,y) &= 75 \\ T(4,y) &= 50 \\ T(x,4) &= 100 \\ \frac{\partial}{\partial y} T(x,0) &= 0 \end{align*}

Nodo (1,0)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 0} - 4 T_{1, 0} + T_{1+1, 0} + T_{1, 0-1} + T_{1, 0+1} &= 0 \\ T_{0, 0} - 4 T_{1, 0} + T_{2, 0} + T_{1, -1} + T_{1, 1} &= 0 \end{align*}

aproximando $T_{y}$ con una diferencia finita centrada

\begin{equation*} \frac{\partial T}{\partial y} = \frac{T_{i, j-1} - T_{i, j+1}}{2 \Delta y} = \frac{T_{1, 0-1} - T_{1, 0+1}}{2 \Delta y} = \frac{T_{1, -1} - T_{1, 1}}{2 \Delta y} \end{equation*}

despejando $T_{1, -1}$

\begin{equation*} T_{1, -1} = 2 \Delta y \frac{\partial T}{\partial y} + T_{1, 1} \end{equation*}

reemplazando

\begin{align*} T_{0, 0} - 4 T_{1, 0} + T_{2, 0} + 2 \Delta y \frac{\partial T}{\partial y} + T_{1, 1} + T_{1, 1} &= 0 \\ T_{0, 0} - 4 T_{1, 0} + T_{2, 0} + 2 \Delta y \frac{\partial T}{\partial y} + 2 T_{1, 1} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 0} + T_{2, 0} + 2 (1) (0) + 2 T_{1, 1} &= 0 \\ - 4 T_{1, 0} + 2 T_{1, 1} + T_{2, 0} &= -75 \end{align*}

Nodo (2,0)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 0} - 4 T_{2, 0} + T_{2+1, 0} + T_{2, 0-1} + T_{2, 0+1} &= 0 \\ T_{1, 0} - 4 T_{2, 0} + T_{3, 0} + T_{2, -1} + T_{2, 1} &= 0 \end{align*}

aproximando $T_{y}$ con una diferencia finita centrada

\begin{equation*} \frac{\partial T}{\partial y} = \frac{T_{i, j-1} - T_{i, j+1}}{2 \Delta y} = \frac{T_{2, 0-1} - T_{2, 0+1}}{2 \Delta y} = \frac{T_{2, -1} - T_{2, 1}}{2 \Delta y} \end{equation*}

despejando $T_{2, -1}$

\begin{equation*} T_{2, -1} = 2 \Delta y \frac{\partial T}{\partial y} + T_{2, 1} \end{equation*}

reemplazando

\begin{align*} T_{1, 0} - 4 T_{2, 0} + T_{3, 0} + 2 \Delta y \frac{\partial T}{\partial y} + T_{2, 1} + T_{2, 1} &= 0 \\ T_{1, 0} - 4 T_{2, 0} + T_{3, 0} + 2 \Delta y \frac{\partial T}{\partial y} + 2 T_{2, 1} &= 0 \end{align*}

\begin{align*} T_{1, 0} - 4 T_{2, 0} + T_{3, 0} + 2 (1) (0) + 2 T_{2, 1} &= 0 \\ T_{1, 0} - 4 T_{2, 0} + 2 T_{2, 1} + T_{3, 0} &= 0 \end{align*}

Nodo (3,0)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 0} - 4 T_{3, 0} + T_{3+1, 0} + T_{3, 0-1} + T_{3, 0+1} &= 0 \\ T_{2, 0} - 4 T_{3, 0} + T_{4, 0} + T_{3, -1} + T_{3, 1} &= 0 \end{align*}

aproximando $T_{y}$ con una diferencia finita centrada

\begin{equation*} \frac{\partial T}{\partial y} = \frac{T_{i, j-1} - T_{i, j+1}}{2 \Delta y} = \frac{T_{3, 0-1} - T_{3, 0+1}}{2 \Delta y} = \frac{T_{3, -1} - T_{3, 1}}{2 \Delta y} \end{equation*}

despejando $T_{3, -1}$

\begin{equation*} T_{3, -1} = 2 \Delta y \frac{\partial T}{\partial y} + T_{3, 1} \end{equation*}

reemplazando

\begin{align*} T_{2, 0} - 4 T_{3, 0} + T_{4, 0} + 2 \Delta y \frac{\partial T}{\partial y} + T_{3, 1} + T_{3, 1} &= 0 \\ T_{2, 0} - 4 T_{3, 0} + T_{4, 0} + 2 \Delta y \frac{\partial T}{\partial y} + 2 T_{3, 1} &= 0 \end{align*}

\begin{align*} T_{2, 0} - 4 T_{3, 0} + 50 + 2 (1) (0) + 2 T_{3, 1} &= 0 \\ T_{2, 0} - 4 T_{3, 0} + 2 T_{3, 1} &= -50 \end{align*}

Nodo (1,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 1} - 4 T_{1, 1} + T_{1+1, 1} + T_{1, 1-1} + T_{1, 1+1} &= 0 \\ T_{0, 1} - 4 T_{1, 1} + T_{2, 1} + T_{1, 0} + T_{1, 2} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 1} + T_{2, 1} + T_{1, 0} + T_{1, 2} &= 0 \\ T_{1, 0} - 4 T_{1, 1} + T_{1, 2} + T_{2, 1} &= -75 \end{align*}

Nodo (2,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 1} - 4 T_{2, 1} + T_{2+1, 1} + T_{2, 1-1} + T_{2, 1+1} &= 0 \\ T_{1, 1} - 4 T_{2, 1} + T_{3, 1} + T_{2, 0} + T_{2, 2} &= 0 \end{align*}

\begin{align*} T_{1, 1} + T_{2, 0} - 4 T_{2, 1} + T_{2, 2} + T_{3, 1} &= 0 \end{align*}

Nodo (3,1)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 1} - 4 T_{3, 1} + T_{3+1, 1} + T_{3, 1-1} + T_{3, 1+1} &= 0 \\ T_{2, 1} - 4 T_{3, 1} + T_{4, 1} + T_{3, 0} + T_{3, 2} &= 0 \end{align*}

\begin{align*} T_{2, 1} - 4 T_{3, 1} + 50 + T_{3, 0} + T_{3, 2} &= 0 \\ T_{2, 1} + + T_{3, 0} - 4 T_{3, 1} + T_{3, 2} &= -50 \end{align*}

Nodo (1,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 2} - 4 T_{1, 2} + T_{1+1, 2} + T_{1, 2-1} + T_{1, 2+1} &= 0 \\ T_{0, 2} - 4 T_{1, 2} + T_{2, 2} + T_{1, 1} + T_{1, 3} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 2} + T_{2, 2} + T_{1, 1} + T_{1, 3} &= 0 \\ T_{1, 1} - 4 T_{1, 2} + T_{1, 3} + T_{2, 2} &= -75 \end{align*}

Nodo (2,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 2} - 4 T_{2, 2} + T_{2+1, 2} + T_{2, 2-1} + T_{2, 2+1} &= 0 \\ T_{1, 2} - 4 T_{2, 2} + T_{3, 2} + T_{2, 1} + T_{2, 3} &= 0 \end{align*}

\begin{align*} T_{1, 2} + T_{2, 1} - 4 T_{2, 2} + T_{2, 3} + T_{3, 2} &= 0 \end{align*}

Nodo (3,2)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 2} - 4 T_{3, 2} + T_{3+1, 2} + T_{3, 2-1} + T_{3, 2+1} &= 0 \\ T_{2, 2} - 4 T_{3, 2} + T_{4, 2} + T_{3, 1} + T_{3, 3} &= 0 \end{align*}

\begin{align*} T_{2, 2} - 4 T_{3, 2} + 50 + T_{3, 1} + T_{3, 3} &= 0 \\ T_{2, 2} + T_{3, 1} - 4 T_{3, 2} + T_{3, 3} &= -50 \end{align*}

Nodo (1,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{1-1, 3} - 4 T_{1, 3} + T_{1+1, 3} + T_{1, 3-1} + T_{1, 3+1} &= 0 \\ T_{0, 3} - 4 T_{1, 3} + T_{2, 3} + T_{1, 2} + T_{1, 4} &= 0 \end{align*}

\begin{align*} 75 - 4 T_{1, 3} + T_{2, 3} + T_{1, 2} + 100 &= 0 \\ T_{1, 2} - 4 T_{1, 3} + T_{2, 3} &= -175 \end{align*}

Nodo (2,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{2-1, 3} - 4 T_{2, 3} + T_{2+1, 3} + T_{2, 3-1} + T_{2, 3+1} &= 0 \\ T_{1, 3} - 4 T_{2, 3} + T_{3, 3} + T_{2, 2} + T_{2, 4} &= 0 \end{align*}

\begin{align*} T_{1, 3} - 4 T_{2, 3} + T_{3, 3} + T_{2, 2} + 100 &= 0 \\ T_{1, 3} + T_{2, 2} - 4 T_{2, 3} + T_{3, 3} &= -100 \end{align*}

Nodo (3,3)

\begin{align*} T_{i-1, j} - 4 T_{i, j} + T_{i+1, j} + T_{i, j-1} + T_{i, j+1} &= 0 \\ T_{3-1, 3} - 4 T_{3, 3} + T_{3+1, 3} + T_{3, 3-1} + T_{3, 3+1} &= 0 \\ T_{2, 3} - 4 T_{3, 3} + T_{4, 3} + T_{3, 2} + T_{3, 4} &= 0 \end{align*}

\begin{align*} T_{2, 3} - 4 T_{3, 3} + 50 + T_{3, 2} + 100 &= 0 \\ T_{2, 3} + T_{3, 2} - 4 T_{3, 3} &= -150 \end{align*}

Sistema de ecuaciones del problema

\begin{align*} - 4 T_{1, 0} + 2 T_{1, 1} + T_{2, 0} &= -75 \\ T_{1, 0} - 4 T_{2, 0} + 2 T_{2, 1} + T_{3, 0} &= 0 \\ T_{2, 0} - 4 T_{3, 0} + 2 T_{3, 1} &= -50 \\ T_{1, 0} - 4 T_{1, 1} + T_{1, 2} + T_{2, 1} &= -75 \\ T_{1, 1} + T_{2, 0} - 4 T_{2, 1} + T_{2, 2} + T_{3, 1} &= 0 \\ T_{2, 1} + + T_{3, 0} - 4 T_{3, 1} + T_{3, 2} &= -50 \\ T_{1, 1} - 4 T_{1, 2} + T_{1, 3} + T_{2, 2} &= -75 \\ T_{1, 2} + T_{2, 1} - 4 T_{2, 2} + T_{2, 3} + T_{3, 2} &= 0 \\ T_{2, 2} + T_{3, 1} - 4 T_{3, 2} + T_{3, 3} &= -50 \\ T_{1, 2} - 4 T_{1, 3} + T_{2, 3} &= -175 \\ T_{1, 3} + T_{2, 2} - 4 T_{2, 3} + T_{3, 3} &= -100 \\ T_{2, 3} + T_{3, 2} - 4 T_{3, 3} &= -150 \end{align*}

en forma matricial

\begin{equation*} \begin{bmatrix} -4 & 2 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & -4 & 2 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & -4 & 2 & 0 & 0 \\ 1 & -4 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 1 & -4 & 1 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & -4 & 1 & 0 \\ 0 & 1 & -4 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 1 & -4 & 1 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & -4 & 1 \\ 0 & 0 & 1 & -4 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 1 & -4 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & -4 \end{bmatrix} \begin{bmatrix} T_{1,0} \\ T_{1,1} \\ T_{1,2} \\ T_{1,3} \\ T_{2,0} \\ T_{2,1} \\ T_{2,2} \\ T_{2,3} \\ T_{3,0} \\ T_{3,1} \\ T_{3,2} \\ T_{3,3} \end{bmatrix} = \begin{bmatrix} -75 \\ 0 \\ -50 \\ -75 \\ 0 \\ -50 \\ -75 \\ 0 \\ -50 \\ -175 \\ -100 \\ -150 \end{bmatrix} \end{equation*}

In [5]:
C = [[-4 2 0 0 1 0 0 0 0 0 0 0],
    [1 0 0 0 -4 2 0 0 1 0 0 0],
    [0 0 0 0 1 0 0 0 -4 2 0 0],
    [1 -4 1 0 0 1 0 0 0 0 0 0],
    [0 1 0 0 1 -4 1 0 0 1 0 0],
    [0 0 0 0 0 1 0 0 1 -4 1 0],
    [0 1 -4 1 0 0 1 0 0 0 0 0],
    [0 0 1 0 0 1 -4 1 0 0 1 0],
    [0 0 0 0 0 0 1 0 0 1 -4 1],
    [0 0 1 -4 0 0 0 1 0 0 0 0],
    [0 0 0 1 0 0 1 -4 0 0 0 1],
    [0 0 0 0 0 0 0 1 0 0 1 -4]];

In [6]:
D = [[-75],
    [0],
    [-50],
    [-75],
    [0],
    [-50],
    [-75],
    [0],
    [-50],
    [-175],
    [-100],
    [-150]];

In [7]:
u = inv(C)*D;

In [8]:
u = transpose(reshape(u, 4,3))

for i=1:3
    for j=1:4
        println("T[$i,$(j-1)] = $(u[i,j])")
    end
end


T[1,0] = 71.9073553216478
T[1,1] = 72.8074388953829
T[1,2] = 76.01510157957134
T[1,3] = 83.41092594700703
T[2,0] = 67.01454349582546
T[2,1] = 68.3072986803124
T[2,2] = 72.84204147589548
T[2,3] = 82.62860220845677
T[3,0] = 59.53622130102927
T[3,1] = 60.565170854145784
T[3,2] = 64.41716343524146
T[3,3] = 74.26144141092456