Added July 7,2019
Solve for \(u(x,t)\) for \(t>0\) and \(0<x<L\) \[ u_{tt} = c^2 u_{xx} \] With boundary condition both ends fixed \begin {align*} u(0,t) &= 0 \\ u(L,t) &=0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= f(x) \\ u_t(x,0) &= g(x) \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == f[x], Derivative[0, 1][u][x, 0] == g[x]}; bc = {u[0, t] == 0, u[L, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}, Assumptions->L>0], 60*10]];
Failed Surprising it could not solve this standard wave PDE on string
Maple ✓
restart; pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f(x),eval(diff(u(x,t),t),t=0)=g(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty } \left ( 2\,{\frac {1}{\pi \,ncL}\sin \left ( {\frac {n\pi \,x}{L}} \right ) \left ( \pi \,\cos \left ( {\frac {\pi \,nct}{L}} \right ) \int _{0}^{L}\!\sin \left ( {\frac {n\pi \,x}{L}} \right ) f \left ( x \right ) \,{\rm d}xnc+L\sin \left ( {\frac {\pi \,nct}{L}} \right ) \int _{0}^{L}\!\sin \left ( {\frac {n\pi \,x}{L}} \right ) g \left ( x \right ) \,{\rm d}x \right ) } \right ) \]
Hand solution
Solving for \(t>0,0<x<L\)\[ u_{tt}=c^{2}u_{xx}\] With BC \begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) \\ u_{t}\left ( x,0\right ) & =g\left ( x\right ) \end {align*}
Let \(u=X\left ( x\right ) T\left ( t\right ) \). The PDE becomes\begin {align*} \frac {T^{\prime \prime }X}{c^{2}} & =X^{\prime \prime }T\\ \frac {1}{c^{2}}\frac {T^{\prime \prime }}{T} & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}
Where \(\lambda \) is separation constant. Hence the eigenvalue ODE is \begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X\left ( L\right ) & =0 \end {align*}
From the boundary conditions, we see that \(\lambda >0\) is the only possible value. Therefore the solution to the above ODE is\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \] Since \(X\left ( 0\right ) =0\) then \(A=0\) and the solution becomes \(X\left ( x\right ) =B\sin \left ( \sqrt {\lambda }x\right ) \). Since \(X\left ( L\right ) =0\) then for non trivial solution we want \(\sqrt {\lambda }L=n\pi \) or \[ \lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\qquad n=1,2,3,\cdots \] Hence the eigenfunctions are \[ \Phi _{n}\left ( x\right ) =\sin \left ( \frac {n\pi }{L}x\right ) \qquad n=1,2,3,\cdots \] The time ODE now becomes\[ T^{\prime \prime }+c^{2}\left ( \frac {n\pi }{L}\right ) ^{2}T=0 \] Which has the solution\[ T\left ( t\right ) =D_{n}\cos \left ( c\frac {n\pi }{L}t\right ) +E_{n}\sin \left ( c\frac {n\pi }{L}t\right ) \] Therefore the complete solution becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( D_{n}\cos \left ( c\frac {n\pi }{L}t\right ) +E_{n}\sin \left ( c\frac {n\pi }{L}t\right ) \right ) \Phi _{n}\left ( x\right ) \tag {1} \end {equation} At \(t=0\) the above becomes\[ f\left ( x\right ) =\sum _{n=1}^{\infty }D_{n}\Phi _{n}\left ( x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =D_{n}\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx\\ & =\frac {L}{2}D_{n} \end {align*}
Hence\begin {equation} D_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx\tag {2} \end {equation} Taking time derivative of (1) gives\[ u_{t}\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( -c\frac {n\pi }{L}D_{n}\sin \left ( c\frac {n\pi }{L}t\right ) +E_{n}c\frac {n\pi }{L}\cos \left ( c\frac {n\pi }{L}t\right ) \right ) \Phi _{n}\left ( x\right ) \] At \(t=0\) the above becomes\[ g\left ( x\right ) =\sum _{n=1}^{\infty }E_{n}c\frac {n\pi }{L}\Phi _{n}\left ( x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}g\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =E_{n}c\frac {n\pi }{L}\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx\\ & =\frac {L}{2}E_{n}c\frac {n\pi }{L}\\ & =\frac {1}{2}E_{n}cn\pi \end {align*}
Hence\begin {equation} E_{n}=\frac {2}{cn\pi }\int _{0}^{L}g\left ( x\right ) \Phi _{n}\left ( x\right ) dx\tag {3} \end {equation} Using (2,3) in (1) gives the final solution as\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{L}s\right ) ds\right ) \cos \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \\ & +\frac {2}{c\pi }\sum _{n=1}^{\infty }\frac {1}{n}\left ( \int _{0}^{L}g\left ( s\right ) \sin \left ( \frac {n\pi }{L}s\right ) ds\right ) \sin \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
____________________________________________________________________________________
Added July 8,2019
Solve for \(u(x,t)\) for \(t>0\) and \(0<x<L\) \[ u_{tt} = c^2 u_{xx} \] With boundary condition both ends fixed \begin {align*} u(0,t) &= 0 \\ u(L,t) &=0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= f(x) \\ u_t(x,0) &= g(x) \\ \end {align*}
Using the following values \begin {align*} L&=10\\ c&=2\\ f(x)&=0\\ g(x)&= \frac {8 x (L-x)^2}{L^3} \end {align*}
Mathematica ✓
ClearAll["Global`*"]; L=10; c=2; f=0; g=(8*x*(L-x)^2)/L^3; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == f, Derivative[0, 1][u][x, 0] == g}; bc = {u[0, t] == 0, u[L, t] == 0}; 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 \sum _{n=1}^{\infty }\frac {160 \left (2+(-1)^n\right ) \sin \left (\frac {n \pi t}{5}\right ) \sin \left (\frac {n \pi x}{10}\right )}{n^4 \pi ^4}\right \}\right \}\]
Maple ✓
restart; L:=10; c:=2; f:=0; g:=(8*x*(L-x)^2)/L^3; pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f,eval(diff(u(x,t),t),t=0)=g; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }160\,{\frac { \left ( \left ( -1 \right ) ^{n}+2 \right ) \sin \left ( 1/10\,n\pi \,x \right ) \sin \left ( 1/5\,n\pi \,t \right ) }{{\pi }^{4}{n}^{4}}}\]
Hand solution
Solving the wave PDE on string with both ends fixed \[ u_{tt}=c^{2}u_{xx}\qquad t>0,x>0 \] With BC \begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) =0\\ u_{t}\left ( x,0\right ) & =g\left ( x\right ) =\frac {8x\left ( L-x\right ) ^{2}}{L^{3}} \end {align*}
Using \(c=2,L=10\).
The general problem PDE was solved in 5.1.1.1 on page 1217 and the solution is\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \cos \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \\ & +\frac {2}{c\pi }\sum _{n=1}^{\infty }\frac {1}{n}\left ( \int _{0}^{L}g\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \sin \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
Substituting the specific values given above into this solution gives\[ u\left ( x,t\right ) =\frac {1}{\pi }\sum _{n=1}^{\infty }\frac {1}{n}\left ( \int _{0}^{10}\frac {8x\left ( 10-x\right ) ^{2}}{10^{3}}\sin \left ( \frac {n\pi }{10}x\right ) dx\right ) \sin \left ( 2\frac {n\pi }{10}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \] But \(\int _{0}^{10}\frac {8x\left ( 10-x\right ) ^{2}}{10^{3}}\sin \left ( \frac {n\pi }{10}x\right ) dx=\frac {160\left ( 2+\left ( -1\right ) ^{n}\right ) }{n^{3}\pi ^{3}}\), hence the solution becomes\[ u\left ( x,t\right ) =\frac {1}{\pi ^{4}}\sum _{n=1}^{\infty }\frac {160\left ( 2+\left ( -1\right ) ^{n}\right ) }{n^{4}}\sin \left ( \frac {n\pi }{5}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \] Animation is below
Source code used for the above
____________________________________________________________________________________
Added July 8,2019
Solve for \(u(x,t)\) for \(t>0\) and \(0<x<L\) \[ u_{tt} = c^2 u_{xx} \] With boundary condition both ends fixed \begin {align*} u(0,t) &= 0 \\ u(L,t) &=0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= f(x) \\ u_t(x,0) &= g(x) \\ \end {align*}
Using the following values \begin {align*} L&=10\\ c&=2\\ f(x)&=\frac {8 x (L-x)^2}{L^3}\\ g(x)&= 0 \end {align*}
Mathematica ✓
ClearAll["Global`*"]; L=10; c=2; g=0; f=(8*x*(L-x)^2)/L^3; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == f, Derivative[0, 1][u][x, 0] == g}; bc = {u[0, t] == 0, u[L, t] == 0}; 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 \sum _{n=1}^{\infty }\frac {32 \left (2+(-1)^n\right ) \cos \left (\frac {n \pi t}{5}\right ) \sin \left (\frac {n \pi x}{10}\right )}{n^3 \pi ^3}\right \}\right \}\]
Maple ✓
restart; L:=10; c:=2; g:=0; f:=(8*x*(L-x)^2)/L^3; pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f,eval(diff(u(x,t),t),t=0)=g; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }32\,{\frac { \left ( \left ( -1 \right ) ^{n}+2 \right ) \sin \left ( 1/10\,n\pi \,x \right ) \cos \left ( 1/5\,n\pi \,t \right ) }{{n}^{3}{\pi }^{3}}}\]
Hand solution
Solving the wave PDE on string with both ends fixed \[ u_{tt}=c^{2}u_{xx}\qquad t>0,x>0 \] With BC \begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) =\frac {8x\left ( L-x\right ) ^{2}}{L^{3}}\\ u_{t}\left ( x,0\right ) & =g\left ( x\right ) =0 \end {align*}
Using \(c=2,L=10\).
The general problem PDE was solved in 5.1.1.1 on page 1217 and the solution is\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \cos \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \\ & +\frac {2}{c\pi }\sum _{n=1}^{\infty }\frac {1}{n}\left ( \int _{0}^{L}g\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx\right ) \sin \left ( c\frac {n\pi }{L}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
Substituting the specific values given above into this solution gives\[ u\left ( x,t\right ) =\frac {1}{5}\sum _{n=1}^{\infty }\left ( \int _{0}^{10}\frac {8x\left ( 10-x\right ) ^{2}}{10^{3}}\sin \left ( \frac {n\pi }{10}x\right ) dx\right ) \cos \left ( \frac {n\pi }{5}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \] But \(\int _{0}^{10}\frac {8x\left ( 10-x\right ) ^{2}}{10^{3}}\sin \left ( \frac {n\pi }{10}x\right ) dx=\frac {160\left ( 2+\left ( -1\right ) ^{n}\right ) }{n^{3}\pi ^{3}}\), hence the solution becomes\[ u\left ( x,t\right ) =32\sum _{n=1}^{\infty }\frac {\left ( 2+\left ( -1\right ) ^{n}\right ) }{n^{3}\pi ^{3}}\cos \left ( \frac {n\pi }{5}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \] Animation is below
Source code used for the above
____________________________________________________________________________________
Added sept 23 ,2019
Solve for \(u(x,t)\) for \(t>0\) and \(-\pi <x<\pi \) \[ u_{tt} = c^2 u_{xx} \] With boundary condition \begin {align*} u(-\pi ,t) &= 0 \\ u(\pi ,t) &=0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= 0 \\ u_t(x,0) &= \sin (x)^2 \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == Sin[x]^2}; bc = {u[-Pi, t] == 0, u[Pi, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(-Pi,t)=0,u(Pi,t)=0; ic := u(x,0)=0,D[2](u)(x,0)=sin(x)^2; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) ={\frac {1}{315\,\pi \,c} \left ( 315\,\sum _{n=5}^{\infty }32\,{\frac {\sin \left ( 1/2\,n \left ( x+\pi \right ) \right ) \sin \left ( 1/2\,cnt \right ) \left ( \left ( -1 \right ) ^{n}-1 \right ) }{\pi \,{n}^{2}c \left ( {n}^{2}-16 \right ) }}\pi \,c-320\,\cos \left ( 3/2\,x \right ) \sin \left ( 3/2\,ct \right ) +1344\,\cos \left ( x/2 \right ) \sin \left ( 1/2\,ct \right ) \right ) }\]
Hand solution
Solve
\[ u_{tt}=c^{2}u_{xx}\] With BC \begin {align*} u\left ( -\pi ,t\right ) & =0\\ u\left ( \pi ,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =0\\ u_{t}\left ( x,0\right ) & =\sin ^{2}\left ( x\right ) \end {align*}
Let \(\xi =x+\pi \). When \(x=-\pi ,\xi =0\) and when \(x=\pi ,\xi =2\pi \). In terms of \(\xi \), the new pde in \(U\left ( \xi ,t\right ) \) becomes
\[ U_{tt}=c^{2}U_{\xi \xi }\] With BC \begin {align*} U\left ( 0,t\right ) & =0\\ U\left ( 2\pi ,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} U\left ( \xi ,0\right ) & =0\\ U_{t}\left ( \xi ,0\right ) & =\sin ^{2}\left ( \xi \right ) \end {align*}
Let \(U=X\left ( \xi \right ) T\left ( t\right ) \). The PDE becomes\begin {align*} \frac {T^{\prime \prime }X}{c^{2}} & =X^{\prime \prime }T\\ \frac {1}{c^{2}}\frac {T^{\prime \prime }}{T} & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}
Where \(\lambda \) is separation constant. Hence the eigenvalue ODE is \begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X\left ( 2\pi \right ) & =0 \end {align*}
From the boundary conditions, we see that \(\lambda >0\) is the only possible value. Therefore the solution to the above ODE is\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }\xi \right ) +B\sin \left ( \sqrt {\lambda }\xi \right ) \] Since \(X\left ( 0\right ) =0\) then \(A=0\) and the solution becomes \(X\left ( \xi \right ) =B\sin \left ( \sqrt {\lambda }\xi \right ) \). Since \(X\left ( 2\pi \right ) =0\) then for non trivial solution we want \(\sqrt {\lambda }2\pi =n\pi \) or \[ \lambda _{n}=\left ( \frac {n}{2}\right ) ^{2}\qquad n=1,2,3,\cdots \] Hence the eigenfunctions are \[ X_{n}\left ( \xi \right ) =\sin \left ( \frac {n}{2}\xi \right ) \qquad n=1,2,3,\cdots \] The time ODE now becomes\begin {align*} T_{n}^{\prime \prime }+c^{2}\lambda _{n}T_{n} & =0\\ T_{n}^{\prime \prime }+c^{2}\left ( \frac {n}{2}\right ) ^{2}T_{n} & =0\\ T_{n}^{\prime \prime }+\frac {c^{2}n^{2}}{4}T_{n} & =0 \end {align*}
Which has the solution\[ T_{n}\left ( t\right ) =D_{n}\cos \left ( \frac {cn}{2}t\right ) +E_{n}\sin \left ( \frac {cn}{2}t\right ) \] Therefore the complete solution becomes\begin {equation} U\left ( \xi ,t\right ) =\sum _{n=1}^{\infty }\left ( D_{n}\cos \left ( \frac {cn}{2}t\right ) +E_{n}\sin \left ( \frac {cn}{2}t\right ) \right ) \sin \left ( \frac {n}{2}\xi \right ) \tag {1} \end {equation}
Switching back to \(x\) the above becomes
\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( D_{n}\cos \left ( \frac {cn}{2}t\right ) +E_{n}\sin \left ( \frac {cn}{2}t\right ) \right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \tag {1A} \end {equation}
At \(t=0\) the above becomes\begin {align*} 0 & =\sum _{n=1}^{\infty }D_{n}\sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \\ D_{n} & =0 \end {align*}
The solution (1A) simplifies to
\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }E_{n}\sin \left ( \frac {cn}{2}t\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \tag {2} \end {equation}
Taking time derivative of (2) gives\[ u_{t}\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( E_{n}\frac {cn}{2}\cos \left ( \frac {cn}{2}t\right ) \right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \] At \(t=0\) the above becomes\[ \sin ^{2}\left ( x\right ) =\sum _{n=1}^{\infty }E_{n}\frac {cn}{2}\sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \] Applying orthogonality gives\begin {align*} \int _{-\pi }^{\pi }\sin ^{2}\left ( x\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) dx & =E_{n}\frac {cn}{2}\int _{-\pi }^{\pi }\sin ^{2}\left ( \frac {n}{2}\left ( x+\pi \right ) \right ) dx\\ & =E_{n}\frac {\pi cn}{2} \end {align*}
For the LHS, for \(n\) even \(\int _{-\pi }^{\pi }\sin ^{2}\left ( x\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) dx=0\). Hence \(E_{n}=0\) for all \(n\) even. For \(n\) odd \begin {align*} \int _{-\pi }^{\pi }\sin ^{2}\left ( x\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) dx & =\frac {16\left ( \cos \left ( n\pi \right ) -1\right ) }{\left ( n^{2}-16\right ) n}\\ & =\frac {16\left ( \left ( -1\right ) ^{n}-1\right ) }{\left ( n^{2}-16\right ) n} \end {align*}
But \(n\) is odd, hence the above simplifies more to
\[ \int _{-\pi }^{\pi }\sin ^{2}\left ( x\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) dx=\frac {-32}{\left ( n^{2}-16\right ) n}\]
Therefore\begin {align} E_{n} & =\frac {2}{n\pi c}\frac {-32}{\left ( n^{2}-16\right ) n}\nonumber \\ & =\frac {-64}{n^{2}\pi c\left ( n^{2}-16\right ) }\nonumber \end {align}
Therefore the final solution (2) now becomes\[ u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\frac {-64}{n^{2}\pi c\left ( n^{2}-16\right ) }\sin \left ( \frac {cn}{2}t\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \]
The following is an animation of the solution for \(c=2\). Using \(c=2\) then the solution above becomes
\[ u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\frac {-32}{n^{2}\pi \left ( n^{2}-16\right ) }\sin \left ( nt\right ) \sin \left ( \frac {n}{2}\left ( x+\pi \right ) \right ) \]
Source code used for the above
____________________________________________________________________________________
Added January 8 ,2020
Problem 6.3.31 Introduction to Partial Dfferential Equations by Peter Olver, ISBN 9783319020983.
Solve
\begin {align*} u_{tt} & =u_{xx}\\ u\left ( -1,t\right ) & =0\\ u\left ( 1,t\right ) & =0\\ u\left ( x,0\right ) & =\delta \left ( x\right ) \\ \frac {\partial u\left ( x,0\right ) }{\partial t} & =0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}]; bc = {u[-1, t] == 0, u[1, t] == 0}; ic = {u[x, 0] == DiracDelta[x], Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x,t),t$2)=diff(u(x,t),x$2); bc:=u(-1,t)=0,u(1,t)=0; ic := u(x,0)=Dirac(x), D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }\sin \left ( 1/2\,n\pi \right ) \sin \left ( 1/2\,n\pi \, \left ( x+1 \right ) \right ) \cos \left ( 1/2\,n\pi \,t \right ) \]
Hand solution
Since the boundary conditions are at \(x=-1\) and at \(x=1\), it is a little easier to solve this by first shifting the boundaries to \(x=0\) and \(x=2\). This is done by transformation. Let\[ z=x+1 \] When \(x=-1\) then \(z=0\) and when \(x=1\) then \(z=2\). The PDE in terms of \(z\) remains the same but the B.C. are shifted. Hence we want to solve for \(v\left ( z,t\right ) \) in\begin {align*} v_{tt} & =v_{zz}\\ v\left ( 0,t\right ) & =0\\ v\left ( 2,t\right ) & =0 \end {align*}
No need to worry about initial conditions now, since we will transform back to \(x\) before applying initial conditions and therefore will use the original initial conditions. This PDE is now solved by separation. Let \(v=Z\left ( z\right ) T\left ( t\right ) \). Substituting into the PDE gives\begin {align*} T^{\prime \prime }Z & =Z^{\prime \prime }T\\ \frac {T^{\prime \prime }}{T} & =\frac {Z^{\prime \prime }}{Z}=-\lambda \end {align*}
This gives the boundary value ODE \begin {align} Z^{\prime \prime }+\lambda Z & =0\tag {1}\\ Z\left ( 0\right ) & =0\nonumber \\ Z\left ( 2\right ) & =0\nonumber \end {align}
And the time ODE\begin {equation} T^{\prime \prime }+\lambda T=0\tag {2} \end {equation} Solving (1). From the boundary conditions we know only \(\lambda >0\) is an eigenvalue. Hence for \(\lambda >0\) the solution is \[ Z\left ( z\right ) =A\cos \left ( \sqrt {\lambda }z\right ) +B\sin \left ( \sqrt {\lambda }z\right ) \] At \(z=0\) this gives \(A=0\). Hence the solution now becomes \(Z\left ( z\right ) =B\sin \left ( \sqrt {\lambda }z\right ) \). At \(z=2\) the above gives \(0=B\sin \left ( 2\sqrt {\lambda }\right ) \). For non-trivial solution we want \(\sin \left ( 2\sqrt {\lambda }\right ) =0\) which implies \(2\sqrt {\lambda }=n\pi \) or\[ \lambda _{n}=\left ( \frac {n\pi }{2}\right ) ^{2}\qquad n=1,2,3,\cdots \] And the corresponding eigenfunctions\[ Z_{n}\left ( z\right ) =\sin \left ( \frac {n\pi }{2}z\right ) \qquad n=1,2,3,\cdots \] The time ODE (2) now becomes\[ T^{\prime \prime }+\left ( \frac {n\pi }{2}\right ) ^{2}T=0 \] Which has solution\[ T_{n}\left ( t\right ) =A_{n}\cos \left ( \frac {n\pi }{2}t\right ) +B_{n}\sin \left ( \frac {n\pi }{2}t\right ) \] Hence the complete solution is\[ v\left ( z,t\right ) =\sum _{n=1}^{\infty }\left ( A_{n}\cos \left ( \frac {n\pi }{2}t\right ) +B_{n}\sin \left ( \frac {n\pi }{2}t\right ) \right ) \sin \left ( \frac {n\pi }{2}z\right ) \] We are now ready to switch back from \(z\) to \(x\). Since \(z=x+1\) then the above becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( A_{n}\cos \left ( \frac {n\pi }{2}t\right ) +B_{n}\sin \left ( \frac {n\pi }{2}t\right ) \right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \tag {3} \end {equation} Now we apply initial conditions to find \(A_{n},B_{n}\). At \(t=0,u\left ( x,0\right ) =\delta \left ( x\right ) \). Hence the above gives\[ \delta \left ( x\right ) =\sum _{n=1}^{\infty }A_{n}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \] Multiplying both sides by \(\sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) \) and Integrating gives\[ \int _{-1}^{1}\delta \left ( x\right ) \sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx=\sum _{n=1}^{\infty }A_{n}\int _{-1}^{1}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx \] By orthogonality of \(\sin \) functions only term survives and the above simplifies to\begin {align*} \int _{-1}^{1}\delta \left ( x\right ) \sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx & =A_{m}\overset {1}{\overbrace {\int _{-1}^{1}\sin ^{2}\left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx}}\\ & =A_{m} \end {align*}
But \(\int _{-1}^{1}\delta \left ( x\right ) \sin \left ( \frac {m\pi }{2}\left ( x+1\right ) \right ) dx=\sin \left ( \frac {m\pi }{2}\right ) \) since that is where \(x=0\). The above reduces to\[ A_{n}=\sin \left ( \frac {n\pi }{2}\right ) \qquad n=1,2,3,\cdots \] The solution (1) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \sin \left ( \frac {n\pi }{2}\right ) \cos \left ( \frac {n\pi }{2}t\right ) +B_{n}\sin \left ( \frac {n\pi }{2}t\right ) \right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \tag {4} \end {equation} Taking time derivatives\[ \frac {\partial }{\partial t}u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( -\frac {n\pi }{2}\sin \left ( \frac {n\pi }{2}\right ) \sin \left ( \frac {n\pi }{2}t\right ) +\frac {n\pi }{2}B_{n}\cos \left ( \frac {n\pi }{2}t\right ) \right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \] At \(t=0\) the above becomes\[ 0=\sum _{n=1}^{\infty }\frac {n\pi }{2}B_{n}\sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \] Therefore \(B_{n}=0\). Hence the solution (4) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }\sin \left ( \frac {n\pi }{2}\right ) \cos \left ( \frac {n\pi }{2}t\right ) \sin \left ( \frac {n\pi }{2}\left ( x+1\right ) \right ) \tag {5} \end {equation} Notice that \(\sin \left ( \frac {n\pi }{2}\right ) \) is zero when \(n\) is even.
____________________________________________________________________________________
This is problem at page 28, David J Logan textbook, applied PDE textbook. No initial conditions given \[ u_{tt} = c^2 u_{xx} \] With boundary condition \begin {align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[L, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc}, u[x, t], {x, t}, Assumptions -> {L > 0}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }\sin \left ( {\frac {n\pi \,x}{L}} \right ) \left ( \sin \left ( {\frac {cn\pi \,t}{L}} \right ) {\it \_C1} \left ( n \right ) +\cos \left ( {\frac {cn\pi \,t}{L}} \right ) {\it \_C5} \left ( n \right ) \right ) \]
____________________________________________________________________________________
Added Feb 25, 2019. Exam 1 problem, MATH 4567 Applied Fourier Analysis, University of Minnesota, Twin Cities.
Solve for \(u(x,t)\) \[ u_{tt} = u_{xx} -u \] With boundary condition \begin {align*} u(0,t) &= 0 \\ u(\pi ,t) &=0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= 0 \\ u_t(x,0) &= 1 \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] - u[x, t]; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 1}; bc = {u[0, t] == 0, u[Pi, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x,t),t$2)=diff(u(x,t),x$2)-u(x,t); bc := u(0,t)=0,u(Pi,t)=0; ic := u(x,0)=0,eval(diff(u(x,t),t),t=0)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }-2\,{\frac { \left ( \left ( -1 \right ) ^{n}-1 \right ) \sin \left ( nx \right ) \sin \left ( \sqrt {{n}^{2}+1}t \right ) }{\pi \,\sqrt {{n}^{2}+1}n}}\]
____________________________________________________________________________________
This is problem at page 149, David J Logan textbook, applied PDE textbook.
\[ \frac {\partial ^2 u}{\partial t^2} = c^2 \frac {\partial ^2 u}{\partial x^2} + p(x,t) \] With boundary conditions \begin {align*} u(\pi ,0) &=0 \\ u(0,t) &= 0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= 0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}] + p[x, t]; bc = {u[0, t] == 0, u[Pi, t] == 0}; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2)+p(x,t); bc := u(0,t)=0,u(Pi,t)=0; ic := u(x,0)=0,D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\int _{0}^{t}\!\sum _{n=1}^{\infty } \left ( 2\,{\frac {\int _{0}^{\pi }\!\sin \left ( nx \right ) p \left ( x,\tau \right ) \,{\rm d}x\sin \left ( nx \right ) \sin \left ( cn \left ( t-\tau \right ) \right ) }{cn\pi }} \right ) \,{\rm d}\tau \]
____________________________________________________________________________________
Added Nov 25, 2018.
This is problem 8.5.2 (a), Richard Haberman applied partial differential equations book, 5th edition
Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space.
Consider a vibrating string with time-dependent forcing: \[ \frac {\partial ^2 u}{\partial t^2} = c^2 \frac {\partial ^2 u}{\partial x^2} + Q(x,t) \] With boundary conditions \begin {align*} u(0,t) &=0 \\ u(L,t) &= 0 \end {align*}
With initial conditions \begin {align*} u_t(x,0) &=0 \\ u(x,0) &= f(x) \end {align*}
my hand solution in in the file feb_24_2019_4_24_pm.tex
, but I need to go over my solution
again to make sure it is correct.
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}] + Q[x, t]; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {u[x, 0] == f[x], Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2)+Q(x,t); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f(x), eval( diff(u(x,t),t),t=0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty } \left ( 2\,{\frac {1}{L}\int _{0}^{L}\!\sin \left ( {\frac {\pi \,n\tau }{L}} \right ) f \left ( \tau \right ) \,{\rm d}\tau \sin \left ( {\frac {\pi \,nx}{L}} \right ) \cos \left ( {\frac {cn\pi \,t}{L}} \right ) } \right ) +\int _{0}^{t}\!\sum _{n=1}^{\infty } \left ( 2\,{\frac {1}{cn\pi }\int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) Q \left ( x,\tau \right ) \,{\rm d}x\sin \left ( {\frac {\pi \,nx}{L}} \right ) \sin \left ( {\frac {cn\pi \, \left ( t-\tau \right ) }{L}} \right ) } \right ) \,{\rm d}\tau \]
____________________________________________________________________________________
Added Nov 25, 2018.
This is problem 8.5.2 (b), Richard Haberman applied partial differential equations book, 5th edition.
Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space.
Consider a vibrating string with time-dependent forcing: \[ u_{tt} = c^2 u_{xx} + g(x) \cos (\omega t) \] With boundary conditions \begin {align*} u(0,t) &=0 \\ u(L,t) &= 0 \end {align*}
With initial conditions \begin {align*} u_t(x,0) &=0 \\ u(x,0) &= f(x) \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}] + g[x]*Cos[w*t]; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {u[x, 0] == f[x], Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2)+ g(x)*cos(w*t); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=0, eval( diff(u(x,t),t),t=0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) ={\frac {1}{\pi \,c} \left ( -2\,\sum _{n=1}^{\infty } \left ( {\frac {L\cos \left ( wt \right ) \pi \,c}{-{\pi }^{2}{c}^{2}{n}^{2}+{L}^{2}{w}^{2}}\sin \left ( {\frac {\pi \,nx}{L}} \right ) \int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) g \left ( x \right ) \,{\rm d}x} \right ) +2\,\sum _{n=1}^{\infty } \left ( {\frac {L\pi \,c}{-{\pi }^{2}{c}^{2}{n}^{2}+{L}^{2}{w}^{2}}\sin \left ( {\frac {\pi \,nx}{L}} \right ) \int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) g \left ( x \right ) \,{\rm d}x\cos \left ( {\frac {cn\pi \,t}{L}} \right ) } \right ) \right ) }\]
Hand solution
Let \[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \] Where we used \(=\) instead of \(\sim \) above, since the PDE given has homogeneous B.C. We know that \(\phi _{n}\left ( x\right ) =\sin \left ( \sqrt {\lambda _{n}}x\right ) \) for \(n=1,2,3,\cdots \) where \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2}\). Substituting the above in the given PDE gives\[ \sum _{n=1}^{\infty }A_{n}^{\prime \prime }\left ( t\right ) \phi _{n}\left ( x\right ) =c^{2}\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \frac {d^{2}\phi _{n}\left ( x\right ) }{dx^{2}}+Q\left ( x,t\right ) \] But \(Q\left ( x,t\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \), hence the above becomes\[ \sum _{n=1}^{\infty }A_{n}^{\prime \prime }\left ( t\right ) \phi _{n}\left ( x\right ) =c^{2}\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \frac {d^{2}\phi _{n}\left ( x\right ) }{dx^{2}}+\sum _{n=1}^{\infty }g_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \] But \(\frac {d^{2}\phi _{n}\left ( x\right ) }{dx^{2}}=-\lambda _{n}\phi _{n}\left ( x\right ) \), hence\[ \sum _{n=1}^{\infty }A_{n}^{\prime \prime }\left ( t\right ) \phi _{n}\left ( x\right ) =-c^{2}\sum _{n=1}^{\infty }\lambda _{n}A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) +\sum _{n=1}^{\infty }g_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \] Multiplying both sides by \(\phi _{m}\left ( x\right ) \) and integrating gives\begin {align*} \int _{0}^{L}\sum _{n=1}^{\infty }A_{n}^{\prime \prime }\left ( t\right ) \phi _{m}\left ( x\right ) \phi _{n}\left ( x\right ) dx & =-c^{2}\int _{0}^{L}\sum _{n=1}^{\infty }\lambda _{n}A_{n}\left ( t\right ) \phi _{m}\left ( x\right ) \phi _{n}\left ( x\right ) dx+\int _{0}^{L}\sum _{n=1}^{\infty }g_{n}\left ( t\right ) \phi _{m}\left ( x\right ) \phi _{n}\left ( x\right ) dx\\ A_{n}^{\prime \prime }\left ( t\right ) \int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx & =-c^{2}\lambda _{n}A_{n}\left ( t\right ) \int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx+g_{n}\left ( t\right ) \int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx \end {align*}
Hence\[ A_{n}^{\prime \prime }\left ( t\right ) +c^{2}\lambda _{n}A_{n}\left ( t\right ) =g_{n}\left ( t\right ) \] Now we solve the above ODE. Let solution be \[ A_{n}\left ( t\right ) =A_{n}^{h}\left ( t\right ) +A_{n}^{p}\left ( t\right ) \] Which is the sum of the homogenous and particular solutions. The homogenous solution is \[ A_{n}^{h}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) \] And the particular solution depends on \(q_{n}\left ( t\right ) \). Once we find \(q_{n}\left ( t\right ) \), we plug-in everything back into \(u\left ( x,t\right ) =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \) and then use initial conditions to find \(c_{1_{n}},c_{2_{n}}\), the two constant of integrations. Now we are given that \(Q\left ( x,t\right ) =g\left ( x\right ) \cos \left ( \omega t\right ) \). Hence\[ g_{n}\left ( t\right ) =\frac {\int _{0}^{L}Q\left ( x,t\right ) \phi _{n}\left ( x\right ) dx}{\int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx}=\frac {\cos \left ( \omega t\right ) \int _{0}^{L}g\left ( x\right ) \phi _{n}\left ( x\right ) dx}{\int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx}=\cos \left ( \omega t\right ) \gamma _{n}\] Where\[ \gamma _{n}=\frac {\int _{0}^{L}g\left ( x\right ) \phi _{n}\left ( x\right ) dx}{\int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx}\] is constant that depends on \(n\). Now we use the above in result found in part (a)\begin {equation} A_{n}^{\prime \prime }\left ( t\right ) +c^{2}\lambda _{n}A_{n}\left ( t\right ) =\gamma _{n}\cos \left ( \omega t\right ) \tag {1} \end {equation} We know the homogenous solution from part (a). \[ A_{n}^{h}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) \] We now need to find the particular solution. Will solve using method of undetermined coefficients.
Case 1 \(\omega \neq c\sqrt {\lambda _{n}}\) (no resonance)
We can now guess \[ A_{n}^{p}\left ( t\right ) =z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \] Plugging this back into (1) gives\begin {align*} \left ( z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \right ) ^{\prime \prime }+c^{2}\lambda _{n}\left ( z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \right ) & =\gamma _{n}\cos \left ( \omega t\right ) \\ \left ( -\omega z_{1}\sin \left ( \omega t\right ) +\omega z_{2}\cos \left ( \omega t\right ) \right ) ^{\prime }+c^{2}\lambda _{n}\left ( z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \right ) & =\gamma _{n}\cos \left ( \omega t\right ) \\ -\omega ^{2}z_{1}\cos \left ( \omega t\right ) -\omega ^{2}z_{2}\sin \left ( \omega t\right ) +c^{2}\lambda _{n}\left ( z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \right ) & =\gamma _{n}\cos \left ( \omega t\right ) \end {align*}
Collecting terms\[ \cos \left ( \omega t\right ) \left ( -\omega ^{2}z_{1}+c^{2}\lambda _{n}z_{1}\right ) +\sin \left ( \omega t\right ) \left ( -\omega ^{2}z_{2}+c^{2}\lambda _{n}z_{2}\right ) =\gamma _{n}\cos \left ( \omega t\right ) \] Therefore we obtain two equations in two unknowns\begin {align*} -\omega ^{2}z_{1}+c^{2}\lambda _{n}z_{1} & =\gamma _{n}\\ -\omega ^{2}z_{2}+c^{2}\lambda _{n}z_{2} & =0 \end {align*}
From the second equation, \(z_{2}=0\) and from the first equation\begin {align*} z_{1}\left ( c^{2}\lambda _{n}-\omega ^{2}\right ) & =\gamma _{n}\\ z_{1} & =\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}} \end {align*}
Hence \begin {align*} A_{n}^{p}\left ( t\right ) & =z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \\ & =\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\cos \left ( \omega t\right ) \end {align*}
Therefore\begin {align*} A_{n}\left ( t\right ) & =A_{n}^{h}\left ( t\right ) +A_{n}^{p}\left ( t\right ) \\ & =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\cos \left ( \omega t\right ) \end {align*}
Now we need to find \(c_{1_{n}},c_{2_{n}}\). Since\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \\ & =\sum _{n=1}^{\infty }\left ( c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\cos \left ( \omega t\right ) \right ) \sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
At \(t=0\) the above becomes\begin {align*} f\left ( x\right ) & =\sum _{n=1}^{\infty }\left ( c_{1_{n}}+\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\right ) \sin \left ( \frac {n\pi }{L}x\right ) \\ & =\sum _{n=1}^{\infty }c_{1_{n}}\sin \left ( \frac {n\pi }{L}x\right ) +\sum _{n=1}^{\infty }\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
Applying orthogonality\begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx & =\int _{0}^{L}\sum _{n=1}^{\infty }c_{1_{n}}\sin \left ( \frac {n\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx+\int _{0}^{L}\sum _{n=1}^{\infty }\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\sin \left ( \frac {n\pi }{L}x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx\\ \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx & =c_{1_{n}}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx+\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx \end {align*}
Rearranging\begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx-\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx & =c_{1_{n}}\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx\\ c_{1_{n}} & =\frac {\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx}{\int _{0}^{L}\sin ^{2}\left ( \frac {n\pi }{L}x\right ) dx}-\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\\ & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx-\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}} \end {align*}
We now need to find \(c_{2_{n}}\). For this we need to differentiate the solution once.\[ \frac {\partial u\left ( x,t\right ) }{\partial t}=\sum _{n=1}^{\infty }\left ( -c\sqrt {\lambda _{n}}c_{1_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) +c\sqrt {\lambda _{n}}c_{2_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) -\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\omega \sin \left ( \omega t\right ) \right ) \sin \left ( \frac {n\pi }{L}x\right ) \] Applying initial conditions \(\frac {\partial u\left ( x,0\right ) }{\partial t}=0\) gives\[ 0=\sum _{n=1}^{\infty }c\sqrt {\lambda _{n}}c_{2_{n}}\sin \left ( \frac {n\pi }{L}x\right ) \] Hence \[ c_{2_{n}}=0 \] Therefore the final solution is\[ A_{n}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\cos \left ( \omega t\right ) \] And\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \] Where \[ c_{1_{n}}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx-\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\] Case 2 \(\omega =c\sqrt {\lambda _{n}}\) Resonance case. Now we can’t guess \(A_{n}^{p}\left ( t\right ) =z_{1}\cos \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) \) so we have to use \[ A_{n}^{p}\left ( t\right ) =z_{1}t\cos \left ( \omega t\right ) +z_{2}t\sin \left ( \omega t\right ) \] Substituting this in \(A_{n}^{\prime \prime }\left ( t\right ) +c^{2}\lambda _{n}A_{n}\left ( t\right ) =\gamma _{n}\cos \left ( \omega t\right ) \) gives\begin {equation} \left ( z_{1}t\cos \left ( \omega t\right ) +z_{2}t\sin \left ( \omega t\right ) \right ) ^{\prime \prime }+c^{2}\lambda _{n}\left ( z_{1}t\cos \left ( \omega t\right ) +z_{2}t\sin \left ( \omega t\right ) \right ) =\gamma _{n}\cos \left ( \omega t\right ) \tag {2} \end {equation} But \begin {align*} \left ( z_{1}t\cos \left ( \omega t\right ) +z_{2}t\sin \left ( \omega t\right ) \right ) ^{\prime \prime } & =\left ( z_{1}\cos \left ( \omega t\right ) -z_{1}\omega t\sin \left ( \omega t\right ) +z_{2}\sin \left ( \omega t\right ) +z_{2}\omega t\cos \left ( \omega t\right ) \right ) ^{\prime }\\ & =-z_{1}\omega \sin \left ( \omega t\right ) -\left ( z_{1}\omega \sin \left ( \omega t\right ) +z_{1}\omega ^{2}t\cos \left ( \omega t\right ) \right ) \\ & +z_{2}\omega \cos \left ( \omega t\right ) +\left ( z_{2}\omega \cos \left ( \omega t\right ) -z_{2}\omega ^{2}t\sin \left ( \omega t\right ) \right ) \\ & =-2z_{1}\omega \sin \left ( \omega t\right ) -z_{1}\omega ^{2}t\cos \left ( \omega t\right ) +2z_{2}\omega \cos \left ( \omega t\right ) -z_{2}\omega ^{2}t\sin \left ( \omega t\right ) \end {align*}
Hence (2) becomes\[ -2z_{1}\omega \sin \left ( \omega t\right ) -z_{1}\omega ^{2}t\cos \left ( \omega t\right ) +2z_{2}\omega \cos \left ( \omega t\right ) -z_{2}\omega ^{2}t\sin \left ( \omega t\right ) +c^{2}\lambda _{n}\left ( z_{1}t\cos \left ( \omega t\right ) +z_{2}t\sin \left ( \omega t\right ) \right ) =\gamma _{n}\cos \left ( \omega t\right ) \] Comparing coefficients we see that \(2z_{2}\omega =\gamma _{n}\) or \[ z_{2}=\frac {\gamma _{n}}{2\omega }\] And \(z_{1}=0\). Therefore \[ A_{n}^{p}\left ( t\right ) =\frac {\gamma _{n}}{2\omega }t\sin \left ( \omega t\right ) \] Therefore\begin {align*} A_{n}\left ( t\right ) & =A_{n}^{h}\left ( t\right ) +A_{n}^{p}\left ( t\right ) \\ & =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{2c\sqrt {\lambda _{n}}}t\sin \left ( \omega t\right ) \end {align*}
We now can find \(c_{1_{n}},c_{2_{n}}\) from initial conditions.\begin {align} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \nonumber \\ & =\sum _{n=1}^{\infty }\left ( c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +c_{2_{n}}\sin \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{2c\sqrt {\lambda _{n}}}t\sin \left ( \omega t\right ) \right ) \sin \left ( \frac {n\pi }{L}x\right ) \tag {4} \end {align}
At \(t=0\)\begin {align*} f\left ( x\right ) & =\sum _{n=1}^{\infty }c_{1_{n}}\sin \left ( \frac {n\pi }{L}x\right ) \\ c_{1n} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx \end {align*}
Taking time derivative of (4) and setting it to zero will give \(c_{2n}\). Since initial speed is zero then \(c_{2_{n}}=0\). Hence\[ A_{n}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{2c\sqrt {\lambda _{n}}}t\sin \left ( \omega t\right ) \] This completes the solution.
Summary of solution
The solution is given by\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }A_{n}\left ( t\right ) \phi _{n}\left ( x\right ) \] Case \(\omega \neq c\sqrt {\lambda _{n}}\)\[ A_{n}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\cos \left ( \omega t\right ) \] And\[ c_{1_{n}}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {m\pi }{L}x\right ) dx-\frac {\gamma _{n}}{c^{2}\lambda _{n}-\omega ^{2}}\] And\[ \gamma _{n}=\frac {\int _{0}^{L}g\left ( x\right ) \phi _{n}\left ( x\right ) dx}{\int _{0}^{L}\phi _{n}^{2}\left ( x\right ) dx}\] And \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\)
Case \(\omega =c\sqrt {\lambda _{n}}\) (resonance)\[ A_{n}\left ( t\right ) =c_{1_{n}}\cos \left ( c\sqrt {\lambda _{n}}t\right ) +\frac {\gamma _{n}}{2c\sqrt {\lambda _{n}}}t\sin \left ( \omega t\right ) \] And\[ c_{1_{n}}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx \]
____________________________________________________________________________________
Added July 2, 2018.
Taken from Maple 2018.1 improvements to PDE’s document. Solve \[ v_{tt} = v_{xx} \] For \(t>0\) and \(0<x<1\). With boundary conditions \begin {align*} v(0,t)&=0\\ v(1,0)&=0 \end {align*}
With initial conditions \begin {align*} v( x,0) & =f(x) \\ \frac {\partial v}{\partial t}(x,0) &=g(x) \\ \end {align*}
Where \(f(x)=-{\frac {{{\rm e}^{2}}x-{{\rm e}^{x+1}}-x+{{\rm e}^{1-x}}}{{{\rm e}^{2}}-1}}\) and \(g(x)=1+{\frac {{{\rm e}^{2}}x-{{\rm e}^{x+1}}-x+{{\rm e}^{1-x}}}{{{\rm e}^{2}}-1}}\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[v[x, t], {t, 2}] == D[v[x, t], {x, 2}]; bc = {v[0, t] == 0, v[1, t] == 0}; ic = {v[x, 0] == -((Exp[2]*x - Exp[x + 1] - x + Exp[1 - x])/(Exp[2] - 1)), Derivative[0, 1][v][x, 0] == 1 + (Exp[2]*x - Exp[x + 1] - x + Exp[1 - x])/(Exp[2] - 1)}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, v[x, t], {x, t}], 60*10]]; sol = sol /. K[1] -> n;
\[\left \{\left \{v(x,t)\to \sum _{n=1}^{\infty }-\frac {2 \left ((-1)^{n+1} n \pi \cos (n \pi t)+\left (\left (-1+(-1)^n\right ) \pi ^2 n^2+2 (-1)^n-1\right ) \sin (n \pi t)\right ) \sin (n \pi x)}{\pi ^4 n^4+\pi ^2 n^2}\right \}\right \}\]
Maple ✓
restart; pde := diff(v(x, t), t, t)=(diff(v(x, t), x, x)); bc := v(0, t) = 0, v(1, t) = 0; ic := v(x, 0) = -(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1), (D[2](v))(x, 0) = 1+(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],v(x,t))),output='realtime'));
\[v \left ( x,t \right ) =\sum _{n=1}^{\infty }-2\,{\frac {\sin \left ( \pi \,nx \right ) \left ( \left ( {\pi }^{2} \left ( -1 \right ) ^{n}{n}^{2}-{\pi }^{2}{n}^{2}+2\, \left ( -1 \right ) ^{n}-1 \right ) \sin \left ( n\pi \,t \right ) - \left ( -1 \right ) ^{n}\cos \left ( n\pi \,t \right ) \pi \,n \right ) }{{\pi }^{2}{n}^{2} \left ( {\pi }^{2}{n}^{2}+1 \right ) }}\]
____________________________________________________________________________________
Added July 2, 2018.
Third example, from Maple 2018.1 improvements to PDE’s document. What_is_New_after_Maple_2018.pdf
Solve \[ \frac {\partial ^2 u}{\partial t^2} = c^2 \frac {\partial ^2 u}{\partial x^2} + 1 \] For \(t>0\) and \(0<x<L\). With boundary conditions \begin {align*} u(0,t)&=0\\ u(L,0)&=0 \end {align*}
With initial conditions \begin {align*} u ( x,0) & =f(x) \\ \frac {\partial u}{\partial t}(x,0) &=g(x) \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}] + 1; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {u[x, 0] == f[x], Derivative[0, 1][u][x, 0] == g[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> L > 0], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); f='f'; pde :=diff(u(x, t), t, t) = c^2* diff(u(x, t), x, x) + 1; bc := u(0, t) = 0, u(L, t) = 0; ic := u(x, 0) = f(x), (D[2](u))(x, 0) = g(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, ic, bc],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =1/2\,{\frac {1}{{c}^{2}} \left ( 2\,\sum _{n=1}^{\infty } \left ( {\frac {1}{\pi \,n{c}^{2}L}\sin \left ( {\frac {\pi \,nx}{L}} \right ) \left ( 2\,L\int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) g \left ( x \right ) \,{\rm d}x\sin \left ( {\frac {cn\pi \,t}{L}} \right ) c-\pi \,\int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) \left ( -2\,f \left ( x \right ) {c}^{2}+Lx-{x}^{2} \right ) \,{\rm d}x\cos \left ( {\frac {cn\pi \,t}{L}} \right ) n \right ) } \right ) {c}^{2}+Lx-{x}^{2} \right ) }\]
____________________________________________________________________________________
This is problem at page 213, David J Logan textbook, applied PDE textbook. Both ends fixed end, with source.
\[ u_{tt} = c^2 u_{xx}+ A x \] With boundary conditions \begin {align*} u(L,0) &=0 \\ u(0,t) &= 0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= 0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}] + A*x; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2)+A* x; bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=0,D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =1/6\,{\frac {1}{{c}^{2}} \left ( A{L}^{2}x-A{x}^{3}+6\,\sum _{n=1}^{\infty }2\,{\frac {{L}^{3} \left ( -1 \right ) ^{n}A}{{n}^{3}{\pi }^{3}{c}^{2}}\sin \left ( {\frac {\pi \,nx}{L}} \right ) \cos \left ( {\frac {cn\pi \,t}{L}} \right ) }{c}^{2} \right ) }\]
____________________________________________________________________________________
Both ends fixed with damping Solve \[ u_{tt} + 2 u_t = c^2 u_{xx} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u(\pi ,0) &=0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= f(x) \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] + 2*D[u[x, t], t] == D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[Pi, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], x, t], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)+2*diff(u(x,t),t)=diff(u(x,t),x$2); ic :=D[2](u)(x,0)=0,u(0,t)=0,u(x,0)=f(x); bc := u(0,t)=0,u(Pi,t)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming t>0),output='realtime'));
\[ u \left (x , t\right ) = \moverset {\infty }{\munderset {n =1}{\sum }}\left \{\begin {array}{cc} \frac {2 \left (\int _{0}^{\pi }\sin \left (x \right ) f \left (x \right )d x \right ) {\mathrm e}^{-t} \left (t +1\right ) \sin \left (x \right )}{\pi } & n =1 \\ -\frac {\left (\int _{0}^{\pi }\sin \left (n x \right ) f \left (x \right )d x \right ) \left (\left (-i-\sqrt {n^{2}-1}\right ) {\mathrm e}^{-t \left (i \sqrt {n^{2}-1}+1\right )}+{\mathrm e}^{t \left (i \sqrt {n^{2}-1}-1\right )} \left (i-\sqrt {n^{2}-1}\right )\right ) \sin \left (n x \right )}{\sqrt {n^{2}-1}\, \pi } & \mathit {otherwise} \end {array}\right . \] But \(n = 1\) should not be included.
____________________________________________________________________________________
Added July 12, 2019.
Solve \[ u_{tt}+ \gamma ^2 u(x,t) = c^2 u_{xx} \] Dispersion term \(\gamma ^2 u(x,t)\) causes the shape of the original wave to distort with time. With \(0<x<L\) and \(t>0\) and with boundary conditions \begin {align*} u(0,t) &= 0\\ u(L,0) &=0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= f(x) \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] + gamma^2*u[x, t] == c^2 D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t},Assumptions->L>0], 60*10]];
Failed Due to adding dispersion term
Maple ✓
restart; interface(showassumed=0); pde :=diff(u(x,t),t$2)+gamma^2*u(x,t)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f(x),D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty } \left ( 2\,{\frac {1}{L}\sin \left ( {\frac {\pi \,nx}{L}} \right ) \cos \left ( {\frac {\sqrt {{\pi }^{2}{c}^{2}{n}^{2}+{L}^{2}{\gamma }^{2}}t}{L}} \right ) \int _{0}^{L}\!\sin \left ( {\frac {\pi \,nx}{L}} \right ) f \left ( x \right ) \,{\rm d}x} \right ) \]
Hand solution
Solving for \(t>0,0<x<L\)\[ \frac {\partial ^{2}u}{\partial t^{2}}+\gamma ^{2}u=c^{2}\frac {\partial ^{2}u}{\partial x^{2}}\qquad 0<x<L,t>0 \] With BC \begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) \\ u_{t}\left ( x,0\right ) & =0 \end {align*}
Dispersion term \(\gamma ^{2}u\,\) causes the shape of the original wave to distort with time. Using separation of variables, Let \(u=X\left ( x\right ) T\left ( t\right ) .\) Substituting this back in the PDE gives\begin {align*} T^{\prime \prime }X+\gamma ^{2}XT & =c^{2}X^{\prime \prime }T\\ \frac {1}{c^{2}}\left ( \frac {T^{\prime \prime }}{T}+\gamma ^{2}\right ) & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}
The eigenvalue ODE is\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X\left ( L\right ) & =0 \end {align*}
The eigenvalues are \(\lambda _{n}=\left ( \frac {n\pi }{L}\right ) ^{2},n=1,2,3,\cdots \) and the eigenfunctions are \(X_{n}\left ( x\right ) =c_{n}\sin \left ( \frac {n\pi }{L}x\right ) \). The time ODE becomes\[ T^{\prime \prime }+\left ( \gamma ^{2}+c^{2}\lambda _{n}\right ) T=0 \] The solution is\[ T_{n}\left ( t\right ) =A_{n}\cos \left ( \sqrt {\gamma ^{2}+c^{2}\lambda _{n}}t\right ) +B_{n}\sin \left ( \sqrt {\gamma ^{2}+c^{2}\lambda _{n}}t\right ) \] Taking time derivatives gives\[ T_{n}^{\prime }\left ( t\right ) =-\sqrt {\gamma ^{2}+c^{2}\lambda _{n}}A_{n}\sin \left ( \sqrt {\gamma ^{2}+c^{2}\lambda _{n}}t\right ) +B_{n}\sqrt {\gamma ^{2}+c^{2}\lambda _{n}}\cos \left ( \sqrt {\gamma ^{2}+c^{2}\lambda _{n}}t\right ) \] At time \(t=0\), the above is zero (initial velocity is zero), which gives\[ 0=B_{n}\sqrt {\gamma ^{2}+c^{2}\lambda _{n}}\] Hence \(B_{n}=0\) and the time ODE solution becomes\[ T_{n}\left ( t\right ) =A_{n}\cos \left ( \sqrt {\gamma ^{2}+c^{2}\lambda _{n}}t\right ) \] Hence the fundamental solution is\begin {align*} u_{n}\left ( x,t\right ) & =T_{n}X_{n}\\ & =c_{n}\cos \left ( \sqrt {\gamma ^{2}+c^{2}\left ( \frac {n\pi }{L}\right ) ^{2}}t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \end {align*}
Therefore the solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }c_{n}\cos \left ( \frac {1}{L}\sqrt {\left ( L^{2}\gamma ^{2}+c^{2}n^{2}\pi ^{2}\right ) }t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \] \(c_{n}\) is found from initial position. At \(t=0\) the above becomes\[ f\left ( x\right ) =\sum _{n=1}^{\infty }c_{n}\sin \left ( \frac {n\pi }{L}x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx & =c_{n}\frac {L}{2}\\ c_{n} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{L}x\right ) dx \end {align*}
Hence solution is\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{L}s\right ) ds\right ) \cos \left ( \frac {1}{L}\sqrt {\left ( L^{2}\gamma ^{2}+c^{2}n^{2}\pi ^{2}\right ) }t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \]
____________________________________________________________________________________
Solve \[ u_{tt}+ \gamma ^2 u(x,t) = c^2 u_{xx} \] Dispersion term \(\gamma ^2 u(x,t)\) causes the shape of the original wave to distort with time. With \(0<x<\pi \) and \(t>0\) and with boundary conditions \begin {align*} u(0,t) &= 0\\ u(\pi ,0) &=0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= \sin ^2(x) \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] + gamma^2*u[x, t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[Pi, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == Sin[x]^2}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed Due to adding dispersion term
Maple ✓
restart; interface(showassumed=0); pde :=diff(u(x,t),t$2)+gamma^2*u(x,t)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(Pi,t)=0; ic := u(x,0)=sin(x)^2,(D[2](u))(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =1/3\,{\frac {1}{\pi } \left ( 3\,\sum _{n=3}^{\infty }4\,{\frac {\sin \left ( nx \right ) \cos \left ( \sqrt {{c}^{2}{n}^{2}+{\gamma }^{2}}t \right ) \left ( \left ( -1 \right ) ^{n}-1 \right ) }{\pi \,n \left ( {n}^{2}-4 \right ) }}\pi +8\,\sin \left ( x \right ) \cos \left ( \sqrt {{c}^{2}+{\gamma }^{2}}t \right ) \right ) }\]
Hand solution
Solving for \(t>0,0<x<L\)\begin {equation} \frac {\partial ^{2}u}{\partial t^{2}}+\gamma ^{2}u=\frac {\partial ^{2}u}{\partial x^{2}}\qquad 0<x<L,t>0\tag {1} \end {equation} With BC \begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
And initial conditions\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) \\ u_{t}\left ( x,0\right ) & =0 \end {align*}
Where now \(L=\pi ,f\left ( x\right ) =\sin ^{2}\left ( x\right ) \).
The general solution for (1) was found in problem 5.1.1.15 on page 1278 as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{L}s\right ) ds\right ) \cos \left ( \frac {t}{L}\sqrt {L^{2}\gamma ^{2}+c^{2}n^{2}\pi ^{2}}\right ) \sin \left ( \frac {n\pi }{L}x\right ) \] Using the above specific values for this problem, the solution becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\left ( \frac {2}{\pi }\int _{0}^{\pi }f\left ( s\right ) \sin \left ( \frac {n\pi }{\pi }s\right ) ds\right ) \cos \left ( \frac {t}{\pi }\sqrt {\pi ^{2}\gamma ^{2}+c^{2}n^{2}\pi ^{2}}\right ) \sin \left ( \frac {n\pi }{\pi }x\right ) \\ & =\sum _{n=1}^{\infty }\left ( \frac {2}{\pi }\int _{0}^{\pi }f\left ( s\right ) \sin \left ( ns\right ) ds\right ) \cos \left ( \sqrt {\gamma ^{2}+c^{2}n^{2}}t\right ) \sin \left ( nx\right ) \end {align*}
But \begin {align*} \int _{0}^{\pi }\sin ^{2}\left ( s\right ) \sin \left ( ns\right ) ds & =\int _{0}^{\pi }\left ( \frac {1}{2}-\frac {1}{2}\cos \left ( 2s\right ) \right ) \sin \left ( ns\right ) ds\\ & =\int _{0}^{\pi }\frac {1}{2}\sin \left ( ns\right ) ds-\frac {1}{2}\int _{0}^{\pi }\cos \left ( 2s\right ) \sin \left ( ns\right ) ds\\ & =\frac {1-\left ( -1\right ) ^{n}}{2n}-\frac {1}{2}\int _{0}^{\pi }\cos \left ( 2s\right ) \sin \left ( ns\right ) ds \end {align*}
\(\int _{0}^{\pi }\cos \left ( 2s\right ) \sin \left ( ns\right ) ds=-\frac {2}{3}\)for \(n=1\) and \(\int _{0}^{\pi }\cos \left ( 2s\right ) \sin \left ( ns\right ) ds=0\) For \(n=2\) and \(\int _{0}^{\pi }\cos \left ( 2s\right ) \sin \left ( ns\right ) ds=\frac {\left ( 1-\left ( -1\right ) ^{n}\right ) n}{n^{2}-4}\ \)for \(n>2\). Hence \[ \int _{0}^{\pi }\sin ^{2}\left ( s\right ) \sin \left ( ns\right ) ds=\left \{ \begin {array} [c]{ccc}\frac {1-\left ( -1\right ) }{2}+\frac {1}{3}=\frac {4}{3} & & n=1\\ \frac {1-\left ( -1\right ) ^{n}}{2n}=0 & & n=2\\ \frac {1-\left ( -1\right ) ^{n}}{2n}-\frac {1}{2}\frac {\left ( 1-\left ( -1\right ) ^{n}\right ) n}{n^{2}-4}=\frac {2}{n}\frac {\left ( -1\right ) ^{n}-1}{n^{2}-4} & & n>2 \end {array} \right . \]
The solution becomes\begin {align*} u\left ( x,t\right ) & =\left ( \frac {2}{\pi }\right ) \frac {4}{3}\cos \left ( \sqrt {\gamma ^{2}+c^{2}}t\right ) \sin \left ( x\right ) +\sum _{n=3}^{\infty }\left ( \frac {2}{\pi }\frac {2}{n}\frac {\left ( -1\right ) ^{n}-1}{n^{2}-4}\right ) \cos \left ( \sqrt {\gamma ^{2}+c^{2}n^{2}}t\right ) \sin \left ( nx\right ) \\ & =\frac {8}{3\pi }\cos \left ( \sqrt {\gamma ^{2}+c^{2}}t\right ) \sin \left ( x\right ) +\frac {4}{\pi }\sum _{n=3}^{\infty }\frac {\left ( -1\right ) ^{n}-1}{n\left ( n^{2}-4\right ) }\cos \left ( \sqrt {\gamma ^{2}+c^{2}n^{2}}t\right ) \sin \left ( nx\right ) \end {align*}
____________________________________________________________________________________
Added July 12, 2019 Solve \[ u_{tt}+ \gamma ^2 u(x,t) = c^2 u_{xx} \] Dispersion term \(\gamma ^2 u(x,t)\) causes the shape of the original wave to distort with time. With \(0<x<L\) and \(t>0\) and with boundary conditions \begin {align*} u(0,t) &= 0\\ u(\pi ,0) &=0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= f(x) \end {align*}
Using the following values \begin {align*} L &= 10 \\ \gamma &= \frac {1}{8}\\ f(x) &=\left \{ \begin {array} [c]{ccc}x-4 & & 4\leq x\leq 5\\ 6-x & & 5\leq x\leq 6\\ 0 & & \text {otherwise}\end {array} \right .\\ c &= 1 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; gamma=1/8; c=1; L=10; f=Piecewise[{{x-4,4<=x<=5},{6-x,5<x<=6},{0,True}}]; pde = D[u[x, t], {t, 2}] + gamma^2*u[x, t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, u[L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed Due to adding dispersion term
Maple ✓
restart; local gamma; gamma:=1/8; c:=1; L:=10; f:=piecewise(4<=x and x<=5, x-4,5<x and x<=6,6-x,true,0); pde :=diff(u(x,t),t$2)+gamma^2*u(x,t)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,u(L,t)=0; ic := u(x,0)=f,(D[2](u))(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }-40\,{\frac { \left ( 16\, \left ( \cos \left ( 1/10\,\pi \,n \right ) \right ) ^{5}-16\, \left ( \cos \left ( 1/10\,\pi \,n \right ) \right ) ^{4}-12\, \left ( \cos \left ( 1/10\,\pi \,n \right ) \right ) ^{3}+12\, \left ( \cos \left ( 1/10\,\pi \,n \right ) \right ) ^{2}+\cos \left ( 1/10\,\pi \,n \right ) -1 \right ) \sin \left ( 1/10\,\pi \,n \right ) \sin \left ( 1/10\,\pi \,nx \right ) \cos \left ( 1/40\,\sqrt {16\,{\pi }^{2}{n}^{2}+25}t \right ) }{{\pi }^{2}{n}^{2}}}\]
Hand solution
Solve for \(0<x<L,t>0\)\[ \frac {\partial ^{2}u}{\partial t^{2}}+\gamma ^{2}u=c^{2}\frac {\partial ^{2}u}{\partial x^{2}}\] Boundary conditions, \(t>0\) (both ends fixed)\begin {align*} u\left ( 0,t\right ) & =0\\ u\left ( L,t\right ) & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} \frac {\partial u\left ( x,0\right ) }{\partial t} & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Using \(L=10,\gamma =1/8,c=1\) and initial position \[ f\left ( x\right ) =\left \{ \begin {array} [c]{ccc}x-4 & & 4\leq x\leq 5\\ 6-x & & 5\leq x\leq 6\\ 0 & & \text {otherwise}\end {array} \right . \]
The general solution to the above PDE was given in problem 5.1.1.15 on page 1278 as
\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{L}s\right ) ds\right ) \cos \left ( \frac {1}{L}\sqrt {\left ( L^{2}\gamma ^{2}+c^{2}n^{2}\pi ^{2}\right ) }t\right ) \sin \left ( \frac {n\pi }{L}x\right ) \]
Replacing given values in the above solution results in
\begin {align} u\left ( x,t\right ) & =\sum _{n=1}^{\infty }\left ( \frac {2}{10}\int _{0}^{10}f\left ( s\right ) \sin \left ( \frac {n\pi }{10}s\right ) ds\right ) \cos \left ( \frac {1}{10}\sqrt {\left ( 100\left ( \frac {1}{8}\right ) ^{2}+n^{2}\pi ^{2}\right ) }t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \nonumber \\ & =\frac {2}{10}\sum _{n=1}^{\infty }\left ( \int _{0}^{10}f\left ( s\right ) \sin \left ( \frac {n\pi }{10}s\right ) ds\right ) \cos \left ( \frac {1}{10}\sqrt {\frac {1}{16}\left ( \frac {100}{4}+16n^{2}\pi ^{2}\right ) }t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \tag {1}\\ & =\frac {2}{10}\sum _{n=1}^{\infty }\left ( \int _{0}^{10}f\left ( s\right ) \sin \left ( \frac {n\pi }{10}s\right ) ds\right ) \cos \left ( \frac {1}{40}\sqrt {25+16n^{2}\pi ^{2}}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \end {align}
But
\[ \int _{0}^{10}f\left ( x\right ) \sin \left ( \frac {n\pi }{10}x\right ) ds=\frac {100\left ( 2\sin \left ( \frac {n\pi }{2}\right ) -\sin \left ( \frac {2n\pi }{5}\right ) -\sin \left ( \frac {3n\pi }{5}\right ) \right ) }{n^{2}\pi ^{2}}\]
Hence the solution (1) becomes
\begin {align*} u\left ( x,t\right ) & =\frac {2}{10}\sum _{n=1}^{\infty }\frac {100\left ( 2\sin \left ( \frac {n\pi }{2}\right ) -\sin \left ( \frac {2n\pi }{5}\right ) -\sin \left ( \frac {3n\pi }{5}\right ) \right ) }{n^{2}\pi ^{2}}\cos \left ( \frac {1}{40}\sqrt {25+16n^{2}\pi ^{2}}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \\ & =\frac {20}{\pi ^{2}}\sum _{n=1}^{\infty }\frac {1}{n^{2}}\left ( 2\sin \left ( \frac {n\pi }{2}\right ) -\sin \left ( \frac {2n\pi }{5}\right ) -\sin \left ( \frac {3n\pi }{5}\right ) \right ) \cos \left ( \frac {1}{40}\sqrt {25+16n^{2}\pi ^{2}}t\right ) \sin \left ( \frac {n\pi }{10}x\right ) \end {align*}
Animation is below. The left one uses \(\gamma =\frac {1}{8}\) and the right one uses larger value of \(\gamma =\frac {5}{8}\) in order to show the effect of larger dispersion.
Source code used for the above
____________________________________________________________________________________
Added March 9, 2018. Solve \[ u_{tt} = 4 u_{xx} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u(\pi ,0) &=0 \end {align*}
With initial conditions \begin {align*} \frac {\partial u}{\partial t}(x,0) &=0 \\ u(x,0) &= \sin ^2(x) \end {align*}
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == 4*D[u[x, t], {x, 2}]; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == Sin[x]^2}; bc = {u[0, t] == 0, u[Pi, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]]; sol = sol /. K[1] -> n;
\[\left \{\left \{u(x,t)\to \sum _{n=1}^{\infty }\frac {4 (\cos (n \pi )-1) \cos (2 n t) \sin (n x)}{\left (n^3-4 n\right ) \pi }\right \}\right \}\] But sum should not include \(n=2\)
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)= 4*diff(u(x,t),x$2); bc := u(0,t)=0,u(Pi,t)=0; ic := u(x,0)=sin(x)^2,D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =1/3\,{\frac {1}{\pi } \left ( 3\,\sum _{n=3}^{\infty }4\,{\frac {\sin \left ( nx \right ) \cos \left ( 2\,nt \right ) \left ( \left ( -1 \right ) ^{n}-1 \right ) }{\pi \,n \left ( {n}^{2}-4 \right ) }}\pi +8\,\sin \left ( x \right ) \cos \left ( 2\,t \right ) \right ) }\] Handled \(n=2\) case correctly
____________________________________________________________________________________
Added December 20, 2018.
Example 18, Taken from https://www.mapleprimes.com/posts/209970-Exact-Solutions-For-PDE-And-Boundary--Initial-Conditions-2018
Solve for \(u(x,t)\) with \(0<x<1\) and \(t>0\) \[ \frac {\partial ^2 u}{\partial t^2} = \frac {\partial ^2 u}{\partial x^2} + x e^{-t} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u(1,0) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= 0\\ \frac {\partial u}{\partial t}(x,0) &=1 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] + x*Exp[-t]; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 0}; bc = {u[0, t] == 0, u[1, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x, t), t$2) = diff(u(x, t), x$2)+x*exp(-t); bc := u(0,t)=0,u(1,t)=0; ic := u(x,0)=0,eval(diff(u(x,t),t),t=0)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=1}^{\infty }-2\,{\frac {\sin \left ( \pi \,nx \right ) \left ( \left ( {\pi }^{2}{n}^{2} \left ( -1 \right ) ^{n}-{\pi }^{2}{n}^{2}+2\, \left ( -1 \right ) ^{n}-1 \right ) \sin \left ( n\pi \,t \right ) + \left ( -1 \right ) ^{n}\pi \,n \left ( {{\rm e}^{-t}}-\cos \left ( n\pi \,t \right ) \right ) \right ) }{{\pi }^{2}{n}^{2} \left ( {\pi }^{2}{n}^{2}+1 \right ) }}\]
____________________________________________________________________________________
Added July 8, 2019 \[ u_{tt} = c^2 u_{xx} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &= g(x) \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == g[x], u[x, 0] == f[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> L>0], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=g(x),u(x,0)=f(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty } \left ( 4\,{\frac {1}{\pi \,c \left ( 1+2\,n \right ) L}\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) \left ( \cos \left ( 1/2\,{\frac {\pi \,c \left ( 1+2\,n \right ) t}{L}} \right ) \pi \,c \left ( n+1/2 \right ) \int _{0}^{L}\!\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) f \left ( x \right ) \,{\rm d}x+\sin \left ( 1/2\,{\frac {\pi \,c \left ( 1+2\,n \right ) t}{L}} \right ) \int _{0}^{L}\!\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) g \left ( x \right ) \,{\rm d}xL \right ) } \right ) \]
Hand solution
Solving for \(0<x<L\)\[ \frac {\partial ^{2}u}{\partial t^{2}}=c^{2}\frac {\partial ^{2}u}{\partial x^{2}}\qquad 0<x<L,t>0 \] Boundary conditions, \(t>0\)\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =g\left ( x\right ) \\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Separation of variables gives the eigenvalue ODE\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( L\right ) & =0 \end {align*}
Only \(\lambda >0\) gives non-trivial solution from the nature of the boundary conditions. Hence solution is\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \] Since \(X\left ( 0\right ) =0\) then the above gives \(0=A\) and the solution becomes\[ X\left ( x\right ) =B\sin \left ( \sqrt {\lambda }x\right ) \] Taking derivatives\[ X^{\prime }\left ( x\right ) =\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }x\right ) \] Since \(X^{\prime }\left ( L\right ) =0\) the above becomes\[ 0=\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }L\right ) \] Which implies \(\sqrt {\lambda }L=\frac {n\pi }{2}\) for \(n=1,3,5,\cdots \) or \[ \lambda _{n}=\left ( \frac {n\pi }{2L}\right ) ^{2}\qquad n=1,3,5,\cdots \] Hence the eigenfunctions are\[ \Phi _{n}\left ( x\right ) =\sin \left ( \sqrt {\lambda _{n}}x\right ) \qquad n=1,3,5,\cdots \]
The time ODE now becomes\[ T^{\prime \prime }+c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}T=0 \] Which has the solution\[ T\left ( t\right ) =D_{n}\cos \left ( c\frac {n\pi }{2L}t\right ) +E_{n}\sin \left ( c\frac {n\pi }{2L}t\right ) \] Therefore the complete solution becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( D_{n}\cos \left ( c\frac {n\pi }{2L}t\right ) +E_{n}\sin \left ( c\frac {n\pi }{2L}t\right ) \right ) \Phi _{n}\left ( x\right ) \tag {1} \end {equation} At \(t=0\) the above becomes\[ f\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }D_{n}\Phi _{n}\left ( x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =D_{n}\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx\\ & =\frac {L}{2}D_{n} \end {align*}
Hence\begin {equation} D_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx\tag {2} \end {equation} Taking time derivative of (1) gives\[ u_{t}\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( -c\frac {n\pi }{2L}D_{n}\sin \left ( c\frac {n\pi }{2L}t\right ) +E_{n}c\frac {n\pi }{L}\cos \left ( c\frac {n\pi }{2L}t\right ) \right ) \Phi _{n}\left ( x\right ) \] At \(t=0\) the above becomes\[ g\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }E_{n}c\frac {n\pi }{2L}\Phi _{n}\left ( x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}g\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =E_{n}c\frac {n\pi }{L}\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx\\ & =\frac {L}{2}E_{n}c\frac {n\pi }{2L}\\ & =\frac {1}{4}E_{n}cn\pi \end {align*}
Hence\begin {equation} E_{n}=\frac {4}{cn\pi }\int _{0}^{L}g\left ( x\right ) \Phi _{n}\left ( x\right ) dx\tag {3} \end {equation} Using (2,3) in (1) gives the final solution as\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=1,3,5,\cdots }^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {n\pi }{2L}x\right ) dx\right ) \cos \left ( c\frac {n\pi }{2L}t\right ) \sin \left ( \frac {n\pi }{2L}x\right ) \\ & +\frac {4}{c\pi }\sum _{n=1,3,5,\cdots }^{\infty }\frac {1}{n}\left ( \int _{0}^{L}g\left ( x\right ) \sin \left ( \frac {n\pi }{2L}x\right ) dx\right ) \sin \left ( c\frac {n\pi }{2L}t\right ) \sin \left ( \frac {n\pi }{2L}x\right ) \end {align*}
Or
\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \cos \left ( c\frac {\left ( 2n+1\right ) \pi }{2L}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\frac {4}{c\pi }\sum _{n=0}^{\infty }\frac {1}{\left ( 2n+1\right ) }\left ( \int _{0}^{L}g\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \sin \left ( c\frac {\left ( 2n+1\right ) \pi }{2L}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
____________________________________________________________________________________
Added July 8, 2019 \[ u_{tt} = c^2 u_{xx} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &=0 \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> L>0], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty } \left ( 2\,{\frac {1}{L}\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) \cos \left ( 1/2\,{\frac {\pi \,c \left ( 1+2\,n \right ) t}{L}} \right ) \int _{0}^{L}\!\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) f \left ( x \right ) \,{\rm d}x} \right ) \]
Hand solution
Solving for \(0<x<L\)\[ u_{tt}=c^{2}u_{xx}\qquad 0<x<L,t>0 \] Boundary conditions, \(t>0\)\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =g\left ( x\right ) =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
The general PDE was solved in 5.1.1.20 on page 1302 and the solution is
\begin {align*} u\left ( x,t\right ) & =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \cos \left ( c\frac {\left ( 2n+1\right ) \pi }{2L}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\frac {4}{c\pi }\sum _{n=0}^{\infty }\frac {1}{\left ( 2n+1\right ) }\left ( \int _{0}^{L}g\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \sin \left ( c\frac {\left ( 2n+1\right ) \pi }{2L}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
But here \(g\left ( x\right ) =0\), hence the above reduces to
\[ u\left ( x,t\right ) =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\right ) \cos \left ( c\frac {\left ( 2n+1\right ) \pi }{2L}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \]
____________________________________________________________________________________
Added July 8, 2019 \[ u_{tt} = c^2 u_{xx} \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &=0 \\ \end {align*}
Using the following values \begin {align*} c &= 4\\ L &=3 \\ h &= \frac {1}{10}\\ f(x) &= \left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right . \end {align*}
Mathematica ✗
ClearAll["Global`*"]; L=3; c=4; h=1/10; f=Piecewise[{{3*h/L*x,0<x<L/3},{h,L/3<x<L}}]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; L:=3; c:=4; h:=1/10; f:=piecewise(0<x and x<L/3,3*h/L*x,L/3<x and x<L,h); pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty }6/5\,{\frac {\sin \left ( 1/6\, \left ( 1+2\,n \right ) \pi \,x \right ) \cos \left ( 1/3\, \left ( 4\,n+2 \right ) t\pi \right ) \left ( \sqrt {3}\sin \left ( 1/3\,\pi \,n \right ) +\cos \left ( 1/3\,\pi \,n \right ) \right ) }{{\pi }^{2} \left ( 1+2\,n \right ) ^{2}}}\]
Hand solution
Solving the wave PDE on string \[ u_{tt}=c^{2}u_{xx}\qquad t>0,x>0 \] Boundary conditions, \(t>0\)\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u\left ( x,0\right ) & =f\left ( x\right ) =\left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right . \\ u_{t}\left ( x,0\right ) & =0 \end {align*}
Using \(c=4,L=3,h=\frac {1}{10}\). Hence \(f\left ( x\right ) =\left \{ \begin {array} [c]{ccc}\frac {1}{10}x & & 0<x<1\\ \frac {1}{10} & & 1<x<3 \end {array} \right . \)
The general problem PDE was solved in 5.1.1.21 on page 1306 and the solution is\[ u\left ( x,t\right ) =\frac {2}{L}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) \cos \left ( \frac {\left ( 2n+1\right ) \pi }{2L}ct\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \] Substituting the specific values given above into this solution gives\[ u\left ( x,t\right ) =\frac {2}{3}\sum _{n=0}^{\infty }\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) \cos \left ( 4\frac {\left ( 2n+1\right ) \pi }{6}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \] But \begin {align*} \int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx & =\int _{0}^{\frac {L}{3}}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx+\int _{\frac {L}{3}}^{L}f\left ( x\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx\\ & =\frac {1}{10}\int _{0}^{1}x\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx+\frac {1}{10}\int _{1}^{3}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx\\ & =\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \end {align*}
Hence the solution becomes\begin {align*} u\left ( x,t\right ) & =\frac {2}{3}\sum _{n=0}^{\infty }\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \cos \left ( \frac {2}{3}\left ( 2n+1\right ) \pi t\right ) \sin \left ( \frac {1}{6}\left ( 2n+1\right ) \pi x\right ) \\ & =\frac {36}{15\pi ^{2}}\sum _{n=0}^{\infty }\frac {1}{\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \cos \left ( \frac {2}{3}\left ( 2n+1\right ) \pi t\right ) \sin \left ( \frac {1}{6}\left ( 2n+1\right ) \pi x\right ) \end {align*}
Animation is below
Source code used for the above
____________________________________________________________________________________
Added July 9, 2019 \[ u_{tt} + b u_t = c^2 u_{xx} \] For \(t>0\) and \(0<x<L\) and boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &= 0 \\ \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] + b*D[u[x,t],t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions->{b>0,L>0}], 60*10]];
Failed
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) assuming L>0,b>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty } \left ( {\frac {1}{\sqrt {-4\, \left ( n+1/2 \right ) ^{2}{c}^{2}{\pi }^{2}+{b}^{2}{L}^{2}}L} \left ( \left ( Lb+\sqrt {-4\, \left ( n+1/2 \right ) ^{2}{c}^{2}{\pi }^{2}+{b}^{2}{L}^{2}} \right ) {{\rm e}^{-1/2\,{\frac { \left ( Lb-\sqrt {-4\, \left ( n+1/2 \right ) ^{2}{c}^{2}{\pi }^{2}+{b}^{2}{L}^{2}} \right ) t}{L}}}}-{{\rm e}^{-1/2\,{\frac { \left ( Lb+\sqrt {-4\, \left ( n+1/2 \right ) ^{2}{c}^{2}{\pi }^{2}+{b}^{2}{L}^{2}} \right ) t}{L}}}} \left ( Lb-\sqrt {-4\, \left ( n+1/2 \right ) ^{2}{c}^{2}{\pi }^{2}+{b}^{2}{L}^{2}} \right ) \right ) \int _{0}^{L}\!\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) f \left ( x \right ) \,{\rm d}x\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) } \right ) \]
Hand solution
Solving for \(t>0,0<x<L\)\[ u_{tt}+bu_{t}=c^{2}u_{xx}\qquad 0<x<L,t>0 \] Boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Separation of variables gives\begin {align*} T^{\prime \prime }X+bT^{\prime }X & =c^{2}X^{\prime \prime }T\\ \frac {1}{c^{2}}\left ( \frac {T^{\prime \prime }}{T}+b\frac {T^{\prime }}{T}\right ) & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}
The eigenvalue ODE is\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( L\right ) & =0 \end {align*}
Only \(\lambda >0\) gives non-trivial solution from the nature of the boundary conditions. Hence solution is\[ X\left ( x\right ) =A\cos \left ( \sqrt {\lambda }x\right ) +B\sin \left ( \sqrt {\lambda }x\right ) \] Since \(X\left ( 0\right ) =0\) then the above gives \(0=A\) and the solution becomes\[ X\left ( x\right ) =B\sin \left ( \sqrt {\lambda }x\right ) \] Taking derivatives\[ X^{\prime }\left ( x\right ) =\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }x\right ) \] Since \(X^{\prime }\left ( L\right ) =0\) the above becomes\[ 0=\sqrt {\lambda }B\cos \left ( \sqrt {\lambda }L\right ) \] Which implies \(\sqrt {\lambda }L=\frac {n\pi }{2}\) for \(n=1,3,5,\cdots \) or \[ \lambda _{n}=\left ( \frac {n\pi }{2L}\right ) ^{2}\qquad n=1,3,5,\cdots \] Hence the eigenfunctions are\[ \Phi _{n}\left ( x\right ) =\sin \left ( \sqrt {\lambda _{n}}x\right ) \qquad n=1,3,5,\cdots \] The time ODE now becomes\begin {align*} \frac {1}{c^{2}}\left ( \frac {T^{\prime \prime }}{T}+b\frac {T^{\prime }}{T}\right ) & =-\lambda _{n}\\ \frac {T^{\prime \prime }}{T}+b\frac {T^{\prime }}{T} & =-c^{2}\lambda _{n}\\ T^{\prime \prime }+bT^{\prime }+c^{2}\lambda _{n}T & =0 \end {align*}
The characteristic equation \(r^{2}+br+c^{2}\lambda _{n}=0\) has the roots \(r=\frac {-B}{2A}\pm \frac {1}{2A}\sqrt {B^{2}-4AC}\rightarrow r=\frac {-b}{2}\pm \frac {1}{2}\sqrt {b^{2}-4c^{2}\lambda _{n}}\) or\[ r=\frac {-b}{2}\pm \frac {1}{2}\sqrt {b^{2}-4c^{2}\lambda _{n}}\] Case \(b^{2}<4c^{2}\lambda _{n}\) for all \(n\). This is called the underdamped case, which generates damped oscillations. The roots becomes\[ r=\frac {-b}{2}\pm \frac {1}{2}i\sqrt {4c^{2}\lambda _{n}-b^{2}}\] Let \(\beta _{n}=\frac {1}{2}\sqrt {4c^{2}\lambda _{n}-b^{2}}\), then\[ r=\frac {-b}{2}\pm i\beta _{n}\] Hence the solution is\[ T_{n}\left ( t\right ) =e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \] Therefore the complete solution becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) \tag {1} \end {equation} At \(t=0\) the above becomes\[ f\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }D_{n}\Phi _{n}\left ( x\right ) \] Applying orthogonality gives\begin {align*} \int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx & =D_{n}\int _{0}^{L}\Phi _{n}^{2}\left ( x\right ) dx\\ & =\frac {L}{2}D_{n} \end {align*}
Hence\begin {equation} D_{n}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \Phi _{n}\left ( x\right ) dx\tag {2} \end {equation} Taking time derivative of (1) gives\[ u_{t}\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\frac {-b}{2}e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) +e^{\frac {-b}{2}t}\left ( -\beta _{n}D_{n}\sin \left ( \beta _{n}t\right ) +E_{n}\beta _{n}\cos \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) \] At \(t=0\) since \(g\left ( x\right ) =0\) then the above becomes\begin {align} 0 & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \frac {-b}{2}D_{n}+E_{n}\beta _{n}\right ) \Phi _{n}\left ( x\right ) \nonumber \\ 0 & =\frac {-b}{2}D_{n}+E_{n}\beta _{n}\nonumber \\ E_{n} & =\frac {bD_{n}}{2\beta _{n}}\tag {3} \end {align}
Using (2,3), the solution (1) now becomes\begin {align*} u\left ( x,t\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +\frac {bD_{n}}{2\beta _{n}}\sin \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) \\ & =\sum _{n=1,3,5,\cdots }^{\infty }D_{n}e^{\frac {-b}{2}t}\left ( \cos \left ( \beta _{n}t\right ) +\frac {b}{2\beta _{n}}\sin \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) \end {align*}
Or\[ u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \Phi _{n}\left ( s\right ) ds\right ) e^{\frac {-b}{2}t}\left ( \cos \left ( \beta _{n}t\right ) +\frac {b}{2\beta _{n}}\sin \left ( \beta _{n}t\right ) \right ) \Phi _{n}\left ( x\right ) \] But \(\beta _{n}=\frac {1}{2}\sqrt {4c^{2}\lambda _{n}-b^{2}}\),\(\lambda _{n}=\left ( \frac {n\pi }{2L}\right ) ^{2}\) and \(\Phi _{n}\left ( x\right ) =\sin \left ( \frac {n\pi }{2L}x\right ) \), hence the above becomes
\begin {align*} u\left ( x,t\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {n\pi }{2L}x\right ) \\ & +\sum _{n=1,3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {n\pi }{2L}x\right ) \end {align*}
Or\begin {align*} u\left ( x,t\right ) & =\sum _{n=0}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=0}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
Case \(b^{2}=4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}\). We see that for \(n=1\) it becomes critical, because then \(b=\frac {\pi c}{L}\) and now and the discriminant is zero in this case. This is called the critical damped case. For \(n>1\), it becomes underdamped, which is the above case. So we only need to find solution for \(n=1\). In this case, the solution to \(T^{\prime \prime }+bT^{\prime }+c^{2}\lambda _{1}T=0\) is\[ T_{1}\left ( t\right ) =D_{1}e^{\frac {-b}{2}t}+E_{1}te^{\frac {-b}{2}t}\] Therefore the complete solution becomes\begin {equation} u\left ( x,t\right ) =\left ( D_{1}e^{\frac {-b}{2}t}+E_{1}te^{\frac {-b}{2}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) +\sum _{n=3,5,\cdots }^{\infty }\left ( D_{n}e^{\frac {-b}{2}t}+E_{n}te^{\frac {-b}{2}t}\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \tag {4} \end {equation} For \(n=1\), At \(t=0\), from intial conditions (4) becomes\[ f\left ( x\right ) =D_{1}\sin \left ( \frac {\pi }{2L}x\right ) \] By orthognailty the above gives\begin {equation} D_{1}=\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx\tag {5} \end {equation} Taking time derivative of (4) for \(n=1\), gives\[ u\left ( x,t\right ) =\left ( \frac {-b}{2}D_{1}e^{\frac {-b}{2}t}+E_{1}\left ( e^{\frac {-b}{2}t}-\frac {b}{2}te^{\frac {-b}{2}t}\right ) \right ) \sin \left ( \frac {\pi }{2L}x\right ) \] At \(t=0\) and since \(g\left ( x\right ) =0\), then the above becomes\begin {align} 0 & =\left ( \frac {-b}{2}D_{1}+E_{1}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \nonumber \\ \frac {-b}{2}D_{1}+E_{1} & =0\nonumber \\ E_{1} & =\frac {b}{2}D_{1}\tag {6} \end {align}
Using (5,6) then (4) becomes\begin {align*} u\left ( x,t\right ) & =D_{1}\left ( e^{\frac {-b}{2}t}+\frac {b}{2}te^{\frac {-b}{2}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) +\sum _{n=3,5,\cdots }^{\infty }\left ( D_{n}e^{\frac {-b}{2}t}+E_{n}te^{\frac {-b}{2}t}\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \\ & =\left ( \frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx\right ) \left ( e^{\frac {-b}{2}t}+\frac {b}{2}te^{\frac {-b}{2}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\lambda _{n}}s\right ) ds\right ) \left ( e^{\frac {-b}{2}t}+\frac {bt}{2}e^{\frac {-b}{2}t}\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \end {align*}
For the case of \(n>1\), the solution was found in the above underdamped case. Putting all these together, gives the solution as\begin {align*} u\left ( x,t\right ) & =\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\pi }{2L}s\right ) ds\right ) \left ( e^{\frac {-b}{2}t}+\frac {b}{2}te^{\frac {-b}{2}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=2}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=2}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
Case \(b^{2}>4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}\). Will consider only the case when this is true for \(n=1\) only. If this is true for larger \(n\), then same solution needs to be summed for each mode. But for simplicity, will consider \(n=1\) here. In this case, the roots are\[ r=\frac {-b}{2}\pm \frac {1}{2}\sqrt {b^{2}-4c^{2}\lambda _{1}}\] Where now \(b^{2}-4c^{2}\lambda _{1}\) is positive. Hence we get \(r_{1}=\frac {-b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\lambda _{1}},r_{2}=\frac {-b}{2}-\frac {1}{2}\sqrt {b^{2}-4c^{2}\lambda _{1}}\) or \begin {align*} r_{1} & =\frac {-b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}\\ r_{1} & =\frac {-b}{2}-\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}} \end {align*}
And the solution to \(T_{1}^{\prime \prime }+bT_{1}^{\prime }+c^{2}\lambda _{1}T=0\) is\[ T_{1}\left ( t\right ) =e^{\frac {-b}{2}t}\left ( D_{1}e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}+E_{1}e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\right ) \] For the rest of the modes, the solution is from above\[ T_{n}\left ( t\right ) =e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \qquad n=3,5,7,\cdots \] Hence the complete solution becomes\begin {align} u\left ( x,t\right ) & =e^{\frac {-b}{2}t}\left ( D_{1}e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}+E_{1}e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \tag {7}\\ & +\sum _{n=3,5,\cdots }^{\infty }e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \sin \left ( \frac {n\pi }{2L}x\right ) \nonumber \end {align}
At \(t=0\) and for \(n=1\), the above becomes\[ f\left ( x\right ) =\left ( D_{1}+E_{1}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \] Hence\begin {equation} \left ( D_{1}+E_{1}\right ) =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx\tag {8} \end {equation} Taking time derivative of (7) and for \(n=1\) at \(t=0\) it gives\[ 0=\left ( \frac {-b}{2}\left ( D_{1}+E_{1}\right ) +\left ( \frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}D_{1}-E_{1}\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}\right ) \right ) \sin \left ( \frac {\pi }{2L}x\right ) \] Hence\begin {align} \frac {-b}{2}\left ( D_{1}+E_{1}\right ) +\left ( \frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}D_{1}-E_{1}\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}\right ) & =0\nonumber \\ -E_{1}\left ( \frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}\right ) & =\left ( \frac {b}{2}-\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}\right ) D_{1}\nonumber \\ E_{1} & =\frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}D_{1}\tag {9} \end {align}
From (8,9)\begin {align*} D_{1} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx-E_{1}\\ D_{1}-\frac {\frac {b}{2}-\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}D_{1} & =\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx\\ D_{1} & =\frac {\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx}{1-\frac {\frac {b}{2}-\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}}\\ & =\frac {\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx \end {align*}
And therefore\begin {align*} E_{1} & =\frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\left ( \frac {\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx\\ & =\frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\frac {2}{L}\int _{0}^{L}f\left ( x\right ) \sin \left ( \frac {\pi }{2L}x\right ) dx \end {align*}
For \(n>1\) the solution is the same as the underdamped case above. Hence the complete solution becomes from (7)\begin {align*} u\left ( x,t\right ) & =e^{\frac {-b}{2}t}\left ( D_{1}e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}+E_{1}e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=3,5,\cdots }^{\infty }e^{\frac {-b}{2}t}\left ( D_{n}\cos \left ( \beta _{n}t\right ) +E_{n}\sin \left ( \beta _{n}t\right ) \right ) \sin \left ( \frac {n\pi }{2L}x\right ) \end {align*}
Or\begin {align*} u\left ( x,t\right ) & =e^{\frac {-b}{2}t}\left ( \frac {\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +e^{\frac {-b}{2}t}\left ( \frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {n\pi }{2L}x\right ) \\ & +\sum _{n=3,5,\cdots }^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {n\pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {n\pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {n\pi }{2L}x\right ) \end {align*}
Or\begin {align*} u\left ( x,t\right ) & =e^{\frac {-b}{2}t}\left ( \frac {\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +e^{\frac {-b}{2}t}\left ( \frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
____________________________________________________________________________________
Added July 9, 2019 \[ u_{tt} + b u_t = c^2 u_{xx} \] For \(t>0\) and \(0<x<L\) and boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &= 0 \\ \end {align*}
Using the following values \begin {align*} L &=3 \\ c &= 4\\ f(x) &= \left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right .\\ h &=\frac {1}{10}\\ b &=\frac {1}{2} \frac {\pi c}{L} \end {align*}
Hence \(b = \frac {2 \pi }{3}\)
Mathematica ✗
ClearAll["Global`*"]; L=3; c=4; h=1/10; b=1/2*(Pi*c/L); f=Piecewise[{{3*h/L*x,0<x<L/3},{h,L/3<x<L}}]; pde = D[u[x, t], {t, 2}] + b*D[u[x,t],t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; L:=3; c:=4; h:=1/10; b:=1/2*(Pi*c/L); f:=piecewise(0<x and x<L/3,3*h/L*x,L/3<x and x<L,h); pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) ),output='realtime'));
\[ u \left (x , t\right ) = \moverset {\infty }{\munderset {n =0}{\sum }}\left (-\frac {6 i \sin \left (\frac {\left (1+2 n \right ) \pi x}{6}\right ) \sin \left (\frac {1}{3} \pi n +\frac {1}{6} \pi \right ) \left (i {\mathrm e}^{\frac {\pi \left (i \sqrt {16 n^{2}+16 n +3}-1\right ) t}{3}} \sqrt {16 n^{2}+16 n +3}+i {\mathrm e}^{-\frac {\pi \left (i \sqrt {16 n^{2}+16 n +3}+1\right ) t}{3}} \sqrt {16 n^{2}+16 n +3}+{\mathrm e}^{\frac {\pi \left (i \sqrt {16 n^{2}+16 n +3}-1\right ) t}{3}}-{\mathrm e}^{-\frac {\pi \left (i \sqrt {16 n^{2}+16 n +3}+1\right ) t}{3}}\right )}{5 \sqrt {16 n^{2}+16 n +3}\, \pi ^{2} \left (1+2 n \right )^{2}}\right ) \]
Hand solution
Solving the wave PDE on string underdamped case \(t>0,0<x<L\)\[ u_{tt}+bu_{t}=c^{2}u_{xx}\qquad 0<x<L,t>0 \] Boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Using \begin {align*} f\left ( x\right ) & =\left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right . \\ b & =\frac {2\pi }{3}\\ c & =4\\ L & =3 \end {align*}
Hence the PDE becomes \(u_{tt}+\frac {2\pi }{3}u_{t}=16u_{xx}\). The general solution to the above PDE was given in problem 5.1.1.23 on page 1318. The eigenvalues are given as \[ \lambda _{n}=\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}\qquad n=0,1,2,\cdots \] And the discriminant is \(b^{2}-4c^{2}\lambda _{n}=b^{2}-4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}=b^{2}-\left ( 4\right ) \left ( 16\right ) \left ( \frac {\left ( 2n+1\right ) ^{2}\pi ^{2}}{36}\right ) \). For \(n=0\) this gives\(\ b^{2}-\frac {16}{9}\pi ^{2}\). But\(\ b=\frac {2\pi }{3}\). Hence discriminant is \(\left ( \frac {2\pi }{3}\right ) ^{2}-\frac {16}{9}\pi ^{2}=-\frac {4}{3}\pi ^{2}\). Since discriminant is negative, then this is underdamped wave with damped oscillations as the solution given from the above problem as\begin {align*} u\left ( x,t\right ) & =\sum _{n=0}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=0}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
Replacing given values in the above solution results in\begin {align} u\left ( x,t\right ) & =\sum _{n=0}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-\pi }{3}t}\left ( \cos \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}t\right ) \right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \tag {1}\\ & +\sum _{n=0}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) e^{\frac {-\pi }{3}t}\left ( \frac {2\pi }{3}\frac {\sin \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}t\right ) }{\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}}\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
But \begin {align*} \int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) & =\frac {1}{10}\int _{0}^{1}x\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx+\frac {1}{10}\int _{1}^{3}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx\\ & =\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \end {align*}
Hence the solution (1) becomes\begin {align} u\left ( x,t\right ) & =\sum _{n=0}^{\infty }\left ( \frac {2}{3}\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \right ) e^{\frac {-\pi }{3}t}\left ( \cos \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}t\right ) \right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \tag {2}\\ & +\sum _{n=0}^{\infty }\left ( \frac {2}{3}\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \right ) e^{\frac {-\pi }{3}t}\left ( \frac {2\pi }{3}\frac {\sin \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}t\right ) }{\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {2\pi }{3}\right ) ^{2}}}\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
Animation is below
Source code used for the above
____________________________________________________________________________________
Added July 10, 2019 \[ u_{tt} + b u_t = c^2 u_{xx} \] For \(t>0\) and \(0<x<L\) and boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &= 0 \\ \end {align*}
Using the following values \begin {align*} L &=3 \\ c &= 4\\ f(x) &= \left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right .\\ h &=\frac {1}{10}\\ b &=\frac {\pi c}{L} \end {align*}
Hence \(b = \frac {4 \pi }{3}\)
Mathematica ✗
ClearAll["Global`*"]; L=3; c=4; h=1/10; b=Pi*c/L; f=Piecewise[{{3*h/L*x,0<x<L/3},{h,L/3<x<L}}]; pde = D[u[x, t], {t, 2}] + b*D[u[x,t],t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; L:=3; c:=4; h:=1/10; b:=Pi*c/L; f:=piecewise(0<x and x<L/3,3*h/L*x,L/3<x and x<L,h); pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) ),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty }\cases {4/5\,{\frac {{{\rm e}^{-2/3\,\pi \,t}} \left ( \pi \,t+3/2 \right ) \sin \left ( 1/6\,\pi \,x \right ) }{{\pi }^{2}}}&$n=0$\cr 3/10\,{\frac { \left ( \left ( 2\,\sqrt {n}\sqrt {n+1}-i \right ) {{\rm e}^{2/3\,i\pi \, \left ( 2\,\sqrt {n}\sqrt {n+1}+i \right ) t}}+ \left ( 2\,\sqrt {n}\sqrt {n+1}+i \right ) {{\rm e}^{2/3\,i\pi \, \left ( -2\,\sqrt {n}\sqrt {n+1}+i \right ) t}} \right ) \sin \left ( 1/6\, \left ( 1+2\,n \right ) \pi \,x \right ) \left ( \sqrt {3}\sin \left ( 1/3\,\pi \,n \right ) +\cos \left ( 1/3\,\pi \,n \right ) \right ) }{\sqrt {n}\sqrt {n+1}{\pi }^{2} \left ( 1+2\,n \right ) ^{2}}}&otherwise\cr }\]
Hand solution
Solving the wave PDE on string underdamped case \(t>0,0<x<L\)\[ u_{tt}+bu_{t}=c^{2}u_{xx}\qquad 0<x<L,t>0 \] Boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Using \begin {align*} f\left ( x\right ) & =\left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right . \\ b & =\frac {4\pi }{3}\\ c & =4\\ L & =3\\ h & =\frac {1}{10} \end {align*}
Hence the PDE becomes \(u_{tt}+\frac {4\pi }{3}u_{t}=16u_{xx}\). The general solution to the above PDE was given in problem 5.1.1.23 on page 1318. The eigenvalues are given as \[ \lambda _{n}=\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}\qquad n=0,1,2,\cdots \] And the discriminant is \(b^{2}-4c^{2}\lambda _{n}=b^{2}-4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}=b^{2}-\left ( 4\right ) \left ( 16\right ) \left ( \frac {\left ( 2n+1\right ) ^{2}\pi ^{2}}{36}\right ) \). For \(n=0\) this gives\(\ b^{2}-\left ( \frac {4}{3}\pi \right ) ^{2}\). But\(\ b=\frac {4\pi }{3}\). Hence discriminant is zero for \(n=0\). This means this is critically damped in first mode. Using the the solution for this case from the above general solution as
\begin {align*} u\left ( x,t\right ) & =\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\pi }{2L}s\right ) ds\right ) \left ( e^{\frac {-b}{2}t}+\frac {b}{2}te^{\frac {-b}{2}t}\right ) \sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
Replacing given values in the above solution results in\begin {align} u\left ( x,t\right ) & =\left ( \frac {2}{3}\int _{0}^{3}f\left ( x\right ) \sin \left ( \frac {\pi }{6}x\right ) dx\right ) \left ( e^{\frac {-2\pi t}{3}}+\frac {b}{2}te^{\frac {-2\pi t}{3}}\right ) \sin \left ( \frac {\pi }{6}x\right ) \tag {1}\\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) e^{\frac {-2\pi t}{3}}\cos \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {\left ( \frac {4\pi }{3}\right ) \sin \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}t\right ) }{\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
But
\[ \int _{0}^{3}f\left ( x\right ) \sin \left ( \frac {\pi }{6}x\right ) dx=\frac {9}{5\pi ^{2}}\]
And\begin {align*} \int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) & =\frac {1}{10}\int _{0}^{1}x\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx+\frac {1}{10}\int _{1}^{3}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx\\ & =\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \end {align*}
Hence the solution (1) becomes
\begin {align} u\left ( x,t\right ) & =\frac {6}{5\pi ^{2}}\left ( e^{\frac {-2\pi t}{3}}+\frac {2}{3}\pi te^{\frac {-2\pi t}{3}}\right ) \sin \left ( \frac {\pi }{6}x\right ) \tag {1}\\ & +\sum _{n=1}^{\infty }\frac {12}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) e^{\frac {-2\pi t}{3}}\cos \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\frac {12}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) e^{\frac {-2\pi t}{3}}\frac {\left ( \frac {4\pi }{3}\right ) \sin \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}t\right ) }{\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\left ( \frac {4\pi }{3}\right ) ^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
Animation is below
Source code used for the above
____________________________________________________________________________________
Added July 11, 2019 \[ u_{tt} + b u_t = c^2 u_{xx} \] For \(t>0\) and \(0<x<L\) and boundary conditions \begin {align*} u(0,t) &= 0\\ u_x(L,t) &=0 \end {align*}
With initial conditions \begin {align*} u(x,0) &= f(x)\\ u_t(x,0) &= 0 \\ \end {align*}
Using the following values \begin {align*} L &=3 \\ c &= 4\\ f(x) &= \left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right .\\ h &=\frac {1}{10}\\ b &=\frac {3}{2} \frac {\pi c}{L} \end {align*}
Hence \(b = 2 \pi \)
Mathematica ✗
ClearAll["Global`*"]; L=3; c=4; h=1/10; b=3/2*Pi*c/L; f=Piecewise[{{3*h/L*x,0<x<L/3},{h,L/3<x<L}}]; pde = D[u[x, t], {t, 2}] + b*D[u[x,t],t] == c^2*D[u[x, t], {x, 2}]; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == 0}; ic = {Derivative[0, 1][u][x, 0] == 0, u[x, 0] == f}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; L:=3; c:=4; h:=1/10; b:=3/2*Pi*c/L; f:=piecewise(0<x and x<L/3,3*h/L*x,L/3<x and x<L,h); pde := diff(u(x,t),t$2) + b*diff(u(x,t),t) = c^2*diff(u(x,t),x$2); bc := u(0,t)=0,D[1](u)(L,t)=0; ic := D[2](u)(x,0)=0,u(x,0)=f; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],u(x,t)) ),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty }3/5\,{\frac {\sin \left ( 1/6\, \left ( 1+2\,n \right ) \pi \,x \right ) \left ( \sqrt {3}\sin \left ( 1/3\,\pi \,n \right ) +\cos \left ( 1/3\,\pi \,n \right ) \right ) \left ( \left ( \sqrt {-16\,{n}^{2}-16\,n+5}+3 \right ) {{\rm e}^{1/3\,\pi \, \left ( \sqrt {-16\,{n}^{2}-16\,n+5}-3 \right ) t}}+{{\rm e}^{-1/3\,\pi \, \left ( \sqrt {-16\,{n}^{2}-16\,n+5}+3 \right ) t}} \left ( \sqrt {-16\,{n}^{2}-16\,n+5}-3 \right ) \right ) }{\sqrt {-16\,{n}^{2}-16\,n+5}{\pi }^{2} \left ( 1+2\,n \right ) ^{2}}}\]
Hand solution
Solving the wave PDE on string underdamped case \(t>0,0<x<L\)\[ u_{tt}+bu_{t}=c^{2}u_{xx}\qquad 0<x<L,t>0 \] Boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=L} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u_{t}\left ( x,0\right ) & =0\\ u\left ( x,0\right ) & =f\left ( x\right ) \end {align*}
Using \begin {align*} f\left ( x\right ) & =\left \{ \begin {array} [c]{ccc}\frac {3h}{L}x & & 0<x<\frac {L}{3}\\ h & & \frac {L}{3}<x<L \end {array} \right . \\ b & =2\pi \\ c & =4\\ L & =3\\ h & =\frac {1}{10} \end {align*}
Hence the PDE becomes \(u_{tt}+2\pi u_{t}=16u_{xx}\). The general solution to the above PDE was given in problem 5.1.1.23 on page 1318. The eigenvalues are given as \[ \lambda _{n}=\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}\qquad n=0,1,2,\cdots \] And the discriminant is \(b^{2}-4c^{2}\lambda _{n}=b^{2}-4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}=b^{2}-\left ( 4\right ) \left ( 16\right ) \left ( \frac {\left ( 2n+1\right ) ^{2}\pi ^{2}}{36}\right ) \). For \(n=0\) this gives\(\ b^{2}-\left ( \frac {4}{3}\pi \right ) ^{2}\). But\(\ b=2\pi \). Hence discriminant is positive for \(n=0\). This means this is critically damped in first mode. Using the the solution for this case from the above general solution as
\begin {align*} u\left ( x,t\right ) & =e^{\frac {-b}{2}t}\left ( \frac {\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +e^{\frac {-b}{2}t}\left ( \frac {-\frac {b}{2}+\frac {1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}{\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}}\right ) \frac {2}{L}\left ( \int _{0}^{L}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{2L}}s\right ) ds\right ) e^{\frac {-1}{2}\sqrt {b^{2}-4c^{2}\left ( \frac {\pi }{2L}\right ) ^{2}}t}\sin \left ( \frac {\pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\cos \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{L}\int _{0}^{L}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}s\right ) ds\right ) e^{\frac {-b}{2}t}\frac {b\sin \left ( \frac {1}{2}\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}t\right ) }{\sqrt {4c^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}\right ) ^{2}-b^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \end {align*}
Replacing given values in the above solution results in\begin {align} u\left ( x,t\right ) & =e^{-\pi t}\left ( \frac {\pi +\frac {1}{2}\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}}{\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}}\right ) \frac {2}{3}\left ( \int _{0}^{3}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{6}}s\right ) ds\right ) e^{\frac {1}{2}\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}t}\sin \left ( \frac {\pi }{6}x\right ) \tag {1}\\ & +e^{-\pi t}\left ( \frac {-\pi +\frac {1}{2}\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}}{\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}}\right ) \frac {2}{3}\left ( \int _{0}^{3}f\left ( s\right ) \sin \left ( \sqrt {\frac {\pi }{6}}s\right ) ds\right ) e^{\frac {-1}{2}\sqrt {4\pi ^{2}-64\left ( \frac {\pi }{6}\right ) ^{2}}t}\sin \left ( \frac {\pi }{6}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) e^{-\pi t}\cos \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-4\pi ^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\left ( \frac {2}{3}\int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) ds\right ) e^{-\pi t}\frac {2\pi \sin \left ( \frac {1}{2}\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-4\pi ^{2}}t\right ) }{\sqrt {64\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-4\pi ^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
But
\[ \int _{0}^{3}f\left ( x\right ) \sin \left ( \frac {\pi }{6}x\right ) dx=\frac {9}{5\pi ^{2}}\]
And\begin {align*} \int _{0}^{3}f\left ( s\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}s\right ) & =\frac {1}{10}\int _{0}^{1}x\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx+\frac {1}{10}\int _{1}^{3}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) dx\\ & =\frac {18}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) \end {align*}
Hence the solution (1) becomes
\begin {align} u\left ( x,t\right ) & =e^{-\pi t}\left ( \frac {\pi +\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}}{2\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}}\right ) \left ( \frac {6}{5\pi ^{2}}\right ) e^{\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}t}\sin \left ( \frac {\pi }{6}x\right ) \tag {2}\\ & +e^{-\pi t}\left ( \frac {-\pi +\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}}{2\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}}\right ) \left ( \frac {6}{5\pi ^{2}}\right ) e^{-\sqrt {\pi ^{2}-16\left ( \frac {\pi }{6}\right ) ^{2}}t}\sin \left ( \frac {\pi }{6}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\frac {12}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) e^{-\pi t}\cos \left ( \sqrt {16\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\pi ^{2}}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \\ & +\sum _{n=1}^{\infty }\frac {12}{5\pi ^{2}\left ( 2n+1\right ) ^{2}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) e^{-\pi t}\frac {\pi \sin \left ( \sqrt {16\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\pi ^{2}}t\right ) }{\sqrt {16\left ( \frac {\left ( 2n+1\right ) \pi }{6}\right ) ^{2}-\pi ^{2}}}\sin \left ( \frac {\left ( 2n+1\right ) \pi }{6}x\right ) \nonumber \end {align}
Animation is below
Source code used for the above
____________________________________________________________________________________
Added July 2, 2018. This is Example 2 (pde 10) taken from Maple document What_is_New_after_Maple_2018.pdf
Solve \[ -u_{tt} + u(x,t)= u_{xx} + 2 e^{-t} \left ( x - \frac {1}{2} x^2 + \frac {1}{2} t - 1 \right ) \] With boundary condition \begin {align*} u(0,t) &= 0 \\ \frac {\partial u(1,t)}{\partial x} &= 0 \end {align*}
And initial conditions \begin {align*} u(x,0) &= x^2-2 x \\ u(x,1)&= u(x,\frac {1}{2}) + e^{-1} \left ( \frac {1}{2} x^2-x\right ) - \left ( \frac {3}{4} x^2- \frac {3}{2}x \right ) e^{\frac {-1}{2}} \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = -D[u[x, t], {t, 2}] + u[x, t] == D[u[x, t], {x, 2}] + 2*Exp[-t]*(x - (1/2)*x^2 + (1/2)*t - 1); bc = {u[0, t] == 0, Derivative[1, 0][u][1, t] == 0}; ic = {u[x, 0] == x^2 - 2*x, u[x, 1] == u[x, 1/2] + ((1/2)*x^2 - x)*Exp[-1] - ((3*x^2)/4 - (3/2)*x)*Exp[-2^(-1)]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], x, t], 60*10]];
Failed
Maple ✓
restart; pde := -diff(u(x, t), t, t) + u(x, t) = diff(u(x, t), x, x)+ 2*exp(-t)*(x-(1/2)*x^2+(1/2)*t-1); ic := u(x, 0) = x^2-2*x, u(x, 1) = u(x, 1/2)+((1/2)*x^2-x)*exp(-1)-(3/4*(x^2)-3/2*x)*exp(-1/2); bc := u(0, t) = 0, eval(diff(u(x, t), x), {x = 1}) = 0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic, bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =-1/2\,{{\rm e}^{-t}}x \left ( x-2 \right ) \left ( t-2 \right ) \]
Hand solution
Solve \begin {equation} -u_{tt}+u=u_{xx}+2e^{-t}\left ( x-\frac {1}{2}x^{2}+\frac {1}{2}t-1\right ) \qquad t>0,0<x<1\tag {1} \end {equation} Boundary conditions\begin {align*} u\left ( 0,t\right ) & =0\\ \left . \frac {\partial u}{\partial x}\right \vert _{x=1} & =0 \end {align*}
Initial conditions, \(t=0\)\begin {align*} u\left ( x,0\right ) & =x^{2}-2x\\ u\left ( x,1\right ) & =u\left ( x,\frac {1}{2}\right ) +e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}} \end {align*}
Since boundary conditions are homogeneous, we can directly use eigenfunction expansion method. Let the solution be \begin {equation} u\left ( x,t\right ) =\sum _{n=1}^{\infty }c_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \tag {2} \end {equation} Where \(\Phi _{n}\left ( x\right ) \) are the eigenfunctions of the corresponding homogeneous PDE \(-u_{tt}+u=u_{xx}\). Using separation of variables, Let \(u=X\left ( x\right ) T\left ( t\right ) .\) Substituting this back in \(-u_{tt}+u=u_{xx}\) gives\begin {align*} -T^{\prime \prime }X+XT & =X^{\prime \prime }T\\ -\frac {T^{\prime \prime }}{T}+1 & =\frac {X^{\prime \prime }}{X}=-\lambda \end {align*}
The eigenvalue ODE is\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( 1\right ) & =0 \end {align*}
This is known to have the eigenvalues are \(\lambda _{n}=\left ( \frac {n\pi }{2L}\right ) ^{2}=\left ( \frac {n\pi }{2}\right ) ^{2}\,\), since \(L=1\). This is for \(n=1,3,5,\cdots \) and the eigenfunctions are \(\Phi _{n}\left ( x\right ) =\sin \left ( \sqrt {\lambda _{n}}x\right ) =\sin \left ( \frac {n\pi }{2}x\right ) \). Therefore the solution (2) is\begin {align*} u\left ( x,t\right ) & =\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \sin \left ( \frac {n\pi }{2}x\right ) \\ & =\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \end {align*}
Substituting this back into (1) gives\begin {equation} -\sum _{n=1,3,5,\cdots }^{\infty }c_{n}^{\prime \prime }\left ( t\right ) \Phi _{n}\left ( x\right ) +\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1,3,5,\cdots }^{\infty }b_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \tag {3} \end {equation} Where \(\sum _{n=1,3,5,\cdots }^{\infty }b_{n}\left ( t\right ) \Phi \left ( x\right ) =2e^{-t}\left ( x-\frac {1}{2}x^{2}+\frac {1}{2}t-1\right ) \). By orthogonality this becomes\begin {align*} \int _{0}^{1}2e^{-t}\left ( x-\frac {1}{2}x^{2}+\frac {1}{2}t-1\right ) \Phi _{n}\left ( x\right ) dx & =b_{n}\left ( t\right ) \int _{0}^{1}\Phi _{n}^{2}\left ( x\right ) dx\\ 2e^{-t}\int _{0}^{1}\left ( x-\frac {1}{2}x^{2}+\frac {1}{2}t-1\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx & =\frac {1}{2}b_{n}\left ( t\right ) \end {align*}
But \(2e^{-t}\int _{0}^{1}\left ( x-\frac {1}{2}x^{2}+\frac {1}{2}t-1\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx=\frac {2e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}}\). Hence the above gives\[ b_{n}\left ( t\right ) =\frac {4e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}}\] Substituting the above into (3) gives\[ -\sum _{n=1,3,5,\cdots }^{\infty }c_{n}^{\prime \prime }\left ( t\right ) \Phi _{n}\left ( x\right ) +\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) =\sum _{n=1,3,5,\cdots }^{\infty }c_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1,3,5,\cdots }^{\infty }\frac {4e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}}\Phi _{n}\left ( x\right ) \] But \(\Phi _{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}\Phi _{n}\left ( x\right ) \), hence the above simplifies to\begin {align*} -c_{n}^{\prime \prime }\left ( t\right ) +c_{n}\left ( t\right ) & =-\lambda _{n}c_{n}\left ( t\right ) +\frac {4e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}}\\ -c_{n}^{\prime \prime }\left ( t\right ) +\left ( 1+\lambda _{n}\right ) c_{n}\left ( t\right ) & =\frac {4e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}}\\ c_{n}^{\prime \prime }\left ( t\right ) -\left ( 1+\frac {n^{2}\pi ^{2}}{4}\right ) c_{n}\left ( t\right ) & =-\frac {4e^{-t}\left ( 8+\left ( t-2\right ) n^{2}\pi ^{2}\right ) }{n^{3}\pi ^{3}} \end {align*}
The solution to this second order ODE can be found to be\[ c_{n}\left ( t\right ) =A_{n}e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}t}{2}}+B_{n}e^{\frac {\sqrt {n^{2}\pi ^{2}+4}t}{2}}+\frac {16\left ( t-2\right ) e^{-t}}{n^{3}\pi ^{3}}\] Hence (2) becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( A_{n}e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}t}{2}}+B_{n}e^{\frac {\sqrt {n^{2}\pi ^{2}+4}t}{2}}+\frac {16\left ( t-2\right ) e^{-t}}{n^{3}\pi ^{3}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \tag {4} \end {equation} At \(t=0\) the above becomes\[ x^{2}-2x=\sum _{n=1,3,5,\cdots }^{\infty }\left ( A_{n}+B_{n}-\frac {32}{n^{3}\pi ^{3}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \] Applying orthogonality gives\[ \int _{0}^{1}\left ( x^{2}-2x\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx=\left ( A_{n}+B_{n}-\frac {32}{n^{3}\pi ^{3}}\right ) \frac {1}{2}\] But \(\int _{0}^{1}\left ( x^{2}-2x\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx=-\frac {16}{n^{3}\pi ^{3}}\), hence the above gives\begin {align} -\frac {32}{n^{3}\pi ^{3}} & =A_{n}+B_{n}-\frac {32}{n^{3}\pi ^{3}}\tag {5}\\ A_{n} & =-B_{n}\nonumber \end {align}
Therefore the solution (4) now becomes\begin {equation} u\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}t}{2}}-e^{\frac {\sqrt {n^{2}\pi ^{2}+4}t}{2}}+\frac {16\left ( t-2\right ) e^{-t}}{n^{3}\pi ^{3}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \tag {6} \end {equation} The second initial conditions is \(u\left ( x,1\right ) =u\left ( x,\frac {1}{2}\right ) +e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}}\). At \(t=1\) the above gives\[ u\left ( x,1\right ) =\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}}{2}}-e^{\frac {\sqrt {n^{2}\pi ^{2}+4}}{2}}-\frac {16e^{-1}}{n^{3}\pi ^{3}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \] At \(t=\frac {1}{2}\) Eq (6) gives\[ u\left ( x,\frac {1}{2}\right ) =\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}}{4}}-e^{\frac {\sqrt {n^{2}\pi ^{2}+4}}{4}}-\frac {24e^{-\frac {1}{2}}}{n^{3}\pi ^{3}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \] Hence the second initial conditions implies \begin {multline*} \sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}}{2}}-e^{\frac {\sqrt {n^{2}\pi ^{2}+4}}{2}}-\frac {16}{n^{3}\pi ^{3}}e^{-1}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \\ -\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( e^{\frac {-\sqrt {n^{2}\pi ^{2}+4}}{4}}-e^{\frac {\sqrt {n^{2}\pi ^{2}+4}}{4}}-\frac {24}{n^{3}\pi ^{3}}e^{-\frac {1}{2}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) =e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}} \end {multline*} Or\begin {multline*} \sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( -2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) -\frac {16}{n^{3}\pi ^{3}}e^{-1}\right ) \sin \left ( \frac {n\pi }{2}x\right ) \\ -\sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( -2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -\frac {24}{n^{3}\pi ^{3}}e^{-\frac {1}{2}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) =e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}} \end {multline*}Simplifying gives\begin {multline*} \sum _{n=1,3,5,\cdots }^{\infty }A_{n}\left ( 2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) -\frac {16}{n^{3}\pi ^{3}}e^{-1}+\frac {24}{n^{3}\pi ^{3}}e^{-\frac {1}{2}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) =\\ e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}} \end {multline*}Applying orthogonality gives\[ A_{n}\left ( 2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) -\frac {16}{n^{3}\pi ^{3}}e^{-1}+\frac {24}{n^{3}\pi ^{3}}e^{-\frac {1}{2}}\right ) \frac {1}{2}=\int _{0}^{1}\left ( e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx \]But \(\int _{0}^{1}\left ( e^{-1}\left ( \frac {1}{2}x^{2}-x\right ) -\left ( \frac {3}{4}x^{2}-\frac {3}{2}x\right ) e^{\frac {-1}{2}}\right ) \sin \left ( \frac {n\pi }{2}x\right ) dx=-\frac {8e^{-\frac {1}{2}}-12e^{-1}}{n^{3}\pi ^{3}}\), hence the above becomes\begin {align*} A_{n}\left ( 2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -2\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) -\frac {16}{n^{3}\pi ^{3}}e^{-1}+\frac {24}{n^{3}\pi ^{3}}e^{-\frac {1}{2}}\right ) & =-\frac {16e^{-1}}{n^{3}\pi ^{3}}+\frac {24e^{-\frac {1}{2}}}{n^{3}\pi ^{3}}\\ 2A_{n}\left ( \sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) \right ) +A_{n}\left ( -\frac {16e^{-1}}{n^{3}\pi ^{3}}+\frac {24e^{-\frac {1}{2}}}{n^{3}\pi ^{3}}\right ) & =-\frac {16e^{-1}}{n^{3}\pi ^{3}}+\frac {24e^{-\frac {1}{2}}}{n^{3}\pi ^{3}} \end {align*}
Since this is true for all \(n=1,3,5,\cdots \) then\begin {align*} A_{n}\left ( \sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) \right ) & =0\\ A_{n} & =1 \end {align*}
Which implies \(\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{4}\right ) -\sinh \left ( \frac {\sqrt {n^{2}\pi ^{2}+4}}{2}\right ) =0\) but this is not possible for \(n=1,3,5,\cdots \). Something went wrong. I need to look at this again.
____________________________________________________________________________________
Added December 20, 2018.
Left end fixed, right end oscillates, initially at rest. With source that depends on time and space.
Example 19, Taken from https://www.mapleprimes.com/posts/209970-Exact-Solutions-For-PDE-And-Boundary--Initial-Conditions-2018
Solve for \(u(x,t)\) with \(0<x<\pi \) and \(t>0\) \[ \frac {\partial ^2 u}{\partial t^2} = 4 \frac {\partial ^2 u}{\partial x^2} + (1+t) x \] With boundary conditions \begin {align*} u(0,t) &= 0\\ u(\pi ,0) &=\sin (t) \end {align*}
With initial conditions \begin {align*} u(x,0) &= 0\\ \frac {\partial u}{\partial t}(x,0) &=0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == 4*D[u[x, t], {x, 2}] + (1 + t)*x; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 0}; bc = {u[0, t] == 0, u[Pi, t] == Sin[t]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x, t), t$2) = 4*diff(u(x, t), x$2)+(1+t)*x; bc := u(0,t)=0,u(Pi,t)=sin(t); ic := u(x,0)=0,eval(diff(u(x,t),t),t=0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) ={\frac {1}{\pi } \left ( \sum _{n=1}^{\infty }4\,{\frac {\sin \left ( nx \right ) \left ( -1 \right ) ^{n} \left ( \left ( {n}^{4}+1/4\,\pi \,{n}^{2}-\pi /16 \right ) \sin \left ( 2\,nt \right ) -1/2\,n \left ( \left ( -\pi \,{n}^{2}+\pi /4 \right ) \cos \left ( 2\,nt \right ) +\sin \left ( t \right ) {n}^{2}+ \left ( t+1 \right ) \pi \, \left ( n+1/2 \right ) \left ( n-1/2 \right ) \right ) \right ) }{\pi \,{n}^{4} \left ( 4\,{n}^{2}-1 \right ) }}\pi +x\sin \left ( t \right ) \right ) }\]
____________________________________________________________________________________
Added May 26, 2019.
Taken from midterm 2 sample exam. UMN Math 5587, Fall 2016. Problem 8
Solve for \(u(x,t)\) with \(-\pi <x<\pi \) and \(t>0\) \[ u_{tt} = u_{xx} \] With boundary conditions \begin {align*} u(-\pi ,t) &= u(\pi ,t)\\ u_x(-\pi ,0) &=u_x(\pi ,t) \end {align*}
With initial conditions \begin {align*} u(x,0) &= x\\ u_t(x,0) &=0 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] ; ic = {u[x, 0] == x, Derivative[0, 1][u][x, 0] == 0}; bc = {u[-Pi, t] == u[Pi,t], Derivative[1, 0][u][-Pi, t] ==Derivative[1, 0][u][Pi, t] }; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✗
restart; pde := diff(u(x, t), t$2) = diff(u(x, t), x$2); bc := u(-Pi,t)=u(Pi,t),eval(diff(u(x,t),x),x=-Pi)=eval(diff(u(x,t),x),x=Pi); ic := u(x,0)=x,eval(diff(u(x,t),t),t=0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t))),output='realtime'));
sol=()
____________________________________________________________________________________
Added May 26, 2019.
Taken from midterm 2 sample exam. UMN Math 5587, Fall 2016. Problem 10
Solve for \(u(x,t)\) with \(0<x<\pi \) and \(t>0\) \[ u_{tt} = u_{xx} \] With boundary conditions \(u(0,t) = u_t(\pi ,t)\) and initial conditions \begin {align*} u(x,0) &= 0\\ u_t(x,0) &=1 \end {align*}
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] ; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 1}; bc = u[0, t] == Derivative[1, 0][u][Pi, t] ; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
Failed
Maple ✗
restart; pde := diff(u(x, t), t$2) = diff(u(x, t), x$2); bc := u(0,t)=eval(diff(u(x,t),x),x=Pi); ic := u(x,0)=0,eval(diff(u(x,t),t),t=0)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t))),output='realtime'));
sol=()
____________________________________________________________________________________
Added January 12, 2020.
Solve for \(u(x,t)\) with \(0<x<L\) and \(t>0\) \[ u_{tt} = c^2 u_{xx} \] With boundary conditions \(u(0,t) = 0, u_x(L,t)=C\) and zero initial conditions \begin {align*} u(x,0) &= 0\\ u_t(x,0) &=0 \end {align*}
For animations use \(L=10,c=1,C=5\)
Mathematica ✗
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == 0, Derivative[0, 1][u][x, 0] == 0}; bc = {u[0, t] == 0, Derivative[1, 0][u][L, t] == C0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t},Assumptions->L>0], 60*10]];
Failed
Maple ✓
restart; pde := diff(u(x, t), t$2) = c^2*diff(u(x, t), x$2); bc := u(0,t)=0, D[1](u)(L,t)=C0; ic := u(x,0)=0,D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t)) assuming L>0),output='realtime'));
\[u \left ( x,t \right ) =\sum _{n=0}^{\infty }-8\,{\frac {L \left ( -1 \right ) ^{n}{\it C0}}{{\pi }^{2} \left ( 1+2\,n \right ) ^{2}}\sin \left ( 1/2\,{\frac { \left ( 1+2\,n \right ) \pi \,x}{L}} \right ) \cos \left ( 1/2\,{\frac {c \left ( 1+2\,n \right ) \pi \,t}{L}} \right ) }+x{\it C0}\]
Hand solution
Let \begin {equation} u\left ( x,t\right ) =v\left ( x,t\right ) +u_{E}\left ( x\right ) \tag {2} \end {equation} \(u_{E}\left ( x\right ) \) is the steady state solution which only needs to satisfy the non-homogeneous boundary conditions. At equilibrium \(\frac {\partial ^{2}u\left ( x,t\right ) }{\partial t^{2}}=0\) and the PDE becomes \(\frac {\partial ^{2}u_{E}\left ( x,t\right ) }{\partial t^{2}}=0\) or the ODE \(\frac {d^{2}u_{E}\left ( x,t\right ) }{dx^{2}}=0\) with B.C. \(u_{E}\left ( 0\right ) =0,u_{E}^{\prime }\left ( L\right ) =C\). The solution to this ODE is\[ u_{E}\left ( x\right ) =c_{1}x+c_{2}\] At first B.C.\[ 0=c_{2}\] Solution becomes \(u_{E}\left ( x\right ) =c_{1}x\). At second B.C. \(u_{E}^{\prime }\left ( x\right ) =c_{1}=C\). Therefore solution is\[ u_{E}\left ( x\right ) =Cx \] Hence\[ u\left ( x,t\right ) =v\left ( x,t\right ) +Cx \] \(v\left ( x,t\right ) \) is the solution to the PDE but with homogeneous B.C. Plugging (2) into (1) gives\[ \frac {\partial ^{2}v\left ( x,t\right ) }{\partial t^{2}}+\frac {\partial ^{2}u_{E}\left ( x,t\right ) }{\partial t^{2}}=c\left ( \frac {\partial ^{2}v\left ( x,t\right ) }{\partial x^{2}}+\frac {\partial ^{2}u_{E}\left ( x,t\right ) }{\partial x^{2}}\right ) \] But \(\frac {\partial ^{2}u_{E}\left ( x,t\right ) }{\partial x^{2}}=0\) and also \(\frac {\partial ^{2}u_{E}\left ( x,t\right ) }{\partial t^{2}}=0\), hence above becomes\[ \frac {\partial ^{2}v\left ( x,t\right ) }{\partial t^{2}}=c\frac {\partial ^{2}v\left ( x,t\right ) }{\partial x^{2}}\] With \(v\left ( x,t\right ) \) having now homogeneous B.C.\begin {align*} v\left ( 0,t\right ) & =0\\ \frac {\partial v\left ( L,t\right ) }{\partial x} & =0 \end {align*}
And initial conditions given by\begin {align*} v\left ( x,0\right ) & =u\left ( x,0\right ) -u_{E}\left ( x\right ) \\ & =0-Cx\\ & =-Cx \end {align*}
And\begin {align*} \frac {\partial v\left ( x,0\right ) }{\partial t} & =\frac {\partial u\left ( x,0\right ) }{\partial t}-\frac {\partial u_{E}\left ( x\right ) }{\partial t}\\ & =0 \end {align*}
In summary, the PDE to solve for \(v\left ( x,t\right ) \) is\begin {align} \frac {\partial ^{2}v\left ( x,t\right ) }{\partial t^{2}} & =c\frac {\partial ^{2}v\left ( x,t\right ) }{\partial x^{2}}\tag {3}\\ v\left ( 0,t\right ) & =0\nonumber \\ \frac {\partial v\left ( L,t\right ) }{\partial x} & =0\nonumber \\ v\left ( x,0\right ) & =-Cx\nonumber \\ \frac {\partial v\left ( x,0\right ) }{\partial t} & =0\nonumber \end {align}
Now we solve for PDE (3) for \(v\left ( x,t\right ) \) using separation of variables since the boundary conditions in space are now homogeneous. Let \(v\left ( x,t\right ) =X\left ( x\right ) T\left ( t\right ) \) and the PDE becomes\[ \frac {1}{c}T^{\prime \prime }X=X^{\prime \prime }T \] Dividing by \(XT\neq 0\) gives\begin {equation} \frac {1}{c}\frac {T^{\prime \prime }}{T}=\frac {X^{\prime \prime }}{X}=-\lambda \tag {4} \end {equation} Where \(\lambda \) is some real positive constant. The space ODE becomes\begin {align*} X^{\prime \prime }+\lambda X & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( L\right ) & =0 \end {align*}
Case \(\lambda <0\): Let The solution is\[ X\left ( x\right ) =c_{1}\cosh \left ( \sqrt {\lambda }x\right ) +c_{2}\sinh \left ( \sqrt {\lambda }x\right ) \] At \(x=0\)\[ 0=c_{1}\] Hence solution becomes \[ X\left ( x\right ) =c_{2}\sinh \left ( \sqrt {\lambda }x\right ) \] Taking derivative\[ X^{\prime }\left ( x\right ) =\sqrt {\lambda }c_{2}\cosh \left ( \sqrt {\lambda }x\right ) \] Using second boundary conditions gives\[ 0=\sqrt {\lambda }c_{2}\cosh \left ( \sqrt {\lambda }L\right ) \] Since \(\cosh \) is zero only when its argument is zero. But we assumed \(\sqrt {\lambda }\) not zero here, then \(c_{2}=0\) in only other choice. Hence this gives trivial solution. Therefore \(\lambda <0\) is not possible.
Case \(\lambda =0\)\begin {align*} X^{\prime \prime } & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( L\right ) & =0 \end {align*}
Solution is \(X\left ( x\right ) =c_{1}x+c_{2}\). First B.C. gives \(0=c_{2}\). Solution becomes \(X\left ( x\right ) =c_{1}x\). Second B.C. gives \(c_{1}=0\). This gives trivial solution again. Hence \(\lambda =0\) is not possible eigenvalue.
Case \(\lambda >0\): The solution becomes\[ X\left ( x\right ) =B_{1}\cos \left ( \sqrt {\lambda }x\right ) +B_{2}\sin \left ( \sqrt {\lambda }x\right ) \] AT first B.C.\[ 0=B_{1}\] Hence solution becomes\[ X\left ( x\right ) =B_{2}\sin \left ( \sqrt {\lambda }x\right ) \] Taking derivative\[ X^{\prime }\left ( x\right ) =\sqrt {\lambda }B_{2}\cos \left ( \sqrt {\lambda }x\right ) \] At second B.C.\[ 0=\sqrt {\lambda }B_{2}\cos \left ( \sqrt {\lambda }L\right ) \] To avoid trivial solution, take \(\cos \left ( \sqrt {\lambda }L\right ) =0\) or \(\sqrt {\lambda }L=\frac {\pi }{2},\frac {3\pi }{2},\frac {5\pi }{2},\cdots \) or \begin {align} \sqrt {\lambda } & =\frac {\pi }{2L},\frac {3\pi }{2L},\frac {5\pi }{2L},\cdots \nonumber \\ \sqrt {\lambda _{n}} & =\left ( \frac {n\pi }{2L}\right ) \qquad n=1,3,5,\cdots \nonumber \\ & =\frac {\left ( 2n+1\right ) \pi }{2L}\qquad n=0,1,2,\cdots \tag {5} \end {align}
Hence the space solution is\begin {equation} X_{n}\left ( x\right ) =B_{n}\sin \left ( \sqrt {\lambda _{n}}x\right ) \qquad n=1,3,5,\cdots \tag {6} \end {equation} Now we solve the time ODE \(T\left ( t\right ) \) from (4), which is\[ T^{\prime \prime }+\lambda cT=0 \] The solution is\[ T_{n}\left ( t\right ) =D_{n}\cos \left ( \sqrt {\lambda _{n}c}t\right ) +E_{n}\sin \left ( \sqrt {\lambda _{n}c}t\right ) \] Therefore\begin {align*} v\left ( x,t\right ) & =\sum _{n=0}^{\infty }T_{n}\left ( t\right ) X_{n}\left ( x\right ) \\ & =\sum _{n=0}^{\infty }\left ( D_{n}\cos \left ( \sqrt {\lambda _{n}c}t\right ) +E_{n}\sin \left ( \sqrt {\lambda _{n}c}t\right ) \right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \end {align*}
Where constant \(B_{n}\) merged with the other constants. Now At \(t=0\)\[ -Cx=\sum _{n=0}^{\infty }D_{n}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Applying orthogonality\begin {align*} -\int _{0}^{L}Cx\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx & =D_{n}\int _{0}^{L}\sin ^{2}\left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx\\ -C\int _{0}^{L}x\sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) dx & =D_{n}\frac {L}{2}\\ -C\left ( \frac {4\left ( -1\right ) ^{n}L^{2}}{\left ( \pi +2n\pi \right ) ^{2}}\right ) & =D_{n}\frac {L}{2}\\ D_{n} & =-C\frac {8\left ( -1\right ) ^{n}L}{\left ( \pi +2n\pi \right ) ^{2}} \end {align*}
Therefore\[ v\left ( x,t\right ) =\sum _{n=0}^{\infty }\left ( -C\frac {8\left ( -1\right ) ^{n}L}{\left ( \pi +2n\pi \right ) ^{2}}\cos \left ( \sqrt {\lambda _{n}c}t\right ) +E_{n}\sin \left ( \sqrt {\lambda _{n}c}t\right ) \right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \] Taking time derivative\[ \frac {\partial v\left ( x,t\right ) }{\partial t}=\sum _{n=0}^{\infty }\left ( C\frac {8\left ( -1\right ) ^{n}L}{\left ( \pi +2n\pi \right ) ^{2}}\frac {\left ( 2n+1\right ) \pi }{2L}\sin \left ( \sqrt {\lambda _{n}c}t\right ) +E_{n}\sqrt {\lambda _{n}c}\cos \left ( \sqrt {\lambda _{n}c}t\right ) \right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \] At \(t=0\)\[ 0=\sum _{n=0}^{\infty }E_{n}\sqrt {\lambda _{n}c}\sin \left ( \sqrt {\lambda _{n}}x\right ) \] Hence \(E_{n}=0\). Therefore solution becomes\[ v\left ( x,t\right ) =\sum _{n=0}^{\infty }-C\frac {8\left ( -1\right ) ^{n}L}{\left ( \pi +2n\pi \right ) ^{2}}\cos \left ( \sqrt {\lambda _{n}c}t\right ) \sin \left ( \sqrt {\lambda _{n}}x\right ) \] Therefore, since \(u\left ( x,t\right ) =v\left ( x,t\right ) +u_{E}\left ( x\right ) \) then\begin {equation} u\left ( x,t\right ) =Cx-C\sum _{n=0}^{\infty }\frac {8\left ( -1\right ) ^{n}L}{\left ( \pi +2n\pi \right ) ^{2}}\cos \left ( \frac {\left ( 2n+1\right ) \pi }{2L}\sqrt {c}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{2L}x\right ) \tag {7} \end {equation} This animation runs for 40 seconds for \(L=10,c=1,C=5\). The solution becomes\begin {equation} u\left ( x,t\right ) =5x-5\sum _{n=0}^{\infty }\frac {80\left ( -1\right ) ^{n}}{\left ( \pi +2n\pi \right ) ^{2}}\cos \left ( \frac {\left ( 2n+1\right ) \pi }{20}\sqrt {10}t\right ) \sin \left ( \frac {\left ( 2n+1\right ) \pi }{20}x\right ) \tag {7} \end {equation}
Code used for the above is
L=10;c=1; C0=5; sqrtLam= (2 n +1) Pi/(2 L); Manipulate[ mysol=C0 x-C0 Sum[(8.0(-1)^n L)/(Pi+2n \[Pi])^2 Sin[sqrtLam x] Cos[sqrtLam Sqrt[c] t],{n,0,numberOfTerms}% ]; Grid[{{Row[{"Solution at time = ",i}]}, {Plot[mysol/.t->i,{x,0,10},PlotRange->{{0,10},{-10,100}}% ,ImageSize->500,GridLines->Automatic,GridLinesStyle->LightGray,PlotStyle->Red]}% }], {{i,0,"time"},0,100,.1,Appearance->"Labeled"}, {{numberOfTerms,1,"n"},1,1000,1,Appearance->"Labeled"} ]
____________________________________________________________________________________