Based on this article by Mathcube
Any quantum mechanical system evolves according to the TDSE given below
To simulate this emulation, we need to solve this differential equation. We can use the Euler Approximation (1st Order approximation) by discretizing the time domain. The differential equation is then approximated in the forward direction by
where
This gives us the Explicit form of the wave-function at the next time step.
Similarly for the backward approximation
we get the implicit form
But in these approximation, we lose the normalization of the wave-function.
To combat the issue of loss of normalization, we can take the average of the implicit and explicit forms given above to get
which defines a unitary transformation
This can then be used to approximate the evolution of the system.
The Crank-Nicolson scheme was implemented in python and the evolution of a gaussian wave-packet in harmonic potential simulated.
The python script outputs a series of ordered JPEG images, which were later stitched using ffmpeg.
ffmpeg -f image2 -framerate 12 -i %03d.jpg Solution.gif