____________________________________________________________________________________
This is problem at page 76 from David J Logan text book.
Solve the heat equation for \(x>0,t>0\) \[ \frac { \partial u}{\partial t} = \frac { \partial ^2 u}{\partial x^2} \] The boundary conditions are \(u(0,t)=f(t)\) and initial conditions \(u(x,0)=0\)
Mathematica ✓
ClearAll[u, t, x, f]; pde = D[u[x, t], t] == 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}], 60*10]]; sol = sol /. {K[2] -> z}
\[ \left \{\left \{u(x,t)\to \frac {x \int _0^t \frac {f(z) e^{-\frac {x^2}{4 (t-z)}}}{(t-z)^{3/2}} \, dz}{2 \sqrt {\pi }}\right \}\right \} \]
Maple ✓
unassign('L,u,t,x'); interface(showassumed=0); pde:=diff(u(x,t),t)=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),HINT = boundedseries) assuming t>0,x>0),output='realtime'));
\[ u \left ( x,t \right ) =1/2\,{\frac {x}{\sqrt {\pi }}\int _{0}^{t}\!{\frac {f \left ( \zeta \right ) }{ \left ( t-\zeta \right ) ^{3/2}}{{\rm e}^{-{\frac {{x}^{2}}{4\,t-4\,\zeta }}}}}\,{\rm d}\zeta } \]
____________________________________________________________________________________
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[u, t, x, k]; 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 \text {Erfc}\left (\frac {x}{2 \sqrt {k t}}\right )\right \}\right \} \]
Maple ✓
L:='L'; u:='u'; t:='t'; x:='x';k:='k'; 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 ) =1-\erf \left ( 1/2\,{\frac {x}{\sqrt {t}\sqrt {k}}} \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[x, t, x0, t0]; 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]];
\[ \text {Failed} \] due to IC/BC not zero
Maple ✓
x:='x'; u:='u'; t:='t'; 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[u, t, x, k, lambda, mu]; 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 \mu \text {Erf}\left (\frac {x}{2 \sqrt {k t}}\right )+\lambda \text {Erfc}\left (\frac {x}{2 \sqrt {k t}}\right )\right \}\right \} \]
Maple ✓
L:='L'; u:='u'; t:='t'; x:='x';mu:='mu';lambda:='lambda';k:='k'; 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 ) \erf \left ( 1/2\,{\frac {x}{\sqrt {t}\sqrt {k}}} \right ) +\lambda \]
____________________________________________________________________________________
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[u, x, t]; 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 {i e^{-\frac {x^2}{4 t}} \left (\text {DawsonF}\left (\frac {2 t-i x}{2 \sqrt {t}}\right )-\text {DawsonF}\left (\frac {2 t+i x}{2 \sqrt {t}}\right )\right )}{\sqrt {\pi }}+\text {Erfc}\left (\frac {x}{2 \sqrt {t}}\right ) & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \} \]
Maple ✓
x:='x'; u:='u'; t:='t'; 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 ) =1/2\,\erf \left ( 1/2\,{\frac {2\,it+x}{\sqrt {t}}} \right ) {{\rm e}^{-t+ix}}-\erf \left ( 1/2\,{\frac {x}{\sqrt {t}}} \right ) -1/2\,\erf \left ( 1/2\,{\frac {2\,it-x}{\sqrt {t}}} \right ) {{\rm e}^{-t-ix}}+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[u, x, t]; 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 {\left (2 k t+x^2\right ) \text {Erfc}\left (\frac {x}{2 \sqrt {k t}}\right )-\frac {2 x \sqrt {k t} e^{-\frac {x^2}{4 k t}}}{\sqrt {\pi }}}{2 k}\right \}\right \} \]
Maple ✓
x:='x'; u:='u'; t:='t'; k:='k'; 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 ( \sqrt {k}\sqrt {t}{{\rm e}^{-1/4\,{\frac {{x}^{2}}{k\,t}}}}x+\sqrt {\pi } \left ( \erf \left ( 1/2\,{\frac {x}{\sqrt {k}\sqrt {t}}} \right ) -1 \right ) \left ( k\,t+1/2\,{x}^{2} \right ) \right ) } \]
____________________________________________________________________________________
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)= \text {UnitTriagle[x-3]} \] And boundary conditions \[ \frac { \partial u}{\partial x}(0,t)= 0 \]
Mathematica ✓
ClearAll[u, x, t]; 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} \frac {1}{2} \left (\frac {\text {Erf}\left (\frac {\left | x-4\right | }{2 \sqrt {t}}\right ) (x-4)^2}{\left | 4-x\right | }+(x+2) \text {Erf}\left (\frac {x+2}{2 \sqrt {t}}\right )-2 (x+3) \text {Erf}\left (\frac {x+3}{2 \sqrt {t}}\right )+(x+4) \text {Erf}\left (\frac {x+4}{2 \sqrt {t}}\right )-\frac {2 (x-3)^2 \text {Erf}\left (\frac {\left | x-3\right | }{2 \sqrt {t}}\right )}{\left | 3-x\right | }+\frac {(x-2)^2 \text {Erf}\left (\frac {\left | x-2\right | }{2 \sqrt {t}}\right )}{\left | 2-x\right | }+\frac {2 \left (e^{-\frac {(x-4)^2}{4 t}}-2 e^{-\frac {(x-3)^2}{4 t}}+e^{-\frac {(x-2)^2}{4 t}}+e^{-\frac {(x+2)^2}{4 t}}-2 e^{-\frac {(x+3)^2}{4 t}}+e^{-\frac {(x+4)^2}{4 t}}\right ) \sqrt {t}}{\sqrt {\pi }}\right ) & x>0 \\ \text {Indeterminate} & \text {True} \\\end {array} \\\end {array}\right \}\right \} \]
Maple ✓
x:='x'; u:='u'; t:='t'; 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 }\sqrt {t}} \left ( t{{\rm e}^{-1/4\,{\frac { \left ( -4+x \right ) ^{2}}{t}}}}-2\,t{{\rm e}^{-1/4\,{\frac { \left ( -3+x \right ) ^{2}}{t}}}}+t{{\rm e}^{-1/4\,{\frac { \left ( -2+x \right ) ^{2}}{t}}}}+t{{\rm e}^{-1/4\,{\frac { \left ( 2+x \right ) ^{2}}{t}}}}+t{{\rm e}^{-1/4\,{\frac { \left ( 4+x \right ) ^{2}}{t}}}}-2\,t{{\rm e}^{-1/4\,{\frac { \left ( x+3 \right ) ^{2}}{t}}}}+1/2\, \left ( \left ( -4+x \right ) \erf \left ( 1/2\,{\frac {-4+x}{\sqrt {t}}} \right ) + \left ( -2\,x+6 \right ) \erf \left ( 1/2\,{\frac {-3+x}{\sqrt {t}}} \right ) + \left ( -2+x \right ) \erf \left ( 1/2\,{\frac {-2+x}{\sqrt {t}}} \right ) + \left ( 2+x \right ) \erf \left ( 1/2\,{\frac {2+x}{\sqrt {t}}} \right ) + \left ( 4+x \right ) \erf \left ( 1/2\,{\frac {4+x}{\sqrt {t}}} \right ) -2\,\erf \left ( 1/2\,{\frac {x+3}{\sqrt {t}}} \right ) \left ( x+3 \right ) \right ) \sqrt {t}\sqrt {\pi } \right ) } \]
____________________________________________________________________________________
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[u, x, t, x0, t0]; 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]];
\[ \text {Failed} \]
Maple ✓
x:='x'; u:='u'; t:='t';x0:='x0';t0:='t0'; 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 ( {{\rm e}^{4\,{\frac {{\it x0}\, \left ( -x+{\it x0} \right ) }{-t+{\it t0}-1}}}}\erf \left ( {\frac { \left ( {\it t0}-t+1 \right ) {\it x0}-x}{\sqrt {t-{\it t0}+1}\sqrt {t-{\it t0}}}} \right ) +{{\rm e}^{4\,{\frac {{\it x0}\, \left ( -x+{\it x0} \right ) }{-t+{\it t0}-1}}}}+\erf \left ( {\frac { \left ( -t+{\it t0}-1 \right ) {\it x0}+x}{\sqrt {t-{\it t0}+1}\sqrt {t-{\it t0}}}} \right ) +1 \right ) {{\rm e}^{{\frac {{x}^{2}}{-t+{\it t0}-1}}}}} \]