Added June 21, 2019
Solve the heat equation
\[ 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*}
Initial condition is \(u(x,0)=f(x)\).
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}] ; bc = {Derivative[1, 0][u][0, t] == 0, u[L, t] == T0}; ic = u[x, 0] == f[x]; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], x, t, Assumptions -> {L > 0, k > 0, t > 0}], 60*10]]; sol = sol/.K[1]->n;
\[\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 K[2]}{2 L}\right ) (f(K[2])-\text {T0}) \, dK[2]}{L}+\text {T0}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=f(x); bc := D[1](u)(0,t)=0, u(L,t)=T0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming L>0,t>0,k>0),output='realtime'));
\[u \left (x , t\right ) = \mathit {T0} +2 \left (\moverset {\infty }{\munderset {n =0}{\sum }}\frac {\left (\int _{0}^{L}\left (-\mathit {T0} +f \left (x \right )\right ) \cos \left (\frac {\left (2 n +1\right ) \pi x}{2 L}\right )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}\right )\]
Hand solution
Solve \(u_{t}=ku_{xx}\) with \(u\left ( x,0\right ) =f\left ( x\right ) \) and \(u_{x}\left ( 0,t\right ) =0,u\left ( L,t\right ) =T_{0}\). Since the right end is not homogeneous, we need to find a reference function. Let \(r\left ( x\right ) =Ax+B\). Then \(r^{\prime }\left ( x\right ) =A\). Since \(u_{x}\left ( 0,t\right ) =0\), then \(A=0\). Hence \(r\left ( x\right ) =B\). Since \(u\left ( L,0\right ) =T_{0}\), then \(r\left ( L\right ) =T_{0}\). Hence \(B=T_{0}\). Therefore \(r\left ( x\right ) =T_{0}\). Now let the solution be\begin {equation} u\left ( x,t\right ) =v\left ( x,t\right ) +r\left ( x\right ) \tag {1} \end {equation} Where \(v\left ( x,t\right ) \) solves the same pde but with homogeneous boundary conditions\begin {align*} v_{t} & =kv_{xx}\\ v_{x}\left ( 0,t\right ) & =0\\ v\left ( L,0\right ) & =0\\ v\left ( x,0\right ) & =u\left ( x,0\right ) -r\left ( x\right ) \\ & =F\left ( x\right ) \end {align*}
The above general PDE was solved in problem 4.1.1.28 on page 527 and the solution is\[ v\left ( x,t\right ) =\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}\] Since here \(F\left ( x\right ) =u\left ( x,0\right ) -r\left ( x\right ) =f\left ( x\right ) -T_{0}\) the above becomes\begin {equation} v\left ( x,t\right ) =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -T_{0}\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}\tag {2} \end {equation} From (1,2) the final solution is\[ u\left ( x,t\right ) =T_{0}+\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -T_{0}\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}\]
____________________________________________________________________________________
Added June 21, 2019
Solve the heat equation
\[ 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*}
Initial condition is \(u(x,0)=f(x)\). Using the following values \begin {align*} L &=5\\ T_0 &=10\\ k &=\frac {1}{100}\\ f(x) &=0 \end {align*}
Mathematica ✓
ClearAll["Global`*"]; L=5; k=1/100; f=0; T0=10; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}] ; bc = {Derivative[1, 0][u][0, t] == 0, u[L, t] == T0}; ic = u[x, 0] == f; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], x, t], 60*10]]; sol = sol/.K[1]->n;
\[\left \{\left \{u(x,t)\to \frac {2}{5} \left (\underset {n=0}{\overset {\infty }{\sum }}-\frac {100 e^{-\frac {(2 \pi n+\pi )^2 t}{10000}} \cos (n \pi ) \cos \left (\frac {1}{10} (2 n+1) \pi x\right )}{2 \pi n+\pi }+25\right )\right \}\right \}\]
Maple ✓
restart; L:=5; k:=1/100; f:=0; T0:=10; pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=f; bc := D[1](u)(0,t)=0, u(L,t)=T0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) ),output='realtime'));
\[u \left (x , t\right ) = -40 \left (\moverset {\infty }{\munderset {n =0}{\sum }}\frac {\left (-1\right )^{n} \cos \left (\frac {\left (2 n +1\right ) \pi x}{10}\right ) {\mathrm e}^{-\frac {\pi ^{2} \left (2 n +1\right )^{2} t}{10000}}}{\left (2 n +1\right ) \pi }\right )+10\]
Hand solution
The general solution for this type of PDE is given in problem 4.1.1.28 on page 527 as\[ u\left ( x,t\right ) =T_{0}+\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -T_{0}\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}\] In this problem \(u\left ( x,0\right ) =\) \(f\left ( x\right ) =0,L=5,k=\frac {1}{100}\) and \(T_{0}=10\), Hence the above becomes\[ u\left ( x,t\right ) =10+\frac {2}{5}\sum _{n=0}^{\infty }\left ( \int _{0}^{5}-10\cos \left ( \frac {\left ( 2n+1\right ) \pi }{10}x\right ) dx\right ) \cos \left ( \frac {\left ( 2n+1\right ) \pi }{10}x\right ) e^{-\frac {1}{100}\left ( \frac {\left ( 2n+1\right ) \pi }{10}\right ) ^{2}t}\] But \(\int _{0}^{5}-10\cos \left ( \frac {\left ( 2n+1\right ) \pi }{10}x\right ) dx=-\frac {100\cos \left ( \pi n\right ) }{\pi \left ( 1+2n\right ) }=\frac {-100\left ( -1\right ) ^{n}}{\pi \left ( 1+2n\right ) }\) and the above becomes\begin {align*} u\left ( x,t\right ) & =10+\frac {2}{5}\sum _{n=0}^{\infty }\frac {-100\left ( -1\right ) ^{n}}{\pi \left ( 1+2n\right ) }\cos \left ( \frac {\left ( 2n+1\right ) \pi }{10}x\right ) e^{-\frac {1}{100}\left ( \frac {\left ( 2n+1\right ) \pi }{10}\right ) ^{2}t}\\ & =10-\frac {40}{\pi }\sum _{n=0}^{\infty }\frac {\left ( -1\right ) ^{n}}{\left ( 1+2n\right ) }\cos \left ( \frac {\left ( 2n+1\right ) \pi }{10}x\right ) e^{-\frac {1}{100}\left ( \frac {\left ( 2n+1\right ) \pi }{10}\right ) ^{2}t} \end {align*}
The following is an animation of the solution
Source code used for the above
____________________________________________________________________________________
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) &= T_0 \end {align*}
Initial condition is \(u(x,0)=f(x)\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[L, t] == T0}; ic = u[x, 0] == f[x]; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t},Assumptions->k>0], 60*10]]; sol = sol /. K[1] -> n
\[\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 \left (f(x)-\frac {\text {T0} x}{L}\right ) \sin \left (\frac {n \pi x}{L}\right ) \, dx\right ) \sin \left (\frac {n \pi x}{L}\right )}{L}+\frac {\text {T0} x}{L}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x,t), t) = k*diff(u(x,t), x$2); bc := u(0,t) = 0, u(L,t) = T0; ic := u(x,0) = f(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, ic, bc],u(x,t)) assuming k>0),output='realtime'));
\[u \left (x , t\right ) = \frac {\mathit {T0} x}{L}+\left (\moverset {\infty }{\munderset {n =1}{\sum }}\frac {2 \left (\int _{0}^{L}\left (L f \left (x \right )-\mathit {T0} x \right ) \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^{2}}\right )\]
Hand solution
Since the right side boundary condition is not homogeneous, then we need to first find a reference function. Let \(r\left ( x\right ) =Ax+B\). At \(x=0,0=B\). Hence \(r\left ( x\right ) =Ax\). At \(x=L,T_{0}=AL\), hence \(A=\frac {T_{0}}{L}\). Therefore \[ r\left ( x\right ) =\frac {T_{0}}{L}x \] Now let \(u\left ( x,t\right ) =v\left ( x,t\right ) +r\left ( x\right ) \) where \(v_{t}=v_{xx}\) but with homogeneous BC \(v\left ( 0,t\right ) =0,v\left ( L,0\right ) =0\). The basic solution for this type of PDE was already given in problem 4.1.1.1 on page 405 as\[ v\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. Hence \begin {align} u\left ( x,t\right ) & =r\left ( x\right ) +v\left ( x,t\right ) \nonumber \\ & =\frac {T_{0}}{L}x+\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {1} \end {align}
At \(t=0\)\[ f\left ( x\right ) -\frac {T_{0}}{L}x=\sum _{n=1}^{\infty }B_{n}e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Multiplying both sides by \(\sin \left ( \sqrt {\lambda _{n^{\prime }}}x\right ) \) and integrating\[ \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n^{\prime }}}x\right ) dx=\int _{0}^{L}\sum _{n=1}^{\infty }B_{n}\sin \left ( \sqrt {\lambda _{n^{\prime }}}x\right ) \sin \left ( \sqrt {\lambda }x\right ) dx \] Moving integration inside summation and by orthogonality of \(\sin \) function the above reduces to\begin {align*} \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx & =B_{n}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx\\ \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx & =\frac {L}{2}B_{n}\\ B_{n} & =\frac {2}{L}\int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx \end {align*}
Therefore the solution from (1) is\[ u\left ( x,t\right ) =\frac {T_{0}}{L}x+\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx\right ) e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \]
____________________________________________________________________________________
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) &= T_0 \end {align*}
Initial condition is \(u(x,0)=f(x)\) using these values \begin {align*} k&=\frac {1}{100}\\ L&=100\\ T_0&=100\\ f(x)&=x \end {align*}
Mathematica ✓
ClearAll["Global`*"]; k=1/100; L=100; T0=100; f=x; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[L, t] == T0}; ic = u[x, 0] == f; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}], 60*10]]; sol = sol /. K[1] -> n
\[\{\{u(x,t)\to x\}\}\]
Maple ✓
restart; L:=100; k:=1/100; T0:=100; f:=x; pde := diff(u(x,t), t) = k*diff(u(x,t), x$2); bc := u(0,t) = 0, u(L,t) = T0; ic := u(x,0) = f; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, ic, bc],u(x,t)) ),output='realtime'));
\[u \left (x , t\right ) = x\]
Hand solution
The general solution for this type of PDE is given in problem 4.1.2.3 on page 622 as\[ u\left ( x,t\right ) =\frac {T_{0}}{L}x+\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx\right ) e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] With \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \). In this problem \begin {align*} L & =100\\ k & =\frac {1}{100}\\ T_{0} & =100\\ f\left ( x\right ) & =x \end {align*}
Hence the solution becomes\begin {align*} u\left ( x,t\right ) & =x+\frac {2}{100}\sum _{n=1}^{\infty }\left ( \int _{0}^{100}\left ( x-x\right ) \sin \left ( \frac {n\pi }{100}x\right ) dx\right ) e^{-\frac {1}{100}\left ( \frac {n\pi }{100}\right ) ^{2}t}\sin \left ( \frac {n\pi }{100}x\right ) \\ & =x+0\\ & =x \end {align*}
____________________________________________________________________________________
Added July 2, 2018. Can not find where I found this PDE.
Solve the heat equation \[ u_t = u_{xx} \] For \(0<x<1\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0 \\ u(1,t) &= 1 \end {align*}
Initial condition is \(u\left (x,0\right ) =\left \{ \begin {array} [c]{ccc}1 & x=1\\ 0 & \text {otherwise} \end {array} \right . \)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[1, t] == 1}; ic = u[x, 0] == Piecewise[{{1, x == 1}, {0, True}}]; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], x, t], 60*10]]; sol = sol /. K[1] -> n
\[\left \{\left \{u(x,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {2 (-1)^n e^{-n^2 \pi ^2 t} \sin (n \pi x)}{n \pi }+x\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x,t), t) = diff(u(x,t), x$2); bc := u(0,t) = 0, u(1,t) = 1; ic := u(x,0) = piecewise(x = 1, 1, true,0); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left (x , t\right ) = x +2 \left (\moverset {\infty }{\munderset {n =1}{\sum }}\frac {\left (-1\right )^{n} {\mathrm e}^{-\pi ^{2} n^{2} t} \sin \left (\pi n x \right )}{\pi n}\right )\]
Hand solution
The general solution for this type of PDE is given in problem 4.1.2.3 on page 622 as\[ u\left ( x,t\right ) =\frac {T_{0}}{L}x+\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}\left ( f\left ( x\right ) -\frac {T_{0}}{L}x\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) dx\right ) e^{-k\lambda _{n}t}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] With \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \). In this problem \begin {align*} L & =1\\ k & =1\\ T_{0} & =1\\ f\left ( x\right ) & =\left \{ \begin {array} [c]{ccc}1 & & x=1\\ 0 & & \text {otherwise}\end {array} \right . \end {align*}
Hence the solution becomes\begin {equation} u\left ( x,t\right ) =x+2\sum _{n=1}^{\infty }\left ( \int _{0}^{1}\left ( f\left ( x\right ) -x\right ) \sin \left ( n\pi x\right ) dx\right ) e^{-\left ( n\pi \right ) ^{2}t}\sin \left ( n\pi x\right ) \tag {1} \end {equation} But\begin {align*} \int _{0}^{1}\left ( f\left ( x\right ) -x\right ) \sin \left ( n\pi x\right ) dx & =\int _{0}^{1}f\left ( x\right ) \sin \left ( n\pi x\right ) dx-\int _{0}^{1}x\sin \left ( n\pi x\right ) dx\\ & =0-\int _{0}^{1}x\sin \left ( n\pi x\right ) dx \end {align*}
\(\int _{0}^{1}x\sin \left ( n\pi x\right ) dx=\frac {\left ( -1\right ) ^{n+1}}{n\pi }\), hence \begin {align*} \int _{0}^{1}\left ( f\left ( x\right ) -x\right ) \sin \left ( n\pi x\right ) dx & =-\frac {\left ( -1\right ) ^{n+1}}{n\pi }\\ & =\frac {\left ( -1\right ) ^{n}}{n\pi } \end {align*}
Therefore (1) becomes\[ u\left ( x,t\right ) =x+2\sum _{n=1}^{\infty }\frac {\left ( -1\right ) ^{n}}{n\pi }e^{-\left ( n\pi \right ) ^{2}t}\sin \left ( n\pi x\right ) \] This is animation of the solution for \(0.3\) seconds. (Animation will show only in the HTML version).
Source code used for the above
____________________________________________________________________________________
Added April 28, 2019
Problem 2, section 77, Fourier series and Boundary value problem, 8th edition by Brown and Churchill.
Solve the heat equation
\[ u_t = u_{xx} \]
For \(0<x<1,t>0\). The boundary conditions are \(u_x(0,t)=h u(0,t)\) and on the right end \(u(1,t)=1\) with \(h>0\). Initial conditions \(u(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}]; ic = u[x, 0] == 0; bc = {Derivative[1, 0][u][0, t] == h * u[0,t], u[1, t] == 1}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions->h>0], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} x^2+\underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} \sqrt {h} \left (\frac {\sqrt {2} e^{-t K[2,K[1]]} \left (2 h+\cos \left (\sqrt {K[2,K[1]]}\right ) ((h-2) K[2,K[1]]-2 h)-\sqrt {K[2,K[1]]} (2 h+K[2,K[1]]-2) \sin \left (\sqrt {K[2,K[1]]}\right )\right )}{K[2,K[1]]^{3/2} \sqrt {h \left (-\cos ^2\left (\sqrt {K[2,K[1]]}\right )+h+2\right )+\frac {\left (h-\cos ^2\left (\sqrt {K[2,K[1]]}\right )\right ) K[2,K[1]]}{h}}}-\frac {2 \sqrt {2} \left (1-e^{-t K[2,K[1]]}\right ) \left (h \left (\cos \left (\sqrt {K[2,K[1]]}\right )-1\right )-\sqrt {K[2,K[1]]} \sin \left (\sqrt {K[2,K[1]]}\right )\right )}{K[2,K[1]]^{3/2} \sqrt {h \left (-\cos ^2\left (\sqrt {K[2,K[1]]}\right )+h+2\right )+\frac {\left (h-\cos ^2\left (\sqrt {K[2,K[1]]}\right )\right ) K[2,K[1]]}{h}}}\right ) \left (\sqrt {K[2,K[1]]} \cos \left (x \sqrt {K[2,K[1]]}\right )+h \sin \left (x \sqrt {K[2,K[1]]}\right )\right )}{\sqrt {h^3-\cos ^2\left (\sqrt {K[2,K[1]]}\right ) h^2+2 h^2+K[2,K[1]] h-\cos ^2\left (\sqrt {K[2,K[1]]}\right ) K[2,K[1]]}} & 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 ✗
restart; pde := diff(u(x,t), t) = (diff(u(x,t), x, x)); ic := u(x,0) = 0; bc := eval(diff(u(x,t), x), x = 0) = h*u(0,t), u(1,t) = 1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming h>0),output='realtime'));
time expired
Hand solution
Solve
\[ u_{t}=u_{xx}\qquad 0<x<1,t>0 \] With boundary conditions\begin {align*} u_{x}\left ( 0,t\right ) -hu\left ( 0,t\right ) & =0\\ u\left ( 1,t\right ) & =1 \end {align*}
With \(h>0\). And initial conditions \(u\left ( x,0\right ) =f\left ( x\right ) \).
Because the second B.C. is not zero, we need to introduce a reference function \(r\left ( x\right ) \) which satisfies the nonhomogeneous boundary conditions.
Let \(r\left ( x\right ) =Ax+B\). When \(x=0\) then the first BC gives\[ A-hB=0 \] And the second BC gives\[ A+B=1 \] From the first equation \(A=hB\). Substituting in the second equation give \(hB+B=1\) or \(B\left ( 1+h\right ) =1\) or \(B=\frac {1}{1+h}\). Hence \(A=\frac {h}{1+h}\). Therefore\begin {align} r\left ( x\right ) & =Ax+B\nonumber \\ & =\frac {h}{1+h}x+\frac {1}{1+h}\nonumber \\ & =\frac {hx+1}{1+h}\tag {1} \end {align}
To verify. \(r_{x}=\frac {h}{1+h}\). When \(x=0\) then \(r\left ( 0\right ) =\frac {1}{1+h}\). Hence \(r_{x}\left ( 0\right ) -hr\left ( 0\right ) =\frac {h}{1+h}-h\frac {1}{1+h}=0\) as expected. And when \(x=1\) then \(r\left ( 1\right ) =1\) as expected. Now that we found \(r\left ( x\right ) \) then we write\[ u\left ( x,t\right ) =v\left ( x,t\right ) +r\left ( x\right ) \] Where \(v\left ( x,t\right ) \) is the solution to the homogenous PDE\[ v_{t}=v_{xx}\qquad 0<x<1,t>0 \] With boundary conditions\begin {align*} v_{x}\left ( 0,t\right ) -hv\left ( 0,t\right ) & =0\\ v\left ( 1,t\right ) & =0 \end {align*}
We can now solve for \(v\left ( x,t\right ) \,\) using separation of variables since boundary conditions are homogenous. Separation of variables gives\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X^{\prime }\left ( 0\right ) -hX\left ( 0\right ) & =0\\ X\left ( 1\right ) & =0 \end {align*}
The above is known eigenvalue problem which we found before. It has the following eigenfunctions and eigenvalues\begin {align*} \phi _{n}\left ( x\right ) & =\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) \qquad n=1,2,\cdots \\ \tan \left ( \alpha _{n}\right ) & =\frac {-\alpha _{n}}{h} \end {align*}
With \(\alpha _{n}>0\). Hence the solution \(v\left ( x,t\right ) \) using generalized Fourier series is\begin {equation} v\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \tag {2} \end {equation} Substituting into the PDE \(v_{t}=v_{xx}\) gives\begin {align*} \sum _{n=1}^{\infty }B_{n}^{\prime }\left ( t\right ) \phi _{n}\left ( x\right ) & =\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \phi _{n}^{\prime \prime }\left ( x\right ) \\ & =-\sum _{n=1}^{\infty }B_{n}\left ( t\right ) \alpha _{n}^{2}\phi _{n}\left ( x\right ) \end {align*}
Therefore the ODE is\[ B_{n}^{\prime }\left ( t\right ) +\alpha _{n}^{2}B_{n}\left ( t\right ) =0 \] The solution is \[ B_{n}\left ( t\right ) =B_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t}\] Hence (2) becomes\[ v\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t}\phi _{n}\left ( x\right ) \] And since \(u\left ( x,t\right ) =v\left ( x,t\right ) +r\left ( x\right ) \) then\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t}\phi _{n}\left ( x\right ) +\frac {hx+1}{1+h}\] Now we find \(B_{n}\left ( 0\right ) \) from initial conditions. At \(t=0\) the above becomes\begin {align*} 0 & =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) \phi _{n}\left ( x\right ) +\frac {hx+1}{1+h}\\ -\frac {hx+1}{1+h} & =\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) \phi _{n}\left ( x\right ) \end {align*}
Hence \begin {align} B_{n}\left ( 0\right ) & =\left \langle -\frac {hx+1}{1+h},\phi _{n}\left ( x\right ) \right \rangle \nonumber \\ & =-\int _{0}^{1}p\left ( x\right ) \frac {hx+1}{1+h}\phi _{n}\left ( x\right ) dx\nonumber \\ & =-\int _{0}^{1}\frac {hx+1}{1+h}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx\nonumber \\ & =-\frac {1}{1+h}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\int _{0}^{1}\left ( hx+1\right ) \sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx\tag {3} \end {align}
But\begin {align*} \int _{0}^{1}\left ( hx+1\right ) \sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx & =\int _{0}^{1}\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx+h\int _{0}^{1}x\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx\\ & =\left [ \frac {\cos \left ( \alpha _{n}\left ( 1-x\right ) \right ) }{\alpha _{n}}\right ] _{0}^{1}+h\left [ \frac {\alpha _{n}x\cos \left ( \alpha _{n}\left ( 1-x\right ) \right ) +\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) }{\alpha _{n}^{2}}\right ] _{0}^{1}\\ & =\frac {1-\cos \left ( \alpha _{n}\right ) }{\alpha _{n}}+\frac {h}{\alpha _{n}^{2}}\left [ \alpha _{n}x\cos \left ( \alpha _{n}\left ( 1-x\right ) \right ) +\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) \right ] _{0}^{1}\\ & =\frac {1-\cos \left ( \alpha _{n}\right ) }{\alpha _{n}}+\frac {h}{\alpha _{n}^{2}}\left [ \alpha _{n}-\sin \alpha _{n}\right ] \\ & =\frac {\alpha _{n}-\alpha _{n}\cos \left ( \alpha _{n}\right ) +h\alpha _{n}-h\sin \alpha _{n}}{\alpha _{n}^{2}} \end {align*}
But \(\frac {\sin \left ( \alpha _{n}\right ) }{\cos \left ( \alpha _{n}\right ) }=-\frac {\alpha _{n}}{h}\) or \(h\sin \left ( \alpha _{n}\right ) =-\alpha _{n}\cos \left ( \alpha _{n}\right ) \) or \(-h\sin \alpha _{n}=\alpha _{n}\cos \left ( \alpha _{n}\right ) \), hence the above simplifies to \begin {align*} \int _{0}^{1}\left ( hx+1\right ) \sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) dx & =\frac {\alpha _{n}+h\alpha _{n}}{\alpha _{n}^{2}}\\ & =\frac {1+h}{\alpha _{n}} \end {align*}
Therefore (3) becomes\begin {align*} B_{n}\left ( 0\right ) & =\frac {-1}{1+h}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\left ( \frac {1+h}{\alpha _{n}}\right ) \\ & =-\frac {1}{\alpha _{n}}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}} \end {align*}
Hence final solution becomes\begin {align*} u\left ( x,t\right ) & =\frac {hx+1}{1+h}+\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) e^{-\alpha _{n}^{2}t}\phi _{n}\left ( x\right ) \\ & =\frac {hx+1}{1+h}+\sum _{n=1}^{\infty }B_{n}\left ( 0\right ) \exp \left ( -\alpha _{n}^{2}t\right ) \sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) \\ & =\frac {hx+1}{1+h}+\sum _{n=1}^{\infty }-\frac {1}{\alpha _{n}}\sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\exp \left ( -\alpha _{n}^{2}t\right ) \sqrt {\frac {2h}{h+\cos ^{2}\alpha _{n}}}\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) \\ & =\frac {hx+1}{1+h}-2h\sum _{n=1}^{\infty }\frac {\sin \left ( \alpha _{n}\left ( 1-x\right ) \right ) }{\alpha _{n}\left ( h+\cos ^{2}\alpha _{n}\right ) }\exp \left ( -\alpha _{n}^{2}t\right ) \end {align*}
____________________________________________________________________________________
Added July 2, 2018.
Second example from Maple document for new improvements in Maple 2018.1
Solve the heat equation
\[ 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\).
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], x] == 13*D[u[x, t], {x, 2}]; bc = {Derivative[1, 0][u][0, t] == 0, Derivative[1, 0][u][1, t] == 1}; ic = u[x, 0] == (1*x^2)/2 + x; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], x, t], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x, t), t) = 13*(diff(u(x, t), x, x)); bc := D[1](u)(0,t)=0,D[1](u)(1,t)=1; ic := u(x, 0) = 1/2*x^2+x; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', simplify(pdsolve([pde, ic, bc],u(x,t)))),output='realtime'));
\[u \left (x , t\right ) = \frac {x^{2}}{2}+13 t +2 \left (\moverset {\infty }{\munderset {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}\]
____________________________________________________________________________________
Added March 31, 2019.
Solve the heat equation for \(u(x,t)\) \[ u_t = k u_{xx} \] For \(0<x<\pi \) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0\\ u_x(\pi ,t) &= A \end {align*}
Initial condition is \(u(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}] ; ic = u[x, 0] == 0; bc = {u[0,t] == 0, Derivative[1, 0][u][Pi, t] == A}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t},Assumptions->A>0], 60*10]];
\[\left \{\left \{u(x,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {8 (-1)^{K[1]} A e^{-\frac {1}{4} t (1-2 K[1])^2} \sin \left (x \left (K[1]-\frac {1}{2}\right )\right )}{\pi (1-2 K[1])^2}+A x\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x, t), t) = diff(u(x, t), x$2): ic := u(x, 0) = 0: bc := u(0,t)=0, eval( diff(u(x,t),x),x=Pi)=A: cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve({pde, ic, bc}, u(x, t)) assuming A>0),output='realtime'));
\[u \left (x , t\right ) = A x +\moverset {\infty }{\munderset {n =0}{\sum }}\left (-\frac {8 A \left (-1\right )^{n} {\mathrm e}^{-\frac {\left (2 n +1\right )^{2} t}{4}} \sin \left (n x +\frac {1}{2} x \right )}{\pi \left (2 n +1\right )^{2}}\right )\]
____________________________________________________________________________________
Added April 15, 2019.
Solve the heat equation for \(u(x,t)\) \[ u_t = k u_{rr} \] For \(0<r<a\) and \(t>0\). The boundary conditions are \begin {align*} u(0,t) &= 0\\ u(a,t) &= a \phi (t) \end {align*}
Initial condition is \(u(r,0)=r f(r)\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[r, t], t] == k*D[u[r, t], {r, 2}] ; ic = u[r, 0] == r*f[r]; bc = {u[0, t] == 0, u[a, t] == a*phi[t]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[r, t], {r, t}], 60*10]];
\[\left \{\left \{u(r,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\sqrt {2} \sqrt {\frac {1}{a}} \left (e^{-\frac {k \pi ^2 t K[1]^2}{a^2}} \int _0^a \sqrt {2} \sqrt {\frac {1}{a}} r (f(r)-\phi (0)) \sin \left (\frac {\pi r K[1]}{a}\right ) \, dr+\int _0^t \frac {(-1)^{K[1]} \sqrt {2} e^{-\frac {k \pi ^2 K[1]^2 (t-K[2])}{a^2}} \phi '(K[2])}{\left (\frac {1}{a}\right )^{3/2} \pi K[1]} \, dK[2]\right ) \sin \left (\frac {\pi r K[1]}{a}\right )+r \phi (t)\right \}\right \}\]
Maple ✓
restart; pde := diff(u(r, t), t) = k*diff(u(r, t), r$2): ic := u(r,0)=r*f(r); bc := u(0,t)=0,u(a,t)=a*phi(t); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve({pde, ic, bc}, u(r, t))),output='realtime'));
\[u \left (r , t\right ) = r \phi \left (t \right )+\int _{0}^{t}\left (\moverset {\infty }{\munderset {n =1}{\sum }}\frac {2 a \left (-1\right )^{n} \left (\frac {d}{d \tau }\phi \left (\tau \right )\right ) {\mathrm e}^{-\frac {\pi ^{2} \left (t -\tau \right ) k \,n^{2}}{a^{2}}} \sin \left (\frac {\pi n r}{a}\right )}{\pi n}\right )d \tau +\left (\moverset {\infty }{\munderset {n =1}{\sum }}\frac {2 \left (\int _{0}^{a}\left (f \left (r \right )-\phi \left (0\right )\right ) r \sin \left (\frac {\pi n r}{a}\right )d r \right ) {\mathrm e}^{-\frac {\pi ^{2} k \,n^{2} t}{a^{2}}} \sin \left (\frac {\pi n r}{a}\right )}{a}\right )\]
Hand solution
Solve \begin {equation} u_{t}=ku_{rr}\qquad t>0,0<r<a \tag {1} \end {equation} With boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( a,t\right ) & =a\phi \left ( t\right ) \end {align*}
And initial conditions\[ u\left ( r,0\right ) =rf\left ( r\right ) \] Since the boundary conditions are not homogeneous, the first step is to convert them to homogeneous. This is done using a reference function which needs to only satisfy the boundary conditions. This reference function can be seen to be \(v\left ( r,t\right ) =r\phi \left ( t\right ) \). Now we write\[ u\left ( r,t\right ) =w\left ( r,t\right ) +v\left ( r,t\right ) \] Where \(w\left ( r,t\right ) \) satisfies the PDE but with homogeneous B.C. Substituting the above into (1) gives\begin {align} w_{t}\left ( r,t\right ) +r\phi ^{\prime }\left ( t\right ) & =kw_{rr}\nonumber \\ w_{t}\left ( r,t\right ) & =kw_{rr}-r\phi ^{\prime }\left ( t\right ) \tag {2} \end {align}
With boundary conditions\begin {align*} w\left ( 0,t\right ) & =0\\ w\left ( a,t\right ) & =0 \end {align*}
The solution to the homogeneous PDE \(w_{t}\left ( r,t\right ) =kw_{rr}\) with the above boundary conditions is easily found and known. The eigenvalues are \(\lambda _{n}=\left ( \frac {n\pi }{a}\right ) ^{2},n=1,2,\cdots \) and eigenfunctions \(\Phi _{n}\left ( r\right ) =\sin \left ( \sqrt {\lambda _{n}}r\right ) \). Let the solution to (2), using eigenfunction expansion be\begin {equation} w\left ( r,t\right ) =\sum _{n=1}^{\infty }C_{n}\left ( t\right ) \Phi _{n}\left ( r\right ) \tag {2A} \end {equation} Substituting the above back into (2) gives\begin {equation} \sum _{n=1}^{\infty }C_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( r\right ) =k\sum _{n=1}^{\infty }C_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( r\right ) -\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( r\right ) \tag {3} \end {equation} Where \(q_{n}\left ( t\right ) \) are the Fourier coefficients of \(r\phi ^{\prime }\left ( t\right ) \) which are found by\[ r\phi ^{\prime }\left ( t\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( r\right ) \] Applying orthogonality using \(\Phi _{n}\left ( r\right ) \) gives\begin {align*} \int _{0}^{a}r\phi ^{\prime }\left ( t\right ) \Phi _{m}\left ( r\right ) dr & =\int _{0}^{a}\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( r\right ) \Phi _{m}\left ( r\right ) dr\\ & =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \int _{0}^{r}\Phi _{n}\left ( r\right ) \Phi _{m}\left ( r\right ) dr \end {align*}
But \(\int _{0}^{a}\Phi _{n}\left ( r\right ) \Phi _{m}\left ( r\right ) dr=\int _{0}^{a}\sin \left ( \frac {n\pi }{a}r\right ) \sin \left ( \frac {m\pi }{a}r\right ) dr=\frac {a}{2}\) for \(n=m\) only, and the above becomes\[ \frac {2}{a}\int _{0}^{a}r\phi ^{\prime }\left ( t\right ) \Phi _{m}\left ( s\right ) dr=q_{m}\left ( t\right ) \] Substituting the above back into (3) gives\[ \sum _{n=1}^{\infty }C_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( r\right ) =k\sum _{n=1}^{\infty }C_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( r\right ) -\sum _{n=1}^{\infty }\left ( \frac {2}{a}\int _{0}^{a}r\phi ^{\prime }\left ( t\right ) \Phi _{m}\left ( r\right ) dr\right ) \Phi _{n}\left ( r\right ) \] But \(\Phi _{n}^{\prime \prime }\left ( r\right ) =-\lambda _{n}\Phi _{n}\left ( r\right ) \) and above simplifies to\begin {align*} \sum _{n=1}^{\infty }C_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( r\right ) +k\sum _{n=1}^{\infty }C_{n}\left ( t\right ) \lambda _{n}\Phi _{n}\left ( r\right ) & =-\sum _{n=1}^{\infty }\left ( \frac {2}{a}\int _{0}^{a}r\phi ^{\prime }\left ( t\right ) \Phi _{m}\left ( r\right ) dr\right ) \Phi _{n}\left ( r\right ) \\ C_{n}^{\prime }\left ( t\right ) +kC_{n}\left ( t\right ) \lambda _{n} & =-\frac {2}{a}\int _{0}^{a}r\phi ^{\prime }\left ( t\right ) \Phi _{m}\left ( r\right ) dr\\ & =-\frac {2}{a}\phi ^{\prime }\left ( t\right ) \int _{0}^{a}r\sin \left ( \frac {n\pi }{a}r\right ) dr\\ & =-\frac {2}{a}\phi ^{\prime }\left ( t\right ) \frac {\left ( -1\right ) ^{n+1}a^{2}}{n\pi }\\ & =-2a\phi ^{\prime }\left ( t\right ) \frac {\left ( -1\right ) ^{n+1}}{n\pi } \end {align*}
This is first order ODE in \(C\left ( t\right ) \). The solution is\[ C_{n}\left ( t\right ) =e^{-k\lambda _{n}t}C_{n}\left ( 0\right ) +2ae^{-k\lambda _{n}t}\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{k\lambda _{n}\tau }d\tau \] From (2A)\[ w\left ( r,t\right ) =\sum _{n=1}^{\infty }\left ( e^{-k\lambda _{n}t}C_{n}\left ( 0\right ) +2ae^{-k\lambda _{n}t}\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{k\lambda _{n}\tau }d\tau \right ) \sin \left ( \frac {n\pi }{a}r\right ) \] Hence \begin {align} u\left ( r,t\right ) & =w\left ( r,t\right ) +v\left ( r,t\right ) \nonumber \\ & =\sum _{n=1}^{\infty }\left ( e^{-k\lambda _{n}t}C_{n}\left ( 0\right ) +2ae^{-k\lambda _{n}t}\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{k\lambda _{n}\tau }d\tau \right ) \sin \left ( \frac {n\pi }{a}r\right ) +r\phi \left ( t\right ) \tag {4} \end {align}
At \(t=0\) the above becomes\begin {align*} rf\left ( r\right ) & =\sum _{n=1}^{\infty }C_{n}\left ( 0\right ) \sin \left ( \frac {n\pi }{a}r\right ) +r\phi \left ( 0\right ) \\ \sum _{n=1}^{\infty }C_{n}\left ( 0\right ) \sin \left ( \frac {n\pi }{a}r\right ) & =r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \end {align*}
Hence \(C_{n}\left ( 0\right ) \) is the Fourier sine coefficients of \(\ r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \)\begin {align*} \frac {a}{2}C_{n}\left ( 0\right ) & =\int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr\\ C_{n}\left ( 0\right ) & =\frac {2}{a}\int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr \end {align*}
Substituting this into (4) gives the final solution as\begin {align*} u\left ( r,t\right ) & =r\phi \left ( t\right ) +\sum _{n=1}^{\infty }\left ( e^{-k\lambda _{n}t}\left ( \frac {2}{a}\int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr\right ) +2ae^{-k\lambda _{n}t}\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{k\lambda _{n}\tau }d\tau \right ) \sin \left ( \frac {n\pi }{a}r\right ) \\ & =r\phi \left ( t\right ) +\sum _{n=1}^{\infty }\left ( e^{-k\lambda _{n}t}\left ( \frac {2}{a}\int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr\right ) +2a\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{-k\lambda _{n}\left ( t-\tau \right ) }d\tau \right ) \sin \left ( \frac {n\pi }{a}r\right ) \\ & =r\phi \left ( t\right ) +\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\left ( \frac {2}{a}\int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr\right ) \sin \left ( \frac {n\pi }{a}r\right ) +\sum _{n=1}^{\infty }2a\frac {\left ( -1\right ) ^{n+1}}{n\pi }\int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{-k\lambda _{n}\left ( t-\tau \right ) }d\tau \sin \left ( \frac {n\pi }{a}r\right ) \end {align*}
Or\begin {align*} u\left ( r,t\right ) & =r\phi \left ( t\right ) \\ & +\frac {2}{a}\sum _{n=1}^{\infty }e^{-k\lambda _{n}t}\sin \left ( \frac {n\pi }{a}r\right ) \left ( \int _{0}^{a}r\left ( f\left ( r\right ) -\phi \left ( 0\right ) \right ) \sin \left ( \frac {n\pi }{a}r\right ) dr\right ) \\ & +\frac {2a}{\pi }\sum _{n=1}^{\infty }\frac {\left ( -1\right ) ^{n+1}}{n}\sin \left ( \frac {n\pi }{a}r\right ) \int _{0}^{t}\phi ^{\prime }\left ( \tau \right ) e^{-k\lambda _{n}\left ( t-\tau \right ) }d\tau \end {align*}
Where \(\lambda _{n}=\left ( \frac {n\pi }{a}\right ) ^{2}\).
____________________________________________________________________________________