20 Wave PDE on finite length string

20.1 Both ends fixed, zero initial position, non-zero initial velocity, with extra term present
20.2 One end fixed, another free, both initial conduitions non zero, and source that depends on time and space
20.3 Both ends fixed, no initial conduitions give and no source (Logan p. 28)
20.4 One end fixed, other free, initial position not zero, initial velocity zero, no source (Logan p. 130)
20.5 Both ends fixed end, initial conditions zero, with source as generic function that depends on time and space (Logan p. 149)
20.6 Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (a))
20.7 Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (b))
20.8 Both ends fixed, initial conditions both not zero, No source
20.9 Both ends fixed end, initial conditions both not zero, and with constant source
20.10 Both ends fixed end, with source (Logan p. 213)
20.11 Telegraphy PDE, both ends fixed with damping
20.12 Both ends fixed. Initial velocity zero. Dispersion term present
20.13 Both ends fixed, non-zero initial position
20.14 Both ends fixed, zero initial position, non zero initial velocity, with source that depends on time and space
20.15 Left end fixed, right end oscillates, initially at rest. With source that depends on time and space

____________________________________________________________________________________

20.1 Both ends fixed, zero initial position, non-zero initial velocity, with extra term present

problem number 130

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[u, x, t, k, L]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; u:='u'; 
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 ( -1+ \left ( -1 \right ) ^{n} \right ) \sin \left ( nx \right ) \sin \left ( \sqrt {{n}^{2}+1}t \right ) }{\pi \,\sqrt {{n}^{2}+1}n}} \]

____________________________________________________________________________________

20.2 One end fixed, another free, both initial conduitions non zero, and source that depends on time and space

problem number 131

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

ClearAll[u, x, t, k, L]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; u:='u'; 
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 ( -2+x \right ) \left ( t-2 \right ) \]

____________________________________________________________________________________

20.3 Both ends fixed, no initial conduitions give and no source (Logan p. 28)

problem number 132

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

ClearAll[u, t, x, L, c]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u'; 
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 ) \]

____________________________________________________________________________________

20.4 One end fixed, other free, initial position not zero, initial velocity zero, no source (Logan p. 130)

problem number 133

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

ClearAll[u, t, x, L, c, f]; 
 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 -> {0 <= x <= L}], 60*10]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';f:='f'; 
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 {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 ) \]

____________________________________________________________________________________

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

problem number 134

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[u, t, x, c, p]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';p:='p'; 
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 ) }{\pi \,nc}} \right ) \,{\rm d}\tau \]

____________________________________________________________________________________

20.6 Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (a))

problem number 135

Added Nov 25, 2018.

This is problem 8.5.2 (a), Richard Haberman applied partial differential 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 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[u, t, x, c, Q, L, f]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';Q:='Q'; 
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 {n\pi \,x}{L}} \right ) \cos \left ( {\frac {\pi \,nct}{L}} \right ) } \right ) +\int _{0}^{t}\!\sum _{n=1}^{\infty } \left ( 2\,{\frac {1}{\pi \,nc}\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 {\pi \,nc \left ( t-\tau \right ) }{L}} \right ) } \right ) \,{\rm d}\tau \]

____________________________________________________________________________________

20.7 Both ends fixed end, initial position given, zero initial velocity, with source that depends on time and space (Haberman 8.5.2 (b))

problem number 136

Added Nov 25, 2018.

This is problem 8.5.2 (b), Richard Haberman applied partial differential 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

ClearAll[u, t, x, c, Q, L, f, g, w]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';g:='Q';w:='w'; 
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'));
 

\[ \text {Bad latex generated} \]

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 \]

____________________________________________________________________________________

20.8 Both ends fixed, initial conditions both not zero, No source

problem number 137

Added July 2, 2018.

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

ClearAll[v, t, t]; 
 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 }\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:='v';x:='x';t:='t'; 
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 ( n\pi \,x \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 ) }} \]

____________________________________________________________________________________

20.9 Both ends fixed end, initial conditions both not zero, and with constant source

problem number 138

Added July 2, 2018.

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

ClearAll[u, t, x, c, L, f, g]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
interface(showassumed=0); 
x:='x';t:='t';a:='a';f='f';L:='L';g:='g'; 
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 {n\pi \,x}{L}} \right ) \left ( 2\,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}xc-\pi \,\cos \left ( {\frac {\pi \,nct}{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 ) } \]

____________________________________________________________________________________

20.10 Both ends fixed end, with source (Logan p. 213)

problem number 139

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

ClearAll[u, t, x, c, A, L]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L';c:='c';u:='u';A:='A'; 
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 {n\pi \,x}{L}} \right ) \cos \left ( {\frac {\pi \,nct}{L}} \right ) }{c}^{2} \right ) } \]

____________________________________________________________________________________

20.11 Telegraphy PDE, both ends fixed with damping

problem number 140

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

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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';f:='f'; 
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 ) =\sum _{n=1}^{\infty } \left ( {\frac {\int _{0}^{\pi }\!\sin \left ( nx \right ) f \left ( x \right ) \,{\rm d}x\sin \left ( nx \right ) \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.

____________________________________________________________________________________

20.12 Both ends fixed. Initial velocity zero. Dispersion term present

problem number 141

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

ClearAll[a, u, x, t, gamma]; 
 pde = (1*D[u[x, t], {t, 2}])/a^2 + gamma^2*u[x, 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] == Sin[x]^2}; 
 sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
 

\[ \text {Failed} \] Due to adding dispersion term

Maple

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u';f:='f';a:='a';g:='g'; 
interface(showassumed=0); 
pde:=1/a^2*diff(u(x,t),t$2)+g^2*u(x,t)=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 ( a\sqrt {{g}^{2}+{n}^{2}}t \right ) \left ( -1+ \left ( -1 \right ) ^{n} \right ) }{\pi \,n \left ( {n}^{2}-4 \right ) }}\pi +8\,\sin \left ( x \right ) \cos \left ( a\sqrt {{g}^{2}+1}t \right ) \right ) } \]

____________________________________________________________________________________

20.13 Both ends fixed, non-zero initial position

problem number 142

Added March 9, 2018.

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

ClearAll[u, t, x, n]; 
 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

 
x:='x'; t:='t'; L:='L'; c:='c';u:='u'; 
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 ( -1+ \left ( -1 \right ) ^{n} \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

____________________________________________________________________________________

20.14 Both ends fixed, zero initial position, non zero initial velocity, with source that depends on time and space

problem number 143

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[u, t, x]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; u:='u'; 
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 }{\frac { \left ( -{\pi }^{2} \left ( -1 \right ) ^{n}{n}^{2}+{\pi }^{2}{n}^{2}+2\, \left ( -1 \right ) ^{1+n}+1 \right ) \cos \left ( \pi \,n \left ( -x+t \right ) \right ) -\pi \, \left ( -1 \right ) ^{n}n\sin \left ( \pi \,n \left ( -x+t \right ) \right ) + \left ( {\pi }^{2} \left ( -1 \right ) ^{n}{n}^{2}-{\pi }^{2}{n}^{2}+2\, \left ( -1 \right ) ^{n}-1 \right ) \cos \left ( \pi \,n \left ( x+t \right ) \right ) +\pi \,n \left ( 2\,{{\rm e}^{-t}} \left ( -1 \right ) ^{1+n}\sin \left ( n\pi \,x \right ) +\sin \left ( \pi \,n \left ( x+t \right ) \right ) \left ( -1 \right ) ^{n} \right ) }{{\pi }^{2}{n}^{2} \left ( {\pi }^{2}{n}^{2}+1 \right ) }} \]

____________________________________________________________________________________

20.15 Left end fixed, right end oscillates, initially at rest. With source that depends on time and space

problem number 144

Added December 20, 2018.

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[u, t, x]; 
 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]];
 

\[ \text {Failed} \]

Maple

 
x:='x'; t:='t'; u:='u'; 
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 ( x\sin \left ( t \right ) +\sum _{n=1}^{\infty }-2\,{\frac { \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 ) \left ( -1 \right ) ^{n}}{\pi \,{n}^{4} \left ( 4\,{n}^{2}-1 \right ) }}\pi \right ) } \]