# Analytical solution to complex Heat Equation with Neumann boundary conditions and lateral heat loss

I have solved a PDE in this from numerically on Mathematica, but does anyone know if there is a way to solve the following PDE analytically, an analytical solution would really help me. This is an adapted heat equation accounting for lateral heat loss in a rod of length $0.2$ ${m}$:

$$u_{t} =\alpha u_{xx}-\kappa(u-T_{0})$$

Where:

$\alpha=1.12*10^{-4}$$m^2 s^{-1} \kappa=2.61*10^{-4}$$s^{-1}$

$T_{0}=17$ C

With boundary conditions:

$$u_{x}(0,t) =0$$ $$u_{x}(0.2,t) =0$$

And initial condition:

$$u(x,0)=\begin{cases} 35.6236 + 0.161087e^{59.9842x},0<x<0.1 \\ 35.6236 + 0.161087e^{59.9842 (-x + 0.2)},0.1<x< 0.2 \\ \end{cases}$$

Any help will be much appreciated. Thanks in advanced.

• Taking $w(x,t)=(u(x,t)-T_0) \, e^{\kappa t}$ as your new unknown function will bring you back to the ordinary heat equation, which has a standard solution in terms of Fourer cosine series. – Hans Lundmark Jul 6 '15 at 19:22

The functions $\{ \cos(n\pi x/L) \}_{n=0}^{\infty}$ form a commplete orthogonal set of functions on $[0,L]$. So you can expand $$u(x,t) = \sum_{n=0}^{\infty}c_{n}(t)\cos(n\pi x/L).$$ In order to solve the equation, plug this form into the equation and solve for the coefficient functions $c_{n}(t)$: $$\sum_{n=0}^{\infty}\{c_{n}'(t)+\alpha n^{2}\pi^{2}/L^{2}c_{n}(t)+\kappa c_{n}(t)\}\cos(n\pi x/L)= \kappa T_{0}$$ The right side is a series in the $\cos$ terms where only the coefficient of the constant term is non-zero. Therefore, \begin{align} c_{0}'(t)+\kappa c_{0}(t) & =\kappa T_{0},\\ c_{n}'(t)+(\alpha n^{2}\pi^{2}/L^{2}+\kappa)c_{n}(t) & =0,\;\; n > 0. \end{align} The solutions of these equations involve an initial constant $c_{n}(0)=C_{n}$. For $n=0$: $$(e^{\kappa t}c_{0}(t))'=(e^{\kappa t} T_{0})' \\ e^{\kappa t}c_{0}(t)-C_{0} = T_{0}(e^{\kappa t}-1) \\ c_{0}(t) = C_{0}e^{-\kappa t}+ T_{0}(1-e^{-\kappa t}).$$ For $n > 0$, $$c_{n}(t) = C_{n}e^{-(\alpha n^{2}\pi^{2}/L^{2}+\kappa)t}$$ The last condition to be satisfied is the initial condition $u(x,0)=f(x)$, which becomes $$f(x) = \sum_{n=0}^{\infty}C_{n}\cos(n\pi x/L).$$ Hence, using the orthogonality of the $\cos$ terms, $$\int_{0}^{L}f(x)\cos(m\pi x/L)dx = C_{m}\int_{0}^{L}\cos^{2}(m\pi x/L)dx.$$ Note that $\int_{0}^{L}\cos^{2}(m\pi x/L)dx=L/2$ for $m \ge 1$ and $L$ for $m=0$. The final solution: $$u(x,t) = \sum_{n=1}^{\infty}\left(\frac{2}{L}\int_{0}^{L}f(x)\cos(n\pi x/L)dx\right) e^{-(\alpha n^{2}\pi^{2}/L^{2}+\kappa)t}\cos(n\pi x/L) \\ + \left(\frac{1}{L}\int_{0}^{L}f(x)dx\right)e^{-\kappa t}+ T_{0}(1-e^{-\kappa t}).$$ Check everything. I'm good at errors. :)
• I used $\cos(n\pi x/L)$ for $n=0,1,2,3,\dots$ because these are the eigenfunctions of $-\frac{d^{2}}{dx^{2}}$ for which $f'(0)=f'(L)=0$. Automatically, when normalized to have integral $1$ on $[0,L]$, they become a complete orthonormal basis of $L^{2}[0,L]$, which means everything can be expanded in these functions; and the expansions converge pointwise under standard conditions, except possibly at the endpoints $0$, $L$ because of endpoint conditions. Your function $f$ needs to satisfy $f'(0)=f'(L)=0$ for more uniform convergence, and this is a consistency requirement for your problem, too. – DisintegratingByParts Jul 7 '15 at 1:19
• @DanielManogaran : I forgot to you ping you on the previous remark. Knowing that you can expand every function in this way, you can verify directly that the solution I've given you is correct. However, check the normalization constants for yourself: $\int_{0}^{L}\cos^{2}(n\pi x/L)dx$, but definitely notice that the one for $n=0$ is different from the others. Note: when you have $\sum_{n=0}^{\infty}c_{n}\cos(n\pi x/L)=\sum_{n=0}^{\infty}d_{n}\cos(n\pi x/L)$ for a.e. $x\in[0,L]$, then $c_n=d_n$. – DisintegratingByParts Jul 7 '15 at 1:25
• @TrialAndError Ohh ok so that is why $c_{n}'(t)+(\alpha n^{2}\pi^{2}/L^{2}+\kappa)c_{n}(t) & =0,\;\; n > 0$ Thanks, is there a name or a proof for $\sum_{n=0}^{\infty}r_{n}\cos(n\pi x/L)=\sum_{n=0}^{\infty}s_{n}\cos(n\pi x/L)$? Thank you very much, you really helped me. – daniel17027 Jul 7 '15 at 10:26