Evolution of a Gaussian wavepacket in terms of square well energy eigenstates

use at your own risk.  not debugged.  10 minutes programming total!  you have been warned.

<<FourierSeries`

nterms=15
d[x_] = Exp[-(x-.5)^2/.01]
Plot[d[x],{x,0,1}]
g[x_] = FourierTrigSeries[d[x],x,nterms,FourierParameters->{1,.5}];
Plot[Chop[g[x]],{x,0,1},PlotRange->All]
fourcoefs=Table[Chop[FourierSinCoefficient[d[x],x,i,FourierParameters->{1,.5}]],{i,15}]

take each spatial eigenstate and multiply by the appropriate Exp[-itE_n]

wavefunction[x_,t_] = Sum[fourcoefs[[k]] Sin[k Pi x] Exp[-I k^2 t],{k,nterms}]

Animate[Plot[Re[wavefunction[x,t]],{x,0,1},PlotRange->{{0,1},{-1,1}}],{t,0,.2,.001}]

Animate[Plot[Abs[wavefunction[x,t]],{x,0,1},PlotRange->{{0,1},{-1,1}}],{t,0,1,.001}]