Algorithms

Spring 2011
course
navigation

Feb 8

Note: added two wikibooks on C to resources page.
Go over homework and Jim's Fourier Notes. Answer questions. (You do have questions, don't you?)

Note differing normalization conventions, where the (2 pi) terms go, and where the 1/N or 1/sqrt(N) pieces go.
Note how the *physical units* are handled in my notes. This is an example of how one eliminates them from the equations before putting 'em into a numerical computation.
Discuss frequencies implied by formula (7) in my notes:
Y[n] , n = 1...N are the spacial (or time) amplitudes. G[j] , j = -N/2+1 ... N/2 are the frequency indexes. So: what is the highest frequency? what is the lowest frequency? what is a "negative" frequency !?
Explain this in terms of wikipedia: Nyquist-Shannon sampling theorem and phases: compare the number of input values and output frequencies and phases.
Do an example on the board with some small values of N, N = 8 is a particularly nice one to study.
N = 8 : Y = [1, 0, 0, 0, 0, 0, 0, 0] # "delta" or "spike" or ... G = ? Y = [1, 1, 1, 1, 1, 1, 1, 1] # "DC" G = ? Y = [0, 0, 1, 1, 1, 1, 0, 0] # "top hat" G = ?
Just plug into formula (7) and see what happens, for practice.
How many multiplications did it take you to find G?
Next: now read the text, pages 68 and following, and see how "divide and conquer" makes doing this quicker.
The wikipedia descriptions may also be helpful; see
It's simplest to focus on the case where N is a multiple of 2.
There is an excellent description in "Numerical Recipes in C" ( http://apps.nrbook.com/c/index.html is an online version of the book) which is a classic book for numerical algorithms. Their formula 12.1.7 and 12.1.9 on page 503 is identical to the Discrete Fourier equations in my notes. And the essence of the FFT is in formula 12.2.3 on page 505.
And here's a C code library that does a real FFT:
And for doing this stuff for real, there's the GSL: GNU Scientific Library :
For a good time, write out the FFT as an algebraic factorization problem for N=4. (Maybe I'll assign that...)
http://cs.marlboro.edu/ courses/ spring2011/algorithms/ notes/ Feb_8
last modified Tuesday February 8 2011 2:54 am EST