Consider the Schrödinger equation for a free particle:
$$i\partial_t\psi(x,y)=-\partial_x^2\psi(x,t)$$
with initial condition
$$\psi(x,0)=\theta(x)$$
and boundary conditions $|\psi(\pm\infty,t)|<\infty$.
I've tried solving it numerically, here's what the solution looks like:

But this solution is not satisfactory because, as I understand, it should not cut off on the high-frequency parts at the ends of this oscillation. Here it's cut off because of finite number of harmonics taken into account.
At the same time, the solution very much resembles partial sums of Fourier series for square wave (with the Gibbs phenomenon as the feature). Another thing I recall immediately is Fresnel integral. The real part especially resembles it.
So, my question is: is actual solution indeed somehow related to partial sums of Fourier series or Fresnel integral? How can the solution be found analytically?
Indeed, after some playing with Fresnel functions I've constructed the solution:
$$2\psi(x,t)=1+\operatorname S\left(\frac x{\sqrt{2\pi t}}\right)+\operatorname C\left(\frac x{\sqrt{2\pi t}}\right)+i\left[\operatorname S\left(\frac x{\sqrt{2\pi t}}\right)-\operatorname C\left(\frac x{\sqrt{2\pi t}}\right)\right],$$
where $\operatorname C(x)$ and $\operatorname S(x)$ are Fresnel integrals.