Added July 6, 2019 Solve the heat equation for \(x>0,t>0\) \[ u_t = k u_{xx} \] The boundary conditions are \(u(0,t)=A\) and initial conditions \(u(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == A; ic = u[x, 0] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> {k>0,x > 0,t>0}], 60*10]];
\[\left \{\left \{u(x,t)\to \frac {x \text {Integrate}\left [\frac {A e^{-\frac {x^2}{4 k t-4 k K[2]}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {k}}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=0; bc := u(0,t)=A; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming k>0,x>0,t>0),output='realtime'));
\[u \left ( x,t \right ) =-\erf \left ( {\frac {x}{2}{\frac {1}{\sqrt {k}}}{\frac {1}{\sqrt {t}}}} \right ) A+A\]
Hand solution
Solving \begin {align} u_{t} & =ku_{xx\qquad }t>0,x>0\tag {1}\\ u\left ( 0,t\right ) & =A\nonumber \\ u\left ( x,0\right ) & =0\nonumber \end {align}
And \(u\left ( x,t\right ) <\infty \) as \(x\rightarrow \infty \). This means \(u\left ( x,t\right ) \) is bounded. This conditions is always needed to solve these problems.
Let \(U\left ( x,s\right ) \) be the Laplace transform of \(u\left ( x,t\right ) \). Defined as \[\mathcal {L}\left ( u,t\right ) =\int _{0}^{\infty }e^{-st}u\left ( x,t\right ) dt \] Applying Laplace transform to the original PDE (1) gives\[ sU\left ( x,s\right ) -u\left ( x,0\right ) =kU_{xx}\left ( x,s\right ) \] But \(u\left ( x,0\right ) =0\), therefore the above becomes\[ U_{xx}-\frac {s}{k}U=0 \] The solution to this differential equation is\[ U\left ( x,s\right ) =c_{1}e^{\sqrt {\frac {s}{k}}x}+c_{2}e^{-\sqrt {\frac {s}{k}}x}\] Since \(u\left ( x,t\right ) \) is bounded in the limit as \(x\rightarrow \infty \) and \(k>0\), therefore it must be that \(c_{1}=0\) to keep the solution bounded. The above simplifies to\begin {equation} U\left ( x,s\right ) =c_{2}e^{-\sqrt {\frac {s}{k}}x}\tag {2} \end {equation} At \(x=0\,,u\left ( 0,t\right ) =A\). Therefore \(U\left ( 0,s\right ) =\mathcal {L}\left ( u\left ( 0,t\right ) \right ) =\mathcal {L}\left ( A\right ) =\frac {1}{s}A\). Hence at \(x=0\) the above gives\[ \frac {1}{s}A=c_{2}\] Therefore (2) becomes\begin {equation} U\left ( x,s\right ) =\frac {A}{s}e^{-\sqrt {\frac {s}{k}}x}\tag {3} \end {equation} From tables, the inverse Laplace transform of the above is (since \(x>0,k>0\))\begin {align*} u\left ( x,t\right ) & =A\operatorname {erfc}\left ( \frac {x}{2\sqrt {kt}}\right ) \\ & =A\left ( 1-\operatorname {erf}\left ( \frac {x}{2\sqrt {kt}}\right ) \right ) \end {align*}
____________________________________________________________________________________
Added July 6, 2019 Solve the heat equation for \(x>0,t>0\) \[ u_t = k u_{xx} \] The boundary conditions are \(u(0,t)=A\) and initial conditions \(u(x,0)=0\), using \begin {align*} A &=60\\ k &=\frac {1}{10} \end {align*}
Mathematica ✓
ClearAll["Global`*"]; k=1/10; A=60; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == A; ic = u[x, 0] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \sqrt {\frac {5}{2 \pi }} x \text {Integrate}\left [\frac {60 e^{-\frac {5 x^2}{2 (t-K[2])}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ] & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\] It fail if assumption \(x>0\) is given. A bug
Maple ✓
restart; k:=1/10; A:=60; pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=0; bc := u(0,t)=A; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming x>0),output='realtime'));
\[u \left ( x,t \right ) =-60\,\erf \left ( 1/2\,{\frac {\sqrt {10}x}{\sqrt {t}}} \right ) +60\]
Hand solution
Solving on semi-infinite domain \begin {align*} u_{t} & =ku_{xx}\qquad t>0,x>0\\ u\left ( 0,t\right ) & =A\\ u\left ( x,0\right ) & =0 \end {align*}
With \(A=60,k=\frac {1}{10}\)
The general problem above was solved in 3.1.6.1 on page 783 and the solution is\[ u\left ( x,t\right ) =A\left ( 1-\operatorname {erf}\left ( \frac {x}{2\sqrt {kt}}\right ) \right ) \] Substituting the specific values given above into this solution gives\[ u\left ( x,t\right ) =60\left ( 1-\operatorname {erf}\left ( \frac {x}{2\sqrt {\frac {t}{10}}}\right ) \right ) \] Animation is below
Source code used for the above
____________________________________________________________________________________
This is problem at page 76 from David J Logan text book.
Solve the heat equation for \(x>0,t>0\) \[ u_t = k u_{xx} \] The boundary conditions are \(u(0,t)=f(t)\) and initial conditions \(u(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == f[t]; ic = u[x, 0] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> {t > 0, x > 0,k>0}], 60*10]]; sol = sol /. {K[2] -> z}
\[\left \{\left \{u(x,t)\to \frac {x \text {Integrate}\left [\frac {f(z) e^{-\frac {x^2}{4 k t-4 k z}}}{(t-z)^{3/2}},\{z,0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {k}}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=0; bc := u(0,t)=f(t); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming t>0,x>0,k>0),output='realtime'));
\[u \left ( x,t \right ) ={\frac {x}{2\,\sqrt {\pi }}\int _{0}^{t}\!{f \left ( \zeta \right ) {{\rm e}^{{\frac {{x}^{2}}{4\,k \left ( -t+\zeta \right ) }}}} \left ( t-\zeta \right ) ^{-{\frac {3}{2}}}}\,{\rm d}\zeta {\frac {1}{\sqrt {k}}}}\]
Hand solution
Solving on semi-infinite domain \begin {align} u_{t} & =ku_{xx}\qquad t>0,x>0\tag {1}\\ u\left ( 0,t\right ) & =f\left ( t\right ) \nonumber \\ u\left ( x,0\right ) & =0\nonumber \end {align}
With \(k>0\) and \(u\left ( x,t\right ) <\infty \) as \(x\rightarrow \infty \). This means \(u\left ( x,t\right ) \) is bounded. This conditions is always needed to solve these problems.
Let \(U\left ( x,s\right ) \) be the Laplace transform of \(u\left ( x,t\right ) \). Defined as \[\mathcal {L}\left ( u,t\right ) =\int _{0}^{\infty }e^{-st}u\left ( x,t\right ) dt \] Applying Laplace transform to the original PDE (1) gives\[ sU\left ( x,s\right ) -u\left ( x,0\right ) =kU_{xx}\left ( x,s\right ) \] But \(u\left ( x,0\right ) =0\), therefore the above becomes\[ U_{xx}-\frac {s}{k}U=0 \] The solution to this differential equation is\[ U\left ( x,s\right ) =c_{1}e^{\sqrt {\frac {s}{k}}x}+c_{2}e^{-\sqrt {\frac {s}{k}}x}\] Since \(u\left ( x,t\right ) \) is bounded in the limit as \(x\rightarrow \infty \) and \(k>0\), therefore it must be that \(c_{1}=0\) to keep the solution bounded. The above simplifies to\begin {equation} U\left ( x,s\right ) =c_{2}e^{-\sqrt {\frac {s}{k}}x}\tag {2} \end {equation} At \(x=0\,,u\left ( 0,t\right ) =f\left ( t\right ) \). Therefore \(U\left ( 0,s\right ) =\mathcal {L}\left ( f\left ( t\right ) \right ) =F\left ( s\right ) \). Hence at \(x=0\) the above gives\[ F\left ( s\right ) =c_{2}\] Therefore (2) becomes\begin {equation} U\left ( x,s\right ) =F\left ( s\right ) e^{-\sqrt {\frac {s}{k}}x}\tag {3} \end {equation} By convolution, the above becomes\begin {equation} u\left ( x,t\right ) =f\left ( t\right ) \circledast G\left ( x,t\right ) \tag {4} \end {equation} Where \(G\left ( x,t\right ) \) is the inverse transform of \(e^{-\sqrt {\frac {s}{k}}x}\) which is \(\frac {xe^{\frac {-x^{2}}{4kt}}}{2\sqrt {k\pi }t^{\frac {3}{2}}}\). Hence (4) becomes\begin {align*} u\left ( x,t\right ) & =f\left ( t\right ) \circledast \frac {xe^{\frac {-x^{2}}{4kt}}}{2\sqrt {k\pi }t^{\frac {3}{2}}}\\ & =\frac {x}{2\sqrt {k\pi }}\int _{0}^{t}\frac {f\left ( \tau \right ) }{\left ( t-\tau \right ) ^{\frac {3}{2}}}e^{\frac {-x^{2}}{4k\left ( t-\tau \right ) }}d\tau \end {align*}
For \(k=1\)\[ u\left ( x,t\right ) =\frac {x}{2\sqrt {\pi }}\int _{0}^{t}\frac {f\left ( \tau \right ) }{\left ( t-\tau \right ) ^{\frac {3}{2}}}e^{\frac {-x^{2}}{4\left ( t-\tau \right ) }}d\tau \]
____________________________________________________________________________________
Added July 7, 2019 Solve the heat equation for \(x>0,t>0\) \[ u_t = k u_{xx} \] The boundary conditions are \(u(0,t)=\sin (t)\) and initial conditions \(u(x,0)=0\) using \(k=\frac {1}{10}\)
Mathematica ✓
ClearAll["Global`*"]; k=1/10; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == Sin[t]; ic = u[x, 0] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> {t > 0, x > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to \sqrt {\frac {5}{2 \pi }} x \text {Integrate}\left [\frac {\sin (K[2]) e^{-\frac {5 x^2}{2 (t-K[2])}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); k:=1/10; pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=0; bc := u(0,t)=sin(t); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t)) assuming t>0,x>0),output='realtime'));
\[u \left ( x,t \right ) =-{\frac {\sqrt {10}x}{2\,\sqrt {\pi }}\int _{0}^{t}\!-{\sin \left ( t-\zeta \right ) {{\rm e}^{-{\frac {5\,{x}^{2}}{2\,\zeta }}}}{\zeta }^{-{\frac {3}{2}}}}\,{\rm d}\zeta }\]
Hand solution
Solving
\begin {align} u_{t} & =ku_{xx}\qquad t>0,x>0\tag {1}\\ u\left ( 0,t\right ) & =f\left ( t\right ) \nonumber \\ u\left ( x,0\right ) & =0\nonumber \end {align}
Using \(k=\frac {1}{10}\) and \(f\left ( t\right ) =\sin \left ( t\right ) \).
The general solution was solved in problem 3.1.6.3 on page 795 and the solution was found to be\[ u\left ( x,t\right ) =\frac {x}{2\sqrt {k\pi }}\int _{0}^{t}\frac {f\left ( \tau \right ) }{\left ( t-\tau \right ) ^{\frac {3}{2}}}e^{\frac {-x^{2}}{4k\left ( t-\tau \right ) }}d\tau \] Replacing the given values above, the solution becomes\[ u\left ( x,t\right ) =\sqrt {\frac {5}{2}}\frac {x}{\sqrt {\pi }}\int _{0}^{t}\frac {\sin \left ( \tau \right ) }{\left ( t-\tau \right ) ^{\frac {3}{2}}}e^{\frac {-5x^{2}}{2\left ( t-\tau \right ) }}d\tau \] We could also use the following form of the solution\[ u\left ( x,t\right ) =\sqrt {\frac {5}{2}}\frac {x}{\sqrt {\pi }}\int _{0}^{t}\frac {\sin \left ( t-\tau \right ) }{\tau ^{\frac {3}{2}}}e^{\frac {-5x^{2}}{2\tau }}d\tau \] Animation is below
Source code used for the above
____________________________________________________________________________________
Solve the heat equation \[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \] For \(x>0\) and \(t>0\). The boundary conditions is \(u(0,t)=1\) and And initial condition \(u(x,0)=0\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == 1; ic = u[x, 0] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> {t > 0, k > 0, x > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to \frac {x \text {Integrate}\left [\frac {e^{-\frac {x^2}{4 k t-4 k K[2]}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {k}}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=0: bc := u(0,t)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t),HINT = boundedseries) assuming t>0,x>0,k>0),output='realtime'));
\[u \left ( x,t \right ) ={\it erfc} \left ( {\frac {x}{2}{\frac {1}{\sqrt {tk}}}} \right ) \]
____________________________________________________________________________________
Added December 20, 2018.
Solve the heat equation for \(u(x,t)\) \[ \frac { \partial u}{\partial t}= \frac {1}{4} \frac { \partial ^2 u}{\partial x^2} \] With initial condition \[ u(x,t_0)= 10; \] And boundary conditions \[ u(-x_0,t) = 0 \] For \(x>|x_0|\) and \(t>|t_0|\).
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == (1/4)*D[u[x, t], {x, 2}]; bc = u[-x0, t] == 0; ic = u[x, t0] == 10; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], x, t, Assumptions -> {t > Abs[t0], x > Abs[x0]}], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} 10 \text {Erf}\left (\frac {x+\text {x0}}{\sqrt {t-\text {t0}}}\right ) & x+\text {x0}>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\] due to IC/BC not zero
Maple ✓
restart; pde := diff(u(x, t), t) = (1/4)*(diff(u(x, t), x$2)); bc := u(-x0, t) = 0; ic := u(x, t0) = 10; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, bc,ic],u(x,t)) assuming x>abs(x0), t>abs(t0)),output='realtime'));
\[u \left ( x,t \right ) =10\,\erf \left ( {\frac {x+{\it x0}}{\sqrt {t-{\it t0}}}} \right ) \]
____________________________________________________________________________________
Solve the heat equation
\[ \frac { \partial u}{\partial t} = k \frac { \partial ^2 u}{\partial x^2} \] For \(x>0\) and \(t>0\). The boundary conditions is \(u(0,t)=\mu \) and And initial condition \(u(x,0)=\lambda \)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; bc = u[0, t] == lambda; ic = u[x, 0] == mu; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, u[x, t], {x, t}, Assumptions -> {t > 0, k > 0, x > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to \frac {x \sqrt {k t} \text {Integrate}\left [\frac {\lambda e^{-\frac {x^2}{4 k t-4 k K[2]}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]+\sqrt {k} \text {Integrate}\left [\mu \left (e^{-\frac {(x-K[1])^2}{4 k t}}-e^{-\frac {(K[1]+x)^2}{4 k t}}\right ),\{K[1],0,\infty \},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } k \sqrt {t}}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x,t),t)=k*diff(u(x,t),x$2); ic := u(x,0)=mu: bc := u(0,t)=lambda; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde,ic,bc],u(x,t),HINT = boundedseries) assuming t>0,x>0,k>0),output='realtime'));
\[u \left ( x,t \right ) = \left ( \lambda -\mu \right ) {\it erfc} \left ( {\frac {x}{2}{\frac {1}{\sqrt {tk}}}} \right ) +\mu \]
____________________________________________________________________________________
From Mathematica DSolve help pages. Solve the heat equation for \(u(x,t)\) on half the line \(x>0\) and \(t>0\) \[ \frac { \partial u}{\partial t}= \frac { \partial ^2 u}{\partial x^2} \] With initial condition \[ u(x,0)= \cos x \] And boundary conditions \[ u(0,t)= 1 \]
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}]; ic = u[x, 0] == Cos[x]; bc = u[0, t] == 1; sol = AbsoluteTiming[TimeConstrained[FullSimplify[DSolve[{pde, ic, bc}, u[x, t], {x, t}]], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {\text {Integrate}\left [\left (e^{-\frac {(x-K[1])^2}{4 t}}-e^{-\frac {(x+K[1])^2}{4 t}}\right ) \cos (K[1]),\{K[1],0,\infty \},\text {Assumptions}\to \text {True}\right ]+\sqrt {t} x \text {Integrate}\left [\frac {e^{-\frac {x^2}{4 (t-K[2])}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {t}} & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x, t), t)=diff(u(x, t), x$2); ic := u(x,0)=cos(x); bc := u(0,t)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t)) assuming t>0 and x>0),output='realtime'));
\[u \left ( x,t \right ) ={\frac {{{\rm e}^{-t+ix}}}{2}\erf \left ( {\frac {2\,it+x}{2}{\frac {1}{\sqrt {t}}}} \right ) }-\erf \left ( {\frac {x}{2}{\frac {1}{\sqrt {t}}}} \right ) -{\frac {{{\rm e}^{-t-ix}}}{2}\erf \left ( {\frac {2\,it-x}{2}{\frac {1}{\sqrt {t}}}} \right ) }+1\]
____________________________________________________________________________________
Solve the heat equation for \(u(x,t)\) on half the line \(x>0\) and \(t>0\) \[ u_t = k u_{xx} \] With initial condition \[ u(x,0)=0 \] And boundary conditions \(u(0,t)=t\). Solution is bounded at infinity.
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == k*D[u[x, t], {x, 2}]; ic = u[x, 0] == 0; bc = u[0, t] == t; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}, Assumptions -> {k > 0, x > 0, t > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to \frac {x \text {Integrate}\left [\frac {K[2] e^{-\frac {x^2}{4 k t-4 k K[2]}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {k}}\right \}\right \}\]
Maple ✓
restart; interface(showassumed=0); pde := diff(u(x, t), t)=k*diff(u(x, t), x$2); ic := u(x,0)=0; bc := u(0,t)=t; assume(x>0); assume(t>0); assume(k>0); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =-{\frac {1}{k\,\sqrt {\pi }} \left ( {{\rm e}^{-{\frac {{x}^{2}}{4\,k\,t}}}}\sqrt {k}\sqrt {t}x+ \left ( k\,t+{\frac {{x}^{2}}{2}} \right ) \sqrt {\pi } \left ( \erf \left ( {\frac {x}{2}{\frac {1}{\sqrt {k}}}{\frac {1}{\sqrt {t}}}} \right ) -1 \right ) \right ) }\]
____________________________________________________________________________________
From Mathematica DSolve help pages. Solve the heat equation for \(u(x,t)\) on half the line \(x>0\) and \(t>0\) \[ u_t= u_{xx} \] With initial condition \[ u(x,0)= \text {UnitTriagle[x-3]} \] And boundary conditions \[ \frac { \partial u}{\partial x}(0,t)= 0 \]
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}]; ic = u[x, 0] == UnitTriangle[x - 3]; bc = Derivative[1, 0][u][0, t] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \Lambda (3-x) & t=0 \\ \frac {2 \int _0^{\infty }\frac {4 e^{-t K[1]^2} \cos (3 K[1]) \cos (x K[1]) \sin ^2\left (\frac {K[1]}{2}\right )}{K[1]^2}dK[1]}{\pi } & t>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x, t), t)=diff(u(x, t), x$2); ic := u(x,0)=piecewise( x>2 and x<3,-2+x, x>3 and x<4, 4-x, 0); bc:=(D[1](u))(0,t)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t)) assuming t>0 and x>0),output='realtime'));
\[u \left ( x,t \right ) ={\frac {1}{\sqrt {\pi }} \left ( t{{\rm e}^{-{\frac { \left ( -4+x \right ) ^{2}}{4\,t}}}}-2\,t{{\rm e}^{-1/4\,{\frac { \left ( -3+x \right ) ^{2}}{t}}}}+t{{\rm e}^{-{\frac { \left ( -2+x \right ) ^{2}}{4\,t}}}}+t{{\rm e}^{-{\frac { \left ( 2+x \right ) ^{2}}{4\,t}}}}-2\,t{{\rm e}^{-1/4\,{\frac { \left ( x+3 \right ) ^{2}}{t}}}}+t{{\rm e}^{-{\frac { \left ( x+4 \right ) ^{2}}{4\,t}}}}+{\frac {\sqrt {\pi }}{2}\sqrt {t} \left ( \left ( -4+x \right ) \erf \left ( {\frac {-4+x}{2}{\frac {1}{\sqrt {t}}}} \right ) + \left ( -2\,x+6 \right ) \erf \left ( {\frac {-3+x}{2}{\frac {1}{\sqrt {t}}}} \right ) + \left ( -2+x \right ) \erf \left ( {\frac {-2+x}{2}{\frac {1}{\sqrt {t}}}} \right ) +\erf \left ( {\frac {2+x}{2}{\frac {1}{\sqrt {t}}}} \right ) \left ( 2+x \right ) + \left ( -2\,x-6 \right ) \erf \left ( {\frac {x+3}{2}{\frac {1}{\sqrt {t}}}} \right ) +\erf \left ( {\frac {x+4}{2}{\frac {1}{\sqrt {t}}}} \right ) \left ( x+4 \right ) \right ) } \right ) {\frac {1}{\sqrt {t}}}}\]
____________________________________________________________________________________
Added December 20, 2018.
Solve for \(u(x,t)\) for \(t>0,x>0\) \[ u_t= \frac {1}{4} u_{xx} \] With initial condition \[ u(x,t_0)= 10 e^{-x^2} \] And boundary conditions \[ \frac { \partial u}{\partial x}(x_0,t)= 0 \]
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == (1*D[u[x, t], {x, 2}])/4; ic = u[x, t0] == 10*Exp[-x^2]; bc = Derivative[1, 0][u][x0, t] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}, Assumptions -> {x > 0, t > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} 10 e^{-x^2} & t-\text {t0}=0 \\ \frac {2 \int _0^{\infty }\frac {5}{2} e^{-\frac {1}{4} K[1] (4 i \text {x0}+(t-\text {t0}+1) K[1])} \sqrt {\pi } \cos ((x-\text {x0}) K[1]) \left (\text {Erfc}\left (\text {x0}-\frac {1}{2} i K[1]\right )+e^{2 i \text {x0} K[1]} \text {Erfc}\left (\text {x0}+\frac {1}{2} i K[1]\right )\right )dK[1]}{\pi } & t-\text {t0}>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x, t), t) = 1/4*(diff(u(x, t), x$2)); bc := eval( diff(u(x,t),x),x=x0)=0; ic := u(x,t0)=10*exp(-x^2); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, bc,ic],u(x,t)) assuming x>0,t>0),output='realtime'));
\[u \left ( x,t \right ) =-5\,{\frac {1}{\sqrt {t-{\it t0}+1}} \left ( -\erf \left ( {\frac { \left ( -t+{\it t0}-1 \right ) {\it x0}+x}{\sqrt {t-{\it t0}+1}\sqrt {t-{\it t0}}}} \right ) -1+ \left ( \erf \left ( {\frac {-{\it x0}\,{\it t0}+ \left ( t-1 \right ) {\it x0}+x}{\sqrt {t-{\it t0}+1}\sqrt {t-{\it t0}}}} \right ) -1 \right ) {{\rm e}^{4\,{\frac {{\it x0}\, \left ( -x+{\it x0} \right ) }{-t+{\it t0}-1}}}} \right ) {{\rm e}^{{\frac {{x}^{2}}{-t+{\it t0}-1}}}}}\]
____________________________________________________________________________________
Added April 5, 2019.
Solve for \(u(x,t)\) in \[ u_t = u_{xx} - u_x \]
For \(t>0,x>0\). With boundary conditions \(u(0,t)=0\) and intitial conditions \(u(x,0)=f(x)\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x, t], {x, 2}] - D[u[x, t], x]; ic = u[x, 0] == f[x]; bc = u[0, t] == 0; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, u[x, t], {x, t}, Assumptions -> {x > 0, t > 0}], 60*10]];
\[\left \{\left \{u(x,t)\to e^{\frac {x}{2}-\frac {t}{4}} \left (\begin {array}{cc} \{ & \begin {array}{cc} \frac {\text {Integrate}\left [e^{-\frac {K[1]}{2}} \left (e^{-\frac {(x-K[1])^2}{4 t}}-e^{-\frac {(x+K[1])^2}{4 t}}\right ) f(K[1]),\{K[1],0,\infty \},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {t}} & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right )\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x,t),t)=diff(u(x,t),x$2)- diff(u(x,t),x); ic := u(x,0)=f(x); bc := u(0,t)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol', pdsolve([pde, ic, bc], u(x, t))assuming t>0,x>0),output='realtime'));
\[u \left ( x,t \right ) ={{\rm e}^{{\frac {x}{2}}}} \left ( {\it invlaplace} \left ( {\int ^{0}\!{f \left ( {\it \_a} \right ) {\frac {1}{\sqrt {{{\rm e}^{{\it \_a}}}}}}{\frac {1}{\sqrt {{{\rm e}^{{\it \_a}\,\sqrt {1+4\,s}}}}}}}{d{\it \_a}}{\frac {1}{\sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}}}{\frac {1}{\sqrt {1+4\,s}}}},s,t \right ) -{\it invlaplace} \left ( {\int ^{0}\!{f \left ( {\it \_a} \right ) \sqrt {{{\rm e}^{{\it \_a}\,\sqrt {1+4\,s}}}}{\frac {1}{\sqrt {{{\rm e}^{{\it \_a}}}}}}}{d{\it \_a}}{\frac {1}{\sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}}}{\frac {1}{\sqrt {1+4\,s}}}},s,t \right ) -{\it invlaplace} \left ( {\sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}\int \!{f \left ( x \right ) {\frac {1}{\sqrt {{{\rm e}^{x}}}}}{\frac {1}{\sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}}}}\,{\rm d}x{\frac {1}{\sqrt {1+4\,s}}}},s,t \right ) +{\it invlaplace} \left ( {\int \!{f \left ( x \right ) \sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}{\frac {1}{\sqrt {{{\rm e}^{x}}}}}}\,{\rm d}x{\frac {1}{\sqrt {{{\rm e}^{x\sqrt {1+4\,s}}}}}}{\frac {1}{\sqrt {1+4\,s}}}},s,t \right ) \right ) \]
____________________________________________________________________________________
Added May 23, 2019.
From Math 5587 midterm I, Fall 2016, practice exam, problem 13.
Solve for \(u(x,t)\) with IC \(u(x,0)=x^2+1\) and BC \(u_t(0,t)=1\) for \(x>0,t>0\) \begin {align*} u_{t} = u_{xx} \end {align*}
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] == D[u[x,t],{x,2}]; ic = u[x,0]==x^2+1; bc = u[0,t]==1; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic,bc}, u[x, t], {x, t}], 60*10]];
\[\left \{\left \{u(x,t)\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {\text {Integrate}\left [\left (e^{-\frac {(x-K[1])^2}{4 t}}-e^{-\frac {(x+K[1])^2}{4 t}}\right ) \left (K[1]^2+1\right ),\{K[1],0,\infty \},\text {Assumptions}\to \text {True}\right ]+\sqrt {t} x \text {Integrate}\left [\frac {e^{-\frac {x^2}{4 (t-K[2])}}}{(t-K[2])^{3/2}},\{K[2],0,t\},\text {Assumptions}\to \text {True}\right ]}{2 \sqrt {\pi } \sqrt {t}} & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x,t),t)= diff(u(x,t),x$2); ic := u(x,0)=x^2+1; bc :=u(0,t)=1; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],u(x,t))),output='realtime'));
\[u \left ( x,t \right ) =-2\,{\it invlaplace} \left ( {\frac {1}{{{\rm e}^{\sqrt {s}x}}{s}^{2}}},s,t \right ) +{x}^{2}+2\,t+1\]
____________________________________________________________________________________