# [SOLVED]Heat Equation

#### dwsmith

##### Well-known member
Is this correct?

$$\text{B.C.}=\begin{cases} T_x(0,t) = 0\\ T(\pi,t) = 1 \end{cases}$$
The I.C. is $T(x,0) = 0$.

The equation is $\frac{1}{\alpha}T_t = T_{xx}$.$$\varphi(x) = A\cos\lambda x + B\frac{\sin\lambda x}{\lambda}$$
and
$$\psi(t) = C\exp\left(-\alpha\lambda^2t\right).$$
First, let's solve the steady state solution, $\varphi_{\text{ss}}'' = 0\Rightarrow\varphi_{\text{ss}} = ax + b$.
From the boundary conditions, we have that $\varphi_{\text{ss}}' = a = 0$ and $\varphi_{\text{ss}} = b = 1$.
So
$$\varphi_{\text{ss}}(x) = 1$$
which satisfy both boundary conditions.
Next, let's solve the transient problem.
Then we have that $\varphi' = -\lambda A\sin\lambda x + B\cos\lambda x$.
Using the homogeneous boundary condition, we have that $B = 0$.
So we are left with $\varphi(x) = A\cos\lambda x$.
Next, we have
$$\cos\lambda L = 0\Rightarrow\lambda = \left(n + \frac{1}{2}\right)\frac{\pi}{L},\quad n\in\mathbb{Z}^+.$$
Our general solution is of the form
$$T(x,t) = 1 + \sum_{n = 1}^{\infty}A_n\cos\left[\left(n + \frac{1}{2}\right)\frac{\pi x}{L}\right]\exp\left[-\alpha\left(n + \frac{1}{2}\right)^2\frac{\pi^2}{L^2}t\right].$$
Using the initial condition, we have $\int_0^{\pi}[f(x) - 1]\cos\left[\left(n + \frac{1}{2}\right)\frac{\pi x}{L}\right]dx = \frac{L}{2}A_n\iff A_n = (-1)^n\frac{4}{\pi(2n + 1)}$.
Finally, we have that the solution to heat equation with the prescribed is
$$T(x,t) = 1 + \frac{4}{\pi}\sum_{n = 1}^{\infty}\frac{(-1)^n}{2n + 1}\cos\left[\left(n + \frac{1}{2}\right)\frac{\pi x}{L}\right]\exp\left[-\alpha\left(n + \frac{1}{2}\right)^2\frac{\pi^2}{L^2}t\right].$$
For the special case of when $\alpha = 1$ and $L = \pi$, we have
$$T(x,t) = 1 + \frac{4}{\pi}\sum_{n = 1}^{\infty}\frac{(-1)^n}{2n + 1}\cos\left[\left(n + \frac{1}{2}\right)x\right]\exp\left[-\left(n + \frac{1}{2}\right)^2t\right].$$

Last edited:

#### dwsmith

##### Well-known member
Assuming this is correct. How do I plot a sequence of the temperature profiles between the initial state and the steady-state?

Last edited:

#### dwsmith

##### Well-known member
Assuming this is correct. How do I plot a sequence of the temperature profiles between the initial state and the steady-state?
Would this be it?
View attachment 357