Added May 26, 2019.
Solve for \(u(x,t)\) for all \(x\) and \(t>0\) with \(u(x,0)=f(x)\) and \(u_t(x,0)=g(x)\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0]==f[x], Derivative[0,1][u][x,0]==g[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); 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],u(x,t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
From Mathematica DSolve help pages (slightly modified)
Solve for \(u(x,t)\) with \(t>0\) on real line
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] + D[u[x, t], x, t] == c^2*D[u[x, t], {x, 2}]; sol = AbsoluteTiming[TimeConstrained[DSolve[pde, u[x, t], {x, t},Assumptions->c>0], 60*10]];
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t$2)+diff(u(x,t),t,x)=c^2*diff(u(x,t),x$2); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve(pde,u(x,t)) assuming t>0,x>0),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added December 20, 2018.
Solve
With initial conditions not at zero
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 1] == g[x], Derivative[0, 1][u][x, 1] == h[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic}, u[x, t], {x, t}, Assumptions -> {t > 0,c>0, x > 0}], 60*10]];
Maple ✓
restart; pde := diff(u(x, t), t$2) = c^2*(diff(u(x, t), x$2)) + f(x, t); ic := u(x, 1) = g(x),eval(diff(u(x,t),t),t=1)=h(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic], u(x, t)) assuming t>0, x>0),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Taken from Mathematica DSolve help pages.
Solve initial value wave PDE on infinite domain
With initial conditions
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}]; ic = {u[x, 0] == E^(-x^2), Derivative[0, 1][u][x, 0] == 1}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t), t$2) = diff(u(x,t), x$2); ic := u(x, 0) = exp(-x^2), (D[2](u))(x,0) = 1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic], u(x, t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Taken from Mathematica DSolve help pages.
Solve initial value wave PDE on infinite domain
With initial conditions
Mathematica ✓
ClearAll["Global`*"]; pde = {D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}] + m}; ic = {u[x, 0] == Sin[x] - Cos[3*x]/E^(Abs[x]/6), Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x, t), t$2) = diff(u(x, t), x$2) + m; ic := u(x, 0) = sin(x) - cos(3*x)/exp(abs(x)/6), (D[2](u))(x, 0) =0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic], u(x, t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
This was first solved analytically by (Krvskal, Zabrsky 1965).
Solve
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] + 6*u[x, t]*D[u[x, t], x] + D[u[x, t], {x, 3}] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[pde, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t)+6*u(x,t)*diff(u(x,t),x)+diff(u(x,t),x$3)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve(pde,u(x,t)) assuming t>0,x>0),output='realtime'));
Hand solution
Solve
Assuming special solution \(u=f\left ( \xi \right ) \) where \(\xi =x-ct\), this PDE is transformed to non-linear first order ODE
The above is solved analytically (Krvskal, Zabrsky 1965) and the solution is
Tall waves move fast but have smaller period, while short wave move slow. Tall wave pass through short wave and leave in same shape they entered. Here are two animations and the above solution. This first animation has one tall wave passing though short wave
Source code used for the above
This animation shows three waves interacting
Source code used for the above
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
From Mathematica DSolve help pages. Inhomogeneous hyperbolic PDE with constant coefficients.
Solve for \(u(x,t)\)
Mathematica ✓
ClearAll["Global`*"]; ode = 3*D[u[x, t], {x, 2}] - D[u[x, t], {t, 2}] + D[u[x, t], x, t] == 1; sol = AbsoluteTiming[TimeConstrained[DSolve[ode, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := 3*diff(u(x, t), x$2) - diff(u(x, t),t$2)+diff(u(x, t), x,t) =1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve(pde, u(x, t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added May 23, 2019.
From Math 5587 midterm I, Fall 2016, practice exam, problem 10.
Solve for \(u(x,t)\) with \(u(x,0)=\sin (x)\) and \(u_t(x,0)=\cos (x)\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0]==Sin[x], Derivative[0,1][u][x,0]==Cos[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)=sin(x), eval( diff(u(x,t),t),t=0)=cos(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added May 23, 2019.
From Math 5587 midterm I, Fall 2016, practice exam, problem 11.
Solve for \(u(x,t)\) with \(u(x,0)=x^2\) and \(u_t(x,0)=x\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0]==x^2, Derivative[0,1][u][x,0]==x}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)=x^2, eval( diff(u(x,t),t),t=0)=x; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added May 23, 2019.
From Math 5587 midterm I, Fall 2016, practice exam, problem 12.
Solve for \(u(x,t)\) with \(u(x,0)=0\) and \(u_t(x,0)=\frac {4 x}{x^2+1}\)
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]==4*x/(x^2+1)}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)=0, eval( diff(u(x,t),t),t=0)=4*x/(x^2+1); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added January 9, 2020
Solve for \(u(x,t)\) with \(u(x,0)=\frac {1}{x^2+1}\) and \(u_t(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0]==1/(x^2+1), Derivative[0,1][u][x,0]==0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)=1/(1+x^2), D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
Hand solution
Solve the wave equation \(u_{tt}=u_{xx}\) for infinite domain \(-\infty <x<\infty \) with initial position \(u\left ( x,0\right ) =\frac {1}{1+x^{2}}\) and zero initial velocity \(g\left ( x\right ) =0\).
The solution for wave PDE \(u_{tt}=a^{2}u_{xx}\) on infinite domain can be given as either series solution, or using D’Alembert solution. Using D’Alembert, the solution is
But here \(c=1\) and \(g\left ( x\right ) \) is zero. Therefore the above simplifies to
Since \(f\left ( x\right ) =\frac {1}{1+x^{2}}\), the above becomes
Animation is below
Source code used for the above
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added January 10, 2020
Solve for \(u(x,t)\) with \(u(x,0)=\sin (x)\) from \(-\pi <x<\pi \) and zero everywhere else and \(u_t(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}]; ic = {u[x, 0] == Piecewise[{{Sin[x], -Pi < x < Pi}, {0, True}}], Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)= piecewise(-Pi<x and x<Pi,sin(x), true,0) , D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
Hand solution
The solution for wave PDE \(u_{tt}=u_{xx}\) on infinite domain using D’Alembert solution with zero initial velocity is
The following is an animation Here is animation for 10 seconds.
Animation is below
Source code used for the above
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added May 26, 2019.
Taken from Final exam, Math 5587 UMN, Fall 2016.
Solve for \(u(x,t)\) for all \(x\) and \(t>0\) with \(u(x,0)=\sin (x)\) and \(u_t(x,0)=-2 x e^{-x^2}\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0]==Sin[x], Derivative[0,1][u][x,0]==-2*x*Exp[-x^2]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic := u(x,0)=sin(x), eval( diff(u(x,t),t),t=0)=-2*x*exp(-x^2); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added Sept, 15, 2019.
Taken from Peter Olver textbook, Introduction to Partial differential equations. Problem 2.4.2
Solve for \(u(x,t)\) for all \(x\) and \(t>0\) with \(u(x,0)=1\) for \(1<x<2\) and zero otherwise. \(u_t(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == D[u[x,t],{x,2}]; ic = {u[x,0] == Piecewise[{{1, 1 < x < 2}, {0, True}}], Derivative[0,1][u][x,0]==0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= diff(u(x,t),x$2); ic:=u(x,0)=piecewise(1<x and x<2,1,true,0),eval( diff(u(x,t),t),t=0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
Hand solution
Solve the wave equation \(u_{tt}=u_{xx}\) when the initial displacement is the box function \(u\left ( 0,x\right ) =\left \{ \begin {array} [c]{ccc}1 & & 1<x<2\\ 0 & & \text {otherwise}\end {array} \right . \), while the initial velocity is zero.
Solution
d’Alembert solution of the wave equation is
Where \(c\) is the wave speed which is \(c=1\) in this problem and \(f\left ( x\right ) =u\left ( 0,x\right ) \) and \(g\left ( x\right ) =u_{t}\left ( 0,x\right ) =0\) in this problem. Hence the above simpifies to
The following is an animation of the solution
Source code used for the above
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added Oct 8, 2019
Exam 1 problem, math 5587, fall 2019, UMN.
Solve for \(u(x,t)\)
With initial conditions \(u(x,0)=\sin x,u_t(x,0)=\cos x\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t,2}] == 4* D[u[x,t],{x,2}]+ Cos[t]; ic = {u[x,0]== Sin[x], Derivative[0,1][u][x,0]==Cos[x]}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)= 4*diff(u(x,t),x$2)+cos(t); ic:=u(x,0)=sin(x),D[2](u)(x,0)=cos(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
Hand solution
Solve the wave equation \(u_{tt}=4u_{xx}+\cos t\) when initial conditions \(u\left ( x,0\right ) =\sin x,u_{t}\left ( x,0\right ) =\cos x\)
Solution
d’Alembert solution of the wave equation is
Where \(c\) is the wave speed which is \(c=2\) in this problem and \(f\left ( x\right ) =u\left ( 0,x\right ) =\sin x\) and \(g\left ( x\right ) =u_{t}\left ( 0,x\right ) =\cos x\) and the force \(F\left ( t\right ) =\cos t\) in this problem. Hence the above simpifies to
But \(\frac {1}{4}\int _{x-2t}^{x+2t}\cos \left ( s\right ) ds=\frac {1}{4}\left [ \sin \left ( s\right ) \right ] _{x-2t}^{x+2t}=\frac {1}{4}\left ( \sin \left ( x+2t\right ) -\sin \left ( x-2t\right ) \right ) \). Hence the above becomes
But
Integration by parts. \(udv=uv-\int vdu\). Let \(u=s,dv=\cos s\), then \(du=1,v=\sin \left ( s\right ) \), then
Using (2) in (1) gives
Substituting the above in (1A) gives
The following is an animation of the solution
Source code used for the above
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Added January 8, 2020
Problem 6.3.27 Introduction to Partial Differential Equations by Peter Olver, ISBN 9783319020983.
Consider the wave equation \(u_{tt}=c^{2}u_{xx}\) on the line \(-\infty <x<\infty \). Use the d’Alembert formula to solve the initial value problem \(u\left ( x,0\right ) =\delta \left ( x-a\right ) ,u_{t}\left ( x,0\right ) =0\).
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], {t, 2}] == c^2*D[u[x, t], {x, 2}]; ic = {u[x, 0] == DiracDelta[x - a], Derivative[0, 1][u][x, 0] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}, Assumptions -> a > 0], 60*10]];
Maple ✓
restart; pde := diff(u(x,t),t$2)=c^2*diff(u(x,t),x$2); ic := u(x,0)=Dirac(x-a), D[2](u)(x,0)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t)) assuming a>0),output='realtime'));
Hand solution
In (2.82), the function \(f\) is the initial conditions and the function \(g\) is the initial velocity. Hence the above becomes
But \(\delta \left ( \left ( x-a\right ) -ct\right ) =\delta \left ( x-a-ct\right ) =\delta \left ( x-\left ( a+ct\right ) \right ) \) and \(\delta \left ( \left ( x-a\right ) +ct\right ) =\delta \left ( x-a+ct\right ) =\delta \left ( x-\left ( a-ct\right ) \right ) \). Hence the above becomes
The above is two half strength delta pulses, one traveling to the left and one traveling to the right from the starting position.
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
From Mathematica DSolve help pages
Solve for \(u(x,t),v(x,t)\)
With initial conditions
Mathematica ✓
ClearAll["Global`*"]; eqns = {D[u[x, t], t] == D[v[x, t], x] + 1, D[v[x, t], t] == -D[u[x, t], x] - 1}; ic = {u[x, 0] == Cos[x]^2, v[x, 0] == Sin[x]}; sol = AbsoluteTiming[TimeConstrained[FullSimplify[DSolve[{eqns, ic}, {u[x, t], v[x, t]}, {x, t}]], 60*10]];