### 17 Wave PDE on ﬁnite length string

_______________________________________________________________________________________

#### 17.1 With zero initial position and velocity, and with source term (Logan p. 115)

problem number 114

This is problem at page 115, David J Logan textbook, applied PDE textbook.

Falling cable lying on a table that is suddenly removed.

$\frac{\partial ^2 u}{\partial t^2} = c^2 \frac{\partial ^2 u}{\partial x^2} - g$

With boundary condition

\begin{align*} u(0,t) &= 0 \end{align*}

And initial conditions \begin{align*} u(x,0) &= 0 \\ \frac{\partial u}{\partial t}(x,0) &= 0 \end{align*}

Mathematica

$\left \{\left \{u(x,t)\to \frac{1}{2} g \left (\left (t-\frac{x}{c}\right )^2 \theta \left (t-\frac{x}{c}\right )-t^2\right )-c_1 \delta \left (t-\frac{x}{c}\right )\right \}\right \}$

Maple

$u \left ( x,t \right ) =1/2\,{\frac{g}{{c}^{2}} \left ({\it Heaviside} \left ( t-{\frac{x}{c}} \right ) \left ( tc-x \right ) ^{2}-{c}^{2}{t}^{2} \right ) }$

_______________________________________________________________________________________

#### 17.2 Both ends ﬁxed, zero initial position, non-zero initial velocity, with extra term present

problem number 115

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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=u^{(2,0)}(x,t)-u(x,t),\left \{u(x,0)=0,u^{(0,1)}(x,0)=1\right \},\{u(0,t)=0,u(\pi ,t)=0\}\right \},u(x,t),\{x,t\}\right ]$

Maple

$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}}$

_______________________________________________________________________________________

#### 17.3 One end ﬁxed, another free, both initial conduitions non zero, and source that depends on time and space

problem number 116

Added July 2, 2018. Taken from Maple 2018.1 improvement to PDE document.

Solve $-\frac{\partial ^2 u}{\partial t^2} + u(x,t)= \frac{\partial ^2 u}{\partial x^2} + 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 ) \\ \end{align*}

Mathematica

$\text{DSolve}\left [\left \{u(x,t)-u^{(0,2)}(x,t)=u^{(2,0)}(x,t)+2 e^{-t} \left (\frac{t}{2}-\frac{x^2}{2}+x-1\right ),\left \{u(x,0)=x^2-2 x,u(x,1)=u\left (x,\frac{1}{2}\right )+\frac{\frac{x^2}{2}-x}{e}-\frac{\frac{3 x^2}{4}-\frac{3 x}{2}}{\sqrt{e}}\right \},\left \{u(0,t)=0,u^{(1,0)}(1,t)=0\right \}\right \},u(x,t),x,t\right ]$

Maple

$u \left ( x,t \right ) =-1/2\,{{\rm e}^{-t}}x \left ( -2+x \right ) \left ( -2+t \right )$

_______________________________________________________________________________________

#### 17.4 Both ends ﬁxed, no initial conduitions give and no source (Logan p. 28)

problem number 117

This is problem at page 28, David J Logan textbook, applied PDE textbook.

$\frac{\partial ^2 u}{\partial t^2} = c^2 \frac{\partial ^2 u}{\partial x^2}$

With boundary condition

\begin{align*} u(0,t) &= 0 \\ u(L,t) &= 0 \end{align*}

Mathematica

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t),\{u(0,t)=0,u(L,t)=0\}\right \},u(x,t),\{x,t\},\text{Assumptions}\to \{L>0\}\right ]$

Maple

$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 )$

_______________________________________________________________________________________

#### 17.5 One end ﬁxed, other free, initial position not zero, initial velocity zero, no source (Logan p. 130)

problem number 118

This is problem at page 130, David J Logan textbook, applied PDE textbook.

$\frac{\partial ^2 u}{\partial t^2} = c^2 \frac{\partial ^2 u}{\partial x^2}$

With boundary conditions

\begin{align*} \frac{\partial u}{\partial x}(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) &= f(x) \end{align*}

Mathematica

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t),\left \{u(0,t)=0,u^{(1,0)}(L,t)=0\right \},\left \{u^{(0,1)}(x,0)=0,u(x,0)=f(x)\right \}\right \},u(x,t),\{x,t\},\text{Assumptions}\to \{0\leq x\leq L\}\right ]$

Maple

$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{c \left ( 1+2\,n \right ) \pi \,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 )$

_______________________________________________________________________________________

#### 17.6 Both ends ﬁxed end, initial conditions zero, with source as generic function that depends on time and space (Logan p. 149)

problem number 119

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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t)+p(x,t),\{u(0,t)=0,u(\pi ,t)=0\},\left \{u(x,0)=0,u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$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$

_______________________________________________________________________________________

#### 17.7 Both ends ﬁxed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (a))

problem number 120

This is problem 8.5.2 (a), Richard Haberman applied partial diﬀerential equations book, 5th edition

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*}

Solve the initial value problem.

my hand solution in ﬁle feb_24_2019_4_24_pm.tex, but I need to go over my solution again to make sure it is correct.

Mathematica

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t)+Q(x,t),\{u(0,t)=0,u(L,t)=0\},\left \{u(x,0)=f(x),u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$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{n\pi \,x}{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{n\pi \,x}{L}} \right ) Q \left ( x,\tau \right ) \,{\rm d}x\sin \left ({\frac{n\pi \,x}{L}} \right ) \sin \left ({\frac{cn\pi \, \left ( t-\tau \right ) }{L}} \right ) } \right ) \,{\rm d}\tau$

_______________________________________________________________________________________

#### 17.8 Both ends ﬁxed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (b))

problem number 121

This is problem 8.5.2 (b), Richard Haberman applied partial diﬀerential equations book, 5th edition

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*}

Solve the initial value problem.

See my solution at HW 9, Math 322. UW Madison.

Mathematica

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t)+g(x) \cos (t w),\{u(0,t)=0,u(L,t)=0\},\left \{u(x,0)=f(x),u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$u \left ( x,t \right ) ={\frac{1}{\pi \,c} \left ( -2\,\sum _{n=1}^{\infty } \left ( -{\frac{1}{2\,{\pi }^{2}{c}^{2}{n}^{3}-2\,{L}^{2}n{w}^{2}}\int _{0}^{L}\!\sin \left ({\frac{n\pi \,x}{L}} \right ) Q \left ( x \right ) \,{\rm d}x \left ( \left ( -L\cos \left ( wt \right ) +\sin \left ( wt \right ) t \left ( cn\pi -Lw \right ) \right ) \left ( cn\pi +Lw \right ) \cases{1&{\frac{-cn\pi +Lw}{w}}=0\cr 0&otherwise\cr }- \left ( L\cos \left ( wt \right ) +\sin \left ( wt \right ) t \left ( cn\pi +Lw \right ) \right ) \left ( cn\pi -Lw \right ) \cases{1&{\frac{cn\pi +Lw}{w}}=0\cr 0&otherwise\cr }+2\,L\cos \left ( wt \right ) \pi \,cn \right ) \sin \left ({\frac{n\pi \,x}{L}} \right ) } \right ) +2\,\sum _{n=1}^{\infty } \left ({\frac{L}{2\,{\pi }^{2}{c}^{2}{n}^{3}-2\,{L}^{2}n{w}^{2}}\sin \left ({\frac{n\pi \,x}{L}} \right ) \left ( \left ( cn\pi +Lw \right ) \cases{1&{\frac{-cn\pi +Lw}{w}}=0\cr 0&otherwise\cr }+ \left ( cn\pi -Lw \right ) \cases{1&{\frac{cn\pi +Lw}{w}}=0\cr 0&otherwise\cr }-2\,cn\pi \right ) \int _{0}^{L}\!\sin \left ({\frac{n\pi \,x}{L}} \right ) Q \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 ﬁnd $$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 ﬁnd $$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)$$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}$$ 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 ﬁnd the particular solution. Will solve using method of undetermined coeﬃcients.

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 ﬁrst 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 ﬁnd $$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 ﬁnd $$c_{2_{n}}$$. For this we need to diﬀerentiate 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 ﬁnal 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$$\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}$$ 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 coeﬃcients 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 ﬁnd $$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$

_______________________________________________________________________________________

#### 17.9 Both ends ﬁxed, initial conditions both not zero, No source

problem number 122

Taken from Maple 2018.1 improvements to PDE’s document.

Solve

$\frac{\partial ^2 v}{\partial t^2} = \frac{\partial ^2 v}{\partial x^2}$

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

$\left \{\left \{v(x,t)\to \underset{n=1}{\overset{\infty }{\sum }}\left (\frac{2 (-1)^n \cos (n \pi t)}{\pi ^3 n^3+\pi n}+\frac{\left (-2 \left (-1+(-1)^n\right ) \pi ^2 n^2-4 (-1)^n+2\right ) \sin (n \pi t)}{\pi ^4 n^4+\pi ^2 n^2}\right ) \sin (n \pi x)\right \}\right \}$

Maple

$v \left ( x,t \right ) =\sum _{n=1}^{\infty }-2\,{\frac{ \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 ) \sin \left ( n\pi \,x \right ) }{{\pi }^{2}{n}^{2} \left ({\pi }^{2}{n}^{2}+1 \right ) }}$

_______________________________________________________________________________________

#### 17.10 Both ends ﬁxed end, initial conditions both not zero, and with constant source

problem number 123

Third example, from Maple 2018.1 improvements to PDE’s document.

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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t)+1,\{u(0,t)=0,u(L,t)=0\},\left \{u(x,0)=f(x),u^{(0,1)}(x,0)=g(x)\right \}\right \},u(x,t),\{x,t\},\text{Assumptions}\to L>0\right ]$

Maple

$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{n\pi \,x}{L}} \right ) \left ( 2\,L\sin \left ({\frac{cn\pi \,t}{L}} \right ) \int _{0}^{L}\!\sin \left ({\frac{n\pi \,x}{L}} \right ) g \left ( x \right ) \,{\rm d}xc-\pi \,\cos \left ({\frac{cn\pi \,t}{L}} \right ) \int _{0}^{L}\!\sin \left ({\frac{n\pi \,x}{L}} \right ) \left ( -2\,f \left ( x \right ){c}^{2}+Lx-{x}^{2} \right ) \,{\rm d}xn \right ) } \right ){c}^{2}+Lx-{x}^{2} \right ) }$

_______________________________________________________________________________________

#### 17.11 Both ends ﬁxed end, with source (Logan p. 213)

problem number 124

This is problem at page 213, David J Logan textbook, applied PDE textbook.

$\frac{\partial ^2 u}{\partial t^2} = c^2 \frac{\partial ^2 u}{\partial x^2} + 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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=c^2 u^{(2,0)}(x,t)+A x,\{u(0,t)=0,u(L,t)=0\},\left \{u(x,0)=0,u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$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{n\pi \,x}{L}} \right ) \cos \left ({\frac{cn\pi \,t}{L}} \right ) }{c}^{2} \right ) }$

_______________________________________________________________________________________

#### 17.12 Telegraphy PDE, both ends ﬁxed with damping

problem number 125

Solve $\frac{\partial ^2 u}{\partial t^2} + 2 \frac{\partial u}{\partial t} = c^2 \frac{\partial ^2 u}{\partial x^2}$

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

$\text{DSolve}\left [\left \{2 u^{(0,1)}(x,t)+u^{(0,2)}(x,t)=u^{(2,0)}(x,t),\{u(0,t)=0,u(\pi ,t)=0\},\left \{u^{(0,1)}(x,0)=0,u(x,0)=f(x)\right \}\right \},u(x,t),x,t\right ]$

Maple

$u \left ( x,t \right ) =\sum _{n=1}^{\infty } \left ({\frac{\sin \left ( nx \right ) \int _{0}^{\pi }\!\sin \left ( nx \right ) f \left ( x \right ) \,{\rm d}x \left ( \left ( -1+\sqrt{-{n}^{2}+1} \right ){{\rm e}^{- \left ( \sqrt{-{n}^{2}+1}+1 \right ) t}}+{{\rm e}^{ \left ( -1+\sqrt{-{n}^{2}+1} \right ) t}} \left ( \sqrt{-{n}^{2}+1}+1 \right ) \right ) }{\sqrt{-{n}^{2}+1}\pi }} \right )$ But $$n = 1$$ should not be included.

_______________________________________________________________________________________

#### 17.13 Both ends ﬁxed. Initial velocity zero. Dispersion term present

problem number 126

Solve $\frac{1}{a^2} \frac{\partial ^2 u}{\partial t^2} + \gamma ^2 u(x,t) = c^2 \frac{\partial ^2 u}{\partial x^2}$

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

$\text{DSolve}\left [\left \{\frac{u^{(0,2)}(x,t)}{a^2}+\gamma ^2 u(x,t)=u^{(2,0)}(x,t),\{u(0,t)=0,u(\pi ,t)=0\},\left \{u^{(0,1)}(x,0)=0,u(x,0)=\sin ^2(x)\right \}\right \},u(x,t),\{x,t\}\right ]$ Due to adding dispersion term

Maple

$u \left ( x,t \right ) =1/3\,{\frac{1}{\pi } \left ( 3\,\sum _{n=3}^{\infty }4\,{\frac{\sin \left ( nx \right ) \cos \left ( a\sqrt{{g}^{2}+{n}^{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 ( a\sqrt{{g}^{2}+1}t \right ) \right ) }$

_______________________________________________________________________________________

#### 17.14 Both ends ﬁxed, non-zero initial position

problem number 127

Solve $\frac{\partial ^2 u}{\partial t^2} = 4 \frac{\partial ^2 u}{\partial x^2}$

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

$\left \{\left \{u(x,t)\to \underset{n=1}{\overset{\infty }{\sum }}\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

$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

_______________________________________________________________________________________

#### 17.15 Both ends ﬁxed, zero initial position, non zero initial velocity, with source that depends on time and space

problem number 128

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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=u^{(2,0)}(x,t)+e^{-t} x,\{u(0,t)=0,u(1,t)=0\},\left \{u(x,0)=0,u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$u \left ( x,t \right ) =\sum _{n=1}^{\infty }{\frac{ \left ( -{\pi }^{2} \left ( -1 \right ) ^{n}{n}^{2}+{\pi }^{2}{n}^{2}-2\, \left ( -1 \right ) ^{n}+1 \right ) \cos \left ( n\pi \, \left ( -x+t \right ) \right ) -\pi \, \left ( -1 \right ) ^{n}n\sin \left ( n\pi \, \left ( -x+t \right ) \right ) + \left ({\pi }^{2} \left ( -1 \right ) ^{n}{n}^{2}-{\pi }^{2}{n}^{2}-2\, \left ( -1 \right ) ^{1+n}-1 \right ) \cos \left ( n\pi \, \left ( x+t \right ) \right ) + \left ( -1 \right ) ^{n}\pi \,n \left ( -2\,\sin \left ( n\pi \,x \right ){{\rm e}^{-t}}+\sin \left ( n\pi \, \left ( x+t \right ) \right ) \right ) }{{\pi }^{2}{n}^{2} \left ({\pi }^{2}{n}^{2}+1 \right ) }}$

_______________________________________________________________________________________

#### 17.16 Left end ﬁxed, right end oscillates, initially at rest. With source that depends on time and space

problem number 129

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

$\text{DSolve}\left [\left \{u^{(0,2)}(x,t)=4 u^{(2,0)}(x,t)+(t+1) x,\{u(0,t)=0,u(\pi ,t)=\sin (t)\},\left \{u(x,0)=0,u^{(0,1)}(x,0)=0\right \}\right \},u(x,t),\{x,t\}\right ]$

Maple

$u \left ( x,t \right ) ={\frac{1}{\pi } \left ( \sum _{n=1}^{\infty }-2\,{\frac{ \left ( -1 \right ) ^{n} \left ( 1/2\,\cos \left ( nx-t \right ){n}^{3}-1/2\,\cos \left ( nx+t \right ){n}^{3}+\sin \left ( nx \right ) \left ( \left ( -2\,{n}^{4}-1/2\,\pi \,{n}^{2}+\pi /8 \right ) \sin \left ( 2\,nt \right ) +n \left ( n+1/2 \right ) \left ( n-1/2 \right ) \pi \, \left ( t-\cos \left ( 2\,nt \right ) +1 \right ) \right ) \right ) }{\pi \,{n}^{4} \left ( 4\,{n}^{2}-1 \right ) }}\pi +x\sin \left ( t \right ) \right ) }$