4.2.2 Polar coordinates (disk, sector, annulus)

   4.2.2.1 [259] no \(\theta \) dependency, insulated (General solution)
   4.2.2.2 [260] no \(\theta \) dependency, insulated (Specific solution)
   4.2.2.3 [261] no \(\theta \) dependency
   4.2.2.4 [262] no \(\theta \) dependency
   4.2.2.5 [263] Haberman 8.3.5 (General solution)
   4.2.2.6 [264] Specific example of the above
   4.2.2.7 [265] Specific example of the above
   4.2.2.8 [266] Inside ring
   4.2.2.9 [267] Articolo 6.9.1
   4.2.2.10 [268] Articolo 6.9.2
   4.2.2.11 [269] Haberman 8.2.5 with \(\theta \) dependency (General case)
   4.2.2.12 [270] With \(\theta \) dependency (Specific example)
   4.2.2.13 [271] With \(\theta \) dependency (specific example)
   4.2.2.14 [272] Insulated with \(\theta \) dependency (General solution)
   4.2.2.15 [273] Insulated with \(\theta \) dependency (Specific example)
   4.2.2.16 [274] Insulated with \(\theta \) dependency (Specific example)

4.2.2.1 [259] no \(\theta \) dependency, insulated (General solution)

problem number 259

Added June 1, 2019

Solve the heat equation in polar coordinates for \(u(r,t)\) \[ u_t = k (u_{rr} + \frac {1}{r} u_r) \] For \(0<r<L\) and \(t>0\). The boundary conditions are such it is insulated \begin {align*} u_r(L,t) &= 0 \end {align*}

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

pict
Figure 4.144:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} e^{-\frac {k t \left (j_{1,K[1]}\right ){}^2}{L^2}} J_0\left (\frac {r j_{1,K[1]}}{L}\right ) \int _0^L \frac {\sqrt {2} r J_0\left (\frac {r j_{1,K[1]}}{L}\right ) f(r)}{L J_0\left (j_{1,K[1]}\right )} \, dr}{L J_0\left (j_{1,K[1]}\right )}+\frac {\sqrt {2} \int _0^L \frac {\sqrt {2} r f(r)}{L} \, dr}{L}\right \}\right \}\]

Maple


\[u \left (r , t\right ) = \sqrt {k}\, \left (\int _{-L +r}^{0}\mathcal {L}^{-1}\left (\frac {\BesselJ \left (0, \frac {\sqrt {-s}\, \left (r -\tau \right )}{\sqrt {k}}\right ) \mathcal {L}\left (\frac {-D\relax (f )\left (L +\tau \right )+\left (-L -\tau \right ) D^{\relax (2)}\relax (f )\left (L +\tau \right )}{L +\tau }, t , s\right )}{\sqrt {-s}\, \BesselJ \left (1, \frac {\sqrt {-s}\, L}{\sqrt {k}}\right )}, s , t\right )d \tau \right )-\sqrt {k}\, \mathcal {L}^{-1}\left (\frac {\BesselJ \left (0, \frac {\sqrt {-s}\, r}{\sqrt {k}}\right ) \mathcal {L}\left (-D\relax (f )\relax (L ), t , s\right )}{\sqrt {-s}\, \BesselJ \left (1, \frac {\sqrt {-s}\, L}{\sqrt {k}}\right )}, s , t\right )+f \relax (r )\] Cant get series solution

Hand solution

Solve for \(u\left (r,t\right ) \)\begin {align*} u_{t} & =k\left (u_{rr}+\frac {1}{r}u_{r}\right ) \\ \left \vert u\left (0,t\right ) \right \vert & <\infty \\ u_{r}\left (L,t\right ) & =0\\ u\left (r,0\right ) & =f\relax (r) \end {align*}

for \(0<r<L\,\). Let \(u=RT\). Substituting in the PDE gives\begin {align*} \frac {T^{\prime }R}{k} & =R^{\prime \prime }T+\frac {1}{r}R^{\prime }T\\ \frac {T^{\prime }}{kT} & =\frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}=-\lambda \end {align*}

The above gives the following ODE’s to solve\[ T^{\prime }+\lambda kT=0 \] And\begin {align} R^{\prime \prime }+\frac {1}{r}R^{\prime }+\lambda R & =0\tag {1}\\ R^{\prime }\relax (L) & =0\nonumber \\ R\relax (0) & <\infty \nonumber \end {align}

Case \(\lambda <0\)

Let \(\lambda =-n^{2}\) for positive \(n\). (1) becomes\begin {align*} R^{\prime \prime }+\frac {1}{r}R^{\prime }-n^{2}R & =0\\ r^{2}R^{\prime \prime }+rR^{\prime }-n^{2}r^{2}R & =0 \end {align*}

This is a Bessel ODE whose solution is \(R\relax (r) =C_{1}\operatorname {BesselI}\left (0,nr\right ) +C_{2}\operatorname {Besselk}\left ( 0,nr\right ) \). Since \(R\relax (r) \) is bounded at \(r=0\) then \(C_{2}=0\) since \(\operatorname {Besselk}\) blows up at \(r=0\). The solution becomes \(R\relax (r) =C_{1}\operatorname {BesselI}\left (0,nr\right ) \). Then \(R^{\prime }\relax (r) =C_{1}\operatorname {BesselI}\left (1,nr\right ) \). Hence we need to solve for \(n\) in the following \(R^{\prime }\left ( L\right ) =0=\operatorname {BesselI}\left (1,nL\right ) \). But \(\operatorname {BesselI}\) has zero only at zero. Therefore \(\lambda <0\) is not possible eigenvalue.

Case \(\lambda =0\)

Equation (1) becomes \(R^{\prime \prime }+\frac {1}{r}R^{\prime }=0\). The solution is \(R\relax (r) =C_{1}\ln \relax (r) +C_{2}\). Since bounded at \(r=0\) then \(C_{1}=0\). The solution becomes \(R\relax (r) =C_{2}\) and \(R^{\prime }\relax (r) =0\). Which satisfies the boundary condition for any constant \(C_{2}\). Therefore \(\lambda =0\) is an eigenvalue with eigenfunction \(R_{0}\relax (r) =1\) as the choice of the constant.

Case \(\lambda >0\)

Equation (1) becomes\[ r^{2}R^{\prime \prime }+rR^{\prime }+\lambda r^{2}R=0 \] This is a Bessel ODE whose solution is \(R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) +C_{2}\operatorname {BesselY}\left (0,\sqrt {\lambda }r\right ) \). Since \(R\left ( r\right ) \) is bounded at \(r=0\) then \(C_{2}=0\) since \(\operatorname {BesselY}\) blows up at \(r=0\). The solution becomes \(R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) \). Then \(R^{\prime }\relax (r) =-C_{1}\operatorname {BesselJ}\left (1,\sqrt {\lambda }r\right ) \). Absorbing the minus sign into the constant, hence \(R^{\prime }\relax (r) =C_{1}\operatorname {BesselJ}\left (1,\sqrt {\lambda }r\right ) \). At \(r=L\) we want

\[ 0=C_{1}\operatorname {BesselJ}\left (1,\sqrt {\lambda }L\right ) \] For non-trivial solution, \(\sqrt {\lambda }L\) are the zeros of the \(\operatorname {BesselJ}\left (1,x\right ) \). Let these zeros be \(\Lambda _{n}\) where \(n=1,2,\cdots \). Hence \begin {align*} \sqrt {\lambda _{n}}L & =\Lambda _{n}\qquad n=1,2,\cdots \\ \lambda _{n} & =\left (\frac {\Lambda _{n}}{L}\right ) ^{2} \end {align*}

The corresponding eigenfunctions are\[ R_{n}\relax (r) =\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) \qquad n=1,2,\cdots \] Now that we found the eigenvalues and eigenfunctions, we can solve the time ODE. For the zero eigenvalue \(\lambda =0\) the ODE \(T^{\prime }+\lambda kT=0\) becomes \(T^{\prime }=0\), hence \(T_{0}\relax (t) \) is a constant. For \(\lambda >0\) the time ODE has solution \(T_{n}\relax (t) =e^{-k\lambda _{n}t}=e^{-k\left (\frac {\Lambda _{n}}{L}\right ) ^{2}t}\). Therefore the complete solution is\[ u\left (r,t\right ) =C_{0}+\sum _{n=1}^{\infty }C_{n}e^{-k\left (\frac {\Lambda _{n}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) \] Now we find the constants from the initial conditions. At \(t=0\)\[ f\relax (r) =C_{0}+\sum _{n=1}^{\infty }C_{n}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) \] For \(n=0\), applying orthogonality gives\begin {align*} \int _{0}^{L}f\relax (r) rdr & =\int _{0}^{L}C_{0}rdr\\ & =C_{0}\frac {L^{2}}{2}\\ C_{0} & =\frac {2}{L^{2}}\int _{0}^{L}f\relax (r) rdr \end {align*}

For \(n>0\)\begin {align*} \int _{0}^{L}f\relax (r) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr & =\int _{0}^{L}C_{n}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr\\ C_{n} & =\frac {\int _{0}^{L}f\relax (r) \operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{L}r\right ) rdr}{\int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr} \end {align*}

Hence the final solution is\[ u\left (r,t\right ) =\frac {2}{L^{2}}\int _{0}^{L}f\relax (r) rdr+\sum _{n=1}^{\infty }\left (\frac {\int _{0}^{L}f\relax (r) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr}{\int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr}\right ) e^{-k\left (\frac {\Lambda _{n}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) \] Where \(\Lambda _{n}\) are the zeros of the \(\operatorname {BesselJ}\left ( 1,x\right ) \).

________________________________________________________________________________________

4.2.2.2 [260] no \(\theta \) dependency, insulated (Specific solution)

problem number 260

Added June 1, 2019

Solve the heat equation in polar coordinates for \(u(r,t)\) \[ u_t = k (u_{rr} + \frac {1}{r} u_r) \] For \(0<r<L\) and \(t>0\) and \(k=1,L=1\). The boundary conditions are such it is insulated \begin {align*} u_r(L,t) &= 0 \end {align*}

Initial condition is \(u(r,0)=2 L r-r^2\).

pict
Figure 4.145:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {K[1]=1}{\overset {\infty }{\sum }}-\frac {2 e^{-t \left (j_{1,K[1]}\right ){}^2} J_0\left (r j_{1,K[1]}\right ) \left (\frac {2 J_2\left (j_{1,K[1]}\right )}{\left (j_{1,K[1]}\right ){}^2}-\frac {2}{3} \, _1F_2\left (\frac {3}{2};1,\frac {5}{2};-\frac {1}{4} \left (j_{1,K[1]}\right ){}^2\right )-\frac {J_3\left (j_{1,K[1]}\right )}{j_{1,K[1]}}\right )}{J_0\left (j_{1,K[1]}\right ){}^2}+\frac {5}{6}\right \}\right \}\]

Maple


\[u \left (r , t\right ) = -r^{2}+2 r -\left (\int _{0}^{r -1}\mathcal {L}^{-1}\left (\frac {\BesselJ \left (0, \sqrt {-s}\, \left (r -\tau \right )\right ) \mathcal {L}\left (\frac {4 \tau +2}{\tau +1}, t , s\right )}{\sqrt {-s}\, \BesselJ \left (1, \sqrt {-s}\right )}, s , t\right )d \tau \right )\] Do not understand Maple solution

Hand solution

Solve for \(u\left (r,t\right ) \)\begin {align*} u_{t} & =k\left (u_{rr}+\frac {1}{r}u_{r}\right ) \\ \left \vert u\left (0,t\right ) \right \vert & <\infty \\ u_{r}\left (1,t\right ) & =0\\ u\left (r,0\right ) & =2Lr-r^{2} \end {align*}

for \(0<r<L\).

The basic solution for this type of PDE was already given in problem 4.2.2.1 on page 1222 as\[ u\left (r,t\right ) =\frac {2}{L^{2}}\int _{0}^{L}f\relax (r) rdr+\sum _{n=1}^{\infty }\left (\frac {\int _{0}^{L}f\relax (r) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr}{\int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{L}r\right ) rdr}\right ) e^{-k\left (\frac {\Lambda _{n}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{L}r\right ) \] Where \(\Lambda _{n}\) are the zeros of the \(\operatorname {BesselJ}\left ( 1,x\right ) \). In this problem \(L=1\) and \(k=1,f\relax (r) =2Lr-r^{2}\). This is animation of the above solution using these specific values for for \(0.2\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 4.146:Source code

pict
Figure 4.147:Code used for animation

________________________________________________________________________________________

4.2.2.3 [261] no \(\theta \) dependency

problem number 261

Added June 1, 2019

Solve the heat equation in polar coordinates for \(u(r,t)\) \[ u_t = k (u_{rr} + \frac {1}{r} u_r) \] For \(0<r<L\) and \(t>0\). The boundary conditions are Newton Law of cooling, where \(h>0\) \begin {align*} L u(L,t) &= -h u(L,t) \end {align*}

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

pict
Figure 4.148:PDE specification

Mathematica


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

Maple


\[u \left (r , t\right ) = h f \relax (L ) \ln \relax (L )-h f \relax (L ) \ln \relax (r )-2 \left (\moverset {\infty }{\munderset {n =0}{\sum }}\frac {\left (-\cosh \left (\frac {k t \lambda _{n}^{2}}{L^{2}}\right )+\sinh \left (\frac {k t \lambda _{n}^{2}}{L^{2}}\right )\right ) \BesselJ \left (0, \frac {r \lambda _{n}}{L}\right ) \left (\int _{0}^{L}\left (-h f \relax (L ) \ln \relax (L )+h f \relax (L ) \ln \relax (r )-f \relax (L )+f \relax (r )\right ) r \BesselJ \left (0, \frac {r \lambda _{n}}{L}\right )d r \right )}{\left (\BesselJ \left (0, \lambda _{n}\right )^{2}+\BesselJ \left (1, \lambda _{n}\right )^{2}\right ) L^{2}}\right )+f \relax (L )\boldsymbol {\mathrm {where}}\left \{-h \BesselJ \left (0, \lambda _{n}\right )+\lambda _{n} \BesselJ \left (1, \lambda _{n}\right )=0\wedge -\infty \le \lambda _{n}\le \infty \right \}\]

________________________________________________________________________________________

4.2.2.4 [262] no \(\theta \) dependency

problem number 262

Taken from Mathematica DSolve help pages

Solve the heat equation in polar coordinates for \(u(r,t)\) \[ \frac { \partial u}{\partial t}= \frac { \partial ^2 u}{\partial r^2} + \frac {1}{r} \frac { \partial u}{\partial r} \] For \(0<r<1\) and \(t>0\). The boundary conditions are \begin {align*} u(1,t) &= 0 \end {align*}

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

pict
Figure 4.149:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {e^{-t \left (j_{0,n}\right ){}^2} \pi J_0\left (r j_{0,n}\right ) \left (J_1\left (j_{0,n}\right ) \pmb {H}_0\left (j_{0,n}\right )-J_0\left (j_{0,n}\right ) \pmb {H}_1\left (j_{0,n}\right )\right )}{J_1\left (j_{0,n}\right ){}^2 \left (j_{0,n}\right ){}^2}\right \}\right \}\]

Maple


\[u \left (r , t\right ) = \moverset {\infty }{\munderset {n =1}{\sum }}\frac {\pi \left (-\BesselJ \left (0, \lambda _{n}\right ) \StruveH \left (1, \lambda _{n}\right )+\BesselJ \left (1, \lambda _{n}\right ) \StruveH \left (0, \lambda _{n}\right )\right ) \left (\cosh \left (t \lambda _{n}^{2}\right )-\sinh \left (t \lambda _{n}^{2}\right )\right ) \BesselJ \left (0, r \lambda _{n}\right )}{\left (\BesselJ \left (0, \lambda _{n}\right )^{2}+\BesselJ \left (1, \lambda _{n}\right )^{2}\right ) \lambda _{n}^{2}}\boldsymbol {\mathrm {where}}\left \{\lambda _{n}=\mathit {BesselJZeros}\left (0, n\right )\wedge 0<\lambda _{n}\right \}\]

________________________________________________________________________________________

4.2.2.5 [263] Haberman 8.3.5 (General solution)

problem number 263

Added Nov 24, 2018.

Problem 8.3.5 from Richard Haberman applied partial differential equations book, 5th edition

Solve for \(u(r,t)\) \[ u_t= k (u_rr+1/r u_r) + f(r,t) \] Inside the circle (\(r<a\)) with \(u=0\) at \(r=a\) and initially \(u=0\).

One of the problems here, is how to tell CAS the implicit condition when solving this which is that \(u(0,t)<\infty \).

pict
Figure 4.150:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {\sqrt {2} J_0\left (\frac {r j_{0,n}}{a}\right ) \int _0^t e^{-\frac {k \left (j_{0,n}\right ){}^2 (t-K[2])}{a^2}} \text {Integrate}\left [\frac {\sqrt {2} r J_0\left (\frac {r j_{0,n}}{a}\right ) f(r,K[2])}{a J_1\left (j_{0,n}\right )},\{r,0,a\},\text {Assumptions}\to a\geq 0\land r<a\right ] \, dK[2]}{a J_1\left (j_{0,n}\right )}\right \}\right \}\]

Maple


\[u \left (r , t\right ) = -\left (\int _{-a +r}^{0}\mathcal {L}^{-1}\left (\frac {\BesselJ \left (0, \sqrt {-\frac {s}{k}}\, \left (r -\tau \right )\right ) \mathcal {L}\left (-\frac {f \left (a +\tau , t\right )}{k}, t , s\right )}{\BesselJ \left (0, \sqrt {-\frac {s}{k}}\, a \right )}, s , t\right )d \tau \right )\]

Hand solution

Since this problem has homogeneous B.C. but has time dependent source (i.e. non-homogenous in the PDE itself), then we will use the method of eigenfunction expansion. In this method, we first find the eigenfunctions \(\phi _{n}\relax (x) \) of the associated homogenous PDE without the source being present. Then use these \(\phi _{n}\relax (x) \) to expand the source \(f\left (x,t\right ) \) as generalized Fourier series. We now switch to the associated homogenous PDE in order to find the eigenfunctions. \(u\equiv u\left (r,t\right ) \). There is no \(\theta \). Hence\begin {align} \frac {\partial u\left (r,t\right ) }{\partial t} & =k\left (\frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}\right ) \tag {1}\\ u\left (a,t\right ) & =0\nonumber \\ \left \vert u\left (0,t\right ) \right \vert & <\infty \nonumber \\ u\left (r,0\right ) & =0\nonumber \end {align}

We need to solve the above in order to find the eigenfunctions \(\phi _{n}\relax (r) \). Let \(u=R\relax (r) T\relax (t) \). Substituting this back into (1) gives\[ T^{\prime }R=k\left (R^{\prime \prime }T+\frac {1}{r}R^{\prime }T\right ) \] Dividing by \(RT\)\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}=-\lambda \] Where \(\lambda \) is the separation constant. The above gives\[ T^{\prime }+k\lambda T=0 \] And\[ rR^{\prime \prime }+R^{\prime }+\lambda rR=0 \] This is a singular Sturm-Liouville ODE. Standard form is\[ \left (rR^{\prime }\right ) ^{\prime }=-\lambda rR \] Hence\begin {align*} p & =r\\ q & =0\\ \sigma & =r \end {align*}

The ODE\(\ rR^{\prime \prime }+R^{\prime }+\lambda rR=0\) is Bessel ODE whose solution is\[ R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) +C_{2}\operatorname {BesselY}\left (0,\sqrt {\lambda }r\right ) \] Since \(\operatorname {BesselY}\left (0,\sqrt {\lambda }r\right ) \) blows up at \(r=0\), then \(C_{2}=0\) and the solution becomes \[ R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) \] At \(r=a\) the above becomes \(0=C_{1}\operatorname {BesselJ}\left ( 0,\sqrt {\lambda }a\right ) \). Non trivial solution requires that \(\sqrt {\lambda }a\) are the zeros of \(\operatorname {BesselJ}\left (0,x\right ) \). Let the zeros be called \(\Lambda _{n},n=1,2,3,\cdots \). Therefore \(\sqrt {\lambda _{n}}a=\Lambda _{n}\) or\[ \lambda _{n}=\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\qquad n=1,2,3,\cdots \] The corresponding eigenfunctions are \(R_{n}\relax (r) =\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \). Now that the eigenfunctions for the homogeneous PDE are found, eigenfunction expansion is used to find the general solution. Let \begin {equation} u\left (r,t\right ) =\sum _{n=1}^{\infty }a_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \tag {2} \end {equation} Where \(a_{n}\relax (t) \) is function of time since it includes the time solution in it. Substituting the above back into the original nonhomogeneous PDE \begin {align} u_{t} & =k\nabla ^{2}u+f\left (r,t\right ) \tag {3}\\ & =k\left (\frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}\right ) +f\left (r,t\right ) \nonumber \end {align}

Where \(\nabla ^{2}u=-\lambda ru\). Substituting (2) into (3), and using \(f\left (r,t\right ) =\sum _{n=1}^{\infty }b_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \) gives

\[ \sum _{n=1}^{\infty }a_{n}^{\prime }\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) =ka_{n}\relax (t) \left ( \sum _{n=1}^{\infty }\operatorname {BesselJ}^{\prime \prime }\left (0,\frac {\Lambda _{n}}{a}r\right ) +\frac {1}{r}\operatorname {BesselJ}^{^{\prime }}\left (0,\frac {\Lambda _{n}}{a}r\right ) \right ) +\sum _{n=1}^{\infty }b_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \]

But \(\sum _{n=1}^{\infty }\operatorname {BesselJ}^{\prime \prime }\left ( 0,\frac {\Lambda _{n}}{a}r\right ) +\frac {1}{r}\operatorname {BesselJ}^{^{\prime }}\left (0,\frac {\Lambda _{n}}{a}r\right ) =-\lambda _{n}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \). The above becomes

\begin {align*} \sum _{n=1}^{\infty }a_{n}^{\prime }\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) & =-ka_{n}\relax (t) \sum _{n=1}^{\infty }\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) +\sum _{n=1}^{\infty }b_{n}\relax (t) \operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \\ \sum _{n=1}^{\infty }\left (a_{n}^{\prime }\relax (t) +k\left ( \frac {\Lambda _{n}}{a}\right ) ^{2}a_{n}\relax (t) \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) & =\sum _{n=1}^{\infty }b_{n}\relax (t) \operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \end {align*}

The above simplifies to\[ a_{n}^{\prime }\relax (t) +k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}a_{n}\relax (t) =b_{n}\relax (t) \] The solution is\[ a_{n}\relax (t) =e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau +a_{n}\relax (0) e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\] Hence the solution (2) becomes\[ u\left (r,t\right ) =\sum _{n=1}^{\infty }\left (e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\left (\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \right ) +a_{n}\left ( 0\right ) e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \] To find \(a_{n}\relax (0) \), putting \(t=0\) in the above gives\[ 0=\sum _{n=1}^{\infty }a_{n}\relax (0) \operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \] Hence \(a_{n}\relax (0) =0\). Therefore \(a_{n}\relax (t) \) becomes.\[ a_{n}\relax (t) =e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \] Hence the solution from (2) now becomes\[ u\left (r,t\right ) =\sum _{n=1}^{\infty }\left (e^{-k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}t}\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \] And finally, to find \(b_{n}\relax (t) \), which is the generalized Fourier coefficient of the expansion of the source in (3) above, orthogonality is used as follows\begin {align*} \int _{0}^{a}f\left (r,t\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr & =b_{n}\relax (t) \int _{0}^{a}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr\\ b_{n}\relax (t) & =\frac {\int _{0}^{a}f\left (r,t\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}{\int _{0}^{a}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr} \end {align*}

Summary of solution \begin {align*} u\left (r,t\right ) & =\sum _{n=1}^{\infty }a_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \\ & =\sum _{n=1}^{\infty }\left (\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \right ) e^{-k\left ( \frac {\Lambda _{n}}{a}\right ) ^{2}t}\operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \end {align*}

Where\[ b_{n}\relax (t) =\frac {\int _{0}^{a}f\left (r,t\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}{\int _{0}^{a}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}\]

________________________________________________________________________________________

4.2.2.6 [264] Specific example of the above

problem number 264

Added June 16,2019

Problem 8.3.5 from Richard Haberman applied partial differential equations book, 5th edition, but added specific values for parameters in order to do animations

Solve for \(u(r,t)\) \[ u_t= k (u_rr+1/r u_r) + f(r,t) \] Inside the circle (\(r<a\)) with \(u=0\) at \(r=a\) and initially \(u=0\). Let \(k=\frac {1}{100},a=2\). Let \(f(r,t)=sin(t)\)

pict
Figure 4.151:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {n=1}{\overset {\infty }{\sum }}\frac {800 J_0\left (\frac {r j_{0,n}}{2}\right ) \left (\sin (t) \left (j_{0,n}\right ){}^2+400 \left (e^{-\frac {1}{400} t \left (j_{0,n}\right ){}^2}-\cos (t)\right )\right )}{J_1\left (j_{0,n}\right ) j_{0,n} \left (\left (j_{0,n}\right ){}^4+160000\right )}\right \}\right \}\]

Maple


\[ u \left (r , t\right ) = -\mathcal {L}^{-1}\left (\frac {J_{0}\left (10 \sqrt {-s}\, r \right )}{J_{0}\left (20 \sqrt {-s}\right ) s}, s , t\right )+\mathcal {L}^{-1}\left (\frac {J_{0}\left (10 \sqrt {-s}\, r \right ) s}{J_{0}\left (20 \sqrt {-s}\right ) \left (s^{2}+1\right )}, s , t\right )+1-\cos \relax (t ) \]

Hand solution

The basic solution for this type of PDE was already given in problem 4.2.2.5 on page 1241 as\begin {align*} u\left (r,t\right ) & =\sum _{n=1}^{\infty }a_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \\ & =\sum _{n=1}^{\infty }\left (\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \right ) e^{-k\left ( \frac {\Lambda _{n}}{a}\right ) ^{2}t}\operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \end {align*}

Where\[ b_{n}\relax (t) =\frac {\int _{0}^{a}f\left (r,t\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}{\int _{0}^{a}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}\] Where \(\Lambda _{n}\) are the \(n^{th}\) zeros of \(\operatorname {BesselJ}\left ( 0,x\right ) \). In this problem \begin {align*} a & =2\\ k & =\frac {1}{100}\\ f\left (r,t\right ) & =\sin \relax (t) \end {align*}

This is animation of the above solution using these specific values for for \(50\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 4.152:Source code

pict
Figure 4.153:Code used for animation

________________________________________________________________________________________

4.2.2.7 [265] Specific example of the above

problem number 265

Added June 16,2019

Problem 8.3.5 from Richard Haberman applied partial differential equations book, 5th edition, but added specific values for the parameters in order to do animations

Solve for \(u(r,t)\) \[ u_t= k (u_rr+1/r u_r) + f(r,t) \] Inside the circle (\(r<a\)) with \(u=0\) at \(r=a\) and initially \(u=0\). Let \(k=\frac {1}{100},a=2\). Let \(f(r,t)=r t e^{-t}\)

pict
Figure 4.154:PDE specification

Mathematica


\[\left \{\left \{u(r,t)\to \underset {n=1}{\overset {\infty }{\sum }}-\frac {1600 J_0\left (\frac {r j_{0,n}}{2}\right ) \left (e^{-t} \left (400 (t+1)-t \left (j_{0,n}\right ){}^2\right )-400 e^{-\frac {1}{400} t \left (j_{0,n}\right ){}^2}\right ) \, _1F_2\left (\frac {3}{2};1,\frac {5}{2};-\frac {1}{4} \left (j_{0,n}\right ){}^2\right )}{3 J_1\left (j_{0,n}\right ){}^2 \left (\left (j_{0,n}\right ){}^2-400\right ){}^2}\right \}\right \}\]

Maple


sol=()

Hand solution

The basic solution for this type of PDE was already given in problem 4.2.2.5 on page 1241 as\begin {align*} u\left (r,t\right ) & =\sum _{n=1}^{\infty }a_{n}\relax (t) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) \\ & =\sum _{n=1}^{\infty }\left (\int _{0}^{t}b_{n}\left (\tau \right ) e^{k\left (\frac {\Lambda _{n}}{a}\right ) ^{2}\tau }d\tau \right ) e^{-k\left ( \frac {\Lambda _{n}}{a}\right ) ^{2}t}\operatorname {BesselJ}\left ( 0,\frac {\Lambda _{n}}{a}r\right ) \end {align*}

Where\[ b_{n}\relax (t) =\frac {\int _{0}^{a}f\left (r,t\right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}{\int _{0}^{a}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{n}}{a}r\right ) rdr}\] Where \(\Lambda _{n}\) are the \(n^{th}\) zeros of \(\operatorname {BesselJ}\left ( 0,x\right ) \). In this problem \begin {align*} a & =2\\ k & =\frac {1}{100}\\ f\left (r,t\right ) & =rte^{-t} \end {align*}

This is animation of the above solution using these specific values for for \(100\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 4.155:Source code

pict
Figure 4.156:Code used for animation

________________________________________________________________________________________

4.2.2.8 [266] Inside ring

problem number 266

Added May 2,2021

Taken from post at https://www.mapleprimes.com/questions/232084-How-Do-I-Solve-The-Heat-Equation-In

Solve for \(u(r,t)\) \[ \frac {\partial }{\partial t}u \left (r , t\right ) = \frac {2 r \left (\frac {\partial }{\partial r}u \left (r , t\right )\right )+r^{2} \left (\frac {\partial ^{2}}{\partial r^{2}}u \left (r , t\right )\right )}{r^{2}} \] Inside the circle ring where \(1<r<2\) with boundary condtions \(u(1,t)=0,u(2,t)=0\) and intitial conditions \(u(r,0)=-\sin (\pi r)\).

pict
Figure 4.157:PDE specification

Mathematica


\[\left \{\left \{w(r,t)\to \frac {\underset {n=1}{\overset {\infty }{\sum }}-\frac {4 \left (1+(-1)^n\right ) e^{-n^2 \pi ^2 t} n \sin (n \pi (r-1))}{\left (n^2-1\right )^2 \pi ^2}}{r}\right \}\right \}\] \(n=1\) causs division by zero

Maple


time expired

________________________________________________________________________________________

4.2.2.9 [267] Articolo 6.9.1

problem number 267

Added December 20, 2018.

Example 6.9.1 from Partial differential equations and boundary value problems with Maple/George A. Articolo, 2nd ed :

We seek the temperature distribution \(u(r,\theta ,t)\) in a thin circular plate over the two-dimensional domain \(D=\{(r,\theta ) | 0<r<1, 0< \theta < \frac {\pi }{2}\}\).

The lateral surfaces of the plate are insulated. The edges \(r = 1\) and \(\theta = 0\) are at a fixed temperature of \(0\), and the edge \(\theta = \frac {\pi }{2}\) is insulated. The initial temperature distribution \(u(r, \theta , 0) = f(r, \theta )\) is \(u(r,\theta ,0)=(r-r^3)\sin (\theta )\).

The thermal diffusivity is \(k = \frac {1}{50}\).

Solve for \(u(r,\theta ,t)\) the heat PDE \[ u_t= k \left (u_{rr} + \frac {1}{r} u_r +\frac {1}{r^2} u_{\theta \theta } \right ) \] With boundary conditions \begin {align*} |u(0,\theta ,t)| &< \infty \\ u(1,\theta ,t) &= 0\\ u(r,0,t) &=0\\ \frac {\partial u}{\partial \theta }(1,\frac {\pi }{2},t) &= 0 \end {align*}

pict
Figure 4.158:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {n=1}{\overset {\infty }{\sum }}\frac {4 e^{-\frac {1}{50} t \left (j_{1,n}\right ){}^2} J_1\left (r j_{1,n}\right ) \left (J_3\left (j_{1,n}\right )+J_2\left (j_{1,n}\right ) j_{1,n}\right ) \sin (\theta )}{3 J_0\left (j_{1,n}\right ){}^2 \left (j_{1,n}\right ){}^2} & (m|n)\in \mathbb {Z}\land m\geq 1\land n\geq 1 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


sol=()

________________________________________________________________________________________

4.2.2.10 [268] Articolo 6.9.2

problem number 268

Added December 20, 2018.

Example 6.9.2 from Partial differential equations and boundary value problems with Maple/George A. Articolo, 2nd ed :

We seek the temperature distribution in a thin circular plate over the two-dimensional domain \( D = \{(r,\theta ) | 0 < r < 1, 0 < \theta < \pi \}\). The lateral surfaces of the plate are insulated. The sides \(\theta = 0\) and \(\theta = \pi \) are at a fixed temperature of \(0\), and the edge \(r = 1\) is insulated. The initial temperature distribution is \(u(r, \theta , 0) = \left (r - \frac {r^3}{3} \right )\sin \theta \).

The thermal diffusivity is \(k = \frac {1}{25}\). Solve for \(u(r,\theta ,t)\) the heat PDE \[ u_t= k \left (u_{rr} + \frac {1}{r} u_r +\frac {1}{r^2} u_{\theta \theta } \right ) \] With boundary conditions \begin {align*} |u(0,\theta ,t) &< \infty \\ u(1,\theta ,t) &= 0\\ u(r,0,t) &=0\\ u(r,\pi ,t) & 0 \end {align*}

pict
Figure 4.159:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {n=1}{\overset {\infty }{\sum }}\frac {4 e^{-\frac {1}{25} t K[2,1,n]^2} J_1(r K[2,1,n]) (J_3(K[2,1,n])+J_2(K[2,1,n]) K[2,1,n]) \sin (\theta )}{3 K[2,1,n] \left (\left (J_0(K[2,1,n]){}^2+J_1(K[2,1,n]){}^2\right ) K[2,1,n]-2 J_0(K[2,1,n]) J_1(K[2,1,n])\right )} & (K[1]|n)\in \mathbb {Z}\land J_{K[1]-1}(K[2,K[1],n])=J_{K[1]+1}(K[2,K[1],n])\land K[1]\geq 1\land n\geq 1\land K[2,1,n]>0\land K[2,K[1],n]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


\[u \left (r , \theta , t\right ) = \moverset {\infty }{\munderset {n =0}{\sum }}\left (-\frac {4 \left (\lambda _{n}^{3} \BesselJ \left (0, \lambda _{n}\right )-\lambda _{n}^{2} \BesselJ \left (1, \lambda _{n}\right )+4 \lambda _{n} \BesselJ \left (0, \lambda _{n}\right )-8 \BesselJ \left (1, \lambda _{n}\right )\right ) \BesselJ \left (1, r \lambda _{n}\right ) {\mathrm e}^{-\frac {t \lambda _{n}^{2}}{25}} \sin \left (\theta \right )}{3 \left (\lambda _{n} \BesselJ \left (0, \lambda _{n}\right )^{2}+\lambda _{n} \BesselJ \left (1, \lambda _{n}\right )^{2}-2 \BesselJ \left (0, \lambda _{n}\right ) \BesselJ \left (1, \lambda _{n}\right )\right ) \lambda _{n}^{3}}\right )\boldsymbol {\mathrm {where}}\left \{\lambda _{n} \BesselJ \left (2, \lambda _{n}\right )-\BesselJ \left (1, \lambda _{n}\right )=0\wedge 0<\lambda _{n}\right \}\]

________________________________________________________________________________________

4.2.2.11 [269] Haberman 8.2.5 with \(\theta \) dependency (General case)

problem number 269

Added Feb 24, 2019.

Problem 8.2.5 from from Richard Haberman applied partial differential equations book, 5th edition.

Solve the initial value problem for a two-dimensional heat equation inside a circle (of radius \(a\)) \(u_t = k \nabla ^2 u\) with time-independent boundary conditions: \begin {align*} u(a,\theta ,t) &= g(\theta ) \end {align*}

And initial conditions \(u(r,\theta ,0) =f(r,\theta )\). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

pict
Figure 4.160:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \left (\begin {array}{cc} \{ & \begin {array}{cc} \underset {m=1}{\overset {\infty }{\sum }}\frac {e^{-\frac {k t \left (j_{0,m}\right ){}^2}{a^2}} J_0\left (\frac {r j_{0,m}}{a}\right ) \int _0^a\int _{-\pi }^{\pi }r J_0\left (\frac {r j_{0,m}}{a}\right ) \left (2 \pi f(r,\theta )-\text {Integrate}[g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]-2 \pi \underset {n=1}{\overset {\infty }{\sum }}\frac {a^{-n} r^n (\cos (n \theta ) \text {Integrate}[\cos (n \theta ) g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]+\text {Integrate}[g(\theta ) \sin (n \theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a] \sin (n \theta ))}{\pi }\right )d\theta dr}{2 a^2 \pi ^2 J_1\left (j_{0,m}\right ){}^2}+\underset {m=1}{\overset {\infty }{\sum }}\left (\underset {n=1}{\overset {\infty }{\sum }}e^{-\frac {k t \left (j_{n,m}\right ){}^2}{a^2}} \left (\frac {J_n\left (\frac {r j_{n,m}}{a}\right ) \cos (n \theta ) \int _0^a\int _{-\pi }^{\pi }r J_n\left (\frac {r j_{n,m}}{a}\right ) \cos (n \theta ) \left (2 \pi f(r,\theta )-\text {Integrate}[g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]-2 \pi \underset {n=1}{\overset {\infty }{\sum }}\frac {a^{-n} r^n (\cos (n \theta ) \text {Integrate}[\cos (n \theta ) g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]+\text {Integrate}[g(\theta ) \sin (n \theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a] \sin (n \theta ))}{\pi }\right )d\theta dr}{a^2 \pi ^2 J_{n-1}\left (j_{n,m}\right ){}^2}+\frac {J_n\left (\frac {r j_{n,m}}{a}\right ) \left (\int _0^a\int _{-\pi }^{\pi }r J_n\left (\frac {r j_{n,m}}{a}\right ) \sin (n \theta ) \left (2 \pi f(r,\theta )-\text {Integrate}[g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]-2 \pi \underset {n=1}{\overset {\infty }{\sum }}\frac {a^{-n} r^n (\cos (n \theta ) \text {Integrate}[\cos (n \theta ) g(\theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a]+\text {Integrate}[g(\theta ) \sin (n \theta ),\{\theta ,-\pi ,\pi \},\text {Assumptions}\to a>0\land k>0\land t>0\land r<a] \sin (n \theta ))}{\pi }\right )d\theta dr\right ) \sin (n \theta )}{a^2 \pi ^2 J_{n-1}\left (j_{n,m}\right ){}^2}\right )\right ) & (n|m)\in \mathbb {Z}\land n\geq 1\land m\geq 1 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right )+\underset {n=1}{\overset {\infty }{\sum }}\frac {a^{-n} r^n \left (\cos (n \theta ) \int _{-\pi }^{\pi } \cos (n \theta ) g(\theta ) \, d\theta +\left (\int _{-\pi }^{\pi } g(\theta ) \sin (n \theta ) \, d\theta \right ) \sin (n \theta )\right )}{\pi }+\frac {\int _{-\pi }^{\pi } g(\theta ) \, d\theta }{2 \pi }\right \}\right \}\]

Maple


sol=()

Hand solution

Solve

\begin {align*} \frac {\partial u\left (r,\theta ,t\right ) }{\partial t} & =k\left ( \frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \\ \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u\left (a,\theta ,t\right ) & =g\left (\theta \right ) \\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ \frac {\partial u}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial u}{\partial \theta }\left (r,\pi ,t\right ) \end {align*}

With initial conditions \(u\left (r,\theta ,0\right ) =f\left (r,\theta \right ) \).

Since the boundary conditions are not homogenous, and since there are no time dependent sources, then in this case we look for \(u_{E}\left (r,\theta \right ) \) which is solution at steady state which needs to satisfy the nonhomogeneous B.C., where \(u\left (r,\theta ,t\right ) =\overset {\text {transient}}{\overbrace {v\left (r,\theta ,t\right ) }}+\overset {\text {steady state}}{\overbrace {u_{E}\left (r,\theta \right ) }}\) and \(v\left (r,\theta ,t\right ) \) solves the PDE but with homogenous B.C. Therefore, we need to find equilibrium (steady state) solution for Laplace PDE on disk, that only needs to satisfy the nonhomogeneous B.C.\begin {align*} \nabla ^{2}u_{E} & =0\\ \frac {\partial ^{2}u_{E}}{\partial r^{2}}+\frac {1}{r}\frac {\partial u_{E}}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u_{E}}{\partial \theta ^{2}} & =0 \end {align*}

With boundary condition\begin {align*} \left \vert u_{E}\left (0,\theta \right ) \right \vert & <\theta \\ u_{E}\left (a,\theta \right ) & =g\left (\theta \right ) \\ u_{E}\left (r,-\pi \right ) & =u_{E}\left (r,\pi \right ) \\ \frac {\partial u_{E}}{\partial \theta }\left (r,-\pi \right ) & =\frac {\partial u_{E}}{\partial \theta }\left (r,\pi \right ) \end {align*}

Let \[ u_{E}\left (r,\theta \right ) =R\relax (r) \Theta \left (\theta \right ) \] Where \(R\relax (r) \) is the solution in radial dimension and \(\Theta \left (\theta \right ) \) is solution in angular dimension. Substituting \(u_{E}\left (r,\theta \right ) \) in the PDE gives\[ R^{\prime \prime }\Theta +\frac {1}{r}R^{\prime }\Theta +\frac {1}{r^{2}}\Theta ^{\prime \prime }R=0 \] Dividing by \(R\relax (r) \Phi \left (\theta \right ) \)\begin {align*} \frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}+\frac {1}{r^{2}}\frac {\Theta ^{\prime \prime }}{\Theta } & =0\\ r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R} & =-\frac {\Theta ^{\prime \prime }}{\Theta } \end {align*}

Hence each side is equal to constant, say \(\lambda \) and we obtain\begin {align*} r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R} & =\lambda \\ -\frac {\Theta ^{\prime \prime }}{\Theta } & =\lambda \end {align*}

Or\begin {align} r^{2}R^{\prime \prime }+rR^{\prime }-\lambda R & =0\tag {1}\\ \Theta ^{\prime \prime }+\lambda \Theta & =0 \tag {2} \end {align}

We start with \(\Phi \) ODE. The boundary conditions on (3) are \begin {align*} \Theta \left (-\pi \right ) & =\Theta \left (\pi \right ) \\ \frac {\partial \Theta }{\partial \theta }\left (-\pi \right ) & =\frac {\partial \Theta }{\partial \theta }\left (\pi \right ) \end {align*}

case \(\lambda =0\) The solution is \(\Phi =c_{1}\theta +c_{2}\). Hence we obtain, from first initial conditions\begin {align*} -\pi c_{1}+c_{2} & =\pi c_{1}+c_{2}\\ c_{1} & =0 \end {align*}

Second boundary conditions just says that \(c_{2}=c_{2}\), so any constant will do. Hence \(\lambda =0\) is an eigenvalue with constant being eigenfunction.

case \(\lambda >0\) The solution is \[ \Theta \left (\theta \right ) =c_{1}\cos \sqrt {\lambda }\theta +c_{2}\sin \sqrt {\lambda }\theta \] The first boundary conditions gives\begin {align} c_{1}\cos \left (-\sqrt {\lambda }\pi \right ) +c_{2}\sin \left (-\sqrt {\lambda }\pi \right ) & =c_{1}\cos \left (\sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \nonumber \\ c_{1}\cos \left (\sqrt {\lambda }\pi \right ) -c_{2}\sin \left (\sqrt {\lambda }\pi \right ) & =c_{1}\cos \left (\sqrt {\lambda }\pi \right ) +c_{2}\sin \left ( \sqrt {\lambda }\pi \right ) \nonumber \\ 2c_{2}\sin \left (\sqrt {\lambda }\pi \right ) & =0\tag {3} \end {align}

From second boundary conditions we obtain\[ \Theta ^{\prime }\left (\theta \right ) =-\sqrt {\lambda }c_{1}\sin \sqrt {\lambda }\theta +c_{2}\sqrt {\lambda }\cos \sqrt {\lambda }\theta \] Therefore\begin {align} -\sqrt {\lambda }c_{1}\sin \left (-\sqrt {\lambda }\pi \right ) +c_{2}\sqrt {\lambda }\cos \left (-\sqrt {\lambda }\pi \right ) & =-\sqrt {\lambda }c_{1}\sin \left (\sqrt {\lambda }\pi \right ) +c_{2}\sqrt {\lambda }\cos \left ( \sqrt {\lambda }\pi \right ) \nonumber \\ \sqrt {\lambda }c_{1}\sin \left (\sqrt {\lambda }\pi \right ) +c_{2}\sqrt {\lambda }\cos \left (\sqrt {\lambda }\pi \right ) & =-\sqrt {\lambda }c_{1}\sin \left ( \sqrt {\lambda }\pi \right ) +c_{2}\sqrt {\lambda }\cos \left (\sqrt {\lambda }\pi \right ) \nonumber \\ \sqrt {\lambda }c_{1}\sin \left (\sqrt {\lambda }\pi \right ) & =-\sqrt {\lambda }c_{1}\sin \left (\sqrt {\lambda }\pi \right ) \nonumber \\ 2c_{1}\sin \left (\sqrt {\lambda }\pi \right ) & =0\tag {4} \end {align}

Both (3) and (4) are satisfied if\begin {align*} \sqrt {\lambda }\pi & =n\pi \qquad n=1,2,3,\cdots \\ \lambda & =n^{2}\qquad n=1,2,3,\cdots \end {align*}

Therefore\begin {equation} \Theta _{n}\left (\theta \right ) =\overset {\lambda =0}{\overbrace {A_{0}}}+\sum _{n=1}^{\infty }A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left ( n\theta \right ) \tag {5} \end {equation} Now we go back to the \(R\) ODE (1) given by \(r^{2}R^{\prime \prime }+rR^{\prime }-\lambda _{n}R=0\) and solve it. This is Euler ODE whose solution is found by substituting \(R\relax (r) =r^{\alpha }\). The solution comes out to be\begin {equation} R_{n}\relax (r) =c_{0}+\sum _{n=1}^{\infty }c_{n}r^{n}\tag {6} \end {equation} Combining (5,6) we now find \(u_{E}\) as\begin {align} u_{E_{n}}\left (r,\theta \right ) & =R_{n}\relax (r) \Theta _{n}\left (\theta \right ) \nonumber \\ u_{E}\left (r,\theta \right ) & =A_{0}+\sum _{n=1}^{\infty }r^{n}\left ( A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left (n\theta \right ) \right ) \tag {7} \end {align}

Where \(c_{0}\) was combined with \(A_{0}\). Now the above equilibrium solution needs to satisfy the non-homogenous B.C. \(u_{E}\left (a,\theta \right ) =g\left (\theta \right ) \). Using orthogonality on (7) to find \(A_{n},B_{n}\) gives\[ g\left (\theta \right ) =A_{0}+\sum _{n=1}^{\infty }a^{n}\left (A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left (n\theta \right ) \right ) \] For \(n=0\)\begin {align*} \int _{0}^{2\pi }g\left (\theta \right ) d\theta & =A_{0}\int _{0}^{2\pi }d\theta \\ A_{0} & =\frac {1}{2\pi }\int _{0}^{2\pi }g\left (\theta \right ) d\theta \end {align*}

For \(n>0\), applying orthogonality using cosine to find \(A_{n}\) gives\begin {align*} \int _{0}^{2\pi }g\left (\theta \right ) \cos \left (n\theta \right ) d\theta & =A_{n}\int _{0}^{2\pi }\cos ^{2}\left (n\theta \right ) a^{n}d\theta \\ A_{n} & =\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \cos \left ( n\theta \right ) d\theta \end {align*}

Similarly, applying orthogonality using sin to find \(B_{n}\) gives\[ B_{n}=\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \sin \left ( n\theta \right ) d\theta \] Therefore, we have found \(u_{E}\left (r,\theta \right ) \) completely now. It is given by (7)\begin {align} u_{E}\left (r,\theta \right ) & =A_{0}+\sum _{n=1}^{\infty }r^{n}\left ( A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left (n\theta \right ) \right ) \tag {7A}\\ A_{0} & =\frac {1}{2\pi }\int _{0}^{2\pi }g\left (\theta \right ) d\theta \nonumber \\ A_{n} & =\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \cos \left ( n\theta \right ) d\theta \nonumber \\ B_{n} & =\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \sin \left ( n\theta \right ) d\theta \nonumber \end {align}

Now, since \(u\left (r,\theta ,t\right ) =v\left (r,\theta ,t\right ) +u_{E}\left (r,\theta \right ) \), then we need to solve now for \(v\left ( r,\theta ,t\right ) \) with homogeneous boundary conditions \begin {align} v_{t}\left (r,\theta ,t\right ) & =k\left (\frac {\partial ^{2}v}{\partial r^{2}}+\frac {1}{r}\frac {\partial v}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}v}{\partial \theta ^{2}}\right ) \tag {8}\\ \left \vert v\left (0,\theta ,t\right ) \right \vert & <\theta \nonumber \\ v\left (a,\theta ,t\right ) & =0\nonumber \\ v\left (r,-\pi ,t\right ) & =v\left (r,\pi ,t\right ) \nonumber \\ \frac {\partial v}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial v}{\partial \theta }\left (r,\pi ,t\right ) \nonumber \end {align}

Let \(v\left (r,\theta ,t\right ) =R\relax (r) \Theta \left ( \theta \right ) T\relax (t) \). Substituting into (8) gives\[ T^{\prime }R\Theta =k\left (R^{\prime \prime }T\Theta +\frac {1}{r}R^{\prime }T\Theta +\frac {1}{r^{2}}\Theta ^{\prime \prime }RT\right ) \] Dividing by \(R\relax (r) \Theta \left (\theta \right ) T\left ( t\right ) \neq 0\) gives\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}+\frac {1}{r^{2}}\frac {\Theta ^{\prime \prime }}{\Theta }\] Let first separation constant be \(-\lambda \), hence the above becomes\begin {align*} \frac {1}{k}\frac {T^{\prime }}{T} & =-\lambda \\ \frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}+\frac {1}{r^{2}}\frac {\Theta ^{\prime \prime }}{\Theta } & =-\lambda \end {align*}

Or\begin {align*} T^{\prime }+\lambda kT & =0\\ r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R}+r^{2}\lambda & =-\frac {\Theta ^{\prime \prime }}{\Theta } \end {align*}

We now separate the second equation above using \(\mu \) giving\begin {align*} r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R}+r^{2}\lambda & =\mu \\ -\frac {\Theta ^{\prime \prime }}{\Theta } & =\mu \end {align*}

Or\begin {align} R^{\prime \prime }+\frac {1}{r}R^{\prime }+R\left (\lambda -\frac {\mu }{r^{2}}\right ) & =0\tag {9}\\ \Theta ^{\prime \prime }+\mu \Theta & =0\tag {10} \end {align}

Equation (9) is Sturm-Liouville ODE with boundary conditions \(R\left ( a\right ) =0\) and bounded at \(r=0\) and (10) has periodic boundary conditions as was solved above. The solution to (10) is given in (5) above, no change for this part.\begin {equation} \Theta _{n}\left (\theta \right ) =\overset {\lambda =0}{\overbrace {\alpha _{0}}}+\sum _{n=1}^{\infty }\alpha _{n}\cos \left (n\theta \right ) +\beta _{n}\sin \left (n\theta \right ) \tag {11} \end {equation} Therefore (9) becomes \(R^{\prime \prime }+\frac {1}{r}R^{\prime }+R\left ( \lambda -\frac {n^{2}}{r^{2}}\right ) =0\) with \(n=0,1,2,\cdots \). We found the solution to this Sturm-Liouville before, it is given by\begin {equation} R_{nm}\relax (r) =J_{n}\left (\sqrt {\lambda _{nm}}r\right ) \qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \tag {12} \end {equation} Where \(\sqrt {\lambda _{nm}}=\frac {a}{z_{nm}}\) where \(a\) is the radius of the disk and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\). This is found numerically. We now just need to find the time solution from \(T^{\prime }+\lambda _{nm}kT=0\). For This has solution \begin {equation} T_{nm}\relax (t) =e^{-k\lambda _{nm}t}\tag {13} \end {equation} Now we combine (11,12,13) to find solution for \(v\left (r,\theta ,t\right ) \), and combining constants gives\begin {align} v_{nm}\left (r,\theta ,t\right ) & =\Theta _{n}\left (\theta \right ) R_{nm}\relax (r) T_{nm}\relax (t) \nonumber \\ v\left (r,\theta ,t\right ) & =\alpha _{0,1}J_{0}\left (\sqrt {\lambda _{0,1}}r\right ) +\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-k\lambda _{nm}t}\left (\alpha _{nm}\cos \left ( n\theta \right ) +\beta _{nm}\sin \left (n\theta \right ) \right ) \nonumber \\ & =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) \left (\alpha _{nm}\cos \left (n\theta \right ) +\beta _{nm}\sin \left (n\theta \right ) \right ) \tag {14} \end {align}

We now need to find \(\alpha _{0},\alpha _{nn},\beta _{nm}\), which are found from initial conditions on \(v\left (r,\theta ,0\right ) \) which is given by\begin {align*} v\left (r,\theta ,0\right ) & =u\left (r,\theta ,0\right ) -u_{E}\left ( r,\theta \right ) \\ & =f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) \end {align*}

Hence from (14), at \(t=0\)\begin {equation} f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) \left ( \alpha _{nm}\cos \left (n\theta \right ) +\beta _{nm}\sin \left (n\theta \right ) \right ) \tag {15} \end {equation}

For each \(n\), inside the \(m\) sum, \(\cos \left (n\theta \right ) \) and \(\sin \left (n\theta \right ) \) will be constant. So we need to apply orthogonality twice in order to remove both sums. Multiplying (15) by \(\cos \left (n^{\prime }\theta \right ) \) and integrating gives\begin {align*} \int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left ( r,\theta \right ) \right ) \cos \left (n^{\prime }\theta \right ) d\theta & =\int _{-\pi }^{\pi }\sum _{n=0}^{\infty }\left (\sum _{m=1}^{\infty }\alpha _{nn}J_{n}\left (\sqrt {\lambda _{nm}}r\right ) \right ) \cos \left ( n\theta \right ) \cos \left (n^{\prime }\theta \right ) d\theta \\ & +\int _{-\pi }^{\pi }\sum _{n=1}^{\infty }\left (\sum _{m=1}^{\infty }\beta _{nm}J_{n}\left (\sqrt {\lambda _{nm}}r\right ) \right ) \sin \left ( n\theta \right ) \cos \left (n^{\prime }\theta \right ) \end {align*}

The second sum in the RHS above goes to zero due to \(\int _{-\pi }^{\pi }\sin \left (n\theta \right ) \cos \left (n^{\prime }\theta \right ) d\theta \) and we end up with\[ \int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left ( r,\theta \right ) \right ) \cos \left (n\theta \right ) d\theta =\alpha _{nn}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) \sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) d\theta \] We now apply orthogonality again, but on Bessel functions and remembering to add the weight \(r\), the above becomes \begin {align*} \int _{0}^{a}\int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left ( r,\theta \right ) \right ) \cos \left (n\theta \right ) J_{n}\left ( \sqrt {\lambda _{nm^{\prime }}}r\right ) rd\theta dr & =\alpha _{nn}\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) \sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) J_{n}\left (\sqrt {\lambda _{nm^{\prime }}}r\right ) rd\theta dr\\ & =\alpha _{nn}\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm^{\prime }}}r\right ) rd\theta dr \end {align*}

Therefore\[ \alpha _{nn}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) \right ) \cos \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] We will repeat the same thing to find \(\beta _{nm}\). The only difference now is to use \(\sin n\theta \). repeating these steps gives\[ \beta _{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) \right ) \sin \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] This complete the solution.

Summary of solution\begin {align*} u\left (r,\theta ,t\right ) & =v\left (r,\theta ,t\right ) +u_{E}\left ( r,\theta \right ) \\ & =u_{E}\left (r,\theta \right ) +\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-k\lambda _{nm}t}\left ( \alpha _{nn}\cos \left (n\theta \right ) +\beta _{nm}\sin \left (n\theta \right ) \right ) \end {align*}

Where\begin {align*} u_{E}\left (r,\theta \right ) & =A_{0}+\sum _{n=1}^{\infty }r^{n}\left ( A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left (n\theta \right ) \right ) \\ A_{0} & =\frac {1}{2\pi }\int _{0}^{2\pi }g\left (\theta \right ) d\theta \\ A_{n} & =\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \cos \left ( n\theta \right ) d\theta \\ B_{n} & =\frac {1}{\pi }\int _{0}^{2\pi }g\left (\theta \right ) \sin \left ( n\theta \right ) d\theta \end {align*}

And\[ \alpha _{nn}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) \right ) \cos \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] And\[ \beta _{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }\left (f\left (r,\theta \right ) -u_{E}\left (r,\theta \right ) \right ) \sin \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] Where \(\sqrt {\lambda _{nm}}=\frac {a}{z_{nm}}\) where \(a\) is the radius of the disk and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\).

________________________________________________________________________________________

4.2.2.12 [270] With \(\theta \) dependency (Specific example)

problem number 270

Added June 12, 2019

Solve the initial value problem for a two-dimensional heat equation inside a circle (of radius \(a=1\)) \(u_t = k \nabla ^2 u\) with \(k=1\) with time-independent boundary conditions: \begin {align*} u(1,\theta ,t) &= 0 \end {align*}

And initial conditions \(u(r,\theta ,0) =1-r^2\). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

pict
Figure 4.161:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {m=1}{\overset {\infty }{\sum }}\frac {4 e^{-t \left (j_{0,m}\right ){}^2} J_0\left (r j_{0,m}\right ) J_2\left (j_{0,m}\right )}{J_1\left (j_{0,m}\right ){}^2 \left (j_{0,m}\right ){}^2} & (n|m)\in \mathbb {Z}\land n\geq 1\land m\geq 1 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


sol=()

Hand solution

Solve

\begin {align*} \frac {\partial u\left (r,\theta ,t\right ) }{\partial t} & =k\left ( \frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \\ \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u\left (a,\theta ,t\right ) & =0\\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ \frac {\partial u}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial u}{\partial \theta }\left (r,\pi ,t\right ) \\ u\left (r,\theta ,0\right ) & =1-r^{2} \end {align*}

With \(t>0,0<r<a\) where \(a=1,k=1\).

This problem was solved in problem 4.2.2.11 on page 1272 (since B.C. is zero, we just need to use \(v\left (r,\theta ,t\right ) \) in the solution given in the above problem). Hence \[ u\left (r,\theta ,t\right ) =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-k\lambda _{nm}t}\left ( A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left (n\theta \right ) \right ) \] Where\[ A_{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }f\left (r,\theta \right ) \cos \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] And\[ B_{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }f\left (r,\theta \right ) \sin \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] Where \(\sqrt {\lambda _{nm}}=\frac {a}{z_{nm}}\) and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\). where \(a\) is the radius of the disk and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\). Since in this problem \(k=1,a=1,f\left (r,\theta \right ) =1-r^{2}\) then

\[ u\left (r,\theta ,t\right ) =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-\frac {t}{z_{nm}^{2}}}\left ( A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left (n\theta \right ) \right ) \]\begin {align*} A_{nm} & =\frac {\int _{0}^{1}\int _{-\pi }^{\pi }\left (1-r^{2}\right ) \cos \left (n\theta \right ) J_{n}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}{\int _{0}^{1}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \\ B_{nm} & =\frac {\int _{0}^{1}\int _{-\pi }^{\pi }\left (1-r^{2}\right ) \sin \left (n\theta \right ) J_{n}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}{\int _{0}^{1}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \end {align*}

Where \(\sqrt {\lambda _{nm}}=\frac {a}{z_{nm}}\) where \(a\) is the radius of the disk and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\).

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

Source code used for the above

pict
Figure 4.162:Source code

pict
Figure 4.163:Animation part of code

________________________________________________________________________________________

4.2.2.13 [271] With \(\theta \) dependency (specific example)

problem number 271

Added June 12, 2019

Solve the initial value problem for a two-dimensional heat equation inside a circle (of radius \(a=1\)) \(u_t = k \nabla ^2 u\) with \(k=1\) with time-independent boundary conditions: \begin {align*} u(1,\theta ,t) &= 0 \end {align*}

And initial conditions \(u(r,\theta ,0) =(r-r^3)\sin \theta \). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

pict
Figure 4.164:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {m=1}{\overset {\infty }{\sum }}\frac {4 e^{-t \left (j_{1,m}\right ){}^2} J_1\left (r j_{1,m}\right ) J_3\left (j_{1,m}\right ) \sin (\theta )}{J_0\left (j_{1,m}\right ){}^2 \left (j_{1,m}\right ){}^2} & (n|m)\in \mathbb {Z}\land n\geq 1\land m\geq 1 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


sol=()

Hand solution

Solve\begin {align*} \frac {\partial u\left (r,\theta ,t\right ) }{\partial t} & =k\left ( \frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \\ \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u\left (a,\theta ,t\right ) & =0\\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ \frac {\partial u}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial u}{\partial \theta }\left (r,\pi ,t\right ) \\ u\left (r,\theta ,0\right ) & =\left (r-r^{3}\right ) \sin \theta \end {align*}

for \(0<r<a\) where \(a=1,k=1\).

This problem was solved in problem 4.2.2.11 on page 1272 (since B.C. is zero, we just need to use \(v\left (r,\theta ,t\right ) \) in the solution given in the above problem). Hence \[ u\left (r,\theta ,t\right ) =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-k\lambda _{nm}t}\left ( A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left (n\theta \right ) \right ) \] Where\[ A_{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }f\left (r,\theta \right ) \cos \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] And\[ B_{nm}=\frac {\int _{0}^{a}\int _{-\pi }^{\pi }f\left (r,\theta \right ) \sin \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}{\int _{0}^{a}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\sqrt {\lambda _{nm}}r\right ) rd\theta dr}\qquad n=0,1,2,\cdots ,m=1,2,3,\cdots \] Where \(\sqrt {\lambda _{nm}}=\frac {a}{z_{nm}}\) and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\) and \(a\) is the radius of the disk and \(z_{nm}\) is the \(m^{th}\) zero of the Bessel function of order \(n\). Since in this problem \(k=1,a=1,f\left (r,\theta \right ) =\left (r-r^{3}\right ) \sin \theta \) then the above solution becomes

\[ u\left (r,\theta ,t\right ) =\sum _{n=0}^{\infty }\sum _{m=1}^{\infty }A_{n}\cos \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-\frac {t}{z_{nm}^{2}}}+\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }B_{n}\sin \left (n\theta \right ) J_{n}\left (\sqrt {\lambda _{nm}}r\right ) e^{-\frac {t}{z_{nm}^{2}}}\]\begin {align*} A_{n} & =\frac {\int _{0}^{1}\int _{-\pi }^{\pi }\left (r-r^{3}\right ) \sin \theta \cos \left (n\theta \right ) J_{n}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}{\int _{0}^{1}\int _{-\pi }^{\pi }\cos ^{2}\left (n\theta \right ) J_{n}^{2}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}\\ B_{n} & =\frac {\int _{0}^{1}\int _{-\pi }^{\pi }\left (r-r^{3}\right ) \sin \theta \sin \left (n\theta \right ) J_{n}\left (\frac {r}{z_{nm}}\right ) rd\theta dr}{\int _{0}^{1}\int _{-\pi }^{\pi }\sin ^{2}\left (n\theta \right ) J_{n}^{2}\left (\frac {r}{z_{nm}}\right ) rd\theta dr} \end {align*}

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

Source code used for the above

pict
Figure 4.165:Source code

pict
Figure 4.166:Animation part of code

________________________________________________________________________________________

4.2.2.14 [272] Insulated with \(\theta \) dependency (General solution)

problem number 272

Added June 13, 2019

Solve for \(u(r,\theta ,t)\), the initial value problem for a two-dimensional heat equation inside a circle of radius \(a\) \[ u_t = k \nabla ^2 u \] with time-independent boundary conditions: \begin {align*} u_r(a,\theta ,t) &= 0 \end {align*}

And initial conditions \(u(r,\theta ,0) =f(r,\theta )\). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

The solution is bounded at \(r=0\).

pict
Figure 4.167:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {\int _0^L\int _{-\pi }^{\pi }r f(r,\theta )d\theta dr}{L^2 \pi }+\underset {n=1}{\overset {\infty }{\sum }}\frac {e^{-k t K[2,0,n]^2} J_0(r K[2,0,n]) \left (\int _0^L\int _{-\pi }^{\pi }r J_0(r K[2,0,n]) f(r,\theta )d\theta dr\right ) \sqrt {K[2,0,n]}}{L^2 \pi \sqrt {J_0(L K[2,0,n]){}^2+J_1(L K[2,0,n]){}^2} \sqrt {\left (J_0(L K[2,0,n]){}^2+J_1(L K[2,0,n]){}^2\right ) K[2,0,n]}}+\underset {n=1}{\overset {\infty }{\sum }}\left (\underset {m=1}{\overset {\infty }{\sum }}e^{-k t K[2,m,n]^2} \left (\frac {2 J_m(r K[2,m,n]) \left (\int _0^L\int _{-\pi }^{\pi }r J_m(r K[2,m,n]) f(r,\theta ) \sin (m \theta )d\theta dr\right ) \sin (m \theta ) K[2,m,n]^{3/2}}{L \pi \sqrt {L \left (J_{m-1}(L K[2,m,n]){}^2+J_m(L K[2,m,n]){}^2\right ) K[2,m,n]-2 m J_{m-1}(L K[2,m,n]) J_m(L K[2,m,n])} \sqrt {K[2,m,n] \left (L \left (J_{m-1}(L K[2,m,n]){}^2+J_m(L K[2,m,n]){}^2\right ) K[2,m,n]-2 m J_{m-1}(L K[2,m,n]) J_m(L K[2,m,n])\right )}}+\frac {2 J_m(r K[2,m,n]) \cos (m \theta ) \left (\int _0^L\int _{-\pi }^{\pi }r J_m(r K[2,m,n]) \cos (m \theta ) f(r,\theta )d\theta dr\right ) K[2,m,n]^{3/2}}{L \pi \sqrt {L \left (J_{m-1}(L K[2,m,n]){}^2+J_m(L K[2,m,n]){}^2\right ) K[2,m,n]-2 m J_{m-1}(L K[2,m,n]) J_m(L K[2,m,n])} \sqrt {K[2,m,n] \left (L \left (J_{m-1}(L K[2,m,n]){}^2+J_m(L K[2,m,n]){}^2\right ) K[2,m,n]-2 m J_{m-1}(L K[2,m,n]) J_m(L K[2,m,n])\right )}}\right )\right ) & J_{m-1}(L K[2,m,n])=J_{m+1}(L K[2,m,n])\land (m|n)\in \mathbb {Z}\land m\geq 1\land n\geq 1\land K[2,m,n]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


sol=()

Hand solution

Solve\[ \frac {\partial u\left (r,\theta ,t\right ) }{\partial t}=k\left ( \frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \] With boundary conditions\begin {align*} \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u_{t}\left (L,\theta ,t\right ) & =g\left (\theta \right ) \\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ \frac {\partial u}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial u}{\partial \theta }\left (r,\pi ,t\right ) \end {align*}

And initial conditions \(u\left (r,\theta ,0\right ) =f\left (r,\theta \right ) \). Let \(y\left (r,\theta ,t\right ) =R\relax (r) \Theta \left ( \theta \right ) T\relax (t) \). Substituting into (1) gives\[ T^{\prime }R\Theta =k\left (R^{\prime \prime }T\Theta +\frac {1}{r}R^{\prime }T\Theta +\frac {1}{r^{2}}\Theta ^{\prime \prime }RT\right ) \] Dividing by \(R\relax (r) \Theta \left (\theta \right ) T\left ( t\right ) \neq 0\) gives\[ \frac {1}{k}\frac {T^{\prime }}{T}=\frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}+\frac {1}{r^{2}}\frac {\Theta ^{\prime \prime }}{\Theta }\] Let first separation constant be \(-\lambda \), hence the above becomes\begin {align*} \frac {1}{k}\frac {T^{\prime }}{T} & =-\lambda \\ \frac {R^{\prime \prime }}{R}+\frac {1}{r}\frac {R^{\prime }}{R}+\frac {1}{r^{2}}\frac {\Theta ^{\prime \prime }}{\Theta } & =-\lambda \end {align*}

Or\begin {align*} T^{\prime }+\lambda kT & =0\\ r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R}+r^{2}\lambda & =-\frac {\Theta ^{\prime \prime }}{\Theta }=\mu \end {align*}

Hence \begin {align*} r^{2}\frac {R^{\prime \prime }}{R}+r\frac {R^{\prime }}{R}+r^{2}\lambda & =\mu \\ -\frac {\Theta ^{\prime \prime }}{\Theta } & =\mu \end {align*}

Or\begin {align} r^{2}R^{\prime \prime }\relax (r) +rR^{\prime }\relax (r) +R\left ( r\right ) \left (r^{2}\lambda -\mu \right ) & =0\tag {2}\\ \Theta ^{\prime \prime }\left (\theta \right ) +\mu \Theta \left (\theta \right ) & =0 \tag {3} \end {align}

Equation (2) is Sturm-Liouville ODE with boundary conditions \(R^{\prime }\relax (a) =0\) and bounded at \(r=0\) and (3) has periodic boundary conditions.

We start with \(\Theta \) ODE. The boundary conditions on (3) are \begin {align*} \Theta \left (-\pi \right ) & =\Theta \left (\pi \right ) \\ \frac {\partial \Theta }{\partial \theta }\left (-\pi \right ) & =\frac {\partial \Theta }{\partial \theta }\left (\pi \right ) \end {align*}

Negative \(\mu \) is not possible, since this gives exponential and the boundary conditions on \(\Theta \left (\theta \right ) \) are periodic.

case \(\mu =0\) The solution is \(\Phi =c_{1}\theta +c_{2}\). Hence we obtain, from first initial conditions\begin {align*} -\pi c_{1}+c_{2} & =\pi c_{1}+c_{2}\\ c_{1} & =0 \end {align*}

Second boundary conditions just says that \(c_{2}=c_{2}\), so any constant will do. Hence \(\mu =0\) is an eigenvalue with constant being eigenfunction \(\Theta _{0}\left (\theta \right ) =1\).

case \(\mu >0\) The solution is \[ \Theta \left (\theta \right ) =c_{1}\cos \sqrt {\mu }\theta +c_{2}\sin \sqrt {\mu }\theta \] The first boundary conditions gives\begin {align} c_{1}\cos \left (-\sqrt {\mu }\pi \right ) +c_{2}\sin \left (-\sqrt {\mu }\pi \right ) & =c_{1}\cos \left (\sqrt {\mu }\pi \right ) +c_{2}\sin \left ( \sqrt {\mu }\pi \right ) \nonumber \\ c_{1}\cos \left (\sqrt {\mu }\pi \right ) -c_{2}\sin \left (\sqrt {\mu }\pi \right ) & =c_{1}\cos \left (\sqrt {\mu }\pi \right ) +c_{2}\sin \left (\sqrt {\mu }\pi \right ) \nonumber \\ 2c_{2}\sin \left (\sqrt {\mu }\pi \right ) & =0 \tag {4} \end {align}

From second boundary conditions we obtain\[ \Theta ^{\prime }\left (\theta \right ) =-\sqrt {\mu }c_{1}\sin \sqrt {\mu }\theta +c_{2}\sqrt {\mu }\cos \sqrt {\mu }\theta \] Therefore\begin {align} -\sqrt {\mu }c_{1}\sin \left (-\sqrt {\mu }\pi \right ) +c_{2}\sqrt {\mu }\cos \left ( -\sqrt {\mu }\pi \right ) & =-\sqrt {\mu }c_{1}\sin \left (\sqrt {\mu }\pi \right ) +c_{2}\sqrt {\lambda }\cos \left (\sqrt {\mu }\pi \right ) \nonumber \\ \sqrt {\mu }c_{1}\sin \left (\sqrt {\mu }\pi \right ) +c_{2}\sqrt {\mu }\cos \left ( \sqrt {\mu }\pi \right ) & =-\sqrt {\mu }c_{1}\sin \left (\sqrt {\mu }\pi \right ) +c_{2}\sqrt {\mu }\cos \left (\sqrt {\mu }\pi \right ) \nonumber \\ \sqrt {\mu }c_{1}\sin \left (\sqrt {\mu }\pi \right ) & =-\sqrt {\mu }c_{1}\sin \left (\sqrt {\mu }\pi \right ) \nonumber \\ 2c_{1}\sin \left (\sqrt {\mu }\pi \right ) & =0 \tag {5} \end {align}

Both (4) and (5) are satisfied if\begin {align} \sqrt {\mu }\pi & =n\pi \qquad n=1,2,3,\cdots \tag {5A}\\ \mu & =n^{2}\qquad n=1,2,3,\cdots \nonumber \end {align}

Therefore \(\mu _{n}=1,4,9,16,\cdots \). Or \(\sqrt {\mu _{n}}=n=1,2,3,\cdots \) \begin {align} \Theta _{n}\left (\theta \right ) & =\overset {n=0}{\overbrace {A_{0}}}+\sum _{n=1}^{\infty }A_{n}\cos \left (\sqrt {\mu _{n}}\theta \right ) +B_{n}\sin \left (\sqrt {\mu _{n}}\theta \right ) \tag {6}\\ & =A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left (n\theta \right ) +B_{n}\sin \left (n\theta \right ) \end {align}

Now we go back to the \(R\relax (r) \) ODE (2) given by \(r^{2}R^{\prime \prime }+rR^{\prime }+R\left (r^{2}\lambda -\mu \right ) =0\) or since \(\mu _{n}=n^{2}\), we write it as \(r^{2}R^{\prime \prime }+rR^{\prime }+R\left ( r^{2}\lambda -n^{2}\right ) =0\) for \(n=0,1,2,\cdots \).

Case \(n=0\)

The \(R\relax (r) \) ODE becomes \(r^{2}R^{\prime \prime }+rR^{\prime }+\lambda r^{2}R=0\). This is a Bessel ODE. If \(\lambda <0\), this leads to solution (contains \(\operatorname {Besselk}\) and \(\operatorname {BesselI}\)) that can not satisfy the boundary conditions. If \(\lambda =0\) then the ODE becomes \(r^{2}R^{\prime \prime }+rR^{\prime }=0\) whose solution is \(R\relax (r) =C_{1}\ln \relax (r) +C_{2}\). Since bounded at \(r=0\). Then \(R\left ( r\right ) =C_{2}\). Hence \(R^{\prime }\relax (r) =0\). Which satisfies the boundary condition at \(r=L\) for any constant \(C_{2}\). Therefore \(\lambda =0\) is possible eigenvalue with constant as its eigenfunction \(R_{0}\relax (r) =1\).

If \(\lambda >0\) the ODE is a Bessel ODE whose solution is \[ R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) +C_{2}\operatorname {BesselY}\left (0,\sqrt {\lambda }r\right ) \] We set \(C_{2}=0\) since \(\operatorname {BesselY}\left (0,\sqrt {\lambda }r\right ) \) blows up at \(r=0\). Hence \(R\relax (r) =C_{1}\operatorname {BesselJ}\left (0,\sqrt {\lambda }r\right ) \) and \(R^{\prime }\relax (r) =-C_{1}\sqrt {\lambda }\operatorname {BesselJ}\left (1,\sqrt {\lambda }r\right ) \). At \(r=L\) we obtain

\(R^{\prime }\relax (L) =-C_{1}\sqrt {\lambda }\operatorname {BesselJ}\left (1,\sqrt {\lambda }L\right ) =0\). Therefore for non-trivial solution we want \(\sqrt {\lambda }L\) to be the zeros of \(\operatorname {BesselJ}\left ( 1,x\right ) \). Let these zeros be \(\Lambda _{m}\), \(m=1,2,3,\cdots \). Hence \begin {align*} \sqrt {\lambda _{0,m}}L & =\Lambda _{m}\\ \lambda _{0,m} & =\left (\frac {\Lambda _{m}}{L}\right ) ^{2}\qquad m=1,2,3,\cdots \end {align*}

Where we added zero as subscript to \(\lambda _{0,m}\) to indicate that this is associated with Case \(n=0\). Hence the eigenfunctions for \(\mu =0\) are\[ R_{0,m}\relax (r) =\operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) \qquad n=0,m=1,2,3,\cdots \] And \(\Theta _{0}\left (\theta \right ) =1\).

Case \(n>0\)

The \(R\relax (r) \) ODE becomes \(r^{2}R^{\prime \prime }+rR^{\prime }+R\left (r^{2}\lambda -n^{2}\right ) =0\).

This is a Bessel ODE. If \(\lambda <0\), this leads to solution that can not satisfy the boundary conditions (contains \(\operatorname {Besselk}\) and \(\operatorname {BesselI}\)). If \(\lambda =0\) then the ODE becomes \(r^{2}R^{\prime \prime }+rR^{\prime }-n^{2}R=0\). This is Euler ODE whose solution is \(R\relax (r) =C_{1}r^{n}+C_{2}r^{-n}\). Since bounded at \(r=0\). Then \(C_{2}=0\) and the solution becomes \(R\relax (r) =C_{1}r^{n}\). Hence \(R^{\prime }\relax (r) =C_{1}nr^{n-1}\). At \(r=L\) this becomes \(C_{1}nL^{n-1}=0\). Since \(L\neq 0\), then this gives \(C_{1}=0\), trivial solution. Hence \(\lambda =0\) is not possible eigenvalue when \(\mu >0\).

If \(\lambda >0\) the ODE becomes \(r^{2}R^{\prime \prime }+rR^{\prime }+R\left ( r^{2}\lambda -n^{2}\right ) =0\) with now \(\lambda \) positive. This is a Bessel ODE whose solution is

\[ R_{n}\relax (r) =C_{1}\operatorname {BesselJ}\left (n,\sqrt {\lambda }r\right ) +C_{2}\operatorname {BesselY}\left (n,\sqrt {\lambda }r\right ) \qquad n=1,2,3,\cdots \] Since \(R\relax (r) \) is bounded at \(r=0\) then \(C_{2}=0\) and the above becomes\[ R_{n}\relax (r) =C_{1}\operatorname {BesselJ}\left (n,\sqrt {\lambda }r\right ) \qquad n=1,2,3,\cdots \] Therefore \[ R_{n}^{\prime }\relax (r) =C_{1}\frac {d}{dr}\operatorname {BesselJ}\left (n,\sqrt {\lambda }r\right ) \] At \(r=L\)\[ R_{n}^{\prime }\relax (L) =C_{1}\frac {d}{dr}\operatorname {BesselJ}\left (n,\sqrt {\lambda }L\right ) \] For non-trivial solution we want\begin {equation} \frac {d}{dr}\operatorname {BesselJ}\left (n,\sqrt {\lambda }L\right ) =0\tag {7} \end {equation} The eigenvalues \(\lambda \) are solved for numerically by finding all zeros of \(\frac {d}{dx}\operatorname {BesselJ}\left (n,x\right ) \). Let these zeros be called \(\Gamma _{nm}\) for \(n=1,2,3,\cdots ,m=1,2,3,\cdots \). Hence\begin {align*} \sqrt {\lambda _{nm}}L & =\Gamma _{nm}\\ \lambda _{nm} & =\left (\frac {\Gamma _{nm}}{L}\right ) ^{2}\qquad n=1,2,3,\cdots ,m=1,2,3,\cdots \end {align*}

With associated eigenfunctions  \(R_{n,m}\relax (r) =\operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \). Now that we solved for \(R_{n,m}\relax (r) \) and \(\Theta _{n,m}\left (\theta \right ) \), what is left is to solve \(\frac {1}{k}\frac {T^{\prime }}{T}=-\lambda _{nm}\).

For \(n=0\)

For \(\lambda =0\) the solution is constant. Say \(T_{00}\relax (t) =1\). For \(\lambda >0\) the solution is \(T_{0m}\relax (t) =e^{-k\lambda _{0m}t}\). Where \(\lambda _{0,m}=\left (\frac {\Lambda _{m}}{L}\right ) ^{2},m=1,2,3,\cdots \) and \(\Lambda _{m}\) are the zeros of \(\operatorname {BesselJ}\left (1,x\right ) \).

For \(n>0\) In this case \(\lambda >0\) only. The solution is \(T_{nm}\relax (t) =e^{-k\lambda _{nm}t}\). Where \(\lambda _{n,m}\) are now the solutions of (7). Hence \(T_{nm}\relax (t) =e^{-k\left ( \frac {\Gamma _{nm}}{L}\right ) ^{2}t}\)

The solution now becomes\[ u\left (r,\theta ,t\right ) =\overset {\text {arbitrary constant}}{\overbrace {R_{0,0}\relax (r) \Theta _{0,0}\left (\theta \right ) T_{0,0}\relax (t) }}+\overset {n=0,m>0}{\overbrace {R_{0,m}\left ( r\right ) \Theta _{0,m}\left (\theta \right ) T_{0.m}\relax (t) }}+\overset {n>0,m>0}{\overbrace {R_{n,m}\relax (r) \Theta _{n,m}\left ( \theta \right ) T_{n.m}\relax (t) }}\] Or\begin {align*} u\left (r,\theta ,t\right ) & =\beta _{0}\\ & +\sum _{m=1}^{\infty }\alpha _{0,m}\operatorname {BesselJ}\left ( 0,\frac {\Lambda _{m}}{L}r\right ) e^{-k\left (\frac {\Lambda _{m}}{L}\right ) ^{2}t}\\ & +\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }e^{-k\left (\frac {\Gamma _{nm}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \left (A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left ( n\theta \right ) \right ) \end {align*}

Where \(\Gamma _{nm}\) are the \(m^{th}\) zeros \(\frac {d}{dx}\operatorname {BesselJ}\left (n,x\right ) \) and \(\Lambda _{m}\) are the \(m^{th}\) zeros of \(\operatorname {BesselJ}\left (1,x\right ) \). These have to be found numerically.

Now we find the constants \(\beta _{0},\alpha _{m},A_{nm},B_{nm}\). For \(n=0,m=0\), and at initial conditions at \(t=0\), and applying orthogonality gives (all eigenfunctions are constants, assumed \(1\), in this case)

\begin {align*} \int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) rdrd\theta & =\beta _{0}\int _{-\pi }^{\pi }\int _{0}^{L}rdrd\theta \\ \beta _{0} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) rdrd\theta }{\pi L^{2}} \end {align*}

For \(n=0,m>0\)\begin {align*} \int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta & =\alpha _{0,m}\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta \\ & =2\pi \alpha _{0,m}\int _{0}^{L}\operatorname {BesselJ}^{2}\left ( 0,\frac {\Lambda _{m}}{L}r\right ) rdr\\ \alpha _{0,m} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta }{2\pi \int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdr} \end {align*}

For \(n>0,m>0\), applying orthogonality on \(\operatorname {BesselJ}\left ( n,\frac {\Gamma _{nm}}{L}r\right ) \) gives\[ \int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left ( n,\frac {\Gamma _{nm}}{L}r\right ) rdr=\sum _{n=1}^{\infty }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) rdr\left (A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left (n\theta \right ) \right ) \] applying orthogonality on \(\cos \left (n\theta \right ) \) the above becomes\begin {align*} \int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos \left (n\theta \right ) rdrd\theta & =A_{nm}\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos ^{2}\left (n\theta \right ) rdrd\theta \\ A_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos ^{2}\left (n\theta \right ) rdrd\theta } \end {align*}

Similarly\[ B_{nm}=\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin ^{2}\left (n\theta \right ) rdrd\theta }\] This complete the solution. In summary, the solution is\begin {align*} u\left (r,\theta ,t\right ) & =\beta _{0}\\ & +\sum _{m=1}^{\infty }\alpha _{0,m}\operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) e^{-k\left (\frac {\Lambda _{m}}{L}\right ) ^{2}t}\\ & +\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }e^{-k\left (\frac {\Gamma _{nm}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \left (A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left ( n\theta \right ) \right ) \end {align*}

Where\begin {align*} \beta _{0} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) rdrd\theta }{\pi L^{2}}\\ \alpha _{0,m} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta }{2\pi \int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdr}\\ A_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos ^{2}\left (n\theta \right ) rdrd\theta }\\ B_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin ^{2}\left (n\theta \right ) rdrd\theta } \end {align*}

And \(\Gamma _{nm}\) are the \(m^{th}\) zeros of \(\frac {d}{dx}\operatorname {BesselJ}\left (n,x\right ) \) and \(\Lambda _{m}\) are the \(m^{th}\) zeros of \(\operatorname {BesselJ}\left (1,x\right ) \). These have to be found numerically.

________________________________________________________________________________________

4.2.2.15 [273] Insulated with \(\theta \) dependency (Specific example)

problem number 273

Added June 15, 2019

Solve for \(u(r,\theta ,t)\), the initial value problem for a two-dimensional heat equation inside a circle of radius \(a\) \[ u_t = k \nabla ^2 u \] For \(t>0\) and \(0<r<L\) with \(L=1,k=1\) and time-independent boundary conditions: \begin {align*} u_r(L,\theta ,t) &= 0 \end {align*}

And initial conditions \(u(r,\theta ,0) =(2 L r-r^2)\cos \theta \sin \theta \). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

The solution is bounded at \(r=0\).

pict
Figure 4.168:PDE specification

Mathematica


\[\left \{\left \{u(r,\theta ,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \underset {K[3]=1}{\overset {\infty }{\sum }}\frac {e^{-t K[2,2,K[3]]^2} J_2(r K[2,2,K[3]]) \left (2 \, _1F_2\left (\frac {5}{2};3,\frac {7}{2};-\frac {1}{4} K[2,2,K[3]]^2\right )-5 \, _0\tilde {F}_1\left (;4;-\frac {1}{4} K[2,2,K[3]]^2\right )\right ) K[2,2,K[3]]^3 \sin (2 \theta )}{40 \left (\left (J_1(K[2,2,K[3]]){}^2+J_2(K[2,2,K[3]]){}^2\right ) K[2,2,K[3]]-4 J_1(K[2,2,K[3]]) J_2(K[2,2,K[3]])\right )} & J_{K[1]-1}(K[2,K[1],K[3]])=J_{K[1]+1}(K[2,K[1],K[3]])\land (K[1]|K[3])\in \mathbb {Z}\land K[1]\geq 1\land K[3]\geq 1\land K[2,K[1],K[3]]>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]

Maple


sol=()

Hand solution

Solve for \(u\left (r,\theta ,t\right ) \)\[ u_{t}=k\left (\frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \] With boundary conditions\begin {align*} \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u_{t}\left (L,\theta ,t\right ) & =0\\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ \frac {\partial u}{\partial \theta }\left (r,-\pi ,t\right ) & =\frac {\partial u}{\partial \theta }\left (r,\pi ,t\right ) \end {align*}

And initial conditions \begin {align*} u\left (r,\theta ,0\right ) & =f\left (r,\theta \right ) =\left ( 2rL-r^{2}\right ) \cos \theta \sin \theta \\ L & =1\\ k & =1 \end {align*}

The basic solution for this type of PDE was already given in problem 4.2.2.14 on page 1295 as\begin {align*} u\left (r,\theta ,t\right ) & =\beta _{0}\\ & +\sum _{m=1}^{\infty }\alpha _{0,m}\operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) e^{-k\left (\frac {\Lambda _{m}}{L}\right ) ^{2}t}\\ & +\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }e^{-k\left (\frac {\Gamma _{nm}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \left (A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left ( n\theta \right ) \right ) \end {align*}

Where\begin {align*} \beta _{0} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) rdrd\theta }{\pi L^{2}}\\ \alpha _{0,m} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta }{2\pi \int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdr}\\ A_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos ^{2}\left (n\theta \right ) rdrd\theta }\\ B_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin ^{2}\left (n\theta \right ) rdrd\theta } \end {align*}

And \(\Gamma _{nm}\) are the \(m^{th}\) zeros of \(\frac {d}{dx}\operatorname {BesselJ}\left (n,x\right ) \) and \(\Lambda _{m}\) are the \(m^{th}\) zeros of \(\operatorname {BesselJ}\left (1,x\right ) \). These have to be found numerically. This is animation of the solution for \(0.2\) seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 4.169:Source code

pict
Figure 4.170:Code for animation

________________________________________________________________________________________

4.2.2.16 [274] Insulated with \(\theta \) dependency (Specific example)

problem number 274

Added June 15, 2019

Solve for \(u(r,\theta ,t)\), the initial value problem for a two-dimensional heat equation inside a circle of radius \(a\) \[ u_t = k \nabla ^2 u \] For \(t>0\) and \(0<r<L\) with \(L=1,k=1\) and time-independent boundary conditions: \begin {align*} u_r(L,\theta ,t) &= 0 \end {align*}

And initial conditions \(u(r,\theta ,0) =(2 L r - r^2) \theta \sin \theta e^{\cos \theta }\). There is an implied periodic boundary conditions on \(\theta \) \begin {align*} u(r,-\pi ,t) &= u(r,\pi ,t)\\ \frac {\partial u}{\partial \theta }(r,-\pi ,t) &= \frac {\partial u}{\partial \theta }(r,\pi ,t) \end {align*}

The solution is bounded at \(r=0\).

pict
Figure 4.171:PDE specification

Mathematica


$Aborted

Maple


sol=()

Hand solution

Solve for \(u\left (r,\theta ,t\right ) \)\[ u_{t}=k\left (\frac {\partial ^{2}u}{\partial r^{2}}+\frac {1}{r}\frac {\partial u}{\partial r}+\frac {1}{r^{2}}\frac {\partial ^{2}u}{\partial \theta ^{2}}\right ) \] With boundary conditions\begin {align*} \left \vert u\left (0,\theta ,t\right ) \right \vert & <\infty \\ u_{t}\left (L,\theta ,t\right ) & =0\\ u\left (r,-\pi ,t\right ) & =u\left (r,\pi ,t\right ) \\ u_{\theta }\left (r,-\pi ,t\right ) & =u_{\theta }\left (r,\pi ,t\right ) \end {align*}

And initial conditions \begin {align*} u\left (r,\theta ,0\right ) & =f\left (r,\theta \right ) =\left ( 2rL-r^{2}\right ) \theta \sin \theta e^{\cos \theta }\\ L & =1\\ k & =1 \end {align*}

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

\[ u\left (r,\theta ,t\right ) =\beta _{0}+\sum _{m=1}^{\infty }\alpha _{0,m}\operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) e^{-k\left (\frac {\Lambda _{m}}{L}\right ) ^{2}t}+\sum _{n=1}^{\infty }\sum _{m=1}^{\infty }e^{-k\left (\frac {\Gamma _{nm}}{L}\right ) ^{2}t}\operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \left ( A_{nm}\cos \left (n\theta \right ) +B_{nm}\sin \left (n\theta \right ) \right ) \] Where\begin {align*} \beta _{0} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) rdrd\theta }{\pi L^{2}}\\ \alpha _{0,m} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdrd\theta }{2\pi \int _{0}^{L}\operatorname {BesselJ}^{2}\left (0,\frac {\Lambda _{m}}{L}r\right ) rdr}\\ A_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \cos ^{2}\left (n\theta \right ) rdrd\theta }\\ B_{nm} & =\frac {\int _{-\pi }^{\pi }\int _{0}^{L}f\left (r,\theta \right ) \operatorname {BesselJ}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin \left ( n\theta \right ) rdrd\theta }{\int _{-\pi }^{\pi }\int _{0}^{L}\operatorname {BesselJ}^{2}\left (n,\frac {\Gamma _{nm}}{L}r\right ) \sin ^{2}\left (n\theta \right ) rdrd\theta } \end {align*}

And \(\Gamma _{nm}\) are the \(m^{th}\) zeros of \(\frac {d}{dx}\operatorname {BesselJ}\left (n,x\right ) \) and \(\Lambda _{m}\) are the \(m^{th}\) zeros of \(\operatorname {BesselJ}\left (1,x\right ) \). These have to be found numerically. This is animation of the solution for0.18 seconds. (Animation will only show in the HTML version)

Source code used for the above

pict
Figure 4.172:Source code

pict
Figure 4.173:Code for animation