3.1.2 From Mathematica help pages

problem number 144

Taken from Mathematica DSolve help pages

Initial value problem with Dirichlet boundary conditions. 1D, zero potential.

Solve for \(f(x,t)\) \[ I f_t = - 2 f_{xx} \] 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["Global`*"]; 
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

restart; 
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 \left (-1\right )^{n}+700\right ) {\mathrm e}^{-\frac {2 i \pi ^{2} \left (t -2\right ) n^{2}}{25}} \sin \left (\frac {\pi \left (x -5\right ) n}{5}\right )}{\pi ^{3} n^{3}}\]

____________________________________________________________________________________