2.1.14 \(u_t+ c u_x = 0\) and \(u(x,0)=e^{-x^2}\)

problem number 14

Taken from Mathematica help pages

Solve for \(u(x,t)\) \[ u_t+ c u_x = 0 \] With initial conditions \(u(x,0)=e^{-x^2}\)

Mathematica

ClearAll["Global`*"]; 
ic  = u[x, 0] == Exp[-x^2]; 
pde =  D[u[x, t], {t}] + c*D[u[x, t], {x}] == 0; 
sol =  AbsoluteTiming[TimeConstrained[DSolve[{pde, ic}, u[x, t], {x, t}], 60*10]];
 

\[\left \{\left \{u(x,t)\to e^{-(x-c t)^2}\right \}\right \}\]

Maple

restart; 
interface(showassumed=0); 
pde := diff(u(x, t), t) + c* diff(u(x, t),x) =0; 
ic  := u(x,0)=exp(-x^2); 
cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
 

\[u \left ( x,t \right ) ={{\rm e}^{- \left ( tc-x \right ) ^{2}}}\]

Hand solution

Solve \begin {equation} u_{t}+cu_{x}=0\tag {1} \end {equation} with initial conditions \(u\left ( x,0\right ) =e^{-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} & =c\tag {4} \end {align}

Solving (3) gives\begin {align} u & =u\left ( x\left ( 0\right ) \right ) \nonumber \\ & =e^{-x\left ( 0\right ) ^{2}}\tag {5} \end {align}

We need to find \(x\left ( 0\right ) \). From (4)\begin {align*} x & =ct+x\left ( 0\right ) \\ x\left ( 0\right ) & =x-ct \end {align*}

Then (5) becomes\[ u\left ( x\left ( t\right ) ,t\right ) =e^{-\left ( x-ct\right ) ^{2}}\]

____________________________________________________________________________________