#### 3.1.4 Finite domain (bar), Periodic BC

##### 3.1.4.1 [212] Periodic BC (general case). IC given

problem number 212

Solve the heat equation $u_t = k u_{xx}$ For $$-L<x<L$$ and $$t>0$$. The boundary conditions are periodic \begin {align*} u(-L,t) &= u(L,t) \\ \frac { \partial u}{\partial x}(-L,t) &= \frac { \partial u}{\partial x}(L,t) \end {align*}

And initial conditions $$u(x,0)=f(x)$$

Mathematica

$\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {e^{-\frac {k \pi ^2 t K[1]^2}{L^2}} \left (\cos \left (\frac {\pi x K[1]}{L}\right ) \int _{-L}^L \frac {\cos \left (\frac {\pi x K[1]}{L}\right ) f(x)}{\sqrt {L}} \, dx+\left (\int _{-L}^L \frac {f(x) \sin \left (\frac {\pi x K[1]}{L}\right )}{\sqrt {L}} \, dx\right ) \sin \left (\frac {\pi x K[1]}{L}\right )\right )}{\sqrt {L}}+\frac {\int _{-L}^L \frac {f(x)}{\sqrt {2} \sqrt {L}} \, dx}{\sqrt {2} \sqrt {L}}\right \}\right \}$

Maple

$u \left (x , t\right ) = \frac {2 L \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\left (\int _{-L}^{L}\cos \left (\frac {\pi n x}{L}\right ) f (x )d x \right ) \cos \left (\frac {\pi n x}{L}\right )+\left (\int _{-L}^{L}f (x ) \sin \left (\frac {\pi n x}{L}\right )d x \right ) \sin \left (\frac {\pi n x}{L}\right )\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}}}{L}\right )+\int _{-L}^{L}f (x )d x}{2 L}$

________________________________________________________________________________________

##### 3.1.4.2 [213] Periodic BC (general case). No IC given

problem number 213

Solve the heat equation $u_t = k u_{xx}$ For $$-\pi <x<\pi$$ and $$t>0$$. The boundary conditions are periodic \begin {align*} u(-\pi ,t) &= u(\pi ,t) \\ \frac { \partial u}{\partial x}(-\pi ,t) &= \frac { \partial u}{\partial x}(\pi ,t) \end {align*}

No initial conditions give.

Mathematica

$\{\{u(x,t)\to c_1\}\}$

Maple

\begin {align*} & u \left (x , t\right ) = c_{3} \left (c_{1} {\mathrm e}^{i x}+c_{2} {\mathrm e}^{-i x}\right ) {\mathrm e}^{-k t}\\& u \left (x , t\right ) = c_{3} \left (c_{1}+c_{2}\right )\\ \end {align*}

Hand solution

Solve the heat equation $$u_{t}=ku_{xx}$$ with periodic boundary conditions $$u\left ( t,-\pi \right ) =u\left ( t,\pi \right ) ,u_{x}\left ( t,-\pi \right ) =u_{x}\left ( t,\pi \right )$$

Solution

Using separation of variables, Let $$u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right )$$. Substituting this into $$u_{t}=ku_{xx}$$ gives $$T^{\prime }X=TX^{\prime \prime }$$. Dividing by $$XT\neq 0$$ gives$\frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda$ Where $$\lambda$$ is the seperation constant. This gives the following ODE’s to solve\begin {align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ T^{\prime }\left ( t\right ) +\lambda kT\left ( t\right ) & =0 \end {align*}

Where $$\lambda$$ is the separation constant. Eigenfunctions are solutions to the spatial ODE. \begin {equation} X\left ( x\right ) =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x} \tag {1} \end {equation} To determine the actual eigenfunctions and eigenvalues, boundary conditions are used. Starting with the spatial ODE above, and transferring the boundary condition to $$X$$, it becomes\begin {align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ X\left ( -\pi \right ) & =X\left ( \pi \right ) \\ X^{\prime }\left ( -\pi \right ) & =X^{\prime }\left ( \pi \right ) \end {align*}

This is an eigenvalue boundary value problem. The solution is\begin {equation} X\left ( x\right ) =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x} \tag {1} \end {equation} case $$\lambda <0$$

Since $$\lambda <0$$, then $$-\lambda$$ is positive. Let $$\mu =-\lambda$$, where $$\mu$$ is now positive. The solution (1) becomes$X\left ( x\right ) =c_{1}e^{\sqrt {\mu }x}+c_{2}e^{-\sqrt {\mu }x}$ The above can be written as\begin {equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt {\mu }x\right ) +c_{2}\sinh \left ( \sqrt {\mu }x\right ) \tag {2} \end {equation} Applying ﬁrst B.C. $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ using (2) gives\begin {align*} c_{1}\cosh \left ( \sqrt {\mu }\pi \right ) +c_{2}\sinh \left ( -\sqrt {\mu }\pi \right ) & =c_{1}\cosh \left ( \sqrt {\mu }\pi \right ) +c_{2}\sinh \left ( \sqrt {\mu }\pi \right ) \\ c_{2}\sinh \left ( -\sqrt {\mu }\pi \right ) & =c_{2}\sinh \left ( \sqrt {\mu }\pi \right ) \end {align*}

But $$\sinh$$ is only zero when its argument is zero which is not the case here. Therefore the above implies that $$c_{2}=0$$. The solution (2) now reduces to\begin {equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt {\mu }x\right ) \tag {3} \end {equation} Taking derivative gives\begin {equation} X^{\prime }\left ( x\right ) =c_{1}\sqrt {\mu }\sinh \left ( \sqrt {\mu }x\right ) \tag {4} \end {equation} Applying the second BC $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ using (4) gives$c_{1}\sqrt {\mu }\sinh \left ( -\sqrt {\mu }\pi \right ) =c_{1}\sqrt {\mu }\sinh \left ( \sqrt {\mu }x\right )$ But $$\sinh$$ is only zero when its argument is zero which is not the case here. Therefore the above implies that $$c_{1}=0$$. This means a trivial solution. Therefore $$\lambda <0$$ is not an eigenvalue.

case $$\lambda =0$$

In this case the solution is $$X\left ( x\right ) =c_{1}+c_{2}x$$. Applying ﬁrst BC $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ gives\begin {align*} c_{1}-c_{2}\pi & =c_{1}+c_{2}\pi \\ -c_{2}\pi & =c_{2}\pi \end {align*}

This gives $$c_{2}=0$$. The solution now becomes $$X\left ( x\right ) =c_{1}$$ and $$X^{\prime }\left ( x\right ) =0$$. Applying the second boundary conditions $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ is not satisﬁes ($$0=0$$). Therefore $$\lambda =0$$ is an eigenvalue with eigenfunction $$X_{0}\left ( 0\right ) =1$$ (selected $$c_{1}=1$$ since an arbitrary constant).

case $$\lambda >0$$

The solution in this case is \begin {align*} X\left ( x\right ) & =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x}\\ & =c_{1}e^{i\sqrt {\lambda }x}+c_{2}e^{-i\sqrt {\lambda }x} \end {align*}

Which can be rewritten as (the constants $$c_{1},c_{2}$$ below will be diﬀerent than the above $$c_{1},c_{2}$$, but kept the same name for simplicity).\begin {equation} X\left ( x\right ) =c_{1}\cos \left ( \sqrt {\lambda }x\right ) +c_{2}\sin \left ( \sqrt {\lambda }x\right ) \tag {5} \end {equation} Applying ﬁrst B.C. $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ using the above gives\begin {align*} c_{1}\cos \left ( \sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( -\sqrt {\lambda }\pi \right ) & =c_{1}\cos \left ( \sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \\ c_{2}\sin \left ( -\sqrt {\lambda }\pi \right ) & =c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \end {align*}

There are two choices here. If $$\sin \left ( -\sqrt {\lambda }\pi \right ) \neq \sin \left ( \sqrt {\lambda }\pi \right )$$, then this implies that $$c_{2}=0$$. If $$\sin \left ( -\sqrt {\lambda }\pi \right ) =\sin \left ( \sqrt {\lambda }\pi \right )$$ then $$c_{2}\neq 0$$. Assuming for now that $$\sin \left ( -\sqrt {\lambda }\pi \right ) =\sin \left ( \sqrt {\lambda }\pi \right )$$. This happens when $$\sqrt {\lambda }\pi =n\pi ,n=1,2,3,\cdots$$, or $\lambda _{n}=n^{2}\qquad n=1,2,3,\cdots$ Using this choice, we will now look to see what happens using the second BC. The solution (5) now becomes$X\left ( x\right ) =c_{1}\cos \left ( nx\right ) +c_{2}\sin \left ( nx\right ) \qquad n=1,2,3,\cdots$ Therefore$X^{\prime }\left ( x\right ) =-c_{1}n\sin \left ( nx\right ) +c_{2}n\cos \left ( nx\right )$ Applying the second BC $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ using the above gives\begin {align*} c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) \\ c_{1}n\sin \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) \\ 0 & =0 \end {align*}

Since $$n$$ is integer. Therefore this means that using $$\lambda _{n}=n^{2}$$ will satisfy both boundary conditions with $$c_{2}\neq 0,c_{1}\neq 0$$. This means the solution (5) becomes$X_{n}\left ( x\right ) =A_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \qquad \qquad n=1,2,3,\cdots$ The above says that there are two eigenfunctions in this case. They are $X_{n}\left ( x\right ) =\left \{ \begin {array} [c]{c}\cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end {array} \right .$ Since there is also zero eigenvalue, then the complete set of eigenfunctions become$X_{n}\left ( x\right ) =\left \{ \begin {array} [c]{c}1\\ \cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end {array} \right .$ Now that the eigenvalues are found, the solution to the time ODE can be found. Recalling that the time ODE from above was found to be $T^{\prime }\left ( t\right ) +\lambda kT\left ( t\right ) =0$ For the zero eigenvalue case, the above reduces to $$T^{\prime }\left ( t\right ) =0$$ which has the solution $$T_{0}\left ( t\right ) =C_{0}$$. For non zero eigenvalues $$\lambda _{n}=n^{2}$$, the ODE becomes $$T^{\prime }\left ( t\right ) +n^{2}T\left ( t\right ) =0$$, whose solution is $$T_{0}\left ( t\right ) =C_{n}e^{-kn^{2}t}$$.

Putting all the above together, gives the fundamental solution as$u_{n}\left ( x,t\right ) =\left \{ \begin {array} [c]{c}C_{0}\\ C_{n}\cos \left ( nx\right ) e^{-kn^{2}t}\qquad \qquad n=1,2,3,\cdots \\ B_{n}\sin \left ( nx\right ) e^{-kn^{2}t}\qquad \qquad n=1,2,3,\cdots \end {array} \right .$ Therefore the complete solution is the sum of the above solutions $u\left ( x,t\right ) =C_{0}+\sum _{n=1}^{\infty }e^{-kn^{2}t}\left ( C_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \right )$ The constants $$C_{0},C_{n},B_{n}$$ can be found from initial conditions.

________________________________________________________________________________________

##### 3.1.4.3 [214] Periodic BC (general case). Damped heat PDE. No IC given

problem number 214

Solve the heat equation $u_t = k u_{xx} -u(x,t)$ For $$-\pi <x<\pi$$ and $$t>0$$. The boundary conditions are periodic \begin {align*} u(-\pi ,t) &= u(\pi ,t) \\ \frac { \partial u}{\partial x}(-\pi ,t) &= \frac { \partial u}{\partial x}(\pi ,t) \end {align*}

No initial conditions give.

Mathematica

Failed

Maple

\begin {align*} & u \left (x , t\right ) = c_{3} \left (c_{1} {\mathrm e}^{i x}+c_{2} {\mathrm e}^{-i x}\right ) {\mathrm e}^{-\left (k +1\right ) t}\\& u \left (x , t\right ) = c_{3} \left (c_{1}+c_{2}\right ) {\mathrm e}^{-t}\\ \end {align*}

Hand solution

Solve the heat equation $$u_{t}=ku_{xx}-u$$ with periodic boundary conditions $$u\left ( t,-\pi \right ) =u\left ( t,\pi \right ) ,u_{x}\left ( t,-\pi \right ) =u_{x}\left ( t,\pi \right )$$

Solution

Using separation of variables, Let $$u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right )$$. Substituting this into $$u_{t}=ku_{xx}$$ gives $$T^{\prime }X=TX^{\prime \prime }$$. Dividing by $$XT\neq 0$$ gives$\frac {1}{k}\frac {T^{\prime }}{T}+XT=\frac {X^{\prime \prime }}{X}=-\lambda$ Where $$\lambda$$ is the seperation constant. This gives the following ODE’s to solve\begin {align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ T^{\prime }\left ( t\right ) +k\left ( 1+\lambda \right ) T\left ( t\right ) & =0 \end {align*}

Where $$\lambda$$ is the separation constant. Eigenfunctions are solutions to the spatial ODE. \begin {equation} X\left ( x\right ) =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x}\tag {1} \end {equation} To determine the actual eigenfunctions and eigenvalues, boundary conditions are used. Transferring the boundary condition to $$X$$, it becomes\begin {align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ X\left ( -\pi \right ) & =X\left ( \pi \right ) \\ X^{\prime }\left ( -\pi \right ) & =X^{\prime }\left ( \pi \right ) \end {align*}

This is an eigenvalue boundary value problem. The solution is\begin {equation} X\left ( x\right ) =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x}\tag {1} \end {equation} case $$\lambda <0$$

Since $$\lambda <0$$, then $$-\lambda$$ is positive. Let $$\mu =-\lambda$$, where $$\mu$$ is now positive. The solution (1) becomes$X\left ( x\right ) =c_{1}e^{\sqrt {\mu }x}+c_{2}e^{-\sqrt {\mu }x}$ The above can be written as\begin {equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt {\mu }x\right ) +c_{2}\sinh \left ( \sqrt {\mu }x\right ) \tag {2} \end {equation} Applying ﬁrst B.C. $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ using (2) gives\begin {align*} c_{1}\cosh \left ( \sqrt {\mu }\pi \right ) +c_{2}\sinh \left ( -\sqrt {\mu }\pi \right ) & =c_{1}\cosh \left ( \sqrt {\mu }\pi \right ) +c_{2}\sinh \left ( \sqrt {\mu }\pi \right ) \\ c_{2}\sinh \left ( -\sqrt {\mu }\pi \right ) & =c_{2}\sinh \left ( \sqrt {\mu }\pi \right ) \end {align*}

But $$\sinh$$ is only zero when its argument is zero which is not the case here. Therefore the above implies that $$c_{2}=0$$. The solution (2) now reduces to\begin {equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt {\mu }x\right ) \tag {3} \end {equation} Taking derivative gives\begin {equation} X^{\prime }\left ( x\right ) =c_{1}\sqrt {\mu }\sinh \left ( \sqrt {\mu }x\right ) \tag {4} \end {equation} Applying the second BC $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ using (4) gives$c_{1}\sqrt {\mu }\sinh \left ( -\sqrt {\mu }\pi \right ) =c_{1}\sqrt {\mu }\sinh \left ( \sqrt {\mu }x\right )$ But $$\sinh$$ is only zero when its argument is zero which is not the case here. Therefore the above implies that $$c_{1}=0$$. This means a trivial solution. Therefore $$\lambda <0$$ is not an eigenvalue.

case $$\lambda =0$$

In this case the solution is $$X\left ( x\right ) =c_{1}+c_{2}x$$. Applying ﬁrst BC $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ gives\begin {align*} c_{1}-c_{2}\pi & =c_{1}+c_{2}\pi \\ -c_{2}\pi & =c_{2}\pi \end {align*}

This gives $$c_{2}=0$$. The solution now becomes $$X\left ( x\right ) =c_{1}$$ and $$X^{\prime }\left ( x\right ) =0$$. Applying the second boundary conditions $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ is not satisﬁes ($$0=0$$). Therefore $$\lambda =0$$ is an eigenvalue with eigenfunction $$X_{0}\left ( 0\right ) =1$$ (selected $$c_{1}=1$$ since an arbitrary constant).

case $$\lambda >0$$

The solution in this case is \begin {align*} X\left ( x\right ) & =c_{1}e^{\sqrt {-\lambda }x}+c_{2}e^{-\sqrt {-\lambda }x}\\ & =c_{1}e^{i\sqrt {\lambda }x}+c_{2}e^{-i\sqrt {\lambda }x} \end {align*}

Which can be rewritten as (the constants $$c_{1},c_{2}$$ below will be diﬀerent than the above $$c_{1},c_{2}$$, but kept the same name for simplicity).\begin {equation} X\left ( x\right ) =c_{1}\cos \left ( \sqrt {\lambda }x\right ) +c_{2}\sin \left ( \sqrt {\lambda }x\right ) \tag {5} \end {equation} Applying ﬁrst B.C. $$X\left ( -\pi \right ) =X\left ( \pi \right )$$ using the above gives\begin {align*} c_{1}\cos \left ( \sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( -\sqrt {\lambda }\pi \right ) & =c_{1}\cos \left ( \sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \\ c_{2}\sin \left ( -\sqrt {\lambda }\pi \right ) & =c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \end {align*}

There are two choices here. If $$\sin \left ( -\sqrt {\lambda }\pi \right ) \neq \sin \left ( \sqrt {\lambda }\pi \right )$$, then this implies that $$c_{2}=0$$. If $$\sin \left ( -\sqrt {\lambda }\pi \right ) =\sin \left ( \sqrt {\lambda }\pi \right )$$ then $$c_{2}\neq 0$$. Assuming for now that $$\sin \left ( -\sqrt {\lambda }\pi \right ) =\sin \left ( \sqrt {\lambda }\pi \right )$$. Then happens when $$\sqrt {\lambda }\pi =n\pi ,n=1,2,3,\cdots$$, or $\lambda _{n}=n^{2}\qquad n=1,2,3,\cdots$ Using this choice, we will now look to see what happens using the second BC. The solution (5) now becomes$X\left ( x\right ) =c_{1}\cos \left ( nx\right ) +c_{2}\sin \left ( nx\right ) \qquad n=1,2,3,\cdots$ Therefore$X^{\prime }\left ( x\right ) =-c_{1}n\sin \left ( nx\right ) +c_{2}n\cos \left ( nx\right )$ Applying the second BC $$X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right )$$ using the above gives\begin {align*} c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) \\ c_{1}n\sin \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) \\ 0 & =0 \end {align*}

Since $$n$$ is integer. Therefore this means that using $$\lambda _{n}=n^{2}$$ will satisfy both boundary conditions with $$c_{2}\neq 0,c_{1}\neq 0$$. This means the solution (5) becomes$X_{n}\left ( x\right ) =A_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \qquad \qquad n=1,2,3,\cdots$ The above says that there are two eigenfunctions in this case. They are $X_{n}\left ( x\right ) =\left \{ \begin {array} [c]{c}\cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end {array} \right .$ Since there is also zero eigenvalue, then the complete set of eigenfunctions become$X_{n}\left ( x\right ) =\left \{ \begin {array} [c]{c}1\\ \cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end {array} \right .$ Now that the eigenvalues are found, the solution to the time ODE can be found. Recalling that the time ODE from above was found to be $T^{\prime }\left ( t\right ) +k\left ( \lambda +1\right ) T\left ( t\right ) =0$ For the zero eigenvalue case, the above reduces to $$T^{\prime }\left ( t\right ) +kT\left ( t\right ) =0$$ which has the solution $$T_{0}\left ( t\right ) =C_{0}e^{-kt}$$. For non zero eigenvalues $$\lambda _{n}=n^{2}$$, the ODE becomes $$T^{\prime }\left ( t\right ) +k\left ( n^{2}+1\right ) T\left ( t\right ) =0$$, whose solution is $$T_{0}\left ( t\right ) =C_{n}e^{-k\left ( n^{2}+1\right ) t}$$.

Putting all the above together, gives the fundamental solution as$u_{n}\left ( t,x\right ) =\left \{ \begin {array} [c]{c}C_{0}e^{-kt}\\ C_{n}\cos \left ( nx\right ) e^{-k\left ( n^{2}+1\right ) t}\qquad \qquad n=1,2,3,\cdots \\ B_{n}\sin \left ( nx\right ) e^{-k\left ( n^{2}+1\right ) t}\qquad \qquad n=1,2,3,\cdots \end {array} \right .$ Therefore the complete solution is the sum of the above solutions $u\left ( t,x\right ) =C_{0}e^{-kt}+\sum _{n=1}^{\infty }e^{-k\left ( n^{2}+1\right ) t}\left ( C_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \right )$ The constants $$C_{0},C_{n},B_{n}$$ can be found from initial conditions.

________________________________________________________________________________________