SetDirectory[NotebookDirectory[]];
a=1.0;hbar=1.0;m=1.0;xini=-10.0;xlast=10.0;Deltat=0.05;height=1.1;

Psi[x_,t_]:=(1/(Pi*Sqrt[2a]))NIntegrate[(Sin[k*a]/(k))Exp[I*(k*x-t*hbar*k^2/(2m))],{k,-Infinity,Infinity}];

Psisq[x_,t_]:=Re[(Psi[x,t]*Conjugate[Psi[x,t]])];
tPsisq[i_]:=Table[{xi,Psisq[xi,i*Deltat]},{xi,xini,xlast,Deltat}];
ListPlot[tPsisq[0],PlotLabel->"|Psi|^2 vs x at t=},t",Joined->True,Mesh->All,PlotRange->{{xini,xlast},{0,2.0}}]

(*
Plot[Psisq[x,t],{x,-10a,10a,0.1a},PlotLabel->"|Psi|^2 vs x at t=},t"]
*)

PM:=Manipulate[
ListPlot[
tPsisq[i],PlotLabel->"|Psi|^2 vs x at t=},t",Joined->True,Mesh->All,PlotRange->{{xini,xlast},{0,height}}
],{i,0,25}];

Export["pareolve.flv",PM];

For[i=0,i≤25,i++,
(*parevolve=Plot[Psisq[x,t],{x,-10a,10a},PlotLabel->"|Psi|^2 vs x at t=},t"];*)
parevolve=
ListPlot[tPsisq[i],PlotLabel->"|Psi|^2 vs x at t=},t",Joined->True,Mesh->All,PlotRange->{{xini,xlast},{0,height}}];
Export[ToString[i]<>"parevolve.gif",parevolve];
];(*end for i*)