Suppose the input state to the QFT is a periodic state with equal non-zero amplitudes at states l + kr as k varies. This demo shows the summation computed by the QFT in order to compute the amplitude of the state |y>. It involves summing m/r roots of unity. The roots of unity are shown in blue. The normalized sum is shown in red. The value of y/m is shown in the animation. When y hits a multiple of r, the red dot moves away from the origin.
This first box computes the frames of the animation.
m = number of qubits
r = period
ymax = how big to let y get
This second box displays the animation. This will probably time out on the sage single cell server; you may need to copy it to your own machine.