# Heat equation with heat radiation and heat transfer

If I want to calculate steady temperature distribution on a one-dimensional stick, and I need to consider both the heat radiation and heat transfer, then my equation will be in the form: $$\frac{\partial ^2 T}{\partial x^2}=A(T^4-T_{env}^4) + B(T-T_{env}).$$

$T_{env}$ is the environment temperature which varies at different places.

Is there any algorithm that can solve this kind of equation numerically? Most of numerical algorithms focus on equation like $H\phi=a\phi$.

Suppose you have 5 cells with 1 ghost cell (related to your particular boundary conditions, whatever they may be) on either side. In this case, you can write your steady-state heat equation as \begin{align} T_0-2T_1+T_2 &= dx^2\,f(T_1)\\ T_1-2T_2+T_3 &= dx^2\,f(T_2)\\ T_2-2T_3+T_4 &= dx^2\,f(T_3)\tag{1}\\ T_3-2T_4+T_5 &= dx^2\,f(T_4)\\ T_4-2T_5+T_6 &= dx^2\,f(T_5)\\ \end{align} where $$f(T_i)=A\left(T_i^4-T_{ext}^4\right) + B\left(T_i-T_{ext}\right)\tag{2}$$ Equation (1) can be expressed as the matrix operation $$\left(\begin{array}{ccccc}1 & -2 & 1 & 0 & 0 &0&0\\ 0 & 1 & -2 & 1 & 0 &0&0\\ 0 & 0 & 1 & -2 & 1 &0&0\\ 0& 0 & 0 & 1 & -2 & 1 &0\\ 0&0& 0 & 0 & 1 & -2 & 1 \\ \end{array}\right)\left(\begin{array}{c}T_0\\T_1\\T_2\\T_3\\T_4\\T_5\\T_6\end{array}\right)=dx^2\left(\begin{array}{c}f(T_0)\\f(T_1)\\f(T_2)\\f(T_3)\\f(T_4)\\f(T_5)\\f(T_6)\end{array}\right)$$ This means that your equation really takes the form, $$\mathbb A\mathbf T=\mathbf b$$ where $\mathbb A$ is a tridiagonal matrix, $\mathbf T$ are your temperatures and $\mathbf b=f(\mathbf T)$ a vector of Equation (2). This is effectively a system of linear equations.