3.1.1 Finite domain (bar), Both ends homogeneous BC

   3.1.1.1 [150] General initial conditions
   3.1.1.2 [151] Specific initial condition
   3.1.1.3 [152] IC \(u=x(1-x)\)
   3.1.1.4 [153] Haberman 2.3.3 (a)
   3.1.1.5 [154] IC hat function
   3.1.1.6 [155] Haberman 2.3.3 (b)
   3.1.1.7 [156] Haberman 2.3.3 (c)
   3.1.1.8 [157] Haberman 2.3.3 (d)
   3.1.1.9 [158] domain from -1 to +1
   3.1.1.10 [159] domain from -1 to +1
   3.1.1.11 [160] with source that depends on space only (general case)
   3.1.1.12 [161] with source that depends on space only (special case)
   3.1.1.13 [162] with source that depends on space and time (general case)
   3.1.1.14 [163] with source that depends on space and time (special case)
   3.1.1.15 [164] Math 4567 Exam
   3.1.1.16 [165] With source
   3.1.1.17 [166] special initial condition
   3.1.1.18 [167] Diffusion Reaction and Euler-Cauchy Sturm-Liouville
   3.1.1.19 [168] Diffusion Reaction. Using growth form reaction term
   3.1.1.20 [169] Diffusion Reaction, using logistic form for reaction term
   3.1.1.21 [170] Diffusion Reaction, using Aleee form for reaction term
   3.1.1.22 [171] Diffusion Reaction. Haberman 2.3.8
   3.1.1.23 [172] Diffusion Reaction
   3.1.1.24 [173] Diffusion Reaction
   3.1.1.25 [174] Diffusion Reaction
   3.1.1.26 [175] Diffusion convection (general case)
   3.1.1.27 [176] Diffusion convection (special case)
   3.1.1.28 [177] Haberman 2.4.2 (general case)
   3.1.1.29 [178] Left end zero, right end insulated, no source
   3.1.1.30 [179] One end insulated
   3.1.1.31 [180] Haberman 2.3.7 (general case)
   3.1.1.32 [181] specific case
   3.1.1.33 [182] Haberman 2.4.1 (a)
   3.1.1.34 [183] Both ends insulated, no source
   3.1.1.35 [184] Haberman 2.4.1 (b) (special case)
   3.1.1.36 [185] Haberman 2.4.1 (c) (special case)
   3.1.1.37 [186] Haberman 2.4.1 (d)
   3.1.1.38 [187] both ends insulated
   3.1.1.39 [188] convection heat loss
   3.1.1.40 [189] Pinchover and Rubinstein 6.25
   3.1.1.41 [190] external source
   3.1.1.42 [191] Diffusion Reaction (general case)
   3.1.1.43 [192] Pinchover and Rubinstein 6.23
   3.1.1.44 [193] Pinchover and Rubinstein 6.21
   3.1.1.45 [194] Diffusion Reaction. Euler-Cauchy Sturm-Liouville
   3.1.1.46 [195] convection heat loss
   3.1.1.47 [196] Mixed BC
   3.1.1.48 [197] Haberman 8.2.1 (f)

3.1.1.1 [150] General initial conditions

problem number 150

Added June 9, 2019

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

Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.1:PDE specification

Mathematica


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

Maple


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

Hand solution

Solve

\[ u_{t}=ku_{xx}\] BC\begin {align*} u\left ( 0,t\right ) & =0\qquad t>0\\ u\left ( L,t\right ) & =0\qquad t>0 \end {align*}

Initial conditions\[ u\left ( x,0\right ) =f\left ( x\right ) \qquad 0<x<L \] Solution

Using separation of variables, let \(u\left ( x,t\right ) =X\left ( x\right ) T\left ( t\right ) \). Substituting this back into the PDE gives\begin {align*} T^{\prime }X & =kX^{\prime \prime }T\\ \frac {1}{k}\frac {T^{\prime }}{T} & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}

Where the separation constant is some real value \(-\lambda \). This gives the following two ODE’s to solve\begin {align} T^{\prime }+\lambda kT & =0\tag {1}\\ X^{\prime \prime }+\lambda X & =0 \tag {2} \end {align}

Starting with the spatial ODE in order to obtain the eigenvalues and eigenfunctions. The boundary conditions on the spatial ODE become\begin {align*} X\left ( 0\right ) & =0\\ X\left ( L\right ) & =0 \end {align*}

There are three cases to consider, depending on if \(\lambda <0,\lambda =0,\lambda >0\). Each one of these cases give a different solution.

Case 1 Assuming \(\lambda <0\). Therefore \(-\lambda \) is positive say \(\mu \). The solution (2) can now 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 {3B} \end {equation} Applying left boundary conditions to (3B) gives\[ 0=c_{1}\] The solution (3B) now reduces to\[ X\left ( x\right ) =c_{2}\sinh \left ( \sqrt {\mu }x\right ) \] Applying right side boundary conditions to the above results in\[ 0=c_{2}\sinh \left ( \sqrt {\mu }L\right ) \] But \(\sinh \left ( \sqrt {\mu }L\right ) \neq 0\) since it was assumed \(\mu \) is not zero and \(\sinh \) is only zero when its argument is zero. The only possibility then is that \(c_{2}=0,\) which leads to trivial solution. Therefore \(\lambda <0\) is not an eigenvalue.

Case 2. Assuming \(\lambda =0\). The ODE becomes \(X^{\prime \prime }=0\), which has the solution \[ X\left ( x\right ) =c_{1}x+c_{2}\] Applying left side B.C. gives\[ 0=c_{2}\] The solution now reduces to \[ X\left ( x\right ) =c_{1}x \] Applying right side B.C. gives\[ 0=c_{1}L \] Leading to the trivial solution. Therefore \(\lambda =0\) is not an eigenvalue.

Case 3 Assuming \(\lambda >0\). In this case equation \(\sqrt {-\lambda }\) is complex and solution to equation (2) can be expressed in terms of trig functions using Euler relation which results in\begin {equation} X\left ( x\right ) =c_{1}\cos \left ( \sqrt {\lambda }x\right ) +c_{2}\sin \left ( \sqrt {\lambda }x\right ) \tag {4} \end {equation} Applying left side B.C. gives\[ 0=c_{1}\] Solution (4) now reduces to\begin {equation} X\left ( x\right ) =C_{2}\sin \left ( \sqrt {\lambda }x\right ) \tag {5} \end {equation} Applying right side B.C. gives\[ 0=C_{2}\sin \left ( \sqrt {\lambda }L\right ) \] Non-trivial solution implies \(\sin \left ( \sqrt {\lambda }L\right ) =0\) or \(\sqrt {\lambda }L=n\pi \) for \(n=1,2,3,\cdots \). Therefore the eigenvalues are\[ \lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \] And the corresponding eigenfunctions from (5) are\begin {equation} X_{n}\left ( x\right ) =C_{n}\sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {6} \end {equation} Now that the eigenvalues are known, the solution to the time ODE (1) can be found.\[ T^{\prime }+\lambda _{n}kT=0 \] This has the solution (using an integrating factor method)\begin {equation} T_{n}\left ( t\right ) =e^{-\lambda _{n}kt} \tag {7} \end {equation} The constant of integration is not needed for (7) since it will be absorbed with the constant of integration coming from solution of the spatial ODE (6) when these solutions are multiplied with each others below. Therefore the fundamental solution is\[ u_{n}\left ( x,t\right ) =T_{n}\left ( t\right ) X_{n}\left ( x\right ) \] Linear combination of fundamental solutions is also a solution (since this is a linear PDE). Therefore the general solution is given by\begin {align} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }u_{n}\nonumber \\ & =\sum _{n=1}^{\infty }T_{n}\left ( t\right ) X_{n}\left ( x\right ) \nonumber \\ & =\sum _{n=1}^{\infty }C_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {8} \end {align}

The initial condition is now used to determine \(c_{n}\), . At \(t=0\), \(u\left ( x,0\right ) =f\left ( x\right ) \) and the above becomes\[ f\left ( x\right ) =\sum _{n=1}^{\infty }C_{n}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Multiplying both sides of the above equation by eigenfunction \(\sin \left ( \sqrt {\lambda _{m}}x\right ) \) and integrating over the domain of \(f\left ( x\right ) \) gives\[ \int _{0}^{L}f\left ( x\right ) \sin \left ( \sqrt {\lambda _{m}}x\right ) dx=\int _{0}^{L}\sum _{n=1}^{\infty }C_{n}\sin \left ( \sqrt {\lambda _{n}}x\right ) \sin \left ( \sqrt {\lambda _{m}}x\right ) dx \] Interchanging the order of summation and integration gives\[ \int _{0}^{L}f\left ( x\right ) \sin \left ( \sqrt {\lambda _{m}}x\right ) dx=\sum _{n=1}^{\infty }C_{n}\int _{0}^{L}\sin \left ( \sqrt {\lambda _{n}}x\right ) \sin \left ( \sqrt {\lambda _{m}}x\right ) dx \] By the orthogonality of the sine functions, all terms in the right side vanish except when \(n=m\), leading to\begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \sqrt {\lambda _{m}}x\right ) dx & =C_{m}\int _{0}^{L}\sin ^{2}\left ( \sqrt {\lambda _{m}}x\right ) dx\\ & =C_{m}\frac {L}{2} \end {align*}

Therefore (replacing \(m\) back to \(n\) now, since it is arbitrary)\[ C_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx\qquad n=1,2,3,\cdots \]

Summary of solution \[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }C_{n}e^{-\left ( \frac {n\pi }{L}\right ) ^{2}\lambda _{n}t}\sin \left ( \frac {n\pi }{L}x\right ) \]

________________________________________________________________________________________

3.1.1.2 [151] Specific initial condition

problem number 151

Added June 20, 2019

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

Initial condition is \(u(x,0)=f(x)\) using the following specific values \begin {align*} f(x) &= 100\\ k&=\frac {1}{100}\\ L&=10 \end {align*}

pict
Figure 3.2:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}-\frac {200 \left (-1+(-1)^n\right ) e^{-\frac {n^2 \pi ^2 t}{10000}} \sin \left (\frac {n \pi x}{10}\right )}{n \pi }\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}-\frac {200 \left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{10000}} \sin \left (\frac {\pi n x}{10}\right )}{\pi n}\]

Hand solution

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }C_{n}e^{-\left ( \frac {n\pi }{L}\right ) ^{2}\lambda _{n}t}\sin \left ( \frac {n\pi }{L}x\right ) \\ C_{n} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\qquad n=1,2,3,\cdots \end {align*}

In this case \(L=10,k=\frac {1}{100},f\left ( x\right ) =100\). Hence the solution becomes\begin {align*} C_{n} & =\frac {2}{10}\int _{0}^{10}100\sin \left ( \frac {n\pi }{10}x\right ) dx\\ & =\frac {200}{\pi n}\left ( 1-\cos \left ( n\pi \right ) \right ) \\ & =\frac {200}{\pi n}\left ( 1+\left ( -1\right ) ^{n+1}\right ) \end {align*}

Hence\[ u\left ( x,t\right ) =\frac {200}{\pi }\sum _{n=1}^{\infty }\frac {1}{n}\left ( 1+\left ( -1\right ) ^{n+1}\right ) e^{-\left ( \frac {n\pi }{10}\right ) ^{2}\lambda _{n}t}\sin \left ( \frac {n\pi }{10}x\right ) \] The following is an animation of the solution

Source code used for the above

pict
Figure 3.3:Source code

pict
Figure 3.4:Code for animation

________________________________________________________________________________________

3.1.1.3 [152] IC \(u=x(1-x)\)

problem number 152

Added June 11, 2019

Solve the heat equation \[ u_t = \frac {1}{100} u_{xx} \] For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end {align*}

Initial condition is \(u(x,0)=x(1-x)\)

pict
Figure 3.5:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}-\frac {4 \left (-1+(-1)^n\right ) e^{-\frac {1}{100} n^2 \pi ^2 t} \sin (n \pi x)}{n^3 \pi ^3}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}-\frac {4 \left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{100}} \sin \left (\pi n x \right )}{\pi ^{3} n^{3}}\]

Hand solution

Solve \(u_{t}=\frac {1}{100}u_{xx}\) with \(0<x<1\) and initial conditions \(u\left ( x,0\right ) =x\left ( 1-x\right ) \)

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions. Here \(L=1\) and \(k=\frac {1}{100}\). Hence the solution becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\left ( n\pi \right ) ^{2}t}\sin \left ( n\pi x\right ) \] At \(t=0\)\[ x\left ( 1-x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( n\pi x\right ) \] Multiplying both sides by \(\sin \left ( m\pi x\right ) \) and integrating gives\[ \int _{0}^{1}x\left ( 1-x\right ) \sin \left ( m\pi x\right ) dx=\int _{0}^{1}\sum _{n=1}^{\infty }B_{n}\sin \left ( n\pi x\right ) \sin \left ( m\pi x\right ) dx \] By orthogonality of sin function the above simplifies to\begin {align*} \int _{0}^{1}x\left ( 1-x\right ) \sin \left ( n\pi x\right ) dx & =B_{n}\int _{0}^{1}\sin ^{2}\left ( n\pi x\right ) dx\\ \int _{0}^{1}x\left ( 1-x\right ) \sin \left ( n\pi x\right ) dx & =\frac {1}{2}B_{n} \end {align*}

But \(\int _{0}^{1}x\left ( 1-x\right ) \sin \left ( n\pi x\right ) dx=\frac {2\left ( 1+\left ( -1\right ) ^{n+1}\right ) }{n^{3}\pi ^{3}}\). Hence\[ B_{n}=\frac {4\left ( 1+\left ( -1\right ) ^{n+1}\right ) }{n^{3}\pi ^{3}}\] And the solution becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {4\left ( 1+\left ( -1\right ) ^{n+1}\right ) }{n^{3}\pi ^{3}}e^{-k\left ( n\pi \right ) ^{2}t}\sin \left ( n\pi x\right ) \] This is animation of the solution for \(30\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 3.6:Source code

________________________________________________________________________________________

3.1.1.4 [153] Haberman 2.3.3 (a)

problem number 153

This is problem 2.3.3, part (a) from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation \[ u_t = k u_{xx} \] Subject to boundary conditions \(u(0,t)=0\) and \(u(L,t)=0\) with the temperature initially \(u(x,0)=6 \sin \left ( \frac {9 \pi x}{L} \right )\)

pict
Figure 3.7:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to 6 e^{-\frac {81 \pi ^2 k t}{L^2}} \sin \left (\frac {9 \pi x}{L}\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 6 \,{\mathrm e}^{-\frac {81 \pi ^{2} k t}{L^{2}}} \sin \left (\frac {9 \pi x}{L}\right )\]

Hand solution

Solve \(u_{t}=ku_{xx}\) with \(0<x<L\) and initial conditions \(u\left ( x,0\right ) =6\sin \left ( \frac {9\pi x}{L}\right ) \).

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions. At \(t=0\)\[ 6\sin \left ( \frac {9\pi x}{L}\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] For \(n=9\)\[ 6\sin \left ( \frac {9\pi x}{L}\right ) =B_{9}\sin \left ( \frac {9\pi }{L}x\right ) \] Hence \(B_{9}=6\) and all other terms are zero. Therefore the solution is\begin {align*} u\left ( x,t\right ) & =B_{9}\sin \left ( \sqrt {\lambda _{9}}x\right ) e^{-k\lambda _{9}t}\\ & =6\sin \left ( \frac {9\pi }{L}x\right ) e^{-k\left ( \frac {9\pi }{L}\right ) ^{2}t}\\ & =6\sin \left ( \frac {9\pi }{L}x\right ) e^{-k\frac {81\pi ^{2}}{L^{2}}t} \end {align*}

________________________________________________________________________________________

3.1.1.5 [154] IC hat function

problem number 154

Added Feb 10, 2018.

Solve the heat equation

\[ u_t = u_{xx} \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(40,t) &= 0 \end {align*}

Initial condition is

\(u\left (x,0\right ) =\left \{ \begin {array} [c]{ccc}x & 0 \leq x < 20\\ 40-x & 20 \geq x \leq 40 \end {array} \right . \)

pict
Figure 3.8:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {640 e^{-\frac {n^2 \pi ^2 t}{1600}} \cos \left (\frac {n \pi }{4}\right ) \sin ^3\left (\frac {n \pi }{4}\right ) \sin \left (\frac {n \pi x}{40}\right )}{n^2 \pi ^2}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {160 \,{\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{1600}} \sin \left (\frac {\pi n}{2}\right ) \sin \left (\frac {\pi n x}{40}\right )}{\pi ^{2} n^{2}}\]

Hand solution

Solve \(u_{t}=ku_{xx}\) with \(0<x<40\) and initial conditions \(u\left ( x,0\right ) =f\left ( x\right ) \) as hat function.

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions. Here \(L=40\) and \(k=1\). Hence the solution becomes

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-\left ( \frac {n\pi }{40}\right ) ^{2}t}\sin \left ( \frac {n\pi }{40}x\right ) \]

At \(t=0\)

\[ f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{40}x\right ) \]

Multiplying both sides by \(\sin \left ( m\pi x\right ) \) and integrating gives

\[ \int _{0}^{40}f\left ( x\right ) \sin \left ( \frac {m\pi }{40}x\right ) dx=\int _{0}^{40}\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{40}x\right ) \sin \left ( \frac {m\pi }{40}x\right ) dx \]

By orthogonality of sin function the above simplifies to

\begin {align*} \int _{0}^{40}f\left ( x\right ) \sin \left ( \frac {n\pi }{40}x\right ) dx & =B_{n}\int _{0}^{40}\sin ^{2}\left ( \frac {n\pi }{40}x\right ) dx\\ \int _{0}^{20}x\sin \left ( \frac {n\pi }{40}x\right ) dx+\int _{20}^{40}\left ( 40-x\right ) \sin \left ( \frac {n\pi }{40}x\right ) dx & =20B_{n} \end {align*}

But \(\int _{0}^{20}x\sin \left ( \frac {n\pi }{40}x\right ) dx+\int _{20}^{40}\left ( 40-x\right ) \sin \left ( \frac {n\pi }{40}x\right ) dx=\frac {3200}{n^{2}\pi ^{2}}\sin \left ( \frac {n\pi }{2}\right ) \). Hence

\[ B_{n}=\frac {160}{n^{2}\pi ^{2}}\sin \left ( \frac {n\pi }{2}\right ) \]

And the solution becomes

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {160}{n^{2}\pi ^{2}}\sin \left ( \frac {n\pi }{2}\right ) e^{-\left ( \frac {n\pi }{40}\right ) ^{2}t}\sin \left ( \frac {n\pi }{40}x\right ) \]

When \(n\) is even the terms are zero Hence

\[ u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\frac {160}{n^{2}\pi ^{2}}\sin \left ( \frac {n\pi }{2}\right ) e^{-\left ( \frac {n\pi }{40}\right ) ^{2}t}\sin \left ( \frac {n\pi }{40}x\right ) \]

Or

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {160}{\left ( 2n-1\right ) ^{2}\pi ^{2}}\sin \left ( \frac {\left ( 2n-1\right ) \pi }{2}\right ) e^{-\left ( \frac {\left ( 2n-1\right ) \pi }{40}\right ) ^{2}t}\sin \left ( \frac {\left ( 2n-1\right ) \pi }{40}x\right ) \]

This is animation of the solution for \(400\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 3.9:Source code

________________________________________________________________________________________

3.1.1.6 [155] Haberman 2.3.3 (b)

problem number 155

This is problem 2.3.3, part (b) from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \]

Subject to boundary conditions \(u(0,t)=0\) and \(u(L,t)=0\) with the temperature initially \(u(x,0)=3 \sin \frac {\pi x}{L} - \sin \frac {3 \pi x}{L}\)

pict
Figure 3.10:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to e^{-\frac {9 \pi ^2 k t}{L^2}} \sin \left (\frac {\pi x}{L}\right ) \left (3 e^{\frac {8 \pi ^2 k t}{L^2}}-2 \cos \left (\frac {2 \pi x}{L}\right )-1\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = -{\mathrm e}^{-\frac {9 \pi ^{2} k t}{L^{2}}} \sin \left (\frac {3 \pi x}{L}\right )+3 \,{\mathrm e}^{-\frac {\pi ^{2} k t}{L^{2}}} \sin \left (\frac {\pi x}{L}\right )\]

Hand solution

Solve \(u_{t}=ku_{xx}\) with \(0<x<L\) and initial conditions \(u\left ( x,0\right ) =3\sin \left ( \frac {\pi x}{L}\right ) -\sin \left ( \frac {3\pi x}{L}\right ) \).

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where the eigenvalues are \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\) for \(n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions.

Initial conditions are now applied. Setting \(t=0\), the above becomes\[ u\left ( x,0\right ) =3\sin \frac {\pi x}{L}-\sin \frac {3\pi x}{L}=\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] As the series is unique, the terms coefficients must match for those shown only, and all other \(B_{n}\) terms vanish. This means that by comparing terms\[ 3\sin \left ( \frac {\pi x}{L}\right ) -\sin \left ( \frac {3\pi x}{L}\right ) =B_{1}\sin \left ( \frac {\pi x}{L}\right ) +B_{3}\sin \left ( \frac {3\pi }{L}x\right ) \] Therefore \begin {align*} B_{1} & =3\\ B_{3} & =-1 \end {align*}

And all other \(B_{n}=0\). The solution is\[ u\left ( x,t\right ) =3\sin \left ( \frac {\pi }{L}x\right ) e^{-k\left ( \frac {\pi }{L}\right ) ^{2}t}-\sin \left ( \frac {3\pi }{L}x\right ) e^{-k\left ( \frac {3\pi }{L}\right ) ^{2}t}\]

________________________________________________________________________________________

3.1.1.7 [156] Haberman 2.3.3 (c)

problem number 156

This is problem 2.3.3, part (c) from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ u_t = k u_{xx} \]

Subject to boundary conditions \(u(0,t)=0\) and \(u(L,t)=0\) with the temperature initially \(u(x,0)=2 \cos \frac {3 \pi x}{L}\)

pict
Figure 3.11:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {4 \left (1+(-1)^n\right ) e^{-\frac {k n^2 \pi ^2 t}{L^2}} n \sin \left (\frac {n \pi x}{L}\right )}{\left (n^2-9\right ) \pi }\right \}\right \}\] but \(n=3\) should be special case

Maple


\[u \left (x , t\right ) = -\frac {16 \,{\mathrm e}^{-\frac {4 \pi ^{2} k t}{L^{2}}} \sin \left (\frac {2 \pi x}{L}\right )}{5 \pi }+\left (\Mapleoverset {\infty }{\Mapleunderset {n =4}{\sum }}\frac {4 \left (\left (-1\right )^{n}+1\right ) n \,{\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}} \sin \left (\frac {\pi n x}{L}\right )}{\pi \left (n^{2}-9\right )}\right )\] handled \(n=3\) case correctly.

Hand solution

Solve \(u_{t}=ku_{xx}\) with \(0<x<L\) and initial conditions \(u\left ( x,0\right ) =2\cos \left ( \frac {3\pi x}{L}\right ) \).

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions. Initial conditions are now applied. Setting \(t=0\), the above becomes\[ u\left ( x,0\right ) =2\cos \left ( \frac {3\pi }{L}x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] Multiplying both sides by \(\sin \left ( \frac {m\pi }{L}x\right ) \) and integrating\begin {align*} \int _{0}^{L}2\cos \left ( \frac {3\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx & =\int _{0}^{L}\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx\\ & =\sum _{n=1}^{\infty }B_{n}\int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx \end {align*}

By orthogonality of \(\sin \) functions the above simplifies to\begin {align*} \int _{0}^{L}2\cos \left ( \frac {3\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx & =B_{m}\int _{0}^{L}\sin ^{2}\left ( \frac {m\pi }{L}x\right ) dx\\ & =B_{m}\frac {L}{2}\\ B_{m} & =\frac {4}{L}\int _{0}^{L}\cos \left ( \frac {3\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx \end {align*}

For \(m=3,B_{3}=0\). For \(m\neq 3\)\begin {align*} B_{m} & =\frac {4}{L}\left ( \frac {1+\left ( -1\right ) ^{m}}{m^{2}-9}\frac {nL}{\pi }\right ) \\ & =\frac {4n}{\pi }\left ( \frac {1+\left ( -1\right ) ^{m}}{m^{2}-9}\right ) \end {align*}

Hence the solution becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1,n\neq 3}^{\infty }\frac {4n}{\pi }\left ( \frac {1+\left ( -1\right ) ^{n}}{n^{2}-9}\right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\\ & =\frac {4}{\pi }\sum _{n=1,n\neq 3}^{\infty }n\left ( \frac {1+\left ( -1\right ) ^{n}}{n^{2}-9}\right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t} \end {align*}

When \(n\) is odd, all terms become zero, hence the above can be also be written as\[ u\left ( x,t\right ) =\frac {8}{\pi }\sum _{n=2,4,6,\cdots }^{\infty }\left ( \frac {n}{n^{2}-9}\right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\]

________________________________________________________________________________________

3.1.1.8 [157] Haberman 2.3.3 (d)

problem number 157

This is problem 2.3.3, part (d) from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \]

Subject to boundary conditions \(u(0,t)=0\) and \(u(L,t)=0\) with the temperature initially \(u\left ( x,0\right ) =\left \{ \begin {array} [c]{ccc}1 & & 0<x\leq \frac {L}{2}\\ 2 & & \frac {L}{2}<x\leq L \end {array} \right . \)

pict
Figure 3.12:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {4 e^{-\frac {k n^2 \pi ^2 t}{L^2}} \left (4 \cos \left (\frac {n \pi }{2}\right )+3\right ) \sin ^2\left (\frac {n \pi }{4}\right ) \sin \left (\frac {n \pi x}{L}\right )}{n \pi }\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (-4 \left (-1\right )^{n}+2 \cos \left (\frac {\pi n}{2}\right )+2\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}} \sin \left (\frac {\pi n x}{L}\right )}{\pi n}\]

Hand solution

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}x\right ) \) are the eigenfunctions. Initial conditions are now applied. Setting \(t=0\), the above becomes\begin {equation} f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \tag {3} \end {equation} Where \[ f\left ( x\right ) =\left \{ \begin {array} [c]{ccc}1 & & 0<x\leq \frac {L}{2}\\ 2 & & \frac {L}{2}<x<L \end {array} \right . \] Multiplying both sides of (3) by \(\sin \left ( \frac {m\pi }{L}x\right ) \) and integrating over the domain gives\[ \int _{0}^{L}\sin \left ( \frac {m\pi }{L}x\right ) f\left ( x\right ) dx=\int _{0}^{L}\left [ \sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {m\pi }{L}x\right ) \sin \left ( \frac {n\pi }{L}x\right ) \right ] dx \] Interchanging the order of integration and summation\[ \int _{0}^{L}\sin \left ( \frac {m\pi }{L}x\right ) f\left ( x\right ) dx=\sum _{n=1}^{\infty }\left [ B_{n}\left ( \int _{0}^{L}\sin \left ( \frac {m\pi }{L}x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \right ] \] But \(\int _{0}^{L}\sin \left ( \frac {m\pi }{L}x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx=0\) for \(n\neq m\), hence only one term survives\[ \int _{0}^{L}\sin \left ( \frac {m\pi }{L}x\right ) f\left ( x\right ) dx=B_{m}\int _{0}^{L}\sin ^{2}\left ( \frac {m\pi }{L}x\right ) dx \] Renaming \(m\) back to \(n\) and since \(\int _{0}^{L}\sin ^{2}\left ( \frac {m\pi }{L}x\right ) dx=\frac {L}{2}\) the above becomes\begin {align*} \int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx & =\frac {L}{2}B_{n}\\ B_{n} & =\frac {2}{L}\int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx\\ & =\frac {2}{L}\left ( \int _{0}^{\frac {L}{2}}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx+\int _{\frac {L}{2}}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx\right ) \\ & =\frac {2}{L}\left ( \int _{0}^{\frac {L}{2}}\sin \left ( \frac {n\pi }{L}x\right ) dx+2\int _{\frac {L}{2}}^{L}\sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \\ & =\frac {2}{L}\left ( \left . \frac {-\cos \left ( \frac {n\pi }{L}x\right ) }{\frac {n\pi }{L}}\right \vert _{0}^{\frac {L}{2}}+2\left . \frac {-\cos \left ( \frac {n\pi }{L}x\right ) }{\frac {n\pi }{L}}\right \vert _{\frac {L}{2}}^{L}\right ) \\ & =\frac {2}{n\pi }\left ( \left ( -\cos \left ( \frac {n\pi }{L}x\right ) \right ) _{0}^{\frac {L}{2}}+2\left ( -\cos \left ( \frac {n\pi }{L}x\right ) \right ) _{\frac {L}{2}}^{L}\right ) \\ & =\frac {2}{n\pi }\left ( \left [ -\cos \left ( \frac {n\pi }{L}\frac {L}{2}\right ) +\cos \left ( 0\right ) \right ] +2\left [ -\cos \left ( n\pi \right ) +\cos \left ( \frac {n\pi }{2}\right ) \right ] \right ) \\ & =\frac {2}{n\pi }\left ( -\cos \left ( \frac {n\pi }{2}\right ) +1-2\cos \left ( n\pi \right ) +2\cos \left ( \frac {n\pi }{2}\right ) \right ) \\ & =\frac {2}{n\pi }\left ( \cos \left ( \frac {n\pi }{2}\right ) +1-2\cos \left ( n\pi \right ) \right ) \end {align*}

Hence the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\] With \begin {align*} B_{n} & =\frac {2}{n\pi }\left ( \cos \left ( \frac {n\pi }{2}\right ) -2\cos \left ( n\pi \right ) +1\right ) \\ & =\frac {2}{n\pi }\left ( 1-2\left ( -1\right ) ^{n}+\cos \left ( \frac {n\pi }{2}\right ) \right ) \\ & =\frac {2}{n\pi }\left ( 1+2\left ( -1\right ) ^{n+1}+\cos \left ( \frac {n\pi }{2}\right ) \right ) \end {align*}

Therefore\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {2}{n\pi }\left ( 1-2\left ( -1\right ) ^{n}+\cos \left ( \frac {n\pi }{2}\right ) \right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\]

________________________________________________________________________________________

3.1.1.9 [158] domain from -1 to +1

problem number 158

Solve the heat equation

\[ \frac { \partial u}{\partial t} = \frac { \partial ^2 u}{\partial x^2} \]

For \(-1<x<1\) and \(t>0\). The boundary conditions are zero at both ends. Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.13:PDE specification

Mathematica


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

Maple


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

Hand solution

Solve \(u_{t}=ku_{xx}\) with \(-1<x<1\) and initial conditions \(u\left ( x,0\right ) =f\left ( x\right ) \) and B.C. \(u\left ( -1,t\right ) =u\left ( 1,t\right ) =0\).

Let \(\xi =x+1\) where \(x=-1\cdots 1\) Therefore \(\xi =0\cdots 2\). This also implies mapping the initial temperature to \(f\left ( x+a\right ) \). Now the ODE is solved\begin {align*} u_{t} & =u_{\xi \xi }\\ u\left ( 0,t\right ) & =0\\ u\left ( 2,t\right ) & =0 \end {align*}

The basic solution for this type of PDE was already given in problem 3.1.1.1 on page 731 as\[ u\left ( \xi ,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}\xi \right ) \]

Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and \(\sin \left ( \sqrt {\lambda _{n}}\xi \right ) \) are the eigenfunctions. Here \(L=2\). Hence the solution becomes

\[ u\left ( \xi ,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\xi \right ) \]

Changing back to \(x\ \)\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \]

At \(t=0\)

\[ f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}e^{-k\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \]

Multiplying both sides by \(\sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) \) and integrating gives

\[ \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx=\int _{-1}^{1}\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx \]

By orthogonality of sin function the above simplifies to

\begin {align*} \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx & =B_{n}\int _{-1}^{1}\sin ^{2}\left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx\\ \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx & =B_{n} \end {align*}

Hence

\[ B_{n}=\int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx \]

And the solution becomes

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx\right ) e^{-k\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \]

________________________________________________________________________________________

3.1.1.10 [159] domain from -1 to +1

problem number 159

Solve the heat equation

\[ \frac { \partial u}{\partial t} = \frac { \partial ^2 u}{\partial x^2} \]

For \(-1<x<1\) and \(t>0\). The boundary conditions are zero at both ends. Initial condition is \(u(x,0)=1-x^2\)

pict
Figure 3.14:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}-\frac {16 \left (-1+(-1)^{K[1]}\right ) e^{-\frac {1}{4} \pi ^2 t K[1]^2} \sin \left (\frac {1}{2} \pi (x+1) K[1]\right )}{\pi ^3 K[1]^3}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}-\frac {16 \left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{4}} \sin \left (\frac {\pi \left (x +1\right ) n}{2}\right )}{\pi ^{3} n^{3}}\]

Hand solution

Solve \(u_{t}=u_{xx}\) with \(-1<x<1\) and initial conditions \(u\left ( x,0\right ) =f\left ( x\right ) =1-x^{2}\) and B.C. \(u\left ( -1,t\right ) =u\left ( 1,t\right ) =0\).

The basic solution for this type of PDE was already given in problem 3.1.1.9 on page 769 as

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx\right ) e^{-k\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \]

Replacing \(f\left ( x\right ) =1-x^{2}\) then

\begin {align*} \int _{-1}^{1}f\left ( x\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx & =\int _{-1}^{1}\left ( 1-x^{2}\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) dx\\ & =\frac {16\left ( 1+\left ( -1\right ) ^{n+1}\right ) }{n^{3}\pi ^{3}} \end {align*}

Hence the solution becomes, using \(k=1\)

\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {16\left ( 1+\left ( -1\right ) ^{n+1}\right ) }{n^{3}\pi ^{3}}e^{-\left ( \frac {n\pi }{2}\right ) ^{2}t}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \]

This is animation of the solution for \(2\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 3.15:Source code

________________________________________________________________________________________

3.1.1.11 [160] with source that depends on space only (general case)

problem number 160

Added July 3, 2019

Solve the heat equation for \(u(x,t)\) \[ u_t= k u_{xx} + Q(x) \] For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t)&=0 \\ u(L,t) &= 0\\ \end {align*}

Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.16:PDE specification

Mathematica


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

Maple


\[u \left (x , t\right ) = \frac {2 L k \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\int _{0}^{L}\left (L k f \left (\mathit {\_a} \right )+L \left (\int _{0}^{\mathit {\_a}}\int _{0}^{\mathit {\_z1}}Q \left (\mathit {\_z1} \right )d \mathit {\_z1} d \mathit {\_z1} \right )-\mathit {\_a} \left (\int _{0}^{L}\int _{0}^{\mathit {\_z1}}Q \left (\mathit {\_z1} \right )d \mathit {\_z1} d \mathit {\_z1} \right )\right ) \sin \left (\frac {\pi \mathit {\_a} n}{L}\right )d \mathit {\_a} \right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}} \sin \left (\frac {\pi n x}{L}\right )}{L^{2} k}\right )-L \left (\int _{0}^{x}\int _{0}^{\mathit {\_a}}Q \left (\mathit {\_a} \right )d \mathit {\_a} d \mathit {\_a} \right )+x \left (\int _{0}^{L}\int _{0}^{\mathit {\_a}}Q \left (\mathit {\_a} \right )d \mathit {\_a} d \mathit {\_a} \right )}{L k}\]

Hand solution

Let the solution be\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \tag {1} \end {equation} Where \(\Phi _{n}\left ( x\right ) \) are the eigenfunctions of the eigenvalue problem for the pde \(u_{t}=ku_{xx}\) with \(u\left ( 0,x\right ) =0,u\left ( L,x\right ) =0\). This was solved in problem 3.1.1.1 on page 731 and \(\Phi _{n}\left ( x\right ) \) was found as\begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

Hence (1) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {1A} \end {equation} Substituting this back into the original given PDE gives\[ \sum _{n=1}^{\infty }a_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( x\right ) =k\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\Phi _{n}\left ( x\right ) \] Where \(Q\left ( x\right ) =\sum _{n=1}^{\infty }q_{n}\Phi _{n}\left ( x\right ) \). Since \(\Phi _{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}\Phi _{n}\left ( x\right ) \), then the above simplifies to\begin {align} \sum _{n=1}^{\infty }a_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( x\right ) & =-k\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \lambda _{n}\Phi _{n}\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\Phi _{n}\left ( x\right ) \nonumber \\ a_{n}^{\prime }\left ( t\right ) +k\lambda _{n}a_{n}\left ( t\right ) & =q_{n}\tag {2} \end {align}

We now need to find \(q_{n}\). By orthogonality\[ \int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx=\int _{0}^{L}q_{n}\Phi _{n}^{2}\left ( x\right ) dx \] But \(\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx=\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx=\frac {L}{2}\) and the above becomes\[ q_{n}=\frac {2}{L}\int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx \] Using the above in (2) gives\[ a_{n}^{\prime }\left ( t\right ) +k\lambda _{n}a_{n}\left ( t\right ) =\frac {2}{L}\int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx \] The integrating factor is \(I=e^{k\lambda _{n}t}\). Hence the above becomes\begin {align*} \frac {d}{dt}\left ( a_{n}\left ( t\right ) e^{k\lambda _{n}t}\right ) & =\frac {2}{L}e^{k\lambda _{n}t}\int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx\\ a_{n}\left ( t\right ) e^{k\lambda _{n}t} & =\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}s}\left ( \int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx\right ) ds+a_{n}\left ( 0\right ) \\ a_{n}\left ( t\right ) & =a_{n}\left ( 0\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}s}\left ( \int _{0}^{L}Q\left ( x\right ) \Phi _{n}\left ( x\right ) dx\right ) ds \end {align*}

Therefore the solution (1A) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left [ a_{n}\left ( 0\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ] \Phi _{n}\left ( x\right ) \tag {3} \end {equation} At \(t=0\)\begin {align*} f\left ( x\right ) & =\sum _{n=1}^{\infty }a_{n}\left ( 0\right ) \Phi _{n}\left ( x\right ) \\ \int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =\int _{0}^{L}a_{n}\left ( 0\right ) \Phi _{n}^{2}\left ( x\right ) dx\\ a_{n}\left ( 0\right ) & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx \end {align*}

The solution (3) becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\left [ \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ] \Phi _{n}\left ( x\right ) \\ & =\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) +\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ) \end {align*}

Where \begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

________________________________________________________________________________________

3.1.1.12 [161] with source that depends on space only (special case)

problem number 161

Added July 4, 2019

Solve the heat equation for \(u(x,t)\) \[ u_t= k u_{xx} + Q(x) \] For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &=0 \\ u(L,t) &= 0\\ \end {align*}

Initial condition is \(u(x,0)=f(x)\) using the following values \begin {align*} L &=5 \\ k &= \frac {1}{10}\\ f(x)&=x(5-x)\\ Q(x)&=x \end {align*}

pict
Figure 3.17:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}-\frac {100 \left (-1+(-1)^n\right ) e^{-\frac {1}{250} n^2 \pi ^2 t} \sin \left (\frac {n \pi x}{5}\right )}{n^3 \pi ^3}+\underset {n=1}{\overset {\infty }{\sum }}-\frac {2500 (-1)^n \left (1-e^{-\frac {1}{250} n^2 \pi ^2 t}\right ) \sin \left (\frac {n \pi x}{5}\right )}{n^3 \pi ^3}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \frac {\left (L -x \right ) Q x +4 k \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (-\pi ^{2} f k n^{2}+L^{2} Q \right ) \left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}} \sin \left (\frac {\pi n x}{L}\right )}{\pi ^{3} k n^{3}}\right )}{2 k}\]

Hand solution

Solve \begin {align*} u_{t} & =ku_{xx}+Q\left ( x\right ) \\ u\left ( 0,t\right ) & =0\\ u\left ( L,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

With \(k=\frac {1}{10},L=5,f\left ( x\right ) =x\left ( 5-x\right ) ,Q\left ( x\right ) =x.\)

The general problem above was solved in 3.1.1.11 on page 779 and the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) +\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ) \] Where \begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

Substituting the specific values given above into this solution gives\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }e^{-\frac {1}{10}\left ( \frac {n\pi }{5}\right ) ^{2}t}\sin \left ( \frac {n\pi }{5}x\right ) \left ( \frac {2}{5}\int _{0}^{5}s\left ( 5-s\right ) \sin \left ( \frac {n\pi }{5}s\right ) ds\right ) \\ & +\sum _{n=1}^{\infty }e^{-\frac {1}{10}\left ( \frac {n\pi }{5}\right ) ^{2}t}\sin \left ( \frac {n\pi }{5}x\right ) \left ( \int _{0}^{t}\frac {2}{5}e^{\frac {1}{10}\left ( \frac {n\pi }{5}\right ) ^{2}\tau }\left ( \int _{0}^{5}s\sin \left ( \frac {n\pi }{5}s\right ) ds\right ) d\tau \right ) \end {align*}

Animation is below

Source code used for the above

pict
Figure 3.18:Source code

pict
Figure 3.19:Code for animation

________________________________________________________________________________________

3.1.1.13 [162] with source that depends on space and time (general case)

problem number 162

Added June 23, 2019

Solve the heat equation for \(u(x,t)\) \[ u_t= k u_{xx} + Q(x,t) \] For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t)&=0 \\ u(L,t) &= 0\\ \end {align*}

Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.20:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} \left (\int _0^t e^{-\frac {k \pi ^2 K[1]^2 (t-K[2])}{L^2}} \text {Integrate}\left [\frac {\sqrt {2} Q(x,K[2]) \sin \left (\frac {\pi x K[1]}{L}\right )}{\sqrt {L}},\{x,0,L\},\text {Assumptions}\to k>0\land L>0\right ] \, dK[2]+e^{-\frac {k \pi ^2 t K[1]^2}{L^2}} \int _0^L \frac {\sqrt {2} f(x) \sin \left (\frac {\pi x K[1]}{L}\right )}{\sqrt {L}} \, dx\right ) \sin \left (\frac {\pi x K[1]}{L}\right )}{\sqrt {L}}\right \}\right \}\]

Maple


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

Hand solution

Solving

\begin {align} u_{t} & =kv_{xx}+Q\left ( x,t\right ) \tag {1}\\ u\left ( 0,t\right ) & =0\nonumber \\ u\left ( L,t\right ) & =0\nonumber \\ u\left ( x,0\right ) & =f\left ( x\right ) \nonumber \end {align}

Let the solution be\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \tag {1} \end {equation} Where \(\Phi _{n}\left ( x\right ) \) are the eigenfunctions of the eigenvalue problem for the pde \(u_{t}=ku_{xx}\) with \(u\left ( 0,x\right ) =0,u\left ( L,x\right ) =0\). This was solved in problem 3.1.1.1 on page 731 and \(\Phi _{n}\left ( x\right ) \) was found as\begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

Hence (1) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {1A} \end {equation} Substituting this back into the original given PDE gives\[ \sum _{n=1}^{\infty }a_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( x\right ) =k\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \] Where \(Q\left ( x,t\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \). Since \(\Phi _{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}\Phi _{n}\left ( x\right ) \), then the above simplifies to\begin {align} \sum _{n=1}^{\infty }a_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( x\right ) & =-k\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \lambda _{n}\Phi _{n}\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \nonumber \\ a_{n}^{\prime }\left ( t\right ) +k\lambda _{n}a_{n}\left ( t\right ) & =q_{n}\left ( t\right ) \tag {2} \end {align}

We now need to find \(q_{n}\left ( t\right ) \). By orthogonality\[ \int _{0}^{L}Q\left ( x,t\right ) \Phi _{n}\left ( x\right ) dx=\int _{0}^{L}q_{n}\left ( t\right ) \Phi _{n}^{2}\left ( x\right ) dx \] But \(\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx=\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx=\frac {L}{2}\) and the above becomes\[ q_{n}\left ( t\right ) =\frac {2}{L}\int _{0}^{L}Q\left ( x,t\right ) \Phi _{n}\left ( x\right ) dx \] Using the above in (2) gives\[ a_{n}^{\prime }\left ( t\right ) +k\lambda _{n}a_{n}\left ( t\right ) =\frac {2}{L}\int _{0}^{L}Q\left ( x,t\right ) \Phi _{n}\left ( x\right ) dx \] The integrating factor is \(I=e^{k\lambda _{n}t}\). Hence the above becomes\begin {align*} \frac {d}{dt}\left ( a_{n}\left ( t\right ) e^{k\lambda _{n}t}\right ) & =\frac {2}{L}e^{k\lambda _{n}t}\int _{0}^{L}Q\left ( x,t\right ) \Phi _{n}\left ( x\right ) dx\\ a_{n}\left ( t\right ) e^{k\lambda _{n}t} & =\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}s}\left ( \int _{0}^{L}Q\left ( x,s\right ) \Phi _{n}\left ( x\right ) dx\right ) ds+a_{n}\left ( 0\right ) \\ a_{n}\left ( t\right ) & =a_{n}\left ( 0\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}s}\left ( \int _{0}^{L}Q\left ( x,s\right ) \Phi _{n}\left ( x\right ) dx\right ) ds \end {align*}

Therefore the solution (1A) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left [ a_{n}\left ( 0\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s,\tau \right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ] \Phi _{n}\left ( x\right ) \tag {3} \end {equation} At \(t=0\)\begin {align*} f\left ( x\right ) & =\sum _{n=1}^{\infty }a_{n}\left ( 0\right ) \Phi _{n}\left ( x\right ) \\ \int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =\int _{0}^{L}a_{n}\left ( 0\right ) \Phi _{n}^{2}\left ( x\right ) dx\\ a_{n}\left ( 0\right ) & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx \end {align*}

The solution (3) becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\left [ \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) e^{-k\lambda _{n}t}+e^{-k\lambda _{n}t}\int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s,\tau \right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ] \Phi _{n}\left ( x\right ) \\ & =\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) +\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s,\tau \right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ) \end {align*}

Where \begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

________________________________________________________________________________________

3.1.1.14 [163] with source that depends on space and time (special case)

problem number 163

Added July 5, 2019

Solve the heat equation for \(u(x,t)\) \[ u_t= k u_{xx} + Q(x,t) \] For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t)&=0 \\ u(L,t) &= 0\\ \end {align*}

Initial condition is \(u(x,0)=f(x)\). Using the following values \begin {align*} L &=\pi \\ k &= \frac {1}{300}\\ Q(x,t) &= e^{-t} \sin (3 x)\\ f(x) &= x(\pi -x) \end {align*}

pict
Figure 3.21:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}-\frac {4 \left (-1+(-1)^n\right ) e^{-\frac {n^2 t}{300}} \sin (n x)}{n^3 \pi }+\frac {100}{97} e^{-t} \left (e^{97 t/100}-1\right ) \sin (3 x)\right \}\right \}\]

Maple


\[u \left (x , t\right ) = -\frac {100 \,{\mathrm e}^{-t} \sin \left (3 x \right )}{97}+\frac {100 \,{\mathrm e}^{-\frac {3 t}{100}} \sin \left (3 x \right )}{97}-4 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {n^{2} t}{300}} \sin \left (n x \right )}{\pi n^{3}}\right )\]

Hand solution

Solving \begin {align*} u_{t} & =ku_{xx}+Q\left ( x,t\right ) \\ u\left ( 0,t\right ) & =0\\ u\left ( L,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

With \(k=\frac {1}{300},L=\pi ,f\left ( x\right ) =x\left ( \pi -x\right ) ,Q\left ( x\right ) =e^{-t}\sin \left ( 3x\right ) .\)

The general problem above was solved in 3.1.6.4 on page 1135 and the solution is\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) \\ & +\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\Phi _{n}\left ( x\right ) \left ( \int _{0}^{t}\frac {2}{L}e^{k\lambda _{n}\tau }\left ( \int _{0}^{L}Q\left ( s,\tau \right ) \Phi _{n}\left ( s\right ) ds\right ) d\tau \right ) \end {align*}

Where\begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( \sqrt {\lambda _{n}}x\right ) \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \end {align*}

Substituting the specific values given above into this solution gives\begin {align*} \Phi _{n}\left ( x\right ) & =\sin \left ( nx\right ) \\ \lambda _{n} & =n^{2}\qquad n=1,2,3,\cdots \end {align*}

And\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) \left ( \frac {2}{\pi }\int _{0}^{\pi }s\left ( \pi -s\right ) \sin \left ( ns\right ) ds\right ) \\ & +\sum _{n=1}^{\infty }e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) \left ( \int _{0}^{t}\frac {2}{\pi }e^{\frac {1}{300}n^{2}\tau }e^{-\tau }\left ( \int _{0}^{\pi }\sin \left ( 3s\right ) \sin \left ( ns\right ) ds\right ) d\tau \right ) \end {align*}

But \(\int _{0}^{\pi }s\left ( \pi -s\right ) \sin \left ( ns\right ) ds=\frac {2-2\left ( -1\right ) ^{n}}{n^{3}}\) and \(\int _{0}^{\pi }\sin \left ( 3s\right ) \sin \left ( ns\right ) ds=0\)  when \(n\neq 3\) and for \(n=3\) it is \(\frac {\pi }{2}\). Hence the above reduces to\begin {align*} u\left ( x,t\right ) & =4\sum _{n=1}^{\infty }\left ( \frac {1-\left ( -1\right ) ^{n}}{\pi n^{3}}\right ) e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) +e^{-\frac {1}{300}\left ( 3\right ) ^{2}t}\sin \left ( 3x\right ) \left ( \int _{0}^{t}\frac {2}{\pi }e^{\frac {1}{300}\left ( 9\right ) ^{2}\tau }e^{-\tau }\left ( \frac {\pi }{2}\right ) d\tau \right ) \\ & =4\sum _{n=1}^{\infty }\left ( \frac {1-\left ( -1\right ) ^{n}}{\pi n^{3}}\right ) e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) +e^{-\frac {9t}{300}}\sin \left ( 3x\right ) \left ( \int _{0}^{t}e^{\frac {9\tau }{300}}e^{-\tau }d\tau \right ) \end {align*}

But \(\int _{0}^{t}e^{\frac {9\tau }{300}}e^{-\tau }d\tau =\frac {100}{97}-\frac {100e^{\frac {-97}{100}t}}{97}\). Hence the above becomes\begin {align*} u\left ( x,t\right ) & =4\sum _{n=1}^{\infty }\left ( \frac {1-\left ( -1\right ) ^{n}}{\pi n^{3}}\right ) e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) +e^{-\frac {9t}{300}}\sin \left ( 3x\right ) \left ( \frac {100}{97}-\frac {100e^{\frac {-97}{100}t}}{97}\right ) \\ & =4\sum _{n=1}^{\infty }\left ( \frac {1-\left ( -1\right ) ^{n}}{\pi n^{3}}\right ) e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) +\sin \left ( 3x\right ) \left ( \frac {100}{97}e^{-\frac {3t}{100}}-\frac {100e^{-t}}{97}\right ) \\ & =4\sum _{n=1}^{\infty }\left ( \frac {1-\left ( -1\right ) ^{n}}{\pi n^{3}}\right ) e^{-\frac {1}{300}n^{2}t}\sin \left ( nx\right ) -\frac {100e^{-t}}{97}\sin \left ( 3x\right ) +\frac {100}{97}e^{-\frac {3t}{100}}\sin \left ( 3x\right ) \end {align*}

Animation is below

Source code used for the above

pict
Figure 3.22:Source code

pict
Figure 3.23:Code for animation

________________________________________________________________________________________

3.1.1.15 [164] Math 4567 Exam

problem number 164

Added April 3, 2019.

Exam question. Math 4567 UMN. Spring 2019.

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

Initial condition is \(u(x,0)=0\).

pict
Figure 3.24:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {2 \left (t n^2+e^{-n^2 t}-1\right ) \sin (n x)}{n^5}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 2 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (n^{2} t +{\mathrm e}^{-n^{2} t}-1\right ) \sin \left (n x \right )}{n^{5}}\right )\]

Hand solution

Let \(u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) X_{n}\left ( x\right ) \), where \(X_{n}\left ( x\right ) \) are the eigenfunctions of the homogeneous PDE \(u_{t}=u_{xx}\). These are known to be \(X_{n}\left ( x\right ) =\sin \left ( \sqrt {\lambda _{n}}x\right ) \) where \(\lambda _{n}=n^{2},n=1,2,3,\cdots \). Hence\[ X_{n}\left ( x\right ) =\sin \left ( nx\right ) \qquad n=1,2,3,\cdots \] Therefore the solution becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \sin \left ( nx\right ) \tag {A} \end {equation} Substituting this into the PDE \(u_{t}=u_{xx}+t\left ( \pi -x\right ) \) gives\[ \sum _{n=1}^{\infty }B_{n}^{\prime }\left ( t\right ) X_{n}\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) X_{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\left ( t\right ) X_{n}\left ( x\right ) \] Where \(\sum _{n=1}^{\infty }q_{n}\left ( t\right ) X_{n}\left ( x\right ) \) is the Fourier series expansion of \(t\left ( \pi -x\right ) \). But \(X_{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}X_{n}\left ( x\right ) =-n^{2}X_{n}\left ( x\right ) \). Hence the above becomes\begin {align} \sum _{n=1}^{\infty }B_{n}^{\prime }\left ( t\right ) X_{n}\left ( x\right ) & =-\sum _{n=1}^{\infty }n^{2}B_{n}\left ( t\right ) X_{n}\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\left ( t\right ) X_{n}\left ( x\right ) \nonumber \\ B_{n}^{\prime }\left ( t\right ) X_{n}\left ( x\right ) +n^{2}B_{n}\left ( t\right ) X_{n}\left ( x\right ) & =q_{n}\left ( t\right ) X_{n}\left ( x\right ) \nonumber \\ B_{n}^{\prime }\left ( t\right ) +n^{2}B_{n}\left ( t\right ) & =q_{n}\left ( t\right ) \tag {1} \end {align}

This is first order ODE which is now solved for \(B_{n}\). But first \(q_{n}\left ( t\right ) \) is found. Since \[ t\left ( \pi -x\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) X_{n}\left ( x\right ) \] Applying orthogonality. Integrating both sides and multiplying by \(X_{m}\left ( x\right ) \) gives\begin {align*} \int _{0}^{\pi }t\left ( \pi -x\right ) X_{m}\left ( x\right ) dx & =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \int _{0}^{\pi }X_{n}\left ( x\right ) X_{m}\left ( x\right ) dx\\ & =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \int _{0}^{\pi }\sin \left ( nx\right ) \sin \left ( mx\right ) dx\\ & =q_{m}\left ( t\right ) \int _{0}^{\pi }\sin ^{2}\left ( mx\right ) dx\\ & =\frac {\pi }{2}q_{m}\left ( t\right ) \end {align*}

Therefore\begin {align*} q_{n}\left ( t\right ) & =\frac {2}{\pi }\int _{0}^{\pi }t\left ( \pi -x\right ) \sin \left ( nx\right ) dx\\ & =\frac {2t\left ( \pi n-\sin \left ( n\pi \right ) \right ) }{\pi n^{2}} \end {align*}

But \(n\) is integer, hence the above simplifies to \[ q_{n}\left ( t\right ) =\frac {2t}{n}\] Hence (1) becomes\[ B_{n}^{\prime }\left ( t\right ) +n^{2}B_{n}\left ( t\right ) =\frac {2t}{n}\] Integrating factor is \(I=e^{\int n^{2}dt}=e^{n^{2}t}\). The above becomes\[ \frac {d}{dt}\left ( B_{n}e^{n^{2}t}\right ) =\frac {2t}{n}e^{n^{2}t}\] Integrating\begin {align} B_{n}e^{n^{2}t} & =\frac {2}{n}\int _{0}^{t}se^{n^{2}s}ds+C\nonumber \\ B_{n}\left ( t\right ) & =\frac {2}{n}e^{-n^{2}t}\int _{0}^{t}se^{n^{2}s}ds+Ce^{-n^{2}t}\tag {2} \end {align}

At \(t=0,B_{n}\left ( 0\right ) =0\). The above reduces to\[ 0=C \] Therefore (2) becomes\begin {align*} B_{n}\left ( t\right ) & =\frac {2}{n}e^{-n^{2}t}\int _{0}^{t}se^{n^{2}s}ds\\ & =\frac {2}{n}\int _{0}^{t}se^{n^{2}\left ( s-t\right ) }ds\\ & =\frac {2\left ( n^{2}t+e^{-n^{2}t}-1\right ) }{n^{5}} \end {align*}

Hence Eq. (A) becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\frac {2\left ( n^{2}t+e^{-n^{2}t}-1\right ) }{n^{5}}\sin \left ( nx\right ) \]

________________________________________________________________________________________

3.1.1.16 [165] With source

problem number 165

Taken from Maple PDE help pages

Solve the heat equation for \(u(x,t)\) \[ u_t= k u_{xx} + Q(x,t) \] For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(1,t) &= 0 \\ \end {align*}

Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.25:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\sqrt {2} \left (\int _0^t e^{-k \pi ^2 K[1]^2 (t-K[2])} \text {Integrate}\left [\sqrt {2} Q(x,K[2]) \sin (\pi x K[1]),\{x,0,1\},\text {Assumptions}\to k>0\land t>0\land x>0\land x<1\right ] \, dK[2]+e^{-k \pi ^2 t K[1]^2} \int _0^1 \sqrt {2} f(x) \sin (\pi x K[1]) \, dx\right ) \sin (\pi x K[1])\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \int _{0}^{t}\left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {2 \left (\int _{0}^{l}Q \left (x , \tau \right ) \sin \left (\frac {\pi n x}{l}\right )d x \right ) {\mathrm e}^{\frac {\pi ^{2} \left (-t +\tau \right ) k n^{2}}{l^{2}}} \sin \left (\frac {\pi n x}{l}\right )}{l}\right )d \tau +2 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\int _{0}^{l}f (x ) \sin \left (\frac {\pi n x}{l}\right )d x \right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{l^{2}}} \sin \left (\frac {\pi n x}{l}\right )}{l}\right )\]

________________________________________________________________________________________

3.1.1.17 [166] special initial condition

problem number 166

Added April 28, 2019.

Taken from https://mathematica.stackexchange.com/questions/197155/solving-a-heat-equation-problem

Solve \(u(x,t)\) \[ u_t = u_{xx} -9 u_x \] For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0\\ u(1,t) &= 0 \end {align*}

Initial condition \(u(x,0)=e^\frac {45}{10}( 5 \sin (\pi x)+ 9 \sin (2 \pi x)+2 \sin (3 \pi x)) \)

pict
Figure 3.26:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to e^{\frac {9}{4} (2 x-9 t)} \underset {K[1]=1}{\overset {\infty }{\sum }}0\right \}\right \}\]

Maple


time expired

Hand solution

Solve

\[ u_{t}=u_{xx}-9u_{x}\] IC\[ u\left ( x,0\right ) =e^{\frac {45}{10}x}\left ( 5\sin \left ( \pi x\right ) +9\sin \left ( 2\pi x\right ) +2\sin \left ( 3\pi x\right ) \right ) \] BC\begin {align*} u\left ( 0,x\right ) & =0\\ u\left ( 1,x\right ) & =0 \end {align*}

Let \(u=X\left ( x\right ) T\left ( t\right ) \), the PDE becomes\begin {align*} T^{\prime }X & =X^{\prime \prime }T-9X^{\prime }T\\ \frac {T^{\prime }}{T} & =\frac {X^{\prime \prime }}{X}-9\frac {X^{\prime }}{X}=-\lambda \end {align*}

Where \(\lambda \) is the seperation constant. From B.C. we know \(\lambda >0\). Hence the eigenvalue ODE is\[ X^{\prime \prime }-9X^{\prime }+\lambda X=0 \] The solution to the above is\begin {align*} X\left ( x\right ) & =C_{1}e^{\frac {1}{2}\left ( 9-\sqrt {81-4\lambda }\right ) x}+C_{2}e^{\frac {1}{2}\left ( 9+\sqrt {81-4\lambda }\right ) x}\\ & =e^{\frac {9x}{2}}\left ( C_{1}e^{-\frac {1}{2}\sqrt {81-4\lambda }x}+C_{2}e^{\frac {1}{2}\sqrt {81-4\lambda }x}\right ) \end {align*}

At \(X\left ( 0\right ) =0\) this gives\[ 0=C_{1}+C_{2}\] And at \(X\left ( 1\right ) =0\)\begin {align*} 0 & =e^{\frac {9}{2}}\left ( C_{1}e^{-\frac {1}{2}\sqrt {81-4\lambda }}+C_{2}e^{\frac {1}{2}\sqrt {81-4\lambda }}\right ) \\ 0 & =e^{\frac {9}{2}}\left ( C_{1}e^{-\frac {1}{2}\sqrt {81-4\lambda }}-C_{1}e^{\frac {1}{2}\sqrt {81-4\lambda }}\right ) \\ 0 & =C_{1}e^{\frac {9}{2}}\left ( e^{-\frac {1}{2}\sqrt {81-4\lambda }}-e^{\frac {1}{2}\sqrt {81-4\lambda }}\right ) \end {align*}

For nontrivial solution we want\begin {align} e^{-\frac {1}{2}\sqrt {81-4\lambda }}-e^{\frac {1}{2}\sqrt {81-4\lambda }} & =0\nonumber \\ e^{-\frac {1}{2}\sqrt {81-4\lambda }} & =e^{\frac {1}{2}\sqrt {81-4\lambda }} \tag {1} \end {align}

Case \(81-4\lambda >0\)

This means \(81-4\lambda \) must be zero or\[ \lambda =\frac {81}{4}\] But using this eigenvalue makes the eigenfunction zero as shown below\begin {align*} X\left ( x\right ) & =e^{\frac {9x}{2}}\left ( C_{1}e^{-\frac {1}{2}\sqrt {81-4\lambda }x}-C_{1}e^{\frac {1}{2}\sqrt {81-4\lambda }x}\right ) \\ & =C_{1}e^{\frac {9x}{2}}\left ( e^{-\frac {1}{2}\sqrt {81-4\lambda }x}-e^{\frac {1}{2}\sqrt {81-4\lambda }x}\right ) \\ & =C_{1}e^{\frac {9x}{2}}\left ( 1-1\right ) \\ & =0 \end {align*}

Therefore \(\lambda =\frac {81}{4}\) can not be used as eigenfunction.

Case \(81-4\lambda <0\)

Then (1) becomes\begin {align*} e^{-\frac {i}{2}\sqrt {4\lambda -81}} & =e^{\frac {i}{2}\sqrt {4\lambda -81}}\\ \cos \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) -i\sin \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) & =\cos \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) +i\sin \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) \\ 2i\sin \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) & =0\\ \sin \left ( \frac {1}{2}\sqrt {4\lambda -81}\right ) & =0\\ \frac {1}{2}\sqrt {4\lambda -81} & =n\pi \qquad n=1,2,\cdots \end {align*}

Hence\begin {align*} \frac {1}{4}\left ( 4\lambda -81\right ) & =n^{2}\pi ^{2}\\ 4\lambda & =81+4n^{2}\pi ^{2}\\ \lambda _{n} & =\frac {81}{4}+n^{2}\pi ^{2} \end {align*}

The corresponding eigenfunctions are (and since \(C_{2}=-C_{1}\)) then\begin {align*} X_{n}\left ( x\right ) & =C_{n}\left ( e^{\frac {1}{2}\left ( 9-\sqrt {81-4\lambda _{n}}\right ) x}-e^{\frac {1}{2}\left ( 9+\sqrt {81-4\lambda _{n}}\right ) x}\right ) \\ & =C_{n}\left ( e^{\frac {1}{2}\left ( 9-i\sqrt {4\lambda _{n}-81}\right ) x}-e^{\frac {1}{2}\left ( 9+i\sqrt {4\lambda _{n}-81}\right ) x}\right ) \\ & =C_{n}e^{\frac {9x}{2}}\left ( e^{-\frac {i}{2}\sqrt {4\lambda _{n}-81}x}-e^{\frac {i}{2}\sqrt {4\lambda _{n}-81}x}\right ) \\ & =C_{n}e^{\frac {9x}{2}}\left ( \cos \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) -i\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) -\cos \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) -\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) \right ) \\ & =C_{n}e^{\frac {9x}{2}}\left ( -2i\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) \right ) \\ & =A_{n}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) \end {align*}

Hence the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }X_{n}\left ( t\right ) T_{n}\left ( t\right ) \] But \(T^{\prime }+\lambda _{n}T=0\) has solution \(T=e^{-\lambda _{n}t}\). Therefore the solution becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }A_{n}e^{-\lambda _{n}t}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) \] At \(t=0\)\[ e^{\frac {45}{10}x}\left ( 5\sin \left ( \pi x\right ) +9\sin \left ( 2\pi x\right ) +2\sin \left ( 3\pi x\right ) \right ) =\sum _{n=1}^{\infty }A_{n}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{n}-81}x\right ) \] But \(\lambda _{n}=\frac {81}{4}+n^{2}\pi ^{2}\). The above becomes\begin {align*} e^{\frac {45}{10}x}\left ( 5\sin \left ( \pi x\right ) +9\sin \left ( 2\pi x\right ) +2\sin \left ( 3\pi x\right ) \right ) & =A_{1}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\left ( \frac {81}{4}+\pi ^{2}\right ) -81}x\right ) \\ & +A_{2}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\left ( \frac {81}{4}+4\pi ^{2}\right ) -81}x\right ) \\ & +A_{3}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\left ( \frac {81}{4}+9\pi ^{2}\right ) -81}x\right ) \\ & +\cdots \end {align*}

Or\begin {align*} e^{\frac {45}{10}x}\left ( 5\sin \left ( \pi x\right ) +9\sin \left ( 2\pi x\right ) +2\sin \left ( 3\pi x\right ) \right ) & =A_{1}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\pi ^{2}}x\right ) \\ & +A_{2}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {16\pi ^{2}}x\right ) \\ & +A_{3}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {36\pi ^{2}}x\right ) \\ & +\cdots \end {align*}

Or\begin {align*} e^{\frac {45}{10}x}\left ( 5\sin \left ( \pi x\right ) +9\sin \left ( 2\pi x\right ) +2\sin \left ( 3\pi x\right ) \right ) & =A_{1}e^{\frac {9x}{2}}\sin \left ( \pi x\right ) \\ & +A_{2}e^{\frac {9x}{2}}\sin \left ( 2\pi x\right ) \\ & +A_{3}e^{\frac {9x}{2}}\sin \left ( 3\pi x\right ) \\ & +\cdots \end {align*}

By comparing coefficients, we see that \(A_{1}e^{\frac {9x}{2}}=5e^{\frac {45}{10}x}\) or \(A_{1}=e^{\left ( \frac {45}{10}-\frac {9}{2}\right ) x}=5\) and \(A_{2}=9\) and \(A_{3}=2\) and and all other \(A_{n}\) for \(n>3\) are zero. Hence the solution becomes\begin {align*} u\left ( x,t\right ) & =5e^{-\lambda _{1}t}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{1}-81}x\right ) +9e^{-\lambda _{2}t}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{2}-81}x\right ) +2e^{-\lambda _{3}t}e^{\frac {9x}{2}}\sin \left ( \frac {1}{2}\sqrt {4\lambda _{3}-81}x\right ) \\ & =e^{-\left ( \frac {81}{4}+\pi ^{2}\right ) t}e^{\frac {9x}{2}}\sin \left ( \pi x\right ) +e^{-\left ( \frac {81}{4}+4\pi ^{2}\right ) t}e^{\frac {9x}{2}}\sin \left ( 2\pi x\right ) +e^{-\left ( \frac {81}{4}+9\pi ^{2}\right ) t}e^{\frac {9x}{2}}\sin \left ( 3\pi x\right ) \\ & =e^{-\frac {81}{4}t+\frac {9}{2}x}\left ( 5e^{-\pi ^{2}t}\sin \left ( \pi x\right ) +9e^{-4\pi ^{2}t}\sin \left ( 2\pi x\right ) +2e^{-9\pi ^{2}t}\sin \left ( 3\pi x\right ) \right ) \end {align*}

________________________________________________________________________________________

3.1.1.18 [167] Diffusion Reaction and Euler-Cauchy Sturm-Liouville

problem number 167

Added May 5, 2019.

Solve \(u(x,t)\) \[ u_t = x^2 u_{xx} + x u_x \] For \(1<x<b\) and \(t>0\). The boundary conditions are \begin {align*} u(1,t) &= 0\\ u(b,t) &= 0 \end {align*}

Initial condition \(u(x,0)=f(x) \)

pict
Figure 3.27:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {2 e^{-\frac {\pi ^2 t K[1]^2}{\log ^2(b)}} \left (\int _1^b \frac {f(x) \sin \left (\frac {\pi K[1] \log (x)}{\log (b)}\right )}{x} \, dx\right ) \sin \left (\frac {\pi K[1] \log (x)}{\log (b)}\right )}{\log (b)}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {2 \left (\int _{1}^{b}\frac {f (x ) \sin \left (\frac {\pi n \ln (x )}{\ln (b )}\right )}{x}d x \right ) {\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{\ln (b )^{2}}} \sin \left (\frac {\pi n \ln (x )}{\ln (b )}\right )}{\ln (b )}\]

________________________________________________________________________________________

3.1.1.19 [168] Diffusion Reaction. Using growth form reaction term

problem number 168

Added December 29, 2018.

Solve for \(u(x,t)\) in \[ u_t = k u_{xx} + r u \] with \(k=\frac {1}{10},r=1\) and \(0<x<1\) and \(t>0\). With boundary conditions \begin {align*} u(0,t) &= 0\\ u(1,t) &=0 \end {align*}

And initial conditions \(u(x,0)=1\).

pict
Figure 3.28:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}-\frac {2 \left (-1+(-1)^{K[1]}\right ) e^{t-\frac {1}{10} \pi ^2 t K[1]^2} \sin (\pi x K[1])}{\pi K[1]}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}-\frac {2 \left (\left (-1\right )^{n}-1\right ) {\mathrm e}^{-\frac {\left (\pi ^{2} n^{2}-10\right ) t}{10}} \sin \left (\pi n x \right )}{\pi n}\]

Hand solution

Solution added 4/3/2019.\begin {align*} u_{t} & =ku_{xx}+ru\qquad t>0,0<x<1\\ u\left ( 0,t\right ) & =0\\ u\left ( 1,t\right ) & =0\\ u\left ( x,0\right ) & =1 \end {align*}

Let \(u=ve^{rt}\). Hence \(u_{t}=v_{t}e^{rt}+vre^{rt}\) and \(u_{xx}=v_{xx}e^{rt}\). Hence the PDE becomes \(v_{t}e^{rt}+vre^{rt}=v_{xx}e^{rt}+rve^{rt}\) which simplifies to\begin {align*} v_{t} & =kv_{xx}\qquad t>0,0<x<1\\ v\left ( 0,t\right ) & =0\\ v\left ( 1,t\right ) & =0 \end {align*}

The above is now in canonical form, it is standard heat PDE with homogeneous B.C. This has the solution\[ v\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-n^{2}\pi ^{2}t}\sin \left ( n\pi x\right ) \] Therefore\begin {align*} u & =ve^{rt}\\ u & =\sum _{n=1}^{\infty }B_{n}e^{-t\left ( n^{2}\pi ^{2}-r\right ) }\sin \left ( n\pi x\right ) \end {align*}

At \(t=0\) the above becomes\[ 1=\sum _{n=1}^{\infty }B_{n}\sin \left ( n\pi x\right ) \] Hence \(B_{n}\) are \(\sin \) Fourier coefficient of \(1\) which is \begin {align*} B_{n} & =2\int _{0}^{1}\sin \left ( n\pi x\right ) dx\\ & =2\left ( -\frac {1}{n\pi }\right ) \left ( \cos n\pi x\right ) _{0}^{1}\\ & =\frac {-2}{n\pi }\left ( \left ( -1\right ) ^{n}-1\right ) \end {align*}

Hence the solution becomes\[ u=\sum _{n=1}^{\infty }\frac {-2}{n\pi }\left ( \left ( -1\right ) ^{n}-1\right ) e^{-t\left ( n^{2}\pi ^{2}-r\right ) }\sin \left ( n\pi x\right ) \] But \(r=\frac {1}{10}\), therefore\[ u\left ( x,t\right ) =-\frac {2}{\pi }\sum _{n=1}^{\infty }\frac {\left ( \left ( -1\right ) ^{n}-1\right ) }{n}e^{-t\left ( n^{2}\pi ^{2}-\frac {1}{10}\right ) }\sin \left ( n\pi x\right ) \]

________________________________________________________________________________________

3.1.1.20 [169] Diffusion Reaction, using logistic form for reaction term

problem number 169

Added December 29, 2018.

Solve for \(u(x,t)\) in \[ u_t = k u_{xx} + r u\left (1- \frac {u}{\alpha } \right ) \]

with \(k=\frac {1}{100},r=\frac {1}{10},\alpha =10\) and \(0<x<1\) and \(t>0\).

With boundary conditions \begin {align*} u(0,t) &= 0\\ u(1,t) &=0 \end {align*}

And initial conditions \(u(x,0)=1\).

pict
Figure 3.29:PDE specification

Mathematica


Failed

Maple


sol=()

________________________________________________________________________________________

3.1.1.21 [170] Diffusion Reaction, using Aleee form for reaction term

problem number 170

Added December 29, 2018.

Solve for \(u(x,t)\) in \[ u_t = k u_{xx} + \alpha u + \beta u ^2 - \gamma u^3 \]

with \(k=\frac {1}{1000},\alpha =\frac {1}{100},\beta =\frac {1}{100}, \gamma =\frac {5}{1000}\) and \(0<x<1\) and \(t>0\).

With boundary conditions \begin {align*} u(0,t) &= 0\\ u(1,t) &=0 \end {align*}

And initial conditions \(u(x,0)=1\).

pict
Figure 3.30:PDE specification

Mathematica


Failed

Maple


sol=()

________________________________________________________________________________________

3.1.1.22 [171] Diffusion Reaction. Haberman 2.3.8

problem number 171

This is problem 2.3.8, from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ u_t = k u_{xx} - \alpha u \]

This corresponds to a one-dimentional rod either with heat loss through the lateral sides with outside temperature zero degrees (\(\alpha >0\)) or with insulated sides with a heat sink propertional to the temperature.

Suppose the boundary conditions are \(u(0,t)=0,u(L,t)=0\), solve with the temperature initially \(u\left ( x,0\right ) =f(x)\) if \(\alpha >0\)

pict
Figure 3.31:PDE specification

Mathematica


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

Maple


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

Hand solution

\begin {align*} \frac {\partial u}{\partial t} & =k\frac {\partial ^{2}u}{\partial x^{2}}-\alpha u\\ \frac {\partial u}{\partial t}+\alpha u & =k\frac {\partial ^{2}u}{\partial x^{2}} \end {align*}

Assuming \(u\left ( x,t\right ) =X\left ( x\right ) T\left ( t\right ) \) and substituting in the above gives\[ XT^{\prime }+\alpha XT=kTX^{\prime \prime }\] Dividing by \(kXT\neq 0\)\[ \frac {T^{\prime }}{kT}+\frac {\alpha }{k}=\frac {X^{\prime \prime }}{X}\] Since each side depends on different independent variable and both are equal, they must be both equal to same constant, say \(-\lambda \). Where \(\lambda \) is assumed real. \[ \frac {1}{k}\frac {T^{\prime }}{T}+\frac {\alpha }{k}=\frac {X^{\prime \prime }}{X}=-\lambda \] The two ODE’s are\begin {align*} \frac {1}{k}\frac {T^{\prime }}{T}+\frac {\alpha }{k} & =-\lambda \\ \frac {X^{\prime \prime }}{X} & =-\lambda \end {align*}

Or\begin {align*} T^{\prime }+\left ( \alpha +\lambda k\right ) T & =0\\ X^{\prime \prime }+\lambda X & =0 \end {align*}

The solution to the space ODE is the familiar (where \(\lambda >0\) is only possible case, As found in Haberman problem 2.3.3, part d. Since it has the same B.C.) \[ X_{n}=B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \qquad n=1,2,3,\cdots \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\). The time ODE is now solved.\[ \frac {dT_{n}}{dt}+\left ( \alpha +\lambda _{n}k\right ) T_{n}=0 \] This has the solution\begin {align*} T_{n}\left ( t\right ) & =e^{-\left ( \alpha +\lambda _{n}k\right ) t}\\ & =e^{-\alpha t}e^{-\left ( \frac {n\pi }{L}\right ) ^{2}kt} \end {align*}

For the same eigenvalues. Notice that no need to add a constant here, since it will be absorbed in the \(B_{n}\) when combined in the following step below. Therefore the solution to the PDE is\[ u_{n}\left ( x,t\right ) =T_{n}\left ( t\right ) X_{n}\left ( x\right ) \] But for linear system sum of eigenfunctions is also a solution. Hence\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }u_{n}\left ( x,t\right ) \\ & =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) e^{-\alpha t}e^{-\left ( \frac {n\pi }{L}\right ) ^{2}kt}\\ & =e^{-\alpha t}\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) e^{-\left ( \frac {n\pi }{L}\right ) ^{2}kt} \end {align*}

Where \(e^{-\alpha t}\) was moved outside since it does not depend on \(n\). From initial condition\[ u\left ( x,0\right ) =f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] Applying orthogonality of \(\sin \) as before to find \(B_{n}\) results in\[ B_{n}=\frac {2}{L}\int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx \] Hence the solution becomes\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}e^{-\alpha t}\left ( \sum _{n=1}^{\infty }\left ( \int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx\right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-\left ( \frac {n\pi }{L}\right ) ^{2}kt}\right ) \\ & =\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}\sin \left ( \frac {n\pi }{L}x\right ) f\left ( x\right ) dx\right ) \sin \left ( \frac {n\pi }{L}x\right ) e^{-t\left ( \frac {n^{2}\pi ^{2}k+\alpha L^{2}}{L^{2}}\right ) } \end {align*}

Hence it is clear that in the limit as \(t\) becomes large \(u\left ( x,t\right ) \rightarrow 0\) since \(\alpha >0\) and\[ \lim _{t\rightarrow \infty }u\left ( x,t\right ) =0 \]

________________________________________________________________________________________

3.1.1.23 [172] Diffusion Reaction

problem number 172

Solve the heat equation

\[ u_t = u_{xx} - u(x,t) \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end {align*}

Initial condition is \(u(x,0)=f(x)\)

pict
Figure 3.32:PDE specification

Mathematica


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

Maple


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

Hand solution

\begin {align*} u_{t} & =u_{xx}-u\\ u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

Let \(u\left ( x,t\right ) =v\left ( x,t\right ) e^{-t}\) , hence \(u_{t}=v_{t}e^{-t}-ve^{-t}\) and \(u_{xx}=v_{xx}e^{-t}\). Therefore the above PDE becomes\begin {align*} v_{t}e^{-t}-ve^{-t} & =v_{xx}e^{-t}-ve^{-t}\\ v_{t} & =v_{xx} \end {align*}

With boundary conditions\begin {align*} v\left ( 0,t\right ) & =0\\ v\left ( L,t\right ) & =0 \end {align*}

The solution to this PDE is known, since it has homogenouse BC and it is in standard form. The solution is\[ v\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-\left ( \frac {n\pi }{L}\right ) ^{2}t}\sin \left ( \frac {n\pi }{L}x\right ) \] Hence \begin {align} u\left ( x,t\right ) & =e^{-t}\sum _{n=1}^{\infty }B_{n}e^{-\left ( \frac {n^{2}\pi ^{2}}{L^{2}}\right ) t}\sin \left ( \frac {n\pi }{L}x\right ) \nonumber \\ & =\sum _{n=1}^{\infty }B_{n}e^{-\left ( \frac {n^{2}\pi ^{2}}{L^{2}}\right ) t-t}\sin \left ( \frac {n\pi }{L}x\right ) \nonumber \\ & =\sum _{n=1}^{\infty }B_{n}e^{-t\left ( \frac {n^{2}\pi ^{2}}{L^{2}}+1\right ) }\sin \left ( \frac {n\pi }{L}x\right ) \nonumber \\ & =\sum _{n=1}^{\infty }B_{n}e^{-t\left ( \frac {n^{2}\pi ^{2}+L^{2}}{L^{2}}\right ) }\sin \left ( \frac {n\pi }{L}x\right ) \tag {1} \end {align}

Applying initial conditions  \(u\left ( x,0\right ) =f\left ( x\right ) \) gives\[ f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] Hence \(B_{n}\) are the Fourier sine coefficients of \(f\left ( x\right ) \)\[ B_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx \] Therefore the solution in (1) becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\frac {2}{L}\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-t\left ( \frac {n^{2}\pi ^{2}+L^{2}}{L^{2}}\right ) }\sin \left ( \frac {n\pi }{L}x\right ) \\ & =\frac {2}{L}\sum _{n=1}^{\infty }\sin \left ( \frac {n\pi }{L}x\right ) e^{-t\left ( \frac {n^{2}\pi ^{2}+L^{2}}{L^{2}}\right ) }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \end {align*}

________________________________________________________________________________________

3.1.1.24 [173] Diffusion Reaction

problem number 173

Added Feb 10, 2018.

Solve the heat equation

\[ u_t + u(x,t) = 100 u_{xx} \]

For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(1,t) &= 0 \end {align*}

Initial condition is \(u(x,0)=\sin (2 \pi x)-\sin (5 \pi x)\)

pict
Figure 3.33:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to e^{-400 \pi ^2 t} \sin (2 \pi x)-e^{-2500 \pi ^2 t} \sin (5 \pi x)\right \}\right \}\]

Maple


\[u \left (x , t\right ) = -{\mathrm e}^{-2500 \pi ^{2} t} \sin \left (5 \pi x \right )+{\mathrm e}^{-400 \pi ^{2} t} \sin \left (2 \pi x \right )\]

________________________________________________________________________________________

3.1.1.25 [174] Diffusion Reaction

problem number 174

Added June 23, 2019.

Solve the heat equation

\[ u_t = k u_{xx} - u x \]

For \(0<x<\pi \) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(\pi ,t) &= 0 \end {align*}

Initial condition \(u(x,0)=\sin (x)\)

pict
Figure 3.34:PDE specification

Mathematica


Failed

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}\frac {\left (\cosh \left (t \lambda _{n}\right )+\sinh \left (t \lambda _{n}\right )\right ) \left (-\AiryAi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right )+\AiryAi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right )\right ) \left (-\AiryAi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \left (\int _{0}^{\pi }\AiryBi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right ) \sin (x )d x \right )+\AiryBi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \left (\int _{0}^{\pi }\AiryAi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right ) \sin (x )d x \right )\right )}{\AiryAi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right )^{2} \left (\int _{0}^{\pi }\AiryBi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right )^{2}d x \right )-2 \AiryAi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \left (\int _{0}^{\pi }\AiryAi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right )d x \right )+\AiryBi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right )^{2} \left (\int _{0}^{\pi }\AiryAi \left (\frac {x +\lambda _{n}}{k^{\frac {1}{3}}}\right )^{2}d x \right )}\boldsymbol {\mathrm {where}}\left \{\AiryAi \left (\frac {\lambda _{n}}{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right )-\AiryAi \left (\frac {\lambda _{n}+\pi }{k^{\frac {1}{3}}}\right ) \AiryBi \left (\frac {\lambda _{n}}{k^{\frac {1}{3}}}\right )=0\wedge -\infty \le \lambda _{n}\le \infty \right \}\]

________________________________________________________________________________________

3.1.1.26 [175] Diffusion convection (general case)

problem number 175

Added June 23, 2019.

Solve the heat equation

\[ u_t = k u_{xx} + a u_x \] Where \(a>0\). For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end {align*}

Initial condition \(u(x,0)=f(x)\)

pict
Figure 3.35:PDE specification

Mathematica


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

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}\frac {2 \left (\cosh \left (\frac {\left (L^{2} a^{2}+4 \pi ^{2} k^{2} n^{2}\right ) t}{4 L^{2} k}\right )-\sinh \left (\frac {\left (L^{2} a^{2}+4 \pi ^{2} k^{2} n^{2}\right ) t}{4 L^{2} k}\right )\right ) \left (\cosh \left (\frac {a x}{2 k}\right )-\sinh \left (\frac {a x}{2 k}\right )\right ) \left (\int _{0}^{L}\left (\cosh \left (\frac {a x}{2 k}\right )-\sinh \left (\frac {a x}{2 k}\right )\right ) {\mathrm e}^{\frac {a x}{k}} f (x ) \sin \left (\frac {\pi n x}{L}\right )d x \right ) \sin \left (\frac {\pi n x}{L}\right )}{L}\]

Hand solution

Solve \begin {align*} u_{t} & =ku_{xx}+au_{x}\\ u\left ( 0,t\right ) & =0\\ u\left ( L,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

Trying separation of variables. Let \(u=XT\), then the PDE becomes\begin {align*} T^{\prime }X & =kX^{\prime \prime }T+aX^{\prime }T\\ \frac {1}{k}\frac {T^{\prime }}{T} & =\frac {X^{\prime \prime }}{X}+\frac {a}{k}\frac {X^{\prime }}{X}=-\lambda \end {align*}

Where \(\lambda \) is separation constant. Hence\[ T^{\prime }+k\lambda T=0 \] Which has solution \(T\left ( t\right ) =e^{-k\lambda t}\) (the constant of integration is not needed, it will be combined with constant coming from the spatial ODE), and the spatial ODE is\begin {align*} \frac {X^{\prime \prime }}{X}+\frac {a}{k}\frac {X^{\prime }}{X} & =-\lambda \\ X^{\prime \prime }+\frac {a}{k}X^{\prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X\left ( L\right ) & =0 \end {align*}

The characteristic equation is \(r^{2}+\frac {a}{k}r+\lambda =0\).

Case \(\lambda =0\) Then \(r^{2}+\frac {a}{k}r=0\) or \(r\left ( r+\frac {a}{k}\right ) =0\). Hence \(r=0\) or \(r=-\frac {a}{k}\). So the solution is\[ X\left ( x\right ) =c_{1}+c_{2}e^{-\frac {a}{k}x}\] At \(X\left ( 0\right ) =0\) the above gives \(0=c_{1}+c_{2}\). Therefore the solution is \(X\left ( x\right ) =c_{1}\left ( 1-e^{\frac {-a}{k}x}\right ) \). At \(X\left ( L\right ) =0\) then \(c_{1}\left ( 1-e^{\frac {a}{k}L}\right ) =0\). This means this for non-trivial solution \(e^{\frac {-a}{k}L}=1\) or \(\frac {-a}{k}L=0\). Hence \(\lambda =0\) is not an eigenvalue.

Case \(\lambda <0\) Then \(r^{2}+\frac {a}{k}r+\lambda =0\) or \(r=\frac {-b}{2}\pm \frac {\sqrt {b^{2}-4ac}}{2a}=\frac {-a}{2k}\pm \frac {\sqrt {\frac {a^{2}}{k^{2}}-4\lambda }}{2}\). Since \(\lambda <0\) then the term under the sqrt root is positive. Hence the solution will have real roots. Not complex conjugate. Hence the solution is pure exponentials.  Let \(\frac {a^{2}}{k^{2}}-4\lambda =\alpha \) and \(\frac {a}{2k}=\beta \) then\begin {align*} r_{1} & =-\beta +\sqrt {\alpha }\\ r_{2} & =-\beta -\sqrt {\alpha } \end {align*}

Then \(X\left ( x\right ) =c_{1}\cosh \left ( \left ( -\beta +\alpha \right ) x\right ) +c_{2}\sinh \left ( \left ( -\beta -\alpha \right ) x\right ) \). At \(X\left ( 0\right ) =0\) this gives \(0=c_{1}\). Hence solution is \(X\left ( x\right ) =c_{2}\sinh \left ( \left ( -\beta -\alpha \right ) x\right ) \). At \(X\left ( L\right ) =0\), this gives\[ 0=c_{2}\sinh \left ( \left ( -\beta -\alpha \right ) L\right ) \] For non-trivial solution, \(\sinh \left ( \left ( -\beta -\alpha \right ) L\right ) =0\). But this is zero only when \(\left ( -\beta -\alpha \right ) L\) or \(\beta =-\alpha \). Or \(\frac {-a}{2k}=-\sqrt {\frac {a^{2}}{k^{2}}-4\lambda }\). Or \(\frac {a^{2}}{4k^{2}}=\frac {a^{2}}{k^{2}}-4\lambda \) or\begin {align*} 4\lambda & =\frac {a^{2}}{k^{2}}-\frac {a^{2}}{4k^{2}}\\ \lambda & =\frac {3}{16}\frac {a^{2}}{k^{2}} \end {align*}

But \(\lambda \) was assumed negative. Hence this is not possible. \(\lambda <0\) is not eigenvalue.

Case \(\lambda >0\) Then \(r^{2}+\frac {a}{k}r+\lambda =0\) or \(r=\frac {-a}{2k}\pm \frac {1}{2}\sqrt {\frac {a^{2}}{k^{2}}-4\lambda }=\frac {-a}{2k}\pm \sqrt {\frac {a^{2}}{4k^{2}}-\lambda }\). Since \(\lambda >0\) then the term under the sqrt root can be negative. Then only when \(\lambda >\frac {a^{2}}{4k^{2}}\) will there be complex roots. Therefore assuming \(\lambda >\frac {a^{2}}{4k^{2}}\), then\begin {align*} r_{1} & =\frac {-a}{2k}+i\sqrt {\lambda -\frac {a^{2}}{4k^{2}}}\\ r_{2} & =\frac {-a}{2k}-i\sqrt {\lambda -\frac {a^{2}}{4k^{2}}} \end {align*}

The solution is\[ X\left ( x\right ) =e^{\frac {-a}{2k}x}\left ( c_{1}\cos \left ( \sqrt {\lambda -\frac {a^{2}}{4k^{2}}}x\right ) +c_{2}\sin \left ( \sqrt {\lambda -\frac {a^{2}}{4k^{2}}}x\right ) \right ) \] At \(X\left ( 0\right ) =0\) this gives \(0=c_{1}\). Hence solution is\[ X\left ( x\right ) =e^{\frac {-a}{2k}x}c_{2}\sin \left ( \sqrt {\lambda -\frac {a^{2}}{4k^{2}}}x\right ) \] At \(X\left ( L\right ) =0\), this gives\[ 0=e^{\frac {-a}{2k}\pi }c_{2}\sin \left ( \sqrt {\lambda -\frac {a^{2}}{4k^{2}}}L\right ) \] For non-trivial solution, \(\sin \left ( \sqrt {\lambda -\frac {a^{2}}{4k^{2}}}L\right ) =0\) or \(\sqrt {\lambda -\frac {a^{2}}{4k^{2}}}L=n\pi \). Hence\begin {align*} \lambda -\frac {a^{2}}{4k^{2}} & =\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \\ \lambda _{n} & =\left ( \frac {n\pi }{L}\right ) ^{2}+\frac {a^{2}}{4k^{2}}\qquad n=1,2,3,\cdots \end {align*}

And the corresponding eigenfunction is \[ X_{n}\left ( x\right ) =e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \qquad n=1,2,3,\cdots \] Therefore the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }c_{n}e^{-k\lambda _{n}t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] \(c_{n}\) is found from initial conditions. At \(t=0\)\begin {align*} f\left ( x\right ) & =\sum _{n=1}^{\infty }c_{n}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \\ e^{\frac {a}{2k}x}f\left ( x\right ) & =\sum _{n=1}^{\infty }c_{n}\sin \left ( \frac {n\pi }{L}x\right ) \end {align*}

Therefore, by orthogonality\begin {align*} \int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx & =c_{n}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx\\ \int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx & =c_{n}\frac {L}{2}\\ c_{n} & =\frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx \end {align*}

Hence the solution becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-k\lambda _{n}t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}+\frac {a^{2}}{4k^{2}}\qquad n=1,2,3,\cdots \)\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-k\left ( \frac {n^{2}\pi ^{2}}{L^{2}}+\frac {a^{2}}{4k^{2}}\right ) t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \]

________________________________________________________________________________________

3.1.1.27 [176] Diffusion convection (special case)

problem number 176

Added June 23, 2019.

Solve the heat equation

\[ u_t = k u_{xx} + a u_x \] Where \(a>0\). For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end {align*}

Initial condition \(u(x,0)=f(x)\) using the following values \begin {align*} f(x)&=\sin (x)\\ k&=1\\ a&=5\\ L&=\pi \end {align*}

pict
Figure 3.36:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to -\frac {-\text {Integrate}\left [\frac {\left (1+e^{-i \pi K}\right ) e^{K (-K t+5 i t+i x)}}{1-K^2},\{K,-\infty ,\infty \},\text {Assumptions}\to K\in \mathbb {C}\right ]+\int _{\infty }^{-\infty }\frac {\exp \left (i t \sqrt {4 K[1]^2+25} K[1]+\frac {1}{2} x \left (2 i K[1]+\sqrt {4 K[1]^2+25}-5\right )\right ) \left (\frac {1+e^{-\frac {1}{2} \pi \left (2 i K[1]+\sqrt {4 K[1]^2+25}-5\right )}}{\frac {1}{4} \left (2 i K[1]+\sqrt {4 K[1]^2+25}-5\right )^2+1}-\frac {1+e^{\frac {1}{2} \pi \left (2 i K[1]+\sqrt {4 K[1]^2+25}+5\right )}}{\frac {1}{4} \left (2 i K[1]+\sqrt {4 K[1]^2+25}+5\right )^2+1}\right )}{-1+e^{\pi \left (2 i K[1]+\sqrt {4 K[1]^2+25}\right )}}dK[1]+\int _{-\infty }^{\infty }\exp \left (-i t \sqrt {4 K[1]^2+25} K[1]-\frac {1}{2} x \left (-2 i K[1]+\sqrt {4 K[1]^2+25}+5\right )\right ) \left (\frac {2 \left (1+\exp \left (-\frac {1}{2} \pi \left (-2 i K[1]+\sqrt {4 K[1]^2+25}-5\right )\right )\right )}{\left (-1+e^{2 i \pi K[1]-\pi \sqrt {4 K[1]^2+25}}\right ) \left (2 i K[1] \left (\sqrt {4 K[1]^2+25}-5\right )+5 \sqrt {4 K[1]^2+25}-27\right )}+\frac {2 i e^{2 i \pi K[1]} \left (1+e^{\frac {1}{2} \pi \left (-2 i K[1]+\sqrt {4 K[1]^2+25}+5\right )}\right )}{\left (e^{2 i \pi K[1]}-e^{\pi \sqrt {4 K[1]^2+25}}\right ) \left (2 K[1] \left (\sqrt {4 K[1]^2+25}+5\right )+i \left (5 \sqrt {4 K[1]^2+25}+27\right )\right )}\right )dK[1]}{2 \pi }\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}-\frac {160 \left (\cosh \left (\frac {5 x}{2}\right )-\sinh \left (\frac {5 x}{2}\right )\right ) \left (\cosh \left (n^{2} t +\frac {25}{4} t \right )-\sinh \left (n^{2} t +\frac {25}{4} t \right )\right ) \left ({\mathrm e}^{\frac {5 \pi }{2}} \left (-1\right )^{n}+1\right ) n \sin \left (n x \right )}{\pi \left (16 n^{4}+168 n^{2}+841\right )}\]

Hand solution

Solve \begin {align*} u_{t} & =ku_{xx}+au_{x}\\ u\left ( 0,t\right ) & =0\\ u\left ( L,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

With \(a=5,k=1,L=\pi ,f\left ( x\right ) =\sin \left ( x\right ) \). The above problem was solved in 3.1.1.26 on page 840 and the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-k\lambda _{n}t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] Where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}+\frac {a^{2}}{4k^{2}}\qquad n=1,2,3,\cdots \)\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-k\left ( \frac {n^{2}\pi ^{2}}{L^{2}}+\frac {a^{2}}{4k^{2}}\right ) t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] Substituting for \(f\left ( x\right ) =\sin \left ( x\right ) \) the above becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}e^{\frac {a}{2k}x}\sin \left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) e^{-k\left ( \frac {n^{2}\pi ^{2}}{L^{2}}+\frac {a^{2}}{4k^{2}}\right ) t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] But \[ \int _{0}^{\pi }e^{\frac {a}{2k}x}\sin \left ( x\right ) \sin \left ( nx\right ) dx=\frac {-16nak^{3}\left ( 1+\left ( -1\right ) ^{n}e^{\frac {\pi a}{2k}}\right ) }{a^{4}+16k^{4}\left ( n^{2}-1\right ) ^{2}+8a^{2}k^{2}\left ( 1+n^{2}\right ) }\] Hence the solution becomes\[ u\left ( x,t\right ) =\frac {-32ak^{3}}{L}\sum _{n=1}^{\infty }\left ( \frac {n\left ( 1+\left ( -1\right ) ^{n}e^{\frac {\pi a}{2k}}\right ) }{a^{4}+16k^{4}\left ( n^{2}-1\right ) ^{2}+8a^{2}k^{2}\left ( 1+n^{2}\right ) }\right ) e^{-k\left ( \frac {n^{2}\pi ^{2}}{L^{2}}+\frac {a^{2}}{4k^{2}}\right ) t}e^{\frac {-a}{2k}x}\sin \left ( \frac {n\pi }{L}x\right ) \] But \(L=\pi \), hence\[ u\left ( x,t\right ) =\frac {-32ak^{3}}{\pi }\sum _{n=1}^{\infty }\left ( \frac {n\left ( 1+\left ( -1\right ) ^{n}e^{\frac {\pi a}{2k}}\right ) }{a^{4}+16k^{4}\left ( n^{2}-1\right ) ^{2}+8a^{2}k^{2}\left ( 1+n^{2}\right ) }\right ) e^{-k\left ( n^{2}+\frac {a^{2}}{4k^{2}}\right ) t}e^{\frac {-a}{2k}x}\sin \left ( nx\right ) \] And \(a=5\)\[ u\left ( x,t\right ) =\frac {-160k^{3}}{\pi }\sum _{n=1}^{\infty }\left ( \frac {n\left ( 1+\left ( -1\right ) ^{n}e^{\frac {5\pi }{2k}}\right ) }{625+16k^{4}\left ( n^{2}-1\right ) ^{2}+200k^{2}\left ( 1+n^{2}\right ) }\right ) e^{-k\left ( n^{2}+\frac {25}{5k^{2}}\right ) t}e^{\frac {-5}{2k}x}\sin \left ( nx\right ) \] And \(k=1\)

\[ u\left ( x,t\right ) =\frac {-160}{\pi }\sum _{n=1}^{\infty }\left ( \frac {n\left ( 1+\left ( -1\right ) ^{n}e^{\frac {5\pi }{2}}\right ) }{625+16\left ( n^{2}-1\right ) ^{2}+200\left ( 1+n^{2}\right ) }\right ) e^{-\left ( n^{2}+\frac {25}{4}\right ) t}e^{\frac {-5}{2}x}\sin \left ( nx\right ) \]

Animation is below

Source code used for the above

pict
Figure 3.37:Source code

pict
Figure 3.38:Code for animation

The following animations for \(a=1,a=7\). Showing the effect of increasing the convection factor \(a\) on the solution.



\(a=1\)

\(a=7\)





________________________________________________________________________________________

3.1.1.28 [177] Haberman 2.4.2 (general case)

problem number 177

This is problem 2.4.2 from Richard Haberman applied partial differential equations, 5th edition.

Solve the heat equation

\[ u_t = k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\), \(u(L,t)=0\) with the temperature initially \(u(x,0)=f(x)\)

pict
Figure 3.39:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \frac {2 \underset {n=0}{\overset {\infty }{\sum }}e^{-\frac {k (2 \pi n+\pi )^2 t}{4 L^2}} \cos \left (\frac {(2 n+1) \pi x}{2 L}\right ) \int _0^L \cos \left (\frac {(2 n+1) \pi x}{2 L}\right ) f(x) \, dx}{L}\right \}\right \}\]

Maple


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

Hand solution

Solve

\[ \frac {\partial u}{\partial t}=\kappa \frac {\partial ^{2}u}{\partial x^{2}}\] Let \(u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right ) \), then the PDE becomes\[ \frac {1}{\kappa }T^{\prime }X=X^{\prime \prime }T \] Dividing by \(XT\)\[ \frac {1}{\kappa }\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}\] Since each side depends on different independent variable and both are equal, they must be both equal to same constant, say \(-\lambda \). Where \(\lambda \) is real. \[ \frac {1}{\kappa }\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda \] The two ODE’s are\begin {align} T^{\prime }+k\lambda T & =0\tag {1}\\ X^{\prime \prime }+\lambda X & =0\tag {2} \end {align}

Per problem statement, \(\lambda \geq 0\), so only two cases needs to be examined.

Case \(\lambda =0\)

The space equation becomes \(X^{\prime \prime }=0\) with the solution \[ X=Ax+b \] Hence left B.C. implies \(X^{\prime }\left ( 0\right ) =0\) or \(A=0\). Therefore the solution becomes \(X=b\). The right B.C. implies \(X\left ( L\right ) =0\) or \(b=0\). Therefore this leads to \(X=0\) as the only solution. This results in trivial solution. Therefore \(\lambda =0\) is not an eigenvalue.

Case \(\lambda >0\)

Starting with the space ODE, the solution is\begin {align*} X\left ( x\right ) & =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =-A\sqrt {\lambda }\sin \left ( \sqrt {\lambda }x\right ) +B\sqrt {\lambda }\cos \left ( \sqrt {\lambda }x\right ) \end {align*}

Left B.C. gives\begin {align*} 0 & =X^{\prime }\left ( 0\right ) \\ & =B\sqrt {\lambda } \end {align*}

Hence \(B=0\) since it is assumed \(\lambda \neq 0\) and \(\lambda >0\). Solution becomes\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) \] Applying right B.C. gives\begin {align*} 0 & =X\left ( L\right ) \\ & =A\cos \left ( \sqrt {\lambda }L\right ) \end {align*}

\(A=0\) leads to trivial solution. Therefore \(\cos \left ( \sqrt {\lambda }L\right ) =0\) or\begin {align*} \sqrt {\lambda } & =\frac {n\pi }{2L}\qquad n=1,3,5,\cdots \\ & =\frac {\left ( 2n-1\right ) \pi }{2L}\qquad n=1,2,3\cdots \end {align*}

Hence\begin {align*} \lambda _{n} & =\left ( \frac {n\pi }{2L}\right ) ^{2}\qquad n=1,3,5,\cdots \\ & =\frac {\left ( 2n-1\right ) ^{2}\pi ^{2}}{4L^{2}}\qquad n=1,2,3\cdots \end {align*}

Therefore\[ X_{n}\left ( x\right ) =A_{n}\cos \left ( \frac {n\pi }{2L}x\right ) \qquad n=1,3,5,\cdots \] And the corresponding time solution\[ T_{n}=e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t}\qquad n=1,3,5,\cdots \] Hence\begin {align*} u_{n}\left ( x,t\right ) & =X_{n}T_{n}\\ u\left ( x,t\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\cos \left ( \frac {n\pi }{2L}x\right ) e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t}\\ & =\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {\left ( 2n-1\right ) \pi }{2L}x\right ) e^{-k\left ( \frac {\left ( 2n-1\right ) \pi }{2L}\right ) ^{2}t} \end {align*}

From initial conditions\[ f\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\cos \left ( \frac {n\pi }{2L}x\right ) \] Multiplying both sides by \(\cos \left ( \frac {m\pi }{2L}x\right ) \) and integrating\[ \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{2L}x\right ) dx=\int \left ( \sum _{n=1,3,5,\cdots }^{\infty }A_{n}\cos \left ( \frac {m\pi }{2L}x\right ) \cos \left ( \frac {n\pi }{2L}x\right ) \right ) dx \] Interchanging order of summation and integration and applying orthogonality results in\begin {align*} \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{2L}x\right ) dx & =A_{m}\frac {L}{2}\\ A_{n} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {n\pi }{2L}x\right ) dx \end {align*}

Therefore the solution is\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1,3,5,\cdots }^{\infty }\left [ \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {n\pi }{2L}x\right ) dx\right ] \cos \left ( \frac {n\pi }{2L}x\right ) e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t}\\ & =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \cos \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) e^{-k\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}t} \end {align*}

________________________________________________________________________________________

3.1.1.29 [178] Left end zero, right end insulated, no source

problem number 178

Added January 13, 2020.

Problem 4.1.4, Introduction to Partial Differential Equations by Peter Olver ISBN 9783319020983.

Solve the heat equation

\[ u_t = k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\), \(u_x(L,t)=0\) with the temperature initially \(u(x,0)=f(x)\)

pict
Figure 3.40:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \frac {2 \underset {n=1}{\overset {\infty }{\sum }}e^{-\frac {k (1-2 n)^2 \pi ^2 t}{4 L^2}} \left (\int _0^L f(x) \sin \left (\frac {(2 n-1) \pi x}{2 L}\right ) \, dx\right ) \sin \left (\frac {(2 n-1) \pi x}{2 L}\right )}{L}\right \}\right \}\]

Maple


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

Hand solution

The problem to solve is to solve for \(u\left ( x,t\right ) \) in\[ u_{t}=ku_{xx}\qquad 0<x<L,t>0 \] With boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ u_{x}\left ( L,t\right ) & =0 \end {align*}

And initial conditions\[ u\left ( x,0\right ) =f\left ( x\right ) \] Let \(u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right ) \), then the PDE becomes\[ T^{\prime }X=kX^{\prime \prime }T \] Dividing by \(XT\)\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}\] Since each side depends on different independent variable and both are equal, they must be both equal to same constant, say \(-\lambda \). Where \(\lambda \) is real. \[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda \] The two ODE’s are\begin {equation} T^{\prime }+\lambda kT=0\tag {1} \end {equation} And the eigenvalue ODE\begin {align} X^{\prime \prime }+\lambda X & =0\tag {2}\\ X\left ( 0\right ) & =0\nonumber \\ X^{\prime }\left ( L\right ) & =0\nonumber \end {align}

Now we solve (2) to find the eigenvalues and eigenfunctions.

Case \(\lambda <0\)

Let \(-\lambda =\omega ^{2}\). Hence the ODE is \(X^{\prime \prime }-\omega ^{2}X=0\) and the solution becomes\[ X\left ( x\right ) =C_{1}\cosh \left ( \omega x\right ) +C_{2}\sinh \left ( \omega x\right ) \] At \(x=0\) the above gives\[ 0=C_{1}\] Hence the solution now becomes\[ X\left ( x\right ) =C_{2}\sinh \left ( \omega x\right ) \] Taking derivative gives\[ X^{\prime }\left ( x\right ) =\omega C_{2}\sinh \left ( \omega x\right ) \] At \(x=L\)\[ 0=\omega C_{2}\cosh \left ( \omega L\right ) \] But \(\cosh \left ( \omega L\right ) \) is never zero. Therefore \(C_{2}=0\) which leads to trivial solution. Therefore \(\lambda <0\) is not eigenvalue.

Case \(\lambda =0\)

The space equation becomes \(X^{\prime \prime }=0\) with the solution \[ X=Ax+B \] At \(x=0\) the above gives \(0=B\). Therefore the solution is \(X=Ax\). Taking derivative gives \(X^{\prime }=A\). At \(x=L\) this gives \(0=A\). Which leads to trivial solutions. Therefore \(\lambda =0\) is not an eigenvalue.

Case \(\lambda >0\)

Starting with the space ODE, the solution is\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \] Left B.C. gives\[ 0=A \] The solution becomes\[ X\left ( x\right ) =B\sin \left ( \sqrt {\lambda }x\right ) \] Taking derivative gives\[ X^{\prime }\left ( x\right ) =\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }x\right ) \] Applying right B.C. gives\[ 0=\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }L\right ) \] For non trivial solution we want \(\cos \left ( \sqrt {\lambda }L\right ) =0\) or\[ \sqrt {\lambda }=\frac {n\pi }{2L}\qquad n=1,3,5,\cdots \] Hence the eigenvalues are \[ \lambda _{n}=\left ( \frac {n\pi }{2L}\right ) ^{2}\qquad n=1,3,5,\cdots \] Therefore the eigenfunctions are \[ X_{n}\left ( x\right ) =\sin \left ( \frac {n\pi }{2L}x\right ) \qquad n=1,3,5,\cdots \] Now that we found the eigenvalues, we can solve the time ODE (1).\begin {align*} T_{n}^{\prime }+k\lambda _{n}T & =0\\ T_{n} & =B_{n}e^{-k\lambda _{n}t}\\ & =B_{n}e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t} \end {align*}

Hence the fundamental solution is \begin {align} u_{n}\left ( x,t\right ) & =X_{n}T_{n}\nonumber \\ u\left ( x,t\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }B_{n}\sin \left ( \frac {n\pi }{2L}x\right ) e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t}\tag {3} \end {align}

From initial conditions\[ f\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }B_{n}\sin \left ( \frac {n\pi }{2L}x\right ) \] Multiplying both sides by \(\sin \left ( \frac {m\pi }{2L}x\right ) \) and integrating\[ \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{2L}x\right ) dx=\int _{0}^{L}\left ( \sum _{n=1,3,5,\cdots }^{\infty }B_{n}\sin \left ( \frac {m\pi }{2L}xx\right ) \sin \left ( \frac {n\pi }{2L}x\right ) \right ) dx \] Interchanging order of summation and integration and applying orthogonality between \(\cos \) functions results in\begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{2L}x\right ) dx & =\int _{0}^{L}B_{m}\sin ^{2}\left ( \frac {m\pi }{2L}x\right ) dx\\ & =B_{m}\frac {L}{2} \end {align*}

Therefore \[ B_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{2L}x\right ) dx \] Therefore the solution is (3) becomes\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1,3,5,\cdots }^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{2L}x\right ) dx\right ) \sin \left ( \frac {n\pi }{2L}x\right ) e^{-k\left ( \frac {n\pi }{2L}\right ) ^{2}t}\\ & =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) e^{-\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}t} \end {align*}

________________________________________________________________________________________

3.1.1.30 [179] One end insulated

problem number 179

Added June 9, 2019

Solve the heat equation for \(u(x,t)\) \[ u_t = k u_{xx} \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} u_x(0,t) &= 0 \\ u(L,t) &= T_0 \\ \end {align*}

Where \(T_0>0\) and initial condition is \(u(x,0)=0\)

pict
Figure 3.41:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to 2 \underset {n=0}{\overset {\infty }{\sum }}-\frac {2 e^{-\frac {1}{4} k (2 \pi n+\pi )^2 t} \text {T0} \cos (n \pi ) \cos \left (\frac {1}{2} (2 n+1) \pi x\right )}{2 \pi n+\pi }+\text {T0}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \mathit {T0} -4 \left (\Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}\frac {\mathit {T0} \left (-1\right )^{n} \cos \left (\frac {\left (2 n +1\right ) \pi x}{2 L}\right ) {\mathrm e}^{-\frac {\pi ^{2} \left (2 n +1\right )^{2} k t}{4 L^{2}}}}{\left (2 n +1\right ) \pi }\right )\]

________________________________________________________________________________________

3.1.1.31 [180] Haberman 2.3.7 (general case)

problem number 180

This is problem 2.3.7, from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ u_t = k u_{xx} \]

Subject to boundary conditions \(u_x(0,t)=0\) , \(u_x(L,t)=0\) with initial conditions \(u(x,0) =f(x)\)

pict
Figure 3.42:PDE specification

Mathematica


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

Maple


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

Hand solution

\begin {align*} \frac {\partial u}{\partial t} & =k\frac {\partial ^{2}u}{\partial x^{2}}\\ u_{x}\left ( 0,t\right ) & =0\\ u_{x}\left ( L,t\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}

Let \(u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right ) \), then the PDE becomes\[ \frac {1}{k}T^{\prime }X=X^{\prime \prime }T \] Dividing by \(XT\neq 0\)\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}\] Since each side depends on different independent variable and both are equal, they must be both equal to same constant, say \(-\lambda \). Where \(\lambda \) is assumed real. \[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda \] The two ODE’s generated are\begin {align} T^{\prime }+k\lambda T & =0\tag {1}\\ X^{\prime \prime }+\lambda X & =0\tag {2} \end {align}

Starting with the space ODE equation (2), with corresponding boundary conditions \(\frac {dX}{dx}\left ( 0\right ) =0,\frac {dX}{dx}\left ( L\right ) =0\). Assuming the solution is \(X\left ( x\right ) =e^{rx}\), Then the characteristic equation is\begin {align*} r^{2}+\lambda & =0\\ r^{2} & =-\lambda \\ r & =\pm \sqrt {-\lambda } \end {align*}

The following cases are considered.

case \(\lambda <0\) In this case, \(-\lambda \) and also \(\sqrt {-\lambda }\) are positive. Hence the roots \(\pm \sqrt {-\lambda }\) are both real. Let \[ \sqrt {-\lambda }=s \] Where \(s>0\). This gives the solution\begin {align*} X\left ( x\right ) & =A\cosh \left ( sx\right ) +B\sinh \left ( sx\right ) \\ \frac {dX}{dx} & =A\sinh \left ( sx\right ) +B\cosh \left ( sx\right ) \end {align*}

Applying the left B.C. gives\begin {align*} 0 & =\frac {dX}{dx}\left ( 0\right ) \\ & =B\cosh \left ( 0\right ) \\ & =B \end {align*}

The solution becomes \(X\left ( x\right ) =A\cosh \left ( sx\right ) \) and hence\(\frac {dX}{dx}=A\sinh \left ( sx\right ) \). Applying the right B.C. gives\begin {align*} 0 & =\frac {dX}{dx}\left ( L\right ) \\ & =A\sinh \left ( sL\right ) \end {align*}

\(A=0\) result in trivial solution. Therefore assuming \(\sinh \left ( sL\right ) =0\) implies \(sL=0\) which is not valid since \(s>0\) and \(L\neq 0\). Hence only trivial solution results from this case. \(\lambda <0\) is not an eigenvalue.

case \(\lambda =0\)

The ODE becomes\[ \frac {d^{2}X}{dx^{2}}=0 \] The solution is\begin {align*} X\left ( x\right ) & =c_{1}x+c_{2}\\ \frac {dX}{dx} & =c_{1} \end {align*}

Applying left boundary conditions gives\begin {align*} 0 & =\frac {dX}{dx}\left ( 0\right ) \\ & =c_{1} \end {align*}

Hence the solution becomes \(X\left ( x\right ) =c_{2}\). Therefore \(\frac {dX}{dx}=0\). Applying the right B.C. provides no information.

Therefore this case leads to the solution \(X\left ( x\right ) =c_{2}\). Associated with this one eigenvalue, the time equation becomes \(\frac {dT_{0}}{dt}=0\) hence \(T_{0}\) is constant, say \(\alpha \). Hence the solution \(u_{0}\left ( x,t\right ) \) associated with this \(\lambda =0\) is\begin {align*} u_{0}\left ( x,t\right ) & =X_{0}T_{0}\\ & =c_{2}\alpha \\ & =A_{0} \end {align*}

where constant \(c_{2}\alpha \) was renamed to \(A_{0}\) to indicate it is associated with \(\lambda =0\).  \(\lambda =0\) is an eigenvalue.

case \(\lambda >0\)

Hence \(-\lambda \) is negative, and the roots are both complex. \[ r=\pm i\sqrt {\lambda }\] The solution is\begin {align*} X\left ( x\right ) & =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \\ \frac {dX}{dx} & =-A\sqrt {\lambda }\sin \left ( \sqrt {\lambda }x\right ) +B\sqrt {\lambda }\cos \left ( \sqrt {\lambda }x\right ) \end {align*}

Applying the left B.C. gives\begin {align*} 0 & =\frac {dX}{dx}\left ( 0\right ) \\ & =B\sqrt {\lambda }\cos \left ( 0\right ) \\ & =B\sqrt {\lambda } \end {align*}

Therefore \(B=0\) as \(\lambda >0\). The solution becomes \(X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) \) and \(\frac {dX}{dx}=-A\sqrt {\lambda }\sin \left ( \sqrt {\lambda }x\right ) \). Applying the right B.C. gives\begin {align*} 0 & =\frac {dX}{dx}\left ( L\right ) \\ & =-A\sqrt {\lambda }\sin \left ( \sqrt {\lambda }L\right ) \end {align*}

\(A=0\) gives a trivial solution. Selecting \(\sin \left ( \sqrt {\lambda }L\right ) =0\) gives\[ \sqrt {\lambda }L=n\pi \qquad n=1,2,3,\cdots \] Or\[ \lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \] Therefore the space solution is\[ X_{n}\left ( x\right ) =A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \qquad n=1,2,3,\cdots \] The time solution is found by solving \[ \frac {dT_{n}}{dt}+k\lambda _{n}T_{n}=0 \] This has the solution\begin {align*} T_{n}\left ( t\right ) & =e^{-k\lambda _{n}t}\\ & =e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\qquad n=1,2,3,\cdots \end {align*}

For the same set of eigenvalues. Notice that no need to add a constant here, since it will be absorbed in the \(A_{n}\) when combined in the following step below. Since for \(\lambda =0\) the time solution was found to be constant, and for \(\lambda >0\) the time solution is \(e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\), then no time solution will grow with time. Time solutions always decay with time as the exponent \(-k\left ( \frac {n\pi }{L}\right ) ^{2}t\) is negative quantity. The solution to the PDE for \(\lambda >0\) is \[ u_{n}\left ( x,t\right ) =T_{n}\left ( t\right ) X_{n}\left ( x\right ) \qquad n=0,1,2,3,\cdots \] But for linear system sum of eigenfunctions is also a solution. Hence\begin {align*} u\left ( x,t\right ) & =u_{\lambda =0}\left ( x,t\right ) +\sum _{n=1}^{\infty }u_{n}\left ( x,t\right ) \\ & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t} \end {align*}

From the solution found above, setting \(t=0\) gives\[ f\left ( x\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \] Multiplying both sides with \(\cos \left ( \frac {m\pi }{L}x\right ) \) where in this problem \(m=0,1,2,\cdots \) (since there was an eigenvalue associated with \(\lambda =0\)), and integrating over the domain gives\begin {align*} \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx & =\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) \left ( A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \right ) dx\\ & =\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\int \cos \left ( \frac {m\pi }{L}x\right ) \sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) dx\\ & =\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\int _{0}^{L}\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {m\pi }{L}x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \end {align*}

Interchanging the order of summation and integration\begin {equation} \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\sum _{n=1}^{\infty }A_{n}\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx\tag {1} \end {equation} case \(m=0\)

When \(m=0\) then \(\cos \left ( \frac {m\pi }{L}x\right ) =1\) and the above simplifies to\[ \int _{0}^{L}f\left ( x\right ) dx=\int _{0}^{L}A_{0}dx+\sum _{n=1}^{\infty }A_{n}\int _{0}^{L}\cos \left ( \frac {n\pi }{L}x\right ) dx \] But \(\int _{0}^{L}\cos \left ( \frac {n\pi }{L}x\right ) dx=0\) and the above becomes\begin {align*} \int _{0}^{L}f\left ( x\right ) dx & =\int _{0}^{L}A_{0}dx\\ & =A_{0}L \end {align*}

Therefore\[ A_{0}=\frac {1}{L}\int _{0}^{L}f\left ( x\right ) dx \] case \(m>0\)

From (1), one term survives in the integration when only \(n=m\), hence\[ \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=A_{0}\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) dx+A_{m}\int _{0}^{L}\cos ^{2}\left ( \frac {m\pi }{L}x\right ) dx \] But \(\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) dx=0\) and the above becomes\[ \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=A_{m}\frac {L}{2}\] Therefore\[ A_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \] For \(n=1,2,3,\cdots \)

Therefore the solution is\begin {align*} u\left ( x,t\right ) & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\\ & =\frac {1}{L}\int _{0}^{L}f\left ( x\right ) dx+\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx\right ) \cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t} \end {align*}

In the limit as \(t\rightarrow \infty \) the term \(e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\rightarrow 0\). What is left is \(A_{0}\). But \(A_{0}=\frac {1}{L}\int _{0}^{L}f\left ( x\right ) dx\) from above. This quantity is the average of the initial temperature.

________________________________________________________________________________________

3.1.1.32 [181] specific case

problem number 181

Added June 21, 2019

Solve

\[ u_t = k u_{xx} \] Subject to boundary conditions \(u_x(0,t)=0\) , \(u_x(L,t)=0\) with initial conditions \(u(x,0)=f(x)\) using the following values \begin {align*} L&=5\\ k&=\frac {1}{100}\\ f(x)&=x \end {align*}

pict
Figure 3.43:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \frac {2}{5} \underset {n=1}{\overset {\infty }{\sum }}\frac {25 \left (-1+(-1)^n\right ) e^{-\frac {n^2 \pi ^2 t}{2500}} \cos \left (\frac {n \pi x}{5}\right )}{n^2 \pi ^2}+\frac {5}{2}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 10 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\left (-1\right )^{n}-1\right ) \cos \left (\frac {\pi n x}{5}\right ) {\mathrm e}^{-\frac {\pi ^{2} n^{2} t}{2500}}}{\pi ^{2} n^{2}}\right )+\frac {5}{2}\]

Hand solution

The general solution for this type of PDE is given in problem 3.1.1.31 on page 864 as\begin {equation} u\left ( x,t\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\tag {1} \end {equation} In this problem \(u\left ( x,0\right ) =\) \(f\left ( x\right ) =x,L=5,k=\frac {1}{100}\). Hence the above becomes\begin {equation} u\left ( x,t\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{5}x\right ) e^{-\left ( \frac {1}{100}\left ( \frac {n\pi }{5}\right ) ^{2}t\right ) }\tag {2} \end {equation} At \(t=0\) the above becomes\[ x=A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{5}x\right ) \] For \(n=0\) orthogonality gives\begin {align*} \int _{0}^{5}xdx & =\int _{0}^{5}A_{0}dx\\ \frac {25}{2} & =5A_{0}\\ A_{0} & =\frac {5}{2} \end {align*}

For \(n>0\)\begin {align*} \int _{0}^{5}x\cos \left ( \frac {n\pi }{5}x\right ) dx & =\int _{0}^{5}A_{n}\cos ^{2}\left ( \frac {n\pi }{5}x\right ) dx\\ \frac {25}{n^{2}\pi ^{2}}\left ( -1+\left ( -1\right ) ^{n}\right ) & =\frac {5}{2}A_{n}\\ A_{n} & =\frac {10}{n^{2}\pi ^{2}}\left ( -1+\left ( -1\right ) ^{n}\right ) \end {align*}

Hence the solution (2) becomes\[ u\left ( x,t\right ) =\frac {5}{2}+\frac {10}{\pi ^{2}}\sum _{n=1}^{\infty }\frac {1}{n^{2}}\left ( -1+\left ( -1\right ) ^{n}\right ) \cos \left ( \frac {n\pi }{5}x\right ) e^{-\frac {n^{2}\pi ^{2}}{2500}t}\] The following is an animation of the solution

Source code used for the above

pict
Figure 3.44:Source code

pict
Figure 3.45:Code for animation

________________________________________________________________________________________

3.1.1.33 [182] Haberman 2.4.1 (a)

problem number 182

This is problem 2.4.1 part(a) from Richard Haberman applied partial differential equations, 5th edition.

Consider the heat equation

\[ u_t = k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\) , \(u_x(L,t)=0\). Initial conditions

\(u(x,0) =\left \{ \begin {array} [c]{ccc}0 & & x< \frac {L}{2}\\ 1 & & x> \frac {L}{2} \end {array} \right . \)

pict
Figure 3.46:PDE specification

Mathematica


$Aborted

Maple


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

________________________________________________________________________________________

3.1.1.34 [183] Both ends insulated, no source

problem number 183

Added January 13, 2020

This is problem 4.1.7 Introduction to Partial Differential Equations by Peter Olver ISBN 9783319020983.

Solve

\[ u_t = k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\) , \(u_x(L,t)=0\). Initial conditions

\(u(x,0) =\left \{ \begin {array} [c]{ccc}x & & 0<x< \frac {L}{2}\\ 1-x & & \frac {L}{2}<x<L \end {array} \right . Use \)L=1\(. \)

pict
Figure 3.47:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to 2 \underset {n=1}{\overset {\infty }{\sum }}\frac {4 e^{-k n^2 \pi ^2 t} \cos \left (\frac {n \pi }{2}\right ) \cos (n \pi x) \sin ^2\left (\frac {n \pi }{4}\right )}{n^2 \pi ^2}+\frac {1}{4}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 2 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\left (-\frac {\left (\left (-1\right )^{n}-2 \cos \left (\frac {\pi n}{2}\right )+1\right ) \cos \left (\pi n x \right ) {\mathrm e}^{-\pi ^{2} k n^{2} t}}{\pi ^{2} n^{2}}\right )\right )+\frac {1}{4}\]

Hand solution

Let \(u\left ( x,t\right ) =T\left ( t\right ) X\left ( x\right ) \), then the PDE becomes\[ \frac {1}{k}T^{\prime }X=X^{\prime \prime }T \] Dividing by \(XT\neq 0\)\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}\] Since each side depends on different independent variable and both are equal, they must be both equal to same constant, say \(-\lambda \). Where \(\lambda \) is assumed real. \[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda \] The two ODE’s generated are\begin {equation} T^{\prime }+k\lambda T=0\tag {1} \end {equation} And the eigenvalue ODE\begin {align} X^{\prime \prime }+\lambda X & =0\tag {2}\\ X^{\prime }\left ( 0\right ) & =0\nonumber \\ X^{\prime }\left ( L\right ) & =0\nonumber \end {align}

Starting with the eigenvalue ODE equation (2). The following cases are considered.

case \(\lambda <0\)

In this case, \(-\lambda \) is positive. Let \(-\lambda =\omega ^{2}\). Hence the ODE is \(X^{\prime \prime }-\omega ^{2}X=0\) and the solution becomes\[ X\left ( x\right ) =C_{1}\cosh \left ( \omega x\right ) +C_{2}\sinh \left ( \omega x\right ) \] Therefore\[ X^{\prime }=C_{1}\sinh \left ( \omega x\right ) +C_{2}\cosh \left ( \omega x\right ) \] Applying the left B.C. gives\[ 0=C_{2}\] Therefore the solution becomes \(X\left ( x\right ) =C_{1}\cosh \left ( \omega x\right ) \) and \(X^{\prime }\left ( x\right ) =C_{1}\sinh \left ( \omega x\right ) \).  Applying the right B.C. gives\[ 0=C_{1}\sinh \left ( \omega L\right ) \] For non-trivial solution we want \(\sinh \left ( \omega L\right ) =0\). But this is not possible since \(\sinh \) is zero when its argument is zero, which is not the case here. Hence only trivial solution results from this case. \(\lambda <0\) is not an eigenvalue.

case \(\lambda =0\)

The solution is\begin {align*} X\left ( x\right ) & =c_{1}x+c_{2}\\ X^{\prime }\left ( x\right ) & =c_{1} \end {align*}

Applying left boundary conditions gives\[ 0=c_{1}\] Hence the solution becomes \(X\left ( x\right ) =c_{2}\). Therefore \(\frac {dX}{dx}=0\). Applying the right B.C. provides no information. Any \(c_{2}\) will work. Therefore this case leads to the solution \(X\left ( x\right ) =c_{2}\). Associated with this one eigenvalue, the time equation becomes \(T_{0}^{\prime }\left ( t\right ) =0\) hence \(T_{0}\left ( t\right ) \) is a constant. Hence the solution \(u_{0}\left ( x,t\right ) \) associated with this \(\lambda =0\) is\begin {align*} u_{0}\left ( x,t\right ) & =X_{0}T_{0}\\ & =A_{0} \end {align*}

where constant \(c_{2}T_{0}\) was renamed to \(\frac {A_{0}}{2}\) to indicate it is associated with \(\lambda =0\).  \(\lambda =0\) is an eigenvalue with eigenfunction constant \(\frac {A_{0}}{2}\).

case \(\lambda >0\)

The solution is\begin {align*} X\left ( x\right ) & =c_{1}\cos \left ( \sqrt {\lambda }x\right ) +c_{2}\sin \left ( \sqrt {\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =-c_{1}\sqrt {\lambda }\sin \left ( \sqrt {\lambda }x\right ) +c_{2}\sqrt {\lambda }\cos \left ( \sqrt {\lambda }x\right ) \end {align*}

Applying the left B.C. gives\[ 0=c_{2}\sqrt {\lambda }\] Therefore \(c_{2}=0\) as \(\lambda >0\). The solution becomes \[ X\left ( x\right ) =c_{1}\cos \left ( \sqrt {\lambda }x\right ) \] And \(X^{\prime }\left ( x\right ) =-c_{1}\sqrt {\lambda }\sin \left ( \sqrt {\lambda }x\right ) \). Applying the right B.C. gives\[ 0=-c_{1}\sqrt {\lambda }\sin \left ( \sqrt {\lambda }L\right ) \] \(c_{1}=0\) gives a trivial solution. Selecting \(\sin \left ( \sqrt {\lambda }L\right ) =0\) gives\[ \sqrt {\lambda }L=n\pi \qquad n=1,2,3,\cdots \] Or\[ \lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \] Therefore the eigenfunctions are\[ X_{n}\left ( x\right ) =\cos \left ( \frac {n\pi }{L}x\right ) \qquad n=1,2,3,\cdots \] The time solution is found by solving \[ T_{n}^{\prime }\left ( t\right ) +k\lambda _{n}T_{n}\left ( t\right ) =0 \] This has the solution\begin {align*} T_{n}\left ( t\right ) & =A_{n}e^{-k\lambda _{n}t}\\ & =A_{n}e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\qquad n=1,2,3,\cdots \end {align*}

The solution to the PDE is \[ u_{n}\left ( x,t\right ) =T_{n}\left ( t\right ) X_{n}\left ( x\right ) \qquad n=0,1,2,3,\cdots \] But for linear system sum of eigenfunctions is also a solution. Hence\begin {align} u\left ( x,t\right ) & =u_{0}\left ( x,t\right ) +\sum _{n=1}^{\infty }u_{n}\left ( x,t\right ) \nonumber \\ & =\frac {A_{0}}{2}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\tag {1} \end {align}

From the solution found above, setting \(t=0\) gives\[ f\left ( x\right ) =\frac {A_{0}}{2}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \] Hence \(A_{0},A_{n}\) are the Fourier \(\cos \) coefficients for the function \(f\left ( x\right ) \). Doing an even extension of \(f\left ( x\right ) \) from \(\left [ -L,L\right ] \), then \(\frac {A_{0}}{2}\) is the average of the function \(f\left ( x\right ) \) over \(\left [ -L,L\right ] \). But this average is seen as \(\frac {2\left ( \frac {1}{2}\times \frac {1}{2}\right ) }{2}=\frac {1}{4}\). The term \(\frac {1}{2}\times \frac {1}{2}\) is the area of \(f\left ( x\right ) \) from \(\left [ 0,L\right ] \).\[ \frac {A_{0}}{2}=\frac {1}{4}\] For \(A_{n}\)\[ A_{n}=\frac {1}{L}\int _{-L}^{L}f\left ( x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \] Replacing \(L=1\) and using the definition of \(f\left ( x\right ) \) given above gives\[ A_{n}=\int _{-1}^{1}f\left ( x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \] But \(f\left ( x\right ) \) is even (after even extending) and \(\cos \) is even, hence the above becomes\begin {align} A_{n} & =2\int _{0}^{1}f\left ( x\right ) \cos \left ( n\pi x\right ) dx\nonumber \\ & =2\left ( \int _{0}^{\frac {1}{2}}x\cos \left ( n\pi x\right ) dx+\int _{\frac {1}{2}}^{1}\left ( 1-x\right ) \cos \left ( n\pi x\right ) dx\right ) \nonumber \\ & =2\left ( \int _{0}^{\frac {1}{2}}x\cos \left ( n\pi x\right ) dx+\int _{\frac {1}{2}}^{1}\cos \left ( n\pi x\right ) dx-\int _{\frac {1}{2}}^{1}x\cos \left ( n\pi x\right ) dx\right ) \tag {2} \end {align}

But \begin {align} \int _{a}^{b}x\cos \left ( n\pi x\right ) dx & =\frac {1}{n\pi }\left [ x\sin \left ( n\pi x\right ) \right ] _{a}^{b}-\frac {1}{n\pi }\int _{a}^{b}\sin \left ( n\pi x\right ) dx\nonumber \\ & =\frac {1}{n\pi }\left [ x\sin \left ( n\pi x\right ) \right ] _{a}^{b}+\frac {1}{n^{2}\pi ^{2}}\left [ \cos \left ( n\pi x\right ) \right ] _{a}^{b}\tag {3} \end {align}

When \(a=0,b=\frac {1}{2}\) the above gives\begin {align} \int _{0}^{\frac {1}{2}}x\cos \left ( n\pi x\right ) dx & =\frac {1}{n\pi }\left [ x\sin \left ( n\pi x\right ) \right ] _{0}^{\frac {1}{2}}+\frac {1}{n^{2}\pi ^{2}}\left [ \cos \left ( n\pi x\right ) \right ] _{0}^{\frac {1}{2}}\nonumber \\ & =\frac {1}{n\pi }\left ( \frac {1}{2}\sin \left ( \frac {n\pi }{2}\right ) \right ) +\frac {1}{n^{2}\pi ^{2}}\left ( \cos \left ( \frac {n\pi }{2}\right ) -1\right ) \nonumber \\ & =\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\left ( \cos \left ( \frac {n\pi }{2}\right ) -1\right ) \nonumber \\ & =\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\tag {4} \end {align}

And when \(a=\frac {1}{2},b=1\) (3) gives\begin {align} \int _{\frac {1}{2}}^{1}x\cos \left ( n\pi x\right ) dx & =\frac {1}{n\pi }\left [ x\sin \left ( n\pi x\right ) \right ] _{\frac {1}{2}}^{1}+\frac {1}{n^{2}\pi ^{2}}\left [ \cos \left ( n\pi x\right ) \right ] _{\frac {1}{2}}^{1}\nonumber \\ & =\frac {1}{n\pi }\left [ \sin \left ( n\pi \right ) -\frac {1}{2}\sin \left ( \frac {n\pi }{2}\right ) \right ] +\frac {1}{n^{2}\pi ^{2}}\left [ \cos \left ( n\pi \right ) -\cos \left ( \frac {n\pi }{2}\right ) \right ] \nonumber \\ & =-\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( n\pi \right ) -\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) \tag {5} \end {align}

Substituting (4,5) into (2) gives\begin {align*} \frac {A_{n}}{2} & =\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\\ & +\int _{\frac {1}{2}}^{1}\cos \left ( n\pi x\right ) dx\\ & -\left ( -\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( n\pi \right ) -\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) \right ) \end {align*}

Or\begin {align*} \frac {A_{n}}{2} & =\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\\ & +\frac {1}{n\pi }\overset {0}{\overbrace {\sin \left ( n\pi \right ) }}-\frac {1}{n\pi }\sin \left ( \frac {n\pi }{2}\right ) \\ & +\frac {1}{2n\pi }\sin \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\cos \left ( n\pi \right ) +\frac {1}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) \end {align*}

Or\begin {align*} \frac {A_{n}}{2} & =\left ( \frac {1}{n\pi }\sin \left ( \frac {n\pi }{2}\right ) +\frac {2}{n^{2}\pi ^{2}}\cos \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\right ) -\frac {1}{n\pi }\sin \left ( \frac {n\pi }{2}\right ) -\frac {1}{n^{2}\pi ^{2}}\cos \left ( n\pi \right ) \\ & =\frac {2\cos \left ( \frac {n\pi }{2}\right ) -1-\left ( -1\right ) ^{n}}{n^{2}\pi ^{2}} \end {align*}

Therefore the solution (1) becomes, after replacing \(L=1\) \begin {equation} u\left ( x,t\right ) =\frac {1}{4}+2\sum _{n=1}^{\infty }\frac {2\cos \left ( \frac {n\pi }{2}\right ) -1-\left ( -1\right ) ^{n}}{n^{2}\pi ^{2}}\cos \left ( n\pi x\right ) e^{-kn^{2}\pi ^{2}t}\nonumber \end {equation}

________________________________________________________________________________________

3.1.1.35 [184] Haberman 2.4.1 (b) (special case)

problem number 184

This is problem 2.4.1 part(b) from Richard Haberman applied partial differential equations, 5th edition.

Solve the heat equation

\[ u_t= k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\), \(u_x(L,t)=0\) with the temperature initially \(u(x,0)=6+ 4 \cos \left ( \frac {3 \pi x}{L} \right )\)

pict
Figure 3.48:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to 4 e^{-\frac {9 \pi ^2 k t}{L^2}} \cos \left (\frac {3 \pi x}{L}\right )+6\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 4 \cos \left (\frac {3 \pi x}{L}\right ) {\mathrm e}^{-\frac {9 \pi ^{2} k t}{L^{2}}}+6\]

Hand solution

The general solution for this type of PDE is given in problem 3.1.1.31 on page 864 as\begin {equation} u\left ( x,t\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\tag {1} \end {equation} In this example \(u\left ( x,0\right ) =\) \(f\left ( x\right ) =6+4\cos \frac {3\pi x}{L}\). Hence at \(t=0\) the above becomes\begin {align*} f\left ( x\right ) & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \\ 6+4\cos \frac {3\pi x}{L} & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \end {align*}

Comparing terms shows that\begin {align*} A_{0} & =6\\ A_{3} & =4 \end {align*}

And all other \(A_{n}=0\). Hence the solution (1) is\[ u\left ( x,t\right ) =6+4\cos \left ( \frac {3\pi }{L}x\right ) e^{-k\left ( \frac {3\pi }{L}\right ) ^{2}t}\]

________________________________________________________________________________________

3.1.1.36 [185] Haberman 2.4.1 (c) (special case)

problem number 185

This is problem 2.4.1 part(c) from Richard Haberman applied partial differential equations, 5th edition.

Solve the heat equation

\[ u_t = k u_{xx} \]

The boundary conditions are \(u_x(0,t)=0\), \(u_x(L,t)=0\) with the temperature initially \(u(x,0)=-2 \sin \frac {\pi x}{L}\)

pict
Figure 3.49:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \frac {2 \underset {n=1}{\overset {\infty }{\sum }}\frac {2 \left (1+(-1)^n\right ) e^{-\frac {k n^2 \pi ^2 t}{L^2}} L \cos \left (\frac {n \pi x}{L}\right )}{\left (n^2-1\right ) \pi }}{L}-\frac {4}{\pi }\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \left (\Mapleoverset {\infty }{\Mapleunderset {n =2}{\sum }}\frac {4 \left (\left (-1\right )^{n}+1\right ) \cos \left (\frac {\pi n x}{L}\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}}}{\pi \left (n^{2}-1\right )}\right )-\frac {4}{\pi }\]

Hand solution

The general solution for this type of PDE is given in problem 3.1.1.31 on page 864 as\begin {equation} u\left ( x,t\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\tag {1} \end {equation} At \(t=0\) the above becomes\begin {align*} f\left ( x\right ) & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \\ -2\sin \frac {\pi x}{L} & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \end {align*}

Multiplying both sides by \(\cos \left ( \frac {m\pi }{L}x\right ) \) and integrating gives\begin {align*} -2\int _{0}^{L}\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx & =\int _{0}^{L}\left ( A_{0}\cos \left ( \frac {m\pi }{L}x\right ) +\cos \left ( \frac {m\pi }{L}x\right ) \sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {n\pi }{L}x\right ) \right ) dx\\ & =\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\int _{0}^{L}\sum _{n=1}^{\infty }A_{n}\cos \left ( \frac {m\pi }{L}x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \end {align*}

Interchanging the order of integration and summation\[ \int _{0}^{L}-2\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\sum _{n=1}^{\infty }A_{n}\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \] Case \(m=0\)

The above becomes\[ -2\int _{0}^{L}\sin \left ( \frac {\pi x}{L}\right ) dx=\int _{0}^{L}A_{0}dx+\sum _{n=1}^{\infty }A_{n}\int _{0}^{L}\cos \left ( \frac {n\pi }{L}x\right ) dx \] But \(\int _{0}^{L}\cos \left ( \frac {n\pi }{L}x\right ) dx=0\) hence\begin {align*} \int _{0}^{L}-2\sin \left ( \frac {\pi x}{L}\right ) dx & =\int _{0}^{L}A_{0}dx\\ A_{0}L & =-2\int _{0}^{L}\sin \left ( \frac {\pi x}{L}\right ) dx\\ A_{0}L & =-2\left ( -\frac {\cos \left ( \frac {\pi x}{L}\right ) }{\frac {\pi }{L}}\right ) _{0}^{L}\\ & =-\frac {2L}{\pi }\left ( -\cos \left ( \frac {\pi L}{L}\right ) +\cos \left ( \frac {\pi 0}{L}\right ) \right ) \\ & =-\frac {2L}{\pi }\left ( -\left ( -1\right ) +1\right ) \\ & =-\frac {4L}{\pi } \end {align*}

Hence\[ A_{0}=\frac {-4}{\pi }\] Case \(m>0\)

\[ \int _{0}^{L}-2\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=\int _{0}^{L}A_{0}\cos \left ( \frac {m\pi }{L}x\right ) dx+\sum _{n=1}^{\infty }A_{n}\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \] One term survives the summation resulting in\[ \int _{0}^{L}-2\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx=\frac {-4}{\pi }\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) dx+A_{m}\int _{0}^{L}\cos ^{2}\left ( \frac {m\pi }{L}x\right ) dx \] But \(\int _{0}^{L}\cos \left ( \frac {m\pi }{L}x\right ) dx=0\) and \(\int _{0}^{L}\cos ^{2}\left ( \frac {m\pi }{L}x\right ) dx=\frac {L}{2}\), therefore\begin {align*} \int _{0}^{L}-2\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {m\pi }{L}x\right ) dx & =A_{m}\frac {L}{2}\\ A_{n} & =\frac {-4}{L}\int _{0}^{L}\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx \end {align*}

But\[ \int _{0}^{L}\sin \left ( \frac {\pi x}{L}\right ) \cos \left ( \frac {n\pi }{L}x\right ) dx=\frac {-L\left ( 1+\cos \left ( n\pi \right ) \right ) }{\pi \left ( n^{2}-1\right ) }\] Therefore\begin {align*} A_{n} & =4\frac {\left ( 1+\cos \left ( n\pi \right ) \right ) }{\pi \left ( n^{2}-1\right ) }\\ & =4\frac {\left ( -1\right ) ^{n}+1}{\pi \left ( n^{2}-1\right ) }\qquad n=1,2,3,\cdots \end {align*}

Hence the solution becomes\[ u\left ( x,t\right ) =\frac {-4}{\pi }+\frac {4}{\pi }\sum _{n=1}^{\infty }\frac {\left ( -1\right ) ^{n}+1}{\left ( n^{2}-1\right ) }\cos \left ( \frac {n\pi }{L}x\right ) e^{-k\left ( \frac {n\pi }{L}\right ) ^{2}t}\]

________________________________________________________________________________________

3.1.1.37 [186] Haberman 2.4.1 (d)

problem number 186

This is problem 2.4.1 part(d) from Richard Haberman applied partial differential equations, 5th edition.

Solve the heat equation

\[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \]

The boundary conditions are \(\frac {\partial u}{\partial x}(0,t)=0\) and \(\frac {\partial u}{\partial x}(L,t)=0\) with the temperature initially \(u(x,0)=-3 \cos \frac {8 \pi x}{L}\)

pict
Figure 3.50:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to -3 e^{-\frac {64 \pi ^2 k t}{L^2}} \cos \left (\frac {8 \pi x}{L}\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = -3 \cos \left (\frac {8 \pi x}{L}\right ) {\mathrm e}^{-\frac {64 \pi ^{2} k t}{L^{2}}}\]

________________________________________________________________________________________

3.1.1.38 [187] both ends insulated

problem number 187

Added December 20, 2018.

Taken from https://www.mapleprimes.com/posts/209970-Exact-Solutions-For-PDE-And-Boundary--Initial-Conditions-2018

Solve the heat equation for \(u(x,t)\)

\[ u_t= 13 u_{xx} \]

For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &= 0\\ \frac {\partial u}{\partial x}(1,t) &= 1 \end {align*}

Initial condition is \(u(x,0)=\frac {1}{2} x^2+x\)

pict
Figure 3.51:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \frac {1}{2} \left (2 \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {2 \left (-1+(-1)^{K[1]}\right ) e^{-13 \pi ^2 t K[1]^2} \cos (\pi x K[1])}{\pi ^2 K[1]^2}+26 t+x^2+1\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \frac {x^{2}}{2}+13 t +2 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\left (-1\right )^{n}-1\right ) \cos \left (\pi n x \right ) {\mathrm e}^{-13 \pi ^{2} n^{2} t}}{\pi ^{2} n^{2}}\right )+\frac {1}{2}\]

________________________________________________________________________________________

3.1.1.39 [188] convection heat loss

problem number 188

This problem is taken from Maple primes post

Left end insulated, right end has convection heat loss https://www.mapleprimes.com/posts/209681-Solving-PDEs-With-Initial-And-Boundary

Solve the heat equation

\[ u_t = k u_{xx} \]

The boundary conditions are, on the left end \(\frac {\partial u}{\partial x}(0,t)=0\) and on the right end \(\frac {\partial u}{\partial x}(1,t)=-u(1,t)\) with the temperature initially \(u(x,0)=1-\frac {1}{4} x^3\)

pict
Figure 3.52:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {K[1]=1}{\overset {\infty }{\sum }}-\frac {e^{-k t K[2,K[1]]} \cos \left (x \sqrt {K[2,K[1]]}\right ) \left (3 \cos \left (\sqrt {K[2,K[1]]}\right ) (K[2,K[1]]-2)-3 \sqrt {K[2,K[1]]} (K[2,K[1]]+2) \sin \left (\sqrt {K[2,K[1]]}\right )+6\right )}{\sqrt {2} \sqrt {3-\cos \left (2 \sqrt {K[2,K[1]]}\right )} K[2,K[1]]^2 \sqrt {\sin ^2\left (\sqrt {K[2,K[1]]}\right )+1}} & \tan \left (\sqrt {K[2,K[1]]}\right )=\frac {1}{\sqrt {K[2,K[1]]}}\land K[1]\in \mathbb {Z}\land K[1]\geq 1\land K[2,K[1]]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 3 \left (\Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}\frac {\left (\lambda _{n}^{3} \sin \left (\lambda _{n}\right )-\lambda _{n}^{2} \cos \left (\lambda _{n}\right )+2 \lambda _{n} \sin \left (\lambda _{n}\right )+2 \cos \left (\lambda _{n}\right )-2\right ) \cos \left (x \lambda _{n}\right ) {\mathrm e}^{-k t \lambda _{n}^{2}}}{\left (2 \lambda _{n}+\sin \left (2 \lambda _{n}\right )\right ) \lambda _{n}^{3}}\right )\boldsymbol {\mathrm {where}}\left \{\lambda _{n} \tan \left (\lambda _{n}\right )-1=0\wedge 0<\lambda _{n}\right \}\]

________________________________________________________________________________________

3.1.1.40 [189] Pinchover and Rubinstein 6.25

problem number 189

Added July 2, 2018. Taken from Maple 2018.1 document, originally exercise 6.25 from Pinchover and Rubinstein.

Solve the heat equation

\[ u_t = k u_{xx} + \cos (w t) \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &= 0 \\ \frac {\partial u}{\partial x}(L,t) &= 0 \\ \end {align*}

Initial condition is \(u(x,0)=x\).

pict
Figure 3.53:PDE specification

Mathematica


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

Maple


\[u \left (x , t\right ) = \frac {L}{2}+\left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {2 \left (\left (-1\right )^{n}-1\right ) L \cos \left (\frac {\pi n x}{L}\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}}}{\pi ^{2} n^{2}}\right )+\frac {\sin \left (t w \right )}{w}\]

________________________________________________________________________________________

3.1.1.41 [190] external source

problem number 190

Added March 18, 2018.

Solve the heat equation

\[ \frac { \partial u}{\partial t}= k \frac { \partial ^2 u}{\partial x^2} + \left ( e^{-c t} \sin \left ( \frac {2 \pi x}{L} \right ) \right ) \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &= 0 \\ \frac {\partial u}{\partial x}(L,t) &= 0 \\ \end {align*}

Initial condition is \(u(x,0)=f(x)\).

pict
Figure 3.54:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} \cos \left (\frac {\pi x K[1]}{L}\right ) \left (e^{-\frac {k \pi ^2 t K[1]^2}{L^2}} \int _0^L \frac {\sqrt {2} \cos \left (\frac {\pi x K[1]}{L}\right ) f(x)}{\sqrt {L}} \, dx+\left (\begin {array}{cc} \{ & \begin {array}{cc} \frac {2 \sqrt {2} \left (-1+(-1)^{K[1]}\right ) e^{-t \left (\frac {k \pi ^2 K[1]^2}{L^2}+c\right )} \left (-e^{c t}+e^{\frac {k \pi ^2 t K[1]^2}{L^2}}\right ) L^{5/2}}{\pi \left (K[1]^2-4\right ) \left (k \pi ^2 K[1]^2-c L^2\right )} & K[1]\neq 2 \\ 0 & \text {True} \\\end {array} \\\end {array}\right )\right )}{\sqrt {L}}+\frac {\int _0^L \frac {f(x)}{\sqrt {L}} \, dx}{\sqrt {L}}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {2 \left (\int _{0}^{L}\cos \left (\frac {\pi n x}{L}\right ) f (x )d x \right ) \cos \left (\frac {\pi n x}{L}\right ) {\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}}}{L}\right )+\frac {\int _{0}^{L}f (x )d x}{L}+\frac {-\frac {8 L^{2} \cos \left (\frac {\pi x}{L}\right ) {\mathrm e}^{-c t}}{3}+\frac {8 L^{2} \cos \left (\frac {\pi x}{L}\right ) {\mathrm e}^{-\frac {\pi ^{2} k t}{L^{2}}}}{3}+4 \left (\Mapleoverset {\infty }{\Mapleunderset {n =3}{\sum }}\frac {\left (L^{2} c -\pi ^{2} k \right ) \left (-{\mathrm e}^{-c t}+{\mathrm e}^{-\frac {\pi ^{2} k n^{2} t}{L^{2}}}\right ) \left (\left (-1\right )^{n}-1\right ) L^{2} \cos \left (\frac {\pi n x}{L}\right )}{\left (n -2\right ) \left (n +2\right ) \left (L^{2} c -\pi ^{2} k n^{2}\right )}\right )}{\pi \left (L^{2} c -\pi ^{2} k \right )}\]

________________________________________________________________________________________

3.1.1.42 [191] Diffusion Reaction (general case)

problem number 191

Added June 9, 2019

Consider the heat equation \[ u_t = k u_{xx} - \beta u \] Suppose the boundary conditions are \(u_x(0,t)=0,u_x(\pi ,t)=0\), solve with the temperature initially \(u\left ( x,0\right ) =x\)

pict
Figure 3.55:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {2 \left (-1+(-1)^{K[1]}\right ) e^{-t \left (k K[1]^2+\beta \right )} \cos (x K[1])}{\pi K[1]^2}+\frac {1}{2} \pi e^{-\beta t}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = 2 \left (\Mapleoverset {\infty }{\Mapleunderset {n =1}{\sum }}\frac {\left (\left (-1\right )^{n}-1\right ) \cos \left (n x \right ) {\mathrm e}^{-\left (k n^{2}+\beta \right ) t}}{\pi n^{2}}\right )+\frac {\pi \,{\mathrm e}^{-\beta t}}{2}\]

Hand solution

Solve

\[ \frac {\partial u}{\partial t}=k\frac {\partial ^{2}u}{\partial x^{2}}-\beta u\qquad 0<x<\pi ,t>0 \] with, \(k>0,\beta >0\) \begin {align*} \frac {\partial u\left ( 0,t\right ) }{\partial x} & =0\\ \frac {\partial u\left ( \pi ,t\right ) }{\partial x} & =0 \end {align*}

And initial conditions \[ u\left ( x,0\right ) =x \] Solution

Let \(u=X\left ( x\right ) T\left ( t\right ) \). Substituting into the PDE gives\[ T^{\prime }X=kX^{\prime \prime }T-\beta XT \] Dividing by \(XT\neq 0\) gives\begin {align*} \frac {T^{\prime }}{T} & =\frac {kX^{\prime \prime }}{X}-\beta \\ \frac {T^{\prime }}{T}+\beta & =\frac {kX^{\prime \prime }}{X}\\ \frac {T^{\prime }}{kT}+\frac {\beta }{k} & =\frac {X^{\prime \prime }}{X} \end {align*}

Since each sides depends on different variable and both are equal, they must be equal to same constant, say \(-\lambda \)\[ \frac {T^{\prime }}{\alpha T}+\frac {\beta }{\alpha }=\frac {X^{\prime \prime }}{X}=-\lambda \] This gives two ODE’s to solve\begin {align} X^{\prime \prime }+\lambda X & =0\tag {1}\\ X^{\prime }\left ( 0\right ) & =0\nonumber \\ X^{\prime }\left ( \pi \right ) & =0\nonumber \end {align}

And\begin {align} \frac {T^{\prime }}{kT}+\frac {\beta }{k} & =-\lambda \tag {2}\\ T^{\prime }+\beta T & =-\lambda kT\nonumber \\ T^{\prime }+T\left ( \lambda k+\beta \right ) & =0\nonumber \end {align}

Starting with (1).  

Assuming \(\lambda <0\), the solution is \begin {align*} X\left ( x\right ) & =A\cosh \left ( \sqrt {-\lambda }x\right ) +B\sinh \left ( \sqrt {-\lambda }x\right ) \\ X^{\prime } & =\sqrt {-\lambda }A\sinh \left ( \sqrt {-\lambda }x\right ) +\sqrt {-\lambda }B\cosh \left ( \sqrt {-\lambda }x\right ) \end {align*}

Applying first B.C. gives \(0=\sqrt {-\lambda }B\), hence \(B=0\). Therefore the solution becomes \(X\left ( x\right ) =A\cosh \left ( \sqrt {-\lambda }x\right ) \) and \(X^{\prime }=\sqrt {-\lambda }A\sinh \left ( \sqrt {-\lambda }x\right ) \). Applying second B.C. gives \[ 0=\sqrt {-\lambda }A\sinh \left ( \sqrt {-\lambda }\pi \right ) \] But \(\sinh \left ( \sqrt {-\lambda }\pi \right ) =0\) only when its argument is zero, which is not the case here. This means \(A=0\), leading to trivial solution. Therefore \(\lambda <0\) is not eigenvalue.

Assuming \(\lambda =0\). The solution is \(X=Ax+B\). Hence \(X^{\prime }=A\). Applying first B.C. Gives \(A=0\). Hence solution is \(X=B\). Second boundary condition gives no additional information. Therefore  \(X=1\) (constant) is the eigenfunction associated with \(\lambda =0\).

Assuming \(\lambda >0\). The solution is\begin {align*} X & =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \\ X^{\prime } & =-\sqrt {\lambda }A\sin \left ( \sqrt {\lambda }x\right ) +\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }x\right ) \end {align*}

Applying first B.C. gives \(0=\sqrt {\lambda }B\), hence \(B=0\). and the solution becomes \(X=A\cos \left ( \sqrt {\lambda }x\right ) ,X^{\prime }=-\sqrt {\lambda }A\sin \left ( \sqrt {\lambda }x\right ) \). Applying second B.C. gives\[ 0=-\sqrt {\lambda }A\sin \left ( \sqrt {\lambda }\pi \right ) \] Therefore \begin {align*} \sin \left ( \sqrt {\lambda }\pi \right ) & =0\\ \sqrt {\lambda }\pi & =n\pi \qquad n=1,2,3,\cdots \\ \lambda & =n^{2}\qquad n=1,2,3,\cdots \end {align*}

Therefore the space solution is\begin {equation} X\left ( x\right ) =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( nx\right ) \tag {3} \end {equation} Now the time ODE (2) is solved.\[ T^{\prime }+T\left ( \lambda k+\beta \right ) =0 \] Integrating factor is \(e^{\int \lambda k+\beta dt}=e^{\left ( \lambda k+\beta \right ) t}\). Hence   \(\frac {d}{dt}\left ( Te^{\left ( \lambda k+\beta \right ) t}\right ) =0\) or \(Te^{\left ( \lambda k+\beta \right ) t}=c\) where \(c\) is constant. Therefore\[ T\left ( t\right ) =ce^{-\left ( \lambda k+\beta \right ) t}\] For \(\lambda =0\), the solution is \[ T_{0}\left ( t\right ) =c_{0}e^{-\beta t}\] and for \(\lambda >0\), the solution is \[ T_{n}\left ( t\right ) =c_{n}e^{-\left ( n^{2}k+\beta \right ) t}\] Hence the time domain solution is\begin {equation} T\left ( t\right ) =c_{0}e^{-\beta t}+\sum _{n=1}^{\infty }c_{n}e^{-\left ( n^{2}k+\beta \right ) t}\tag {4} \end {equation} Combining (3,4) the solution is\begin {align} u_{n} & =X_{n}T_{n}\nonumber \\ u\left ( x,t\right ) & =\sum _{n=0}^{\infty }X_{n}T_{n}\nonumber \\ & =c_{0}e^{-\beta t}+\sum _{n=1}^{\infty }b_{n}\cos \left ( nx\right ) e^{-\left ( n^{2}k+\beta \right ) t}\tag {5} \end {align}

where both constants from space and time eigenfunctions are combined into one constant \(b_{n}\) above in the sum. Now initial conditions are used to find coefficients. At \(t=0\)\begin {align*} u\left ( x,0\right ) & =c_{0}+\sum _{n=1}^{\infty }b_{n}\cos \left ( nx\right ) \\ x & =c_{0}+\sum _{n=1}^{\infty }b_{n}\cos \left ( nx\right ) \end {align*}

Multiplying both sides by \(\cos \left ( mx\right ) \) and integrating gives\[ \int _{0}^{\pi }x\cos mxdx=\int _{0}^{\pi }\left ( c_{0}\cos mx+\sum _{n=1}^{\infty }b_{n}\cos mx\cos \left ( nx\right ) \right ) dx \] For \(m=0\), all terms in the sum in RHS vanish, and only \(c_{0}\) left\begin {align*} \int _{0}^{\pi }xdx & =\int _{0}^{\pi }c_{0}dx\\ & =c_{0}\pi \end {align*}

Hence\begin {align} c_{0} & =\frac {1}{\pi }\int _{0}^{\pi }xdx\tag {6}\\ & =\frac {1}{\pi }\frac {\pi ^{2}}{2}\nonumber \\ & =\frac {\pi }{2}\nonumber \end {align}

For \(n>0\)\begin {align*} \int _{0}^{\pi }x\cos mxdx & =\int _{0}^{\pi }\sum _{n=1}^{\infty }b_{n}\cos mx\cos \left ( nx\right ) dx\\ & =\sum _{n=1}^{\infty }b_{n}\int _{0}^{\pi }\cos mx\cos \left ( nx\right ) dx \end {align*}

All terms in the sum vanish except for \(n=m\). The above becomes\begin {align} \int _{0}^{\pi }x\cos mxdx & =b_{n}\frac {\pi }{2}\nonumber \\ b_{n} & =\frac {2}{\pi }\int _{0}^{\pi }x\cos mxdx\tag {7} \end {align}

Using integration by part, \(\int _{0}^{\pi }x\cos nxdx\), let \(u=x,dv=\cos nx,\rightarrow du=1,v=\frac {\sin nx}{n}\), therefore\begin {align*} \int _{0}^{\pi }x\cos nxdx & =\left ( x\frac {\sin nx}{n}\right ) _{0}^{\pi }-\frac {1}{n}\int _{0}^{\pi }\sin nxdx\\ & =\frac {1}{n}\left ( \pi \sin n\pi -0\right ) +\frac {1}{n}\left ( \frac {\cos nx}{n}\right ) _{0}^{\pi }\\ & =0+\frac {1}{n^{2}}\left ( \cos nx\right ) _{0}^{\pi }\\ & =\frac {1}{n^{2}}\left ( \cos n\pi -1\right ) \end {align*}

Hence \begin {align*} b_{n} & =\frac {2}{\pi }\int _{0}^{\pi }x\cos mxdx\\ & =\frac {2}{\pi }\frac {\left ( -1^{n}-1\right ) }{n^{2}} \end {align*}

Therefore the final solution is, from (5), by combing all above results, becomes\begin {align*} u\left ( x,t\right ) & =c_{0}e^{-\beta t}+\sum _{n=1}^{\infty }b_{n}\cos \left ( nx\right ) e^{-\left ( n^{2}k+\beta \right ) t}\\ & =\frac {\pi }{2}e^{-\beta t}+\frac {2}{\pi }\sum _{n=1}^{\infty }\frac {\left ( -1^{n}-1\right ) }{n^{2}}\cos \left ( nx\right ) e^{-\left ( n^{2}k+\beta \right ) t} \end {align*}

This is animation of the solution for \(k=1,\beta =2\) for \(2\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 3.56:Source code

________________________________________________________________________________________

3.1.1.43 [192] Pinchover and Rubinstein 6.23

problem number 192

Added July 2, 2018.

4th example from Maple document for new improvements in Maple 2018.1, originally taken from Pinchover and Rubinstein’s exercise 6.23 .

Solve the heat equation on bar

\[ u_t= u_{xx} + g(x,t) \]

Where \(g(x,t) = e^{3 t} \cos (17 \pi x)\) for \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &=0 \\ \frac {\partial u}{\partial x}(1,t) &=0 \end {align*}

Initial condition is \(u(x,0) =f(x)\) where \(f(x) = 3 \cos (42 \pi x)\).

pict
Figure 3.57:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\sqrt {2} \cos (\pi x K[1]) \left (\int _0^t e^{-\pi ^2 K[1]^2 (t-K[2])} \left (\begin {array}{cc} \{ & \begin {array}{cc} \frac {e^{3 K[2]}}{\sqrt {2}} & K[1]=17 \\ 0 & \text {True} \\\end {array} \\\end {array}\right ) \, dK[2]+e^{-\pi ^2 t K[1]^2} \left (\begin {array}{cc} \{ & \begin {array}{cc} \frac {3}{\sqrt {2}} & K[1]=42 \\ 0 & \text {True} \\\end {array} \\\end {array}\right )\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \frac {\left (867 \pi ^{2}+9\right ) \cos \left (42 \pi x \right ) {\mathrm e}^{-1764 \pi ^{2} t}+\left ({\mathrm e}^{3 t}-{\mathrm e}^{-289 \pi ^{2} t}\right ) \cos \left (17 \pi x \right )}{289 \pi ^{2}+3}\]

________________________________________________________________________________________

3.1.1.44 [193] Pinchover and Rubinstein 6.21

problem number 193

added July 2, 2018.

Taken from Maple document for new improvements in Maple 2018.1, originally taken from Pinchover and Rubinstein’s exercise 6.21

Solve the heat equation on bar

\[ u_t = u_{xx} + g(x,t) \]

Where \(g(x,t) = t \cos (2001 x)\) for \(0<x<\pi \) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &=0 \\ \frac {\partial u}{\partial x}(1,t) &=0 \end {align*}

Initial condition is \(u(x,0) =f(x)\) where \(f(x) = \pi \cos (2 x)\).

pict
Figure 3.58:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\sqrt {\frac {2}{\pi }} \cos (x K[1]) \left (\int _0^t e^{-K[1]^2 (t-K[2])} \left (\begin {array}{cc} \{ & \begin {array}{cc} \sqrt {\frac {\pi }{2}} K[2] & K[1]=2001 \\ 0 & \text {True} \\\end {array} \\\end {array}\right ) \, dK[2]+e^{-t K[1]^2} \left (\begin {array}{cc} \{ & \begin {array}{cc} \frac {\pi ^{3/2}}{\sqrt {2}} & K[1]=2 \\ 0 & \text {True} \\\end {array} \\\end {array}\right )\right )\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \pi \cos \left (2 x \right ) {\mathrm e}^{-4 t}+\frac {\left (4004001 t +{\mathrm e}^{-4004001 t}-1\right ) \cos \left (2001 x \right )}{16032024008001}\]

________________________________________________________________________________________

3.1.1.45 [194] Diffusion Reaction. Euler-Cauchy Sturm-Liouville

problem number 194

Added April 20, 2019.

Solve the parabolic pde for \(u(x,t)\) \[ u_t = x^2 u_{xx} + x u_x \] For \(1<x<b\) and \(t>0\). The boundary conditions are \begin {align*} u_x(1,t) &= 0\\ h u(b,t) + u_x(b,t) &= 0 \end {align*}

Where \(h>0\). Initial condition is \(u(x,0)=\ln x\)

pict
Figure 3.59:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {2 b e^{-t K[2,K[1]]} h \cos \left (\sqrt {K[2,K[1]]} \log (x)\right ) \left (\cos \left (\sqrt {K[2,K[1]]} \log (b)\right )+\sqrt {K[2,K[1]]} \log (b) \sin \left (\sqrt {K[2,K[1]]} \log (b)\right )-1\right )}{K[2,K[1]] \left (\sin ^2\left (\sqrt {K[2,K[1]]} \log (b)\right )+b h \log (b)\right )} & \frac {b h}{\sqrt {K[2,K[1]]}}=\tan \left (\sqrt {K[2,K[1]]} \log (b)\right )\land K[1]\in \mathbb {Z}\land K[1]\geq 1\land K[2,K[1]]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \infty \,\mathrm {signum}\left (c_{2} \cos \left (\sqrt {\frac {b^{2} h^{2} \left (\cos ^{2}\lambda _{\mathit {\_Z65}}\right )}{\sin \left (\lambda _{\mathit {\_Z65}}\right )^{2}}}\, \ln (x )\right ) {\mathrm e}^{-\frac {b^{2} h^{2} t \left (\cos ^{2}\lambda _{\mathit {\_Z65}}\right )}{\sin \left (\lambda _{\mathit {\_Z65}}\right )^{2}}}\right )\boldsymbol {\mathrm {where}}\left \{\lambda _{\mathit {\_Z65}}-\sqrt {\frac {b^{2} h^{2}}{\tan \left (\lambda _{\mathit {\_Z65}}\right )^{2}}}\, \ln (b )=0\wedge -\infty \le \lambda _{\mathit {\_Z65}}\le \infty \right \}\]

Hand solution

Solve\begin {equation} u_{t}=x^{2}u_{xx}+xu_{x}\tag {1} \end {equation} With \(1<x\,<b,t>0\). BC\begin {align*} u_{x}\left ( 1,t\right ) & =0\\ hu\left ( b,t\right ) +u_{x}\left ( b,t\right ) & =0 \end {align*}

Where \(h>0\). And initial conditions\[ u\left ( x,0\right ) =\ln x \] Let \(u=X\left ( x\right ) T\left ( x\right ) \). Substituting into (1) gives \begin {align*} T^{\prime }X & =x^{2}X^{\prime \prime }T+xX^{\prime }T\\ \frac {T^{\prime }}{T} & =x^{2}\frac {X^{\prime \prime }}{X}+x\frac {X^{\prime }}{X}=-\lambda \end {align*}

Where \(\lambda \) is the separation constant. From the boundary conditions, we know that \(\lambda \) will be only positive. So we do not need to check for possibility of negative of zero eigenvalue. Letting \(\lambda =\alpha ^{2}\), then the above reduces to\begin {align} x^{2}X^{\prime \prime }+xX^{\prime }+\alpha ^{2}X & =0\tag {2}\\ T^{\prime }+\alpha ^{2}T & =0\tag {3} \end {align}

Equation (2) is Euler ODE. Assuming \(X=x^{r}\), then \(X^{\prime }=rx^{r-1},X^{\prime \prime }=r\left ( r-1\right ) x^{r-2}\). Substituting back into (2) gives the characteristic equation\begin {align*} r\left ( r-1\right ) x^{r}+rx^{r}+\alpha ^{2}x^{r} & =0\\ r^{2}+\alpha ^{2} & =0\\ r & =\pm i\alpha \end {align*}

Hence the solution to (2) is\begin {align*} X\left ( x\right ) & =Ax^{i\alpha }+Bx^{-i\alpha }\\ & =Ae^{\ln x^{i\alpha }}+Be^{\ln x^{-i\alpha }}\\ & =Ae^{i\alpha \ln x}+Be^{-i\alpha \ln x} \end {align*}

Which using Euler relation can be written as (using new constants, but the name of the constants kept the same for simplicity)\[ X\left ( x\right ) =A\cos \left ( \alpha \ln x\right ) +B\sin \left ( \alpha \ln x\right ) \] Applying first BC. \(X^{\prime }\left ( 1,t\right ) =0\) gives\begin {align*} X^{\prime }\left ( x\right ) & =-\frac {\alpha }{x}A\sin \left ( \alpha \ln x\right ) +B\frac {\alpha }{x}\cos \left ( \alpha \ln x\right ) \\ 0 & =-\alpha A\sin \left ( \alpha \ln 1\right ) +B\alpha \cos \left ( \alpha \ln 1\right ) \\ & =B\alpha \end {align*}

Since \(\alpha >0\) then \(B=0\). Hence the solution becomes \[ X\left ( x\right ) =A\cos \left ( \alpha \ln x\right ) \] Applying second BC. \(hX\left ( b\right ) +X^{\prime }\left ( b\right ) =0\) gives\begin {align} hA\cos \left ( \alpha \ln b\right ) -A\frac {\alpha }{b}\sin \left ( \alpha \ln b\right ) & =0\nonumber \\ h-\frac {\alpha }{b}\tan \left ( \alpha \ln b\right ) & =0\nonumber \\ \tan \left ( \alpha \ln b\right ) & =\frac {hb}{\alpha }\tag {4} \end {align}

There is no analytical solution to the above. The eigenvalues \(\alpha _{n}\) are the solutions to the above nonlinear equation. Therefore the eigenfunctions are \[ X_{n}\left ( x\right ) =\cos \left ( \alpha _{n}\ln x\right ) \] With eigenvalues \(\alpha _{n}>0\) given by solutions to (4). The solution to the time ODE is\begin {align*} T_{n}^{\prime }+\alpha _{n}^{2}T_{n} & =0\\ T_{n}\left ( t\right ) & =T_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t} \end {align*}

Hence the solution to (1) is\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }T_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t}\cos \left ( \alpha _{n}\ln x\right ) \tag {5} \end {equation} At \(t=0\)\[ \ln x=\sum _{n=1}^{\infty }T_{n}\left ( 0\right ) \cos \left ( \alpha _{n}\ln x\right ) \] Applying orthogonality gives\begin {align*} \int _{1}^{b}\ln x\cos \left ( \alpha _{n}\ln x\right ) dx & =T_{n}\left ( 0\right ) \int _{1}^{b}\cos ^{2}\left ( \alpha _{n}\ln x\right ) dx\\ T_{n}\left ( 0\right ) & =\frac {\int _{1}^{b}\ln x\cos \left ( \alpha _{n}\ln x\right ) dx}{\int _{1}^{b}\cos ^{2}\left ( \alpha _{n}\ln x\right ) dx} \end {align*}

Hence the solution (5) becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {\int _{1}^{b}\ln x\cos \left ( \alpha _{n}\ln x\right ) dx}{\int _{1}^{b}\cos ^{2}\left ( \alpha _{n}\ln x\right ) dx}\right ) e^{-\alpha _{n}^{2}t}\cos \left ( \alpha _{n}\ln x\right ) \]

________________________________________________________________________________________

3.1.1.46 [195] convection heat loss

problem number 195

Added April 28, 2019

Problem 4, section 74, Fourier series and Boundary value problem, 8th edition by Brown and Churchill.

Solve the heat equation

\[ u_t = k u_{xx} \]

For \(0<x<1,t>0\). The boundary conditions are, on the left end \(u(0,t)=0\) and on the right end \(u_x(1,t)=-h u(1,t)\) with \(h>0\). Initial conditions \(u(x,0)=f(x)\)

pict
Figure 3.60:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {K[1]=1}{\overset {\infty }{\sum }}-\frac {\sqrt {2} e^{-k t K[2,K[1]]} \sqrt {h} \left (\int _0^1 -\frac {2 \sqrt {h} f(x) \sin \left (x \sqrt {K[2,K[1]]}\right )}{\sqrt {2 h+\cos \left (2 \sqrt {K[2,K[1]]}\right )+1}} \, dx\right ) \sin \left (x \sqrt {K[2,K[1]]}\right )}{\sqrt {\cos ^2\left (\sqrt {K[2,K[1]]}\right )+h}} & h \tan \left (\sqrt {K[2,K[1]]}\right )+\sqrt {K[2,K[1]]}=0\land K[1]\in \mathbb {Z}\land K[1]\geq 1\land K[2,K[1]]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


\[u \left (x , t\right ) = \Mapleoverset {\infty }{\Mapleunderset {n =0}{\sum }}-\frac {2 h \left (\int _{0}^{1}f (x ) \sin \left (\frac {h x \sin \left (\lambda _{n}\right )}{\cos \left (\lambda _{n}\right )}\right )d x \right ) {\mathrm e}^{-\frac {h^{2} k t \left (\sin ^{2}\lambda _{n}\right )}{\cos \left (\lambda _{n}\right )^{2}}} \mathrm {signum}\left (\cos \left (\lambda _{n}\right )\right ) \mathrm {signum}\left (\sin \left (\lambda _{n}\right )\right ) \sin \left (\lambda _{n}\right ) \sin \left (\frac {h x \sin \left (\lambda _{n}\right )}{\cos \left (\lambda _{n}\right )}\right )}{-h \,\mathrm {signum}\left (\cos \left (\lambda _{n}\right )\right ) \mathrm {signum}\left (\sin \left (\lambda _{n}\right )\right ) \sin \left (\lambda _{n}\right )+\cos \left (\lambda _{n}\right ) \cos \left (\frac {h \,\mathrm {signum}\left (\sin \left (\lambda _{n}\right )\right ) \sin \left (\lambda _{n}\right )}{{| \cos \left (\lambda _{n}\right )|}}\right ) \sin \left (\frac {h \,\mathrm {signum}\left (\sin \left (\lambda _{n}\right )\right ) \sin \left (\lambda _{n}\right )}{{| \cos \left (\lambda _{n}\right )|}}\right )}\boldsymbol {\mathrm {where}}\left \{-\sqrt {\tan ^{2}\lambda _{n}}\, h +\lambda _{n}=0\wedge -\infty \le \lambda _{n}\le \infty \right \}\]

Hand solution

To solve the PDE, we first check the boundary conditions by writing them as\begin {align*} a_{1}u\left ( 0,t\right ) +a_{2}u_{x}\left ( 0,t\right ) & =0\\ b_{1}u\left ( 1,t\right ) +b_{2}u_{x}\left ( 1,t\right ) & =0 \end {align*}

Then \(a_{1}=0,a_{2}=0\). Hence \(a_{1}a_{2}=0\). And \(b_{1}=1,b_{2}=h\). Then since it is assumed that \(h>0\), then \(b_{1}b_{2}\geq 0\). And since \(q\left ( x\right ) =0\) from the PDE itself, then we know that eigenvalues must be \(\lambda \geq 0\).

Let \(u=X\left ( x\right ) T\left ( t\right ) \) then the PDE becomes\begin {align*} T^{\prime }X & =X^{\prime \prime }T\\ \frac {T^{\prime }}{T} & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}

Hence the Sturm Liouville problem is \begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( 1\right ) +hX\left ( 1\right ) & =0 \end {align*}

Where \(p\left ( x\right ) =1\).

Case \(\lambda =0\)

Solution is \[ X\left ( x\right ) =Ax+B \] At \(x=0\)\[ 0=B \] Hence solution becomes\[ X\left ( x\right ) =Ax \] At \(x=1\) the second boundary conditions gives\begin {align*} A+hA & =0\\ A\left ( 1+h\right ) & =0 \end {align*}

For non trivial solution \(1+h=0\) or \(h=-1\). But we assumed that \(h>0\). Therefore \(\lambda =0\) is not eigenvalue.

Case \(\lambda >0\)

Let \(\lambda =\alpha ^{2},\alpha >0\). Hence solution is \[ X\left ( x\right ) =A\cos \left ( \alpha x\right ) +B\sin \left ( \alpha x\right ) \] At \(X\left ( 0\right ) =0\)\[ 0=A \] The solution becomes\[ X\left ( x\right ) =B\sin \left ( \alpha x\right ) \] At \(x=1\) the second boundary conditions gives\begin {align*} B\alpha \cos \left ( \alpha \right ) +hB\sin \left ( \alpha \right ) & =0\\ \alpha \cos \left ( \alpha \right ) +h\sin \left ( \alpha \right ) & =0\\ \tan \left ( \alpha \right ) & =-\frac {\alpha }{h} \end {align*}

Therefore the eigenvalues are given by solution to \[ \tan \left ( \alpha _{n}\right ) =-\frac {\alpha _{n}}{h}\qquad n=1,2,3,\cdots \] And eigenfunctions are\[ X_{n}\left ( x\right ) =\sin \left ( \alpha _{n}x\right ) \] The normalized eigenfunctions are\[ \phi _{n}\left ( x\right ) =\frac {X_{n}\left ( x\right ) }{\left \Vert X_{n}\left ( x\right ) \right \Vert }\] But \begin {align*} \left \Vert X_{n}\left ( x\right ) \right \Vert ^{2} & =\int _{0}^{1}p\left ( x\right ) X_{n}^{2}\left ( x\right ) dx\\ & =\int _{0}^{1}\sin ^{2}\left ( \alpha _{n}x\right ) dx\\ & =\frac {1}{2}\int _{0}^{1}1-\cos \left ( 2\alpha _{n}x\right ) dx\\ & =\frac {1}{2}\left ( 1-\left [ \frac {\sin \left ( 2\alpha _{n}x\right ) }{2\alpha _{n}}\right ] _{0}^{1}\right ) \\ & =\frac {1}{2}\left ( 1-\frac {1}{2\alpha _{n}}\left [ \sin \left ( 2\alpha _{n}x\right ) \right ] _{0}^{1}\right ) \\ & =\frac {1}{2}\left ( 1-\frac {\sin \left ( 2\alpha _{n}\right ) }{2\alpha _{n}}\right ) \\ & =\frac {1}{2}-\frac {\sin \left ( 2\alpha _{n}\right ) }{4\alpha _{n}} \end {align*}

But \(\sin \left ( 2\alpha _{n}\right ) =2\sin \alpha _{n}\cos \alpha _{n}\) and \(\alpha _{n}=-h\frac {\sin \left ( \alpha _{n}\right ) }{\cos \left ( \alpha _{n}\right ) }\), therefore the above becomes\begin {align*} \left \Vert X_{n}\left ( x\right ) \right \Vert ^{2} & =\frac {1}{2}+\frac {2\sin \alpha _{n}\cos \alpha _{n}}{4h\frac {\sin \left ( \alpha _{n}\right ) }{\cos \left ( \alpha _{n}\right ) }}\\ & =\frac {1}{2}+\frac {\cos ^{2}\alpha _{n}}{2h}\\ & =\frac {h+\cos ^{2}\alpha _{n}}{2h} \end {align*}

Hence\begin {align*} \phi _{n}\left ( x\right ) & =\frac {X_{n}\left ( x\right ) }{\sqrt {\frac {h+\cos ^{2}\alpha _{n}}{2h}}}\\ & =\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}x\right ) \end {align*}

Now we use generalized Fourier series to find the solution. Let\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \tag {1} \end {equation} Substituting this back into the PDE gives\[ \sum _{n=1}^{\infty }B_{n}^{\prime }\left ( t\right ) \phi _{n}\left ( x\right ) =k\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \phi _{n}^{\prime \prime }\left ( x\right ) \] But \(\phi _{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}\phi _{n}\left ( x\right ) =-\alpha _{n}^{2}\phi _{n}\left ( x\right ) \). The above becomes\begin {align*} \sum _{n=1}^{\infty }B_{n}^{\prime }\left ( t\right ) \phi _{n}\left ( x\right ) & =-k\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \alpha _{n}^{2}\phi _{n}\left ( x\right ) \\ B_{n}^{\prime }\left ( t\right ) +k\alpha _{n}^{2}B_{n}\left ( t\right ) & =0 \end {align*}

The solution is \[ B_{n}\left ( t\right ) =B_{n}\left ( 0\right ) e^{-k\alpha _{n}^{2}t}\] Hence (1) becomes\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) e^{-k\alpha _{n}^{2}t}\phi _{n}\left ( x\right ) \] At \(t=0\) the above becomes\[ f\left ( x\right ) =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) \phi _{n}\left ( x\right ) \] Therefore\begin {align*} B_{n}\left ( 0\right ) & =\left \langle f\left ( x\right ) ,\phi _{n}\left ( x\right ) \right \rangle \\ & =\int _{0}^{1}p\left ( x\right ) f\left ( x\right ) \phi _{n}\left ( x\right ) dx\\ & =\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\int _{0}^{1}f\left ( x\right ) \sin \left ( \alpha _{n}x\right ) dx \end {align*}

Therefore \begin {align*} B_{n}\left ( t\right ) & =B_{n}\left ( 0\right ) e^{-k\alpha _{n}^{2}t}\\ & =\left ( \sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\int _{0}^{1}f\left ( x\right ) \sin \left ( \alpha _{n}x\right ) dx\right ) e^{-k\alpha _{n}^{2}t} \end {align*}

and solution (1) becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\left ( \int _{0}^{1}f\left ( x\right ) \sin \left ( \alpha _{n}x\right ) dx\right ) e^{-k\alpha _{n}^{2}t}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}x\right ) \\ & =\frac {2h}{h+\cos ^{2}\alpha _{n}}\sum _{n=1}^{\infty }\left ( \int _{0}^{1}f\left ( x\right ) \sin \left ( \alpha _{n}x\right ) dx\right ) e^{-k\alpha _{n}^{2}t}\sin \left ( \alpha _{n}x\right ) \end {align*}

________________________________________________________________________________________

3.1.1.47 [196] Mixed BC

problem number 196

Solve the heat equation

\[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} \frac { \partial u}{\partial x}(0,t) +u(0,t) &=0 \\ \frac { \partial u}{\partial x}(L,t) +u(L,t) &=0 \end {align*}

And initial condition \(u(x,0)=f(x)\)

pict
Figure 3.61:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} e^{-k t K[2,K[1]]} \left (\int _0^L \frac {\sqrt {2} f(x) \sqrt {K[2,K[1]]+1} \left (\cos \left (x \sqrt {K[2,K[1]]}\right ) \sqrt {K[2,K[1]]}-\sin \left (x \sqrt {K[2,K[1]]}\right )\right )}{\sqrt {(K[2,K[1]]+1) \left (K[2,K[1]] L+L+\cos \left (2 L \sqrt {K[2,K[1]]}\right )-1\right )}} \, dx\right ) \sqrt {K[2,K[1]]+1} \left (\cos \left (x \sqrt {K[2,K[1]]}\right ) \sqrt {K[2,K[1]]}-\sin \left (x \sqrt {K[2,K[1]]}\right )\right )}{\sqrt {2 K[2,K[1]] \cos ^2\left (L \sqrt {K[2,K[1]]}\right )+2 \cos ^2\left (L \sqrt {K[2,K[1]]}\right )+L K[2,K[1]]^2+L+2 L K[2,K[1]]-2 K[2,K[1]]-2}} & (K[2,K[1]]+1) \sin \left (L \sqrt {K[2,K[1]]}\right )=0\land K[1]\in \mathbb {Z}\land K[1]\geq 1\land K[2,K[1]]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


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

________________________________________________________________________________________

3.1.1.48 [197] Haberman 8.2.1 (f)

problem number 197

added March 18, 2018.

This is problem 8.2.1, part(f) from Richard Haberman applied partial differential equations 5th edition.

Solve the heat equation

\[ \frac { \partial u}{\partial t}= k \frac { \partial ^2 u}{\partial x^2} + \sin \left ( \frac {2 \pi x}{L} \right ) \]

For \(0<x<L\) and \(t>0\). The boundary conditions are \begin {align*} \frac {\partial u}{\partial x}(0,t) &= 0 \\ \frac {\partial u}{\partial x}(L,t) &= 0 \\ \end {align*}

Initial condition is \(u(x,0)=f(x)\).

pict
Figure 3.62:PDE specification

Mathematica


\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} \cos \left (\frac {\pi x K[1]}{L}\right ) \left (\frac {\left (1-e^{-\frac {k \pi ^2 t K[1]^2}{L^2}}\right ) \left (\begin {array}{cc} \{ & \begin {array}{cc} 0 & K[1]=2 \\ \frac {2 \sqrt {2} \left (-1+(-1)^{K[1]}\right ) \sqrt {L}}{\pi \left (K[1]^2-4\right )} & \text {True} \\\end {array} \\\end {array}\right ) L^2}{k \pi ^2 K[1]^2}+e^{-\frac {k \pi ^2 t K[1]^2}{L^2}} \int _0^L \frac {\sqrt {2} \cos \left (\frac {\pi x K[1]}{L}\right ) f(x)}{\sqrt {L}} \, dx\right )}{\sqrt {L}}+\frac {\int _0^L \frac {f(x)}{\sqrt {L}} \, dx}{\sqrt {L}}\right \}\right \}\]

Maple


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

________________________________________________________________________________________