Source: http://maxwell.ucsc.edu/~peter/250/mathematica/discreteFT2.nb.pdf