Added Sept 12, 2019.
Taken from Peter Olver textbook, Introduction to Partial differential equations.
Solve for \(u(t,x)\) in \(u_t+2 u_x = 0\) with IC \(u(-1,x)=\frac {x}{1+x^2}\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[t, x], {t}] +2* D[u[t, x], {x}] == 0; ic = u[-1,x]==x/(1+x^2); sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[t, x], {t, x}], 60*10]];
\[\left \{\left \{u(t,x)\to \frac {-2 t+x-2}{4 t^2-4 t (x-2)+x^2-4 x+5}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(t, x), t) +2*diff(u(t, x),x) =0; ic:=u(-1,x)=x/(1+x^2); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(t,x))),output='realtime'));
\[u \left (t , x\right ) = \frac {-2 t +x -2}{\left (-2 t +x -2\right )^{2}+1}\]
Hand solution
Solve \[ u_{t}+2u_{x}=0 \] With initial conditions \(u\left ( -1,x\right ) =\frac {x}{1+x^{2}}\).
Solution
Let \(u=u\left ( x\left ( t\right ) ,t\right ) \). Then \begin {equation} \frac {du}{dt}=\frac {\partial u}{\partial x}\frac {dx}{dt}+\frac {\partial u}{\partial t}\tag {2} \end {equation} Comparing (1),(2) shows that \begin {align} \frac {du}{dt} & =0\tag {3}\\ \frac {dx}{dt} & =2\tag {4} \end {align}
Eq (3) says that \(u\) is constant on the chataterstic lines, or \(u=u\left ( x\left ( -1\right ) \right ) \). Using the given initial conditions, this becomes \begin {equation} u\left ( x\left ( t\right ) ,t\right ) =\frac {x\left ( -1\right ) }{1+x\left ( -1\right ) ^{2}}\tag {5} \end {equation} Eq (4) is now used to find \(x\left ( -1\right ) \). Soving (4) gives \(x=x\left ( 0\right ) +2t\). Hence \(x\left ( -1\right ) =x\left ( 0\right ) -2\) or \(x\left ( 0\right ) =x\left ( -1\right ) +2\). Therefore \begin {align*} x & =x\left ( -1\right ) +2+2t\\ x\left ( -1\right ) & =x-2-2t \end {align*}
Now that we found \(x\left ( -1\right ) \), we substitute it in (5), giving the solution\[ u\left ( x\left ( t\right ) ,t\right ) =\frac {x-2-2t}{1+\left ( x-2-2t\right ) ^{2}}\] Alternative method. Using Lagrange-charpit method
\[ \frac {dt}{1}=\frac {dx}{2}=\frac {du}{0}\] Which implies that \(du=0\) or \(u=C_{1}\). A constant. Integrating \(\frac {dt}{1}=\frac {dx}{2}\) gives \(t=\frac {1}{2}x+C_{2}\) or \(C_{2}=t-\frac {1}{2}x\). But \(C_{1}=F\left ( C_{2}\right ) \) always, where \(F\) is arbitrary function. Since \(C_{1}=u\) then\begin {align} u & =F\left ( C_{2}\right ) \nonumber \\ u & =F\left ( t-\frac {1}{2}x\right ) \tag {1} \end {align}
At \(t=-1\) the above becomes\[ \frac {x}{1+x^{2}}=F\left ( -1-\frac {1}{2}x\right ) \] Let \(-1-\frac {1}{2}x=z\) which implies \(x=-2\left ( 1+z\right ) \) The above can be written as\begin {align*} \frac {-2\left ( 1+z\right ) }{1+\left ( -2\left ( 1+z\right ) \right ) ^{2}} & =F\left ( z\right ) \\ F\left ( z\right ) & =-\frac {2\left ( 1+z\right ) }{4z^{2}+8z+5} \end {align*}
From the above then (1) can be written as\begin {align*} u\left ( t,x\right ) & =-\frac {2\left ( 1+\left ( t-\frac {1}{2}x\right ) \right ) }{4\left ( t-\frac {1}{2}x\right ) ^{2}+8\left ( t-\frac {1}{2}x\right ) +5}\\ & =\frac {x-2t-2}{4t^{2}-4tx+8t+x^{2}-4x+5}\\ & =\frac {x-2t-2}{1+\left ( x-2-2t\right ) ^{2}} \end {align*}
The following is an animation of the solution
3D |
2D |
|
|
Source code used for the above
____________________________________________________________________________________