____________________________________________________________________________________
From page 30, David J Logan textbook, applied PDE textbook.
Solve \[ I h \frac {\partial f}{\partial t} = - \frac {h^2}{2 m} \frac {\partial ^2 f}{\partial x^2} \]
With boundary conditions
\begin {align*} f(0,t) &= 0\\ f(L,0) &=0 \end {align*}
Mathematica ✓
ClearAll[f, t, x, L, m, h]; pde = I*h*D[f[x, t], t] == -((h^2*D[f[x, t], {x, 2}])/(2*m)); bc = {f[0, t] == 0, f[L, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc}, f[x, t], {x, t}, Assumptions -> L > 0], 60*10]]; sol = sol /. K[1] -> n;
\[ \left \{\left \{f(x,t)\to \sum _{n=1}^{\infty }e^{-\frac {i h n^2 \pi ^2 t}{2 L^2 m}} c_n \sin \left (\frac {n \pi x}{L}\right )\right \}\right \} \]
Maple ✓
x:='x'; t:='t'; L:='L'; c:='c';f:='f'; interface(showassumed=0); pde:=I*h*diff(f(x,t),t)=-h^2/(2*m)*diff(f(x,t),x$2); bc:=f(0,t)=0,f(L,t)=0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc],f(x,t)) assuming L>0),output='realtime'));
\[ f \left ( x,t \right ) =\sum _{n=1}^{\infty }{\it \_C1} \left ( n \right ) \sin \left ( {\frac {n\pi \,x}{L}} \right ) {{\rm e}^{{\frac {-i/2h{\pi }^{2}{n}^{2}t}{m{L}^{2}}}}} \]
____________________________________________________________________________________
Solve for \(f(x,y,t)\) \[ I \frac {\partial f}{\partial t} = - \frac {\hbar ^2}{2 m} \left ( \frac {\partial ^2 f}{\partial x^2} + \frac {\partial ^2 f}{\partial y^2} \right ) \]
With boundary conditions
\begin {align*} f(0,y,t) &= 0\\ f(1,y,t) &=0 \\ f(x,1,t) &=0 \\ f(x,0,t) &=0 \end {align*}
And initial conditions \(f(x,y,0)=\sqrt {2} \left ( \sin (2\pi x) \sin (\pi y) + \sin (\pi x) \sin (2 \pi y) \right )\)
Mathematica ✓
ClearAll[f, t, x, y]; pde = I*D[f[x, y, t], {t}] == -((hBar^2*Laplacian[f[x, y, t], {x, y}])/(2*m)); initSum = f[x, y, 0] == Sqrt[2]*(Sin[2*Pi*x]*Sin[Pi*y] + Sin[Pi*x]*Sin[2*Pi*y]); bcs = {f[0, y, t] == 0, f[1, y, t] == 0, f[x, 1, t] == 0, f[x, 0, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bcs, initSum}, f[x, y, t], {x, y, t}], 60*10]];
\[ \left \{\left \{f(x,y,t)\to \sqrt {2} e^{-\frac {5 i \pi ^2 \text {hBar}^2 t}{2 m}} (\sin (2 \pi x) \sin (\pi y)+\sin (\pi x) \sin (2 \pi y))\right \}\right \} \]
Maple ✓
x:='x'; t:='t'; y:='y'; hbar:='hbar';f:='f'; interface(showassumed=0); pde:= I* diff(f(x,y,t),t) = -hBar^2/(2*m) * (diff(f(x,y,t),x$2) + diff(f(x,y,t),y$2)); ic := f(x, y, 0) = sqrt(2)*(sin(2*Pi*x)*sin(Pi*y) + sin(Pi*x)*sin(2*Pi*y)); bc := f(0, y, t) = 0, f(1, y, t) = 0, f(x, 1, t) = 0, f(x, 0, t) = 0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],f(x,y,t))),output='realtime'));
\[ f \left ( x,y,t \right ) =\sqrt {2}\sin \left ( \pi \,x \right ) {{\rm e}^{{\frac {-5/2\,i{{\it hBar}}^{2}t{\pi }^{2}}{m}}}} \left ( 2\,\cos \left ( \pi \,x \right ) \sin \left ( \pi \,y \right ) +\sin \left ( 2\,\pi \,y \right ) \right ) \]
____________________________________________________________________________________
Taken from Mathematica DSolve help pages
Solve for \(f(x,t)\) \[ I \frac {\partial f}{\partial t} = - 2 \frac {\partial ^2 f}{\partial x^2} \]
With boundary conditions
\begin {align*} f(5,t) &= 0\\ f(10,t) &=0 \\ \end {align*}
And initial conditions \(f(x,2)=f(x)\) where \(f(x)=-350 + 155 x - 22 x^2 + x^3\)
Mathematica ✓
ClearAll[g, f, t, x]; pde = I*D[f[x, t], t] == -2*D[f[x, t], {x, 2}]; g[x_] := -350 + 155*x - 22*x^2 + x^3; ic = f[x, 2] == g[x]; bc = {f[5, t] == 0, f[10, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc, ic}, f[x, t], {x, t}], 60*10]]; sol = sol /. K[1] -> n;
\[ \left \{\left \{f(x,t)\to \sum _{n=1}^{\infty }\frac {100 \left (7+8 (-1)^n\right ) e^{-\frac {2}{25} i n^2 \pi ^2 (t-2)} \sin \left (\frac {1}{5} n \pi (x-5)\right )}{n^3 \pi ^3}\right \}\right \} \]
Maple ✓
x:='x'; t:='t'; y:='y'; f:='f';g:='g'; pde:=I*diff(f(x,t),t)=-2*diff(f(x,t),x$2); bc:=f(5,t)=0,f(10,t)=0; g:=x->-350+155*x-22*x^2+x^3; ic:=f(x,2)=g(x); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc,ic],f(x,t))),output='realtime'));
\[ f \left ( x,t \right ) =\sum _{n=1}^{\infty }{\frac { \left ( 800+700\, \left ( -1 \right ) ^{n} \right ) \sin \left ( 1/5\,n\pi \,x \right ) {{\rm e}^{-{\frac {2}{25}}\,i{\pi }^{2}{n}^{2} \left ( t-2 \right ) }}}{{n}^{3}{\pi }^{3}}} \]
____________________________________________________________________________________
Taken from Mathematica DSolve help pages
Solve for \(f(x,t)\) \[ I \frac {\partial f}{\partial t} = - \frac {\partial ^2 f}{\partial x^2} + 2 x^2 f(x,t) \]
With boundary conditions
\begin {align*} f(-\infty ,t) &= 0\\ f(\infty ,t) &=0 \end {align*}
Mathematica ✓
ClearAll[f, t, x]; pde = I*D[f[x, t], t] == -D[f[x, t], {x, 2}] + 2*x^2*f[x, t]; bc = {f[-Infinity, t] == 0, f[Infinity, t] == 0}; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc}, f[x, t], {x, t}], 60*10]]; sol = sol /. K[1] -> n;
\[ \left \{\left \{f(x,t)\to \sum _{n=0}^{\infty }e^{-\frac {x^2}{\sqrt {2}}-2 i \sqrt {2} \left (n+\frac {1}{2}\right ) t} c_n \text {HermiteH}\left (n,\sqrt [4]{2} x\right )\right \}\right \} \]
Maple ✗
x:='x'; t:='t'; y:='y'; f:='f';g:='g'; pde:=I*diff(f(x,t),t)=-diff(f(x,t),x$2)+2*x^2*f(x,t); bc:=f(-infinity ,t)=0,f(infinity,t)=0; try cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc],f(x,t))),output='realtime')); catch: sol:=(); cpu_time :=0; end try;
\[ \text { sol=() } \] Maple does not support \(\infty \) in boundary conditions
____________________________________________________________________________________
Taken from Introduction to Quantum mechanics, second edition, by David Griffiths, page 47.
Solve for \(f(x,t)\) \[ I h \frac {\partial f}{\partial t} = - \frac {h^2}{2 m} \frac {\partial ^2 f}{\partial x^2} \]
With initial conditions \(f(x,0) = A x (a-x)\) for \(0\leq x \leq a\) and zero otherwise.
Mathematica ✓
ClearAll[x, t, f, a, A, m, h]; ic = Piecewise[{{A*x*(a - x), 0 <= x <= a}, {0, True}}]; pde = I*h*D[f[x, t], t] == -((h^2*D[f[x, t], {x, 2}])/(2*m)); sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, f[x, 0] == ic}, f[x, t], {x, t}, Assumptions -> a > 0], 60*10]];
\[ \left \{\left \{f(x,t)\to \frac {\left (\frac {1}{2}+\frac {i}{2}\right ) (-1)^{3/4} A \sqrt {h} \sqrt {t} \left (-i \sqrt {\pi } m x^2 \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} (a-x)}{\sqrt {h} \sqrt {t}}\right )+i \sqrt {\pi } a m x \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} (a-x)}{\sqrt {h} \sqrt {t}}\right )+i \sqrt {\pi } a m x \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} x}{\sqrt {h} \sqrt {t}}\right )+\sqrt {\pi } h t \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} (a-x)}{\sqrt {h} \sqrt {t}}\right )-(1+i) a \sqrt {h} \sqrt {m} \sqrt {t} e^{\frac {i m x^2}{2 h t}}-(1+i) \sqrt {h} \sqrt {m} \sqrt {t} x e^{\frac {i m (a-x)^2}{2 h t}}-i \sqrt {\pi } m x^2 \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} x}{\sqrt {h} \sqrt {t}}\right )+\sqrt {\pi } h t \text {Erfi}\left (\frac {\left (\frac {1}{2}+\frac {i}{2}\right ) \sqrt {m} x}{\sqrt {h} \sqrt {t}}\right )+(1+i) \sqrt {h} \sqrt {m} \sqrt {t} x e^{\frac {i m x^2}{2 h t}}\right )}{\sqrt {2 \pi } m^{3/2} \sqrt {\frac {h t}{m}}}\right \}\right \} \]
Maple ✓
x:='x'; t:='t'; f:='f'; a:='a';A:='A';h:='h';m:='m'; ic:=f(x,0)=piecewise(0<=x and x<=a,A*x*(a-x),0); pde:=I*h*diff(f(x,t),t) = -h^2/(2*m)*diff(f(x,t),x$2); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',dsolve([pde,ic],f(x,t)) assuming a>0),output='realtime')); sol:=convert(sol,Int);
\[ f \left ( x,t \right ) =-2\,A \left ( {\frac {i/2}{\pi }\int _{-\infty }^{\infty }\!{\frac {1}{{s}^{3}}{{\rm e}^{{\frac {-i/2h{s}^{2}t}{m}}+isx}}}\,{\rm d}s}-{\frac {i/2}{\pi }\int _{-\infty }^{\infty }\!{\frac {1}{{s}^{3}}{{\rm e}^{{\frac {-i/2s \left ( hst+2\,am \right ) }{m}}+isx}}}\,{\rm d}s}+1/4\,{\frac {a}{\pi }\int _{-\infty }^{\infty }\!{\frac {1}{{s}^{2}}{{\rm e}^{{\frac {-i/2h{s}^{2}t}{m}}+isx}}}\,{\rm d}s}+1/4\,{\frac {a}{\pi }\int _{-\infty }^{\infty }\!{\frac {1}{{s}^{2}}{{\rm e}^{{\frac {-i/2s \left ( hst+2\,am \right ) }{m}}+isx}}}\,{\rm d}s} \right ) \]
____________________________________________________________________________________
Taken from Introduction to Quantum mechanics, second edition, by David Griffiths, page 47. This is the same as the above problem but has an extra \(V(x) f(x,t)\) terms where \(V(x)\) is the infinite square well potential defined by \(V(x)=0\) if \(0\leq x \leq a\) and \(V(x)=\infty \) otherwise.
Solve for \(f(x,t)\) \[ I \hslash \frac {\partial f}{\partial t} = - \frac {\hslash ^2}{2 m} \frac {\partial ^2 f}{\partial x^2} + V(x) f(x,t) \]
With initial conditions \(f(x,0) = A x (a-x)\) for \(0\leq x \leq a\) and zero otherwise.
Mathematica ✓
ClearAll[x, y, t, f, m]; ic = f[x, y, 0] == Sqrt[2]*(Sin[2*Pi*x]*Sin[Pi*y] + Sin[Pi*x]*Sin[3*Pi*y]); bc = {f[0, y, t] == 0, f[1, y, t] == 0, f[x, 1, t] == 0, f[x, 0, t] == 0}; pde = I*h*D[f[x, y, t], t] == -((h^2*(D[f[x, y, t], {x, 2}] + D[f[x, y, t], {y, 2}]))/(2*m)); sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, ic, bc}, f[x, y, t], {x, y, t}], 60*10]];
\[ \left \{\left \{f(x,y,t)\to \sqrt {2} e^{-\frac {5 i \pi ^2 h t}{m}} \left (\sin (\pi x) \sin (3 \pi y)+\sin (2 \pi x) \sin (\pi y) e^{\frac {5 i \pi ^2 h t}{2 m}}\right )\right \}\right \} \]
Maple ✓
x:='x'; t:='t'; f:='f'; a:='a';A:='A';h:='h';m:='m'; V:=x->piecewise(0<=x and x<=a,0,infinity); ic:=f(x,0)=piecewise(0<=x and x<=a,A*x*(a-x),0); pde:=I*h*diff(f(x,t),t)=-h^2/(2*m)*diff(f(x,t),x$2) +V(x)*f(x,t); cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],f(x,t)) assuming a>0),output='realtime'));
\[ \text {Bad latex generated} \]
____________________________________________________________________________________
Added December 20, 2018.
Example 28, taken from https://www.mapleprimes.com/posts/209970-Exact-Solutions-For-PDE-And-Boundary--Initial-Conditions-2018
Solve for \(f(x,y,t)\) \[ I \hslash \frac {\partial f}{\partial t} = - \frac {\hslash ^2}{2 m} \left ( \frac {\partial ^2 f}{\partial x^2} + \frac {\partial ^2 f}{\partial y^2} \right ) \]
With initial conditions \(f(x,y,0) = \sqrt {2} \left ( \sin (2 \pi x) \sin (\pi y)+ \sin (\pi x) \sin (3 \pi y) \right )\) and boundary conditions \begin {align*} f(0,y,t) &= 0 \\ f(1,y,t) &= 0 \\ f(x,1,t) &= 0 \\ f(x,0,t) &= 0 \end {align*}
Mathematica ✗
ClearAll[x, t, f, a, A, m, h]; v[x_] = Piecewise[{{0, 0 <= x <= a}}, Infinity]; ic = Piecewise[{{A*x*(a - x), 0 <= x <= a}, {0, True}}]; ode = I*h*D[f[x, t], t] == -((h^2*D[f[x, t], {x, 2}])/(2*m)) + v[x]*f[x, t]; sol = AbsoluteTiming[TimeConstrained[DSolve[{ode, f[x, 0] == ic}, f[x, t], {x, t}, Assumptions -> a > 0], 60*10]];
\[ \text {Failed} \]
Maple ✓
x:='x'; t:='t'; f:='f'; y:='y';m:='m'; pde := I*hbar* diff(f(x, y, t), t) = - hbar^2/(2*m)* (diff(f(x, y, t), x$2)+diff(f(x, y, t), y$2)); ic := f(x, y, 0) = sqrt(2)*(sin(2*Pi*x)*sin(Pi*y)+sin(Pi*x)*sin(3*Pi*y)); bc:= f(0, y, t) = 0, f(1, y, t) = 0, f(x, 1, t) = 0, f(x, 0, t) = 0; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic,bc],f(x,y,t))),output='realtime'));
\[ f \left ( x,y,t \right ) =\sqrt {2}\sin \left ( \pi \,x \right ) \left ( 2\,{{\rm e}^{{\frac {-5/2\,i{\it hbar}\,t{\pi }^{2}}{m}}}}\cos \left ( \pi \,x \right ) \sin \left ( \pi \,y \right ) +\sin \left ( 3\,\pi \,y \right ) {{\rm e}^{{\frac {-5\,i{\it hbar}\,t{\pi }^{2}}{m}}}} \right ) \]