Talk:Discrete Fourier transform/Archive 1

message: Bo - Before I revert some of your edits, let me explain myself. A sequence is an ordered set of numbers, and that's about it. A vector is a mathematical object which has associated operators etc. and by a logical process it can be deduced that if you define a set of basis vectors (a coordinate system), you can represent a vector in terms of this basis set by a sequence. The sequence is not the vector, at least from a mathematicians or a physicists  point  of view. It is from a computer programmers point of view, I think, but this is a mathematical article. That means the statement:
:The vector of n complex numbers x0, ..., xn−1 are transformed into the vector of n complex numbers f0, ..., fn−1 by the DFT according to the formula:
is not correct, "vector" should read "sequence". There is no such thing as a "vector of complex numbers",  only a sequence of complex numbers that may or may not represent a vector, depending on whether a coordinate system and all the vector operators have been defined. The bottom line is that the DFT operates on sequences. It is often very helpful (and interesting) to assume that the sequences are representative of vectors. The DFT then can be thought of as a linear vector operator, etc. etc. The article is a bit sloppy in this regard and needs to be fixed. PAR 10:38, 30 September 2005 (UTC)
replies: text: Hi PAR. That subtle distinction between sequence and vector was not at all supported by the original version of the article. On the contrary it was explicitely stated that 'sequence' means 'vector'.  \mathbb{C}^n  is a vector space over the field  \mathbb{C} . So the elements are vectors. These vectors are subject to discrete fourier transforms, which are linear (or, preferably antilinear) transformations of the vector space. The limiting cases of the DFT where  n \rightarrow \infty , such as the fourier integrals and the fourier series, are still linear or antilinear transformations of complex vector spaces. So I don't agree that any distinction between 'sequence' and 'vector' is neither necessary, nor useful, nor easy to explain. The better way to get rid of the sloppyness is to abandon the concept of 'sequence' in this context. Bo Jacoby 12:21, 30 September 2005 (UTC)

text: PAR, as soon as you say that the DFT is a linear operator, this immediately implies that you are talking about an operator on a vector space.  So, I agree with Bo in that I don't think it's very useful to talk about DFTs that do not operate on vector space.  On the other hand, we are not talking about any vector space in general; we are talking about the particular vector space  \mathbb{C}^n  formed of a sequence of complex numbers (where addition and multiplication are defined in the natural way).  Moreover, the abstract (non-spatial) definition of a vector space may be unfamiliar to many readers, and because of that I suspect it is a gentler introduction to begin by calling it a "sequence" of inputs.  (There's certainly nothing mathematically incorrect about calling it a sequence.)    So, while I disagree in part with PAR's reasoning, I agree with his conclusion (that the previous wording is arguably better).  —Steven G. Johnson 17:43, 30 September 2005 (UTC)

text: A cyclic shift is just a unitary operator (i.e. a "rotation") on the vector space, as is multiplication by a linear phase.  I'm not sure what you mean by properties "of a vector nature".  I still don't see the problem with calling it by the more-familiar term of "sequence" in addition to the more-technical term of "vector", though.  As George Orwell pointed out in 1984, synonyms (and their slightly differing shades of meaning) make language more expressive, not less. —Steven G. Johnson 01:55, 1 October 2005 (UTC)
thread_title:  Vector or sequence 

message: A second suggestion. Why not simply write: \mathcal{F}(\{ x_k e^{\frac{2\pi i}{n}km} \})_j=\mathcal{F}(\{x_k\})_{j-m}  and  \mathcal{F}(\{x_{k-m}\})_j=\mathcal{F}(\{x_k\})_j e^{-\frac{2\pi i}{n}jm}  instead of:  if \mathcal{F}(\{x_k\})_j=f_j then \mathcal{F}(\{ x_k e^{\frac{2\pi i}{n}km} \})_j=f_{j-m} and \mathcal{F}(\{x_{k-m}\})_j=f_j e^{-\frac{2\pi i}{n}jm} ? The f is unnecessary. Bo Jacoby 09:02, 3 October 2005 (UTC)
replies: text: I am against that - its a true statement, but its significance is not as immediately obvious. A reader is liable to look at the first one  and wonder "so what?" but looking at the same involving f, its immediately clear: multiply the input by the exponential factor amounts to shifting the output. PAR 20:50, 3 October 2005 (UTC)
thread_title:  The shift theorem 

message: This section introduces a 4th notation for the fourier transform : The primed index: \ x_{j'}. Why not reuse one of the 3: \mathcal{F}(\{x_{k}\})_j, \ f_j, \ X_j. Further cleanup may reduce the number even more, hopefully to one. Bo Jacoby 09:25, 3 October 2005 (UTC)
replies: text: I agree. The point of the primed index rather than the primed vector is to emphasize that the vector has not changed, only its components have, as a result of a coordinate system change. This is in the flavor of Einstein notation for tensors, but it shouldn't be introduced here out of the blue. Either introduce it with explanation or stick to the old notation. (Yes, I am the one that wrote it that way) PAR 20:50, 3 October 2005 (UTC)
thread_title: The DFT as a unitary transformation

message: The introduction should give a short answer to the short question: "What is the discrete fourier transform?". Smalltalk should be avoided here. 
Using the involutary DFT as the definition will do this, and also save the The Plancherel theorem from being mentioned twice in the article. Bo Jacoby 11:52, 3 October 2005 (UTC)
replies: text: Some history on this article: I changed the definition to include two general normalization constants, constrained only by the fact that their product be 1/n. StevenJ then argued that this was too much of a jolt for someone trying to use Wikipedia as one source among many, an argument which I now agree with. On this basis, we should use the most common definition in the introduction, then expand from there. So  that means, in my mind, introducing with either (1,1/n) (the present normalization) or (1/√n,1/√n) (the unitary normalization). The present normalization is appealing to algorithmic types, because you don't need to calculate square roots. The unitary is appealing to physics types because it is symmetric, and analogous to a rigid rotation in Euclidean space, all sorts of things are conserved, dot product, angles, etc.  But, given the present normalization, the Plancherel theorem  needs to be stated in the present normalization, and then restated to illustrate the efficacy of the unitary normalization.  PAR 20:50, 3 October 2005 (UTC)
replies: text: (PAR, I'm a physicist myself.  In physics, you rarely use the discrete version of the transform at all for theoretical work, so your argument is a bit strange.   The DFT in my experience is mainly used for computation, and occasionally for expression of discrete convolutions, in which cases the unitary normalization is actually often not the most convenient form as I mentioned below.  —Steven G. Johnson 04:42, 5 October 2005 (UTC)

text: Unitarity is one convenient property.  The fact that you apparently think it is the only convenient property tells me that you've never done much digital signal processing.  For example, putting the 1/n factor in the idft (or only on the dft) makes the convolution theorem come out in a simpler form.  (This is probably why Matlab, for example, uses the same convention as in Wikipedia.)  From my own personal experience, in talking about FFT algorithms to compute the DFT (which themselves are a rich source of interesting mathematics and not just a practical "programming" matter), the normalization factors are an annoyance that is universally omitted.  (See above re: involution form.) —Steven G. Johnson 00:28, 5 October 2005 (UTC)
replies: text: PS. From a programming perspective, the computation of the square root is irrelevant as it is only done once.  More expensive are the 2N multiplications. —Steven G. Johnson
Actually I do have FFT-experience. I completely agree on your PS that the time for taking the square root is epsilon. But the time for the 2N real multiplications is neglectible too because the inner loop of the FFT requires Nlog(N)/log(2) complex multiplications, so this inner loop is more timecomsuming when N is a large number. When N is not a large number everything is fast, so nothing matters. Of cause you know all that. The convolution theorem asserts that the transform of a convolution is the product of the transforms, so the convolution is the transform of the product of the transforms. Can that really be simplified? Please show me. I don't think that unitarity is the only convenient property. Involutarity is nice too, because it is timeconsuming to debug the error of having chosen the wrong one of IDFT and DFT. Not having this to worry about makes programming safer. Bo Jacoby 08:39, 5 October 2005 (UTC)

text: That statement about the convolution is no longer true if you use the unitary normalization.  You either have to change the definition of convolution, or have an extra sqrt(N) factor in the convolution theorem.  But of course, you knew that?  —Steven G. Johnson 16:23, 5 October 2005 (UTC)

text: By the way, in practical circumstances the scaling is not quite so negligible as you imagine, especially in the common case where it is implemented as an extra pass over the array (due to the memory implications more than the arithmetic cost), because the number of passes over the array is quite small already (even though it grows logarithmically) for an optimized FFT.  It is possible to absorb the normalization into the twiddle factors, but this has other disadvantages (e.g. the same twiddle factors can't be re-used for the forward and inverse transforms).  It is just as efficient (or more efficient), and more flexible, to absorb it into the user's computations.  —Steven G. Johnson
Implement any variation of the discrete fourier transform to suit your needs of saving computer time, but stick to one definition and explain your subroutine in terms of that. Bo Jacoby 11:54, 6 October 2005 (UTC)

text: As another example of a Fourier variant where the unitary normalization is not the most convenient, by the way, consider the Fourier series (where almost no one uses a normalization corresponding to the unitary FT).  Your "one true normalization" crusade is just not sensible, I think.  —Steven G. Johnson
Yes. Here the symmetry is broken. The coefficients of the fourier series are integrals. Yet my point is the same as before: define one discrete fourier transform and express everything else in terms of that, instead of confusing the reader regarding the meaning of the word. My 'crusade' is for simplicity and clarity, and you are not my opponent in that respect. Bo Jacoby 11:54, 6 October 2005 (UTC)
replies: text: Initially the article did use one definition, the one at the top.  (In my experience this definition is by far the most common in actual practice.  It makes things like the convolution theorem come out more nicely.)  Then one section was added to say how a unitary normalization has some advantages in expressing certain things in a nice form.  I think this is reasonable — indeed, different conventions have different advantages and disadvantages, and it is a service to readers to point this out.  It does not make the article "unreadable", especially since the one place where a different convention is used is confined clearly to one sub-section.  The alternatives are (a) don't present the unitary representation at all, which misses out on those nice expressions or (b) adopt the unitary representation everywhere, which is at odds with common practice and is inconvenient for actual usage. —Steven G. Johnson 15:50, 6 October 2005 (UTC)
thread_title:  Introduction. Definition 

message: I should practice what I preach, so I redid the unitary section to get rid of the primed indices. The problem is, I replaced it with primed vector symbols, and this is still not in conformity with previous use of capitals as transformed quantities. I want to emphasize with the notation as much as possible the idea of having a constant vector object, and its components are the only things that change, the DFT being simply a coordinate transformation. That was the idea of the primed coordinate indices rather than the primed vector symbols. However, to express the unitary stuff using capital letters would further obscure this idea. Is there any objection to changing the capital letters to primed letters in the rest of the article? PAR 15:56, 8 October 2005 (UTC)
replies: text: Capital letters are more conventional, and are used in most of the other Fourier transform pages (other than the discrete transforms, sigh).  They are easier to distinguish visually than primed letters.  And, most importantly, the frequency domain is sufficiently distinct, in practice, from the time domain that I don't agree that we want to minimize the differences between the two representations.  I would rather you changed to capitals in the unitary section.  —Steven G. Johnson 16:25, 8 October 2005 (UTC)

text: First of all, the discrete Fourier transform is not typically used for quantum wave functions, and the article should favor the contexts in which the DFT is typically used.  Second, even in quantum mechanics your prime notation is not common either. (When talking about wave functions, the most common notation I've seen is \psi and \tilde\psi for distinguishing the position and momentum-space representations...or rather, in QM the most common representation is probably Dirac notation which is basis-independent, and then using <x|ψ> etc.)  The fact that it is a linear unitary transformation is already emphasized enough; we don't need to add an unusual notation on top of that.  —Steven G. Johnson 22:27, 8 October 2005 (UTC)
thread_title:  Redo unitary 

message: I separated the involutions from the tricks. 
Is the Hartley transformation really an involution ? Shouldn't the divisor '2' be under the square root sign ? Shouldn't the formula be found in the Discrete Hartley transform article ? Bo Jacoby 13:13, 13 October 2005 (UTC)
replies: text: Yes. Yes. Already mentioned.—Steven G. Johnson
Dear friend. The Discrete Hartley transform says: Its main distinction from the DFT is that it transforms real inputs to real outputs, with no intrinsic involvement of complex numbers, in variance your statement: taking the real part is necessary to get the Hartley transform (even for the real inputs, the outputs of H(x) are complex). Please make up your mind. That the involution form is basically an aside; it does not merit its own section is your opinion, but not your decision. You know that the matter is controversial. Nobody prevents you from expressing your view based on your experience, nor should you prevent others from expressing their view based on their experience. My experience-based view is that this involution has the simpler algebraic properties. Please restore my edit and stop acting like a censor of the spanish inquisition.  Bo Jacoby 08:56, 14 October 2005 (UTC)

text: H(x) is not the Hartley transform.  Its real part is, for real inputs.  (The imaginary part is the Hartley transform with a different sign convention.)  Personal attacks ala the Inquisition aside (nobody expects the Spanish Inquisition!), anything more than an aside is inappropriate because promotion of your personal non-standard DFT variant, whatever its merits, is original research, as has been repeatedly explained to you.   If you prefer, we can delete mention of it entirely.  —Steven G. Johnson 15:19, 14 October 2005 (UTC)

text: Bo - NO - I need help when I'm right and Steven J. is wrong. Its just that he's more or less right on this. PAR 14:50, 17 October 2005 (UTC)
thread_title:  Involutions 2

message: I like the stacked version better than the unstacked version.  IMO, that's the whole point of having a cool math editor.  --Bob K 21:11, 15 December 2005 (UTC)
replies: text: Me too, but I don't have strong enough feelings about it to go through and change it.  Knock yourself out if you want, but first you might ask User:Michael Hardy to explain his reasoning on this edit. —Steven G. Johnson 21:23, 15 December 2005 (UTC)

text: PS: I'm betting you two will get outvoted on this one if it comes to that. Michael Hardy 21:53, 15 December 2005 (UTC)

text: So is this the voting process?  How does everyone else know that it's happening?  When is it over?  --Bob K 02:18, 16 December 2005 (UTC)

text: Quite true.  But I have to point out that my preferred (linear) notation is:  e^{j 2 \pi k n/N}\, \Big (or e^{i 2 \pi k n/N}\,, if you insist\Big ), and I never have the problem you are worried about.  I just think stacking looks great, compared to all the ugly computer code that has passed before my eyes.  --Bob K 06:02, 16 December 2005 (UTC)
replies: text: That is an improvement.  But it still is clearer, I think, to keep the 2πi/n as a single unit (since mathematically most of the important properties of the DFT follow from the fact that it is a root of unity to the jk-th power).  I also agree that it looks nicer stacked in this particular case.  I'm changing it back. —Steven G. Johnson 20:07, 16 December 2005 (UTC)
thread_title:  "stacked" fractions in superscripts? 

message: Just as an idea of what I am talking about, I collected all the articles in :Category:Digital signal processing including sub-categories and listed them on the above page. I also put a menu in listing notational changes, and we can check them off as needed. I assume the k,n,N changes are acceptable to everyone, so I listed that first. I didn't spend a lot of time alphabetizing or elaborating in case this idea doesn't fly. PAR 20:04, 17 December 2005 (UTC)
replies: text: This looks fine to me — so far, it seems there is universal agreement on the (j,k,n) to (k,n,N) changes, but not on other changes, so it makes sense to start on the k,n,N now. —Steven G. Johnson 04:23, 19 December 2005 (UTC)
thread_title:  [[Talk:Discrete Fourier Transform/Notation]] 

message: I have started converting the notation in Discrete cosine transform to match the changes that we have agreed to on this article.  The four changes are:
1.  n becomes N:  Change all instances of the symbol n to the new symbol N to represent the length of the sequences in both the time and frequency domains.
2.  k becomes n: Change all instances of the symbol k to the new symbol n to represent the index variable for the time domain sequence.
3.  j becomes k:  Change all instances of the symbol j to the new symbol k to represent the index variable for the frequency domain sequence.
4.  f becomes X:  Change all instances of the symbol f to the new symobl X to represent the transformation of the data sequence in the frequency domain.
Once I have finished the DCT article, I will start working on Discrete sine transform.
If others would like to help, please review the List of Fourier-related transforms for articles to work on (discrete versions only).
-- Metacomet 16:00, 6 January 2006 (UTC)
thread_title: Conversion of other related articles

message: The section on Completeness states: "for any N ≥ 0, any N-dimensional complex vector has a DFT and an IDFT which are in turn N-dimensional complex vectors."
The case N=0 is unimportant, and all the formulas having N in the denominator ceases to make sense. It should be changed to "for any N > 0, any N-dimensional complex vector has a DFT and an IDFT which are in turn N-dimensional complex vectors."
Bo Jacoby 07:46, 5 January 2006 (UTC)
replies: text: Done. --Bob K 02:37, 7 January 2006 (UTC)
thread_title: Exclude the case N=0

message: Since this article is basically totally incomprehensible to those who do not know higher math, perhaps we could include a visual representation of a DFT so the reader may at least get a vague idea of what it means/does. How about a nmr or ftir spectrum?--Deglr6328 08:09, 12 April 2006 (UTC)
replies: text: Good point.  This is a very dry article for an encyclopedia.  Unless someone has the time to spice it up, a better-than-nothing alternative is to refer the readers to the DFT pictures at Discrete-time_Fourier_transform#Finite_length_sequences.  --Bob K 17:48, 12 April 2006 (UTC)
replies: text: Remember, if a reader needs a basic introduction to Fourier transforms in general, this article is not really the place to do it.  (e.g. NMR and FTIR spectra are examples of continous Fourier transforms.  In any case, a more familiar example to most readers will be the coarse spectrum displayed on a typical stereo.)  —Steven G. Johnson 15:36, 13 June 2006 (UTC)
thread_title: an idea

message: The Finite Fourier Transform is an experiment you really can do at home; your spreadsheet is all you need.
=== Poor man's explanation of the discrete Fourier Transform: The basics ===
---A WORK IN PROGRESS--
All "real-world" waveforms can be described by a summation of sines and cosines with constant coefficients (amplitudes): Why do we care?
Why do we care? Answer this: Why does a bird chirp sound different than a cricket chirp? What frequency (pitch) was that crow's caw? Why does my voice sound different than yours? How do we make this awful picture of Aunt Millie sharper? Most scientists mathematicians, and engineers use the various processes called "the Fourier transform" to answer these and similar questions. They want to learn more about the waveforms of the signals-- the "waveform" is "the shape" of "the signal" (that comes for example, from their microphone). 
Why not just look the waveform on an oscilloscope or a computer screen? Because it will be just a jumble of up-and-down "waves" with littler wavey wiggles in them -- like ocean waves, big waves with little waves riding on top. There is nothing we can use there.
The discrete Fourier transform freezes in time facts about a waveform's "pitch" (its frequency, its tone high or low as in A-440 cycles per second versus middle C-512 [?]) that we can look at as long as we'd like. And, given this transform, we can recover our original waveform.
When waveforms have been "transformed" to this stationary form we can do all kinds of neat things to them. Such as: use Adobe Photoshop to sharpen the digital photos of Aunt Millie. 
Discrete signal recording:
Before the mid-1980's sound recording was done first (i) mechanically by phonograph, then later (ii) electro-optically on film (motion picture sound track), or tape (magnetically). Sound engineers used these "analog" (continuous as opposed to discrete) methods and looked at their signals on "analog" oscilloscopes. 
  
But today the computer "sound card" takes the signal that comes from the scientist's microphone and "samples" it (40,000 times per second, or 44,000 per second, or 176,000 per second, etc). What the sound card produces and sends to the computer are streams of "bits and bytes" -- 16 bits, 24 bits, 32 bits -- that represent the signal but are no longer "the signal" itself; the sound is gone across the meadow into the hills, the signal from the microphone is converted to heat and lost forever. All that exists finally are "the bits and bytes" that the scientist's computer has recorded on her hard drive or her flash-card.
This type of "signal-processing" is called "analog-to-digital" (A-to-D) conversion and is done by special circuitry. In all cases the conversion involves (i) sampling the waveform, (2) A-to-D conversion at a fixed interval (such as 44,000 conversions per second, or 176,000 conversions per second for "high resolution" recordings). Quite often the processs involves more steps: (i) smooth the signal with a "low-pass filter", (ii)"hold" the signal steady for a moment while (iii) the A-to-D converter samples the held signal, (iv) actually A-to-D convert the sampled signal. We will see below why these extra steps are required.
Sampling is easy: 
To sample a waveform just multiply it by 1 to take the sample; the rest of the time, multiply by 0. (The briefer the sample, the better). In our example, the waveform we are sampling changes from -10 to +10 (usually the waveforms are much smaller, this is just an example). Whenever our "sampler" takes a sample, it -- in effect -- multiplies the waveform at that instant by 1.   
:waveform....0.......3.......5.......7.......9.......10......10......10.......9.......7.......5.......3.......0......-3......-5......-7......-9......-10....
:sampler:..1..0..0..0..0..0..0..0..1..0..0..0..0..0..0..0...1..0..0..0..0..0..0..0..1..0..0..0..0..0..0..0..1..0..0..0..0..0..0..0..1...
:samples:..0..0..0..0..0..0..0..0..7..0..0..0..0..0..0..0..10.0..0..0..0..0..0..0...4..0..0..0..0..0..0..0.-5..0..0..0..0..0..0..0.-10..
Our resulting string of numbers-as-samples looks like this:
:{...0,7,10,4,-5,-10,...etc}.
thumbnail 
Notice something interesting: our waveform is compressed into just a few samples, now stored in space on a computer disk (or whereever). Is it really possible that we can recover our original waveform from this squished stuff? YES!
An aside: Quantization:
A crude A-to-D converter might change our analog number between -15 and +15 into 31 levels of "quantization" equivalent to steps (quanta) of 1. These "levels" will come out as bits and bytes. For example, +5 might be 00100, -5 might be 10101, etc. Fancy A-to-D converters convert to 32 bits or about 4 billion levels. Common audio conversion in a computer is to 16 bits, about 65,000 levels.
The role of the discrete Fourier transform is not fret about issues surrounding "quantization". The transform's role is to convert our waveform from a time-based event into frequencies that we can stare at forever, if we want to. The only job quantization has to do is to give the computer (or us) numbers that it (we) can crunch. 
Analog samples would work just fine if we had a bunch of analog multipliers and adders to do the transform.
But what about the transform? Show me the transform!
All in good time. First we need to describe how we get the waveform back:
Discrete signal playback:
thumbnail| The dashed pink line is the original waveform before sampling; the sampled cosine is shown as circles on the waveform. During reconstruction a "hold" maintains the sampled value for one full "clock cycle" (unit of 1). The "steps" are "low-pass filtered" and presented as "output" shown in blue. (The filter is a simple "RC-" filter that could be built out of Radio Shack parts -- a simple recursive, IIR "one-pole" filter.)
When the scientist plays back the sound on her computer, the computer delivers the saved bytes to the sound-card.
> [usually beforehand the scientist selects a "slice" to look at and transform... Sound Forge example? hence the sampling window] 
The card uses a reverse process called Digital-to-Analog (D-to-A) to convert the bytes and bits back into a waveform. But the output from the D-to-A converter will again have discrete steps in it. If we were to look at the Sony Sound Forge reproduction of the "signal's waveform" we find it is represented by points (the discrete samples) connected by lines (interpolations so the result may look like triangles). After D-to-A conversion the sound card smoothes out the steps (or triangles) with a low-pass filter. The sound card amplifies this smoothed now-analog signal; it is now in a form our scientist can hear on her speakers [Is this correct re sigma-delta conversion?]
A question appears: Why do we believe we can trust our tools?: 
In brief: we can't until we "calibrate them" -- test them against known good results. We wonder: will a reproduction be faithful to its original? Maybe yes, maybe no. Even if our crow-caw microphone introduces "junk" (wind noise is typical), a poorly-designed sound card may introduce unexpected junk into our scientist's reproduced waveform (growls, whistles, whines). If this is the case, she (hopefully) will find it when she looks at "the spectrum" of the waveform. With the use of the discrete Fourier transform she can do just that -- look at the "frequency spectrum" of her bird and insect sounds, present them on a sonogram that plots frequency on the Y axis, time on the X axis, and colors the intensity of the sound. Perhaps from what she expects and from applying known waveforms to her sampler, she can learn to "trust her tools".
==== Preliminaries ====
sines and cosines:
Why do we need to discuss "sines" and "cosines"? It just turns out that any snippet of waveform can be approximated by a bunch of them added together. The why and the proof of this is not so simple, however. [see Why it Works].
Most people think of sines and cosines in terms of trigonometry, but the words themselves do not contain those ideas. Rather, the word "sine" comes from Latin sinus meaning "curve": we speak of Marilyn Monroe as a "sinuous woman", for example. And "cosine" comes from Latin cosinus, co- (with, together) +sinus "curve" (Websters New Collegiate). The sine and cosine are close associates.   
The pendulum is commonly used as the example of a repeating "cosinusoidal" motion (cf Cannon p. 171ff). Pull it to the right R, then let it go. The pendulum comes back to center C, swings to the left L, then back to center C:
: start = R, -> C, -> L, -> C, -> R, -> C, -> L, -> C, etc.
A "full cycle" is the motion R, C, L, C. Apply numbers to the symbols R, C, L; choose R = +1, C = 0, L= -1. Now record the motion -- at one-second snap-shots -- of a really slow pendulum -- our pendulum takes 8 seconds to make its complete cycle . We see that our pendulum seems to "dwell" longer at the extremes L = -1 and R = +1, and move faster in the center C = 0. Our records, in fact, show the pendulum's positions to be as follows:
:time in seconds { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...}
:position of pendulum: { 1, 0.7, 0, -0.7, -1, -0.7, 0, 0.7, 1, ...}
The waveform in the first picture is a cosine. In the picture of its reconstruction the reconstruced waveform is "almost a sine" -- if it were to start at zero it would be a sine (ignoring the wiggles riding on it). Its shift to the right repreents a delay and is called its phase shift; the "hold" and the "filter" are responsible for this.   
Observe what we have just done: we have sampled the motion of the pendulum. And we will soon use these same numbers to extract the Discrete Fourier Transform from our snippet of waveform!
We say the pendulum's (and hence its cosine's) frequency is how long in seconds the pendulum requires to make one full cycle. Our slow pendulum takes 8 seconds to move in one full cycle, so we say that its frequency is 1/8 Hz (Hz = Hertz = cycles per second).
If we plot the times on an X axis and the pendulum's position on a Y axis and draw a smooth curve through the points, the cosine is just this smooth curve. A sine curve is of identical shape, just shifted right so that it starts at 0 rather than 1. [footnote: derivative of sine is cosine and vice versa; easy to see with difference equations]. If we were to put a felt-tip pen on the bottom of our pendulum and, at a steady rate, pull a piece of paper beneath the pendulum, the motion of the pen would trace out the cosine (or sine). The shapes of the two waves -- sine and cosine -- are identical; they just start at different values. 
Sampling Window:
Only rarely is a signal sampled for a long period of time and then have a discrete Fourier Transform applied to it. Usually we do this for just an interesting piece of the waveform. If we are recording a crow's caw we just "snip" the "caw" and discard the uninteresting road noise and lawn-mower sounds.  The time-duration of the "snippet" (or length of the snippet if we are looking at the waveform on our computer screen) is called "the window". 
For more about what can go wrong with windows and what we do about it, see "What can go wrong" below.
Fundamental frequency, Harmonics, frequency components, amplitudes, : 
thumbnail
thumbnail
Anyone who plays a musical instrument knows what an "octave" is: it is just the next lower or higher register. For example: middle C is the note C just below the treble staff, the first octave above middle C is the C on the staff. The next octave higher puts C above the staff. A higher octaves represents doubling frequency. A harmonic is similar, but it represents an integer multiple of (usually positive with 0 a special case i.e. 1, 2, 3, 4, ...), rather than a doubling of, a base frequency called "the fundamental:"
 
: "harmonic: Overtone: esp: one whose vibration frequency is an integral multiple of that of the fundamental (Webster's)
: "fundamental: the harmonic component of a complex wave that has the lowest frequency and commonly the greatest amplitude (Webster's)
: "amplitude: the extent of a vibratory movement (Webster's)
Another name for the harmonics is the frequency components. The harmonics/frequency components together with the fundamental make up the spectrum of the waveform.
thumbnail
As it turns out we will need to find both cosine and sine harmonics. Neither a collection of sine harmonics nor a collection of cosine harmonics is sufficient (adequate) to reconstruct our waveform -- we need both sets. Why? Because the cosine always starts from 1, if we encounter a wave that starts from 0 we will need the sine harmonics too. More likely than not we will need both sets.
The fundamental is fundamental
So just who or what determines "the fundamental"?
Hamming (p. 508) provides us with a wonderful analogy: think about our "snippet" of waveform as if it were wrapped around a cylinder with a circumference the same length as the snippet. [The following may be O.R. [?]: a perhaps even better analogy is an early precursor to the motion-picture, the Mutoscope -- a cylinder with sampling slits in it, around the inside of which a sequence of images is wrapped. The viewer cranks a handle and watchs the scene move. Problem is, the scene repeats every rotation. But this is exactly like Hamming's analogy.]
thumbnail|The waveform is sampled sixteen times at equal intervals around the cylinder
The discrete Fourier transform treats our waveform as if it were "a snippet" wrapped around in a cyclider that is spinning. It is the circumference of the cylinder -- or "(time-)duration" of the cylinder to make one full roation-cycle -- that determines the so-called "wavelength of the fundamental", or in time, the longest duration and lowest frequency that the transform can deliver back to us.
All the other frequencies that the transform delivers/produces will be integer multiples of this fundamental. Why would this be? An obscure answer is: the average value of the "area under the curve" of sine or cosine curve is 0. If we were to use a non-integer (0.5 cycles or 1.5 cycles) this would not be the case. 
But rather than this obscure answer, what we are going to do is show firstly that a cosine fundamental can "pluck out" of a waveform a cosine of the same (fundamental) frequency, but not a sine. Secondly we will show that a cosine with double the frequency does not pluck out either a cosine nor a cosine of the fundamental frequency. This will be true for every harmonic, not just the first with double the frequency.
=== Our first transform: cosine x cosine = 1 if the cosines are the same frequency and "in phase" ===
400px|thumbnail
We will "transform" our sampled pendulum's cosine waveform with itself, and see what we get. What we do is write down one cycle of our pendulum -- sampled at the 8 1-second intervals -- and multiply each sample by itself. We add up the numbers, and divide by 4 to get what is called "(double) the weighted average".
:time in seconds.....: { 0,.... 1, ...2,... 3,... 4,... 5,....6,....7 }
:position of pendulum..: { +1.0, +0.7, +0.0, -0.7, -1.0, -0.7, +0.0, +0.7 }
:cosine wave............: { +1.0, +0.7, +0.0, -0.7, -1.0, -0.7, +0.0, +0.7 }
:products.................: { +1.0, +0.5, +0.0, +0.5, +1.0, +0.5, 0.0, +0.5 }
The sum of the individual products is 4 and the average is 1.
=== Our second Discrete Fourier Transform: a sine and cosine of same (integral) frequency produces 0 ===
400px|thumbnail
We will "transform" our pendulum's motion with a sine pendulum's motion -- same slow speed -- and see what we get. We add up the numbers, and divide by 4 to get "the weighted average".
time in seconds.........: { 0,.... 1, ...2,... 3,... 4,... 5,....6,....7 } 
position of cosine pendulum..: { +1.0, +0.7, +0.0, -0.7, -1.0, -0.7, +0.0, +0.7 } 
position of sine pendulum....: { +0.0, +0.7, +1.0, +0.7, +0.0, -0.7, -1.0, -0.7,  } 
products.....................: { +0.0, +0.5, +0.0, -0.5, +0.0, +0.5, +0.0, -0.5 } 
running sum of products......: { +0.0, +0.5, +0.5, +0.0, +0.0, +0.5, +0.5, +0.0 } 
The sum of the products is 0 and the average is 0.
=== Our third Discrete Fourier Transform: two cosines, or a sine and cosine, of different (integral) frequencies produce 0 ===
400px|thumbnail
We will "transform" our pendulum's motion with a faster pendulum's motion -- three as fast -- and see what we get. What we do is put down three cycles of our fast pendulum -- sampled at the same 8 1-second intervals -- and multiply each slow sample by the fast sample. We add up the numbers, and divide by 4 to get "the weighted average".
:time in seconds.........: { 0,.... 1, ...2,... 3,... 4,... 5,....6,....7 }
:position of slow pendulum..: { +1.0, +0.7, +0.0, -0.7, -1.0, -0.7, +0.0, +0.7 }
:position of fast pendulum..: { +1.0, -0.7, +0.0, +0.7, -1.0, +0.7, +0.0, -0.7 }
:products....................: { +1.0, -0.5, +0.0, -0.5, +1.0, -0.5, +0.0, -0.5 }
:running sum of products.....: { +1.0, +0.5, +0.5, +0.0, +1.0, +0.5, +0.5, +0.0 }
The sum of the products is 0 and the average is 0.
This time we multiply our slow pendulum's motion by by the three-times-as-fast sine waveform:
:time in seconds.......: { 0,.... 1, ...2,... 3,... 4,... 5,....6,....7 }
:position of slow pendulum..: { +1.0, +0.7, +0.0, -0.7, -1.0, -0.7, +0.0, +0.7 }
:position of fast pendulum..: { +0.0, +0.7, -1.0, +0.7, +0.0, -0.7, +1.0, -0.7 }
:products...................: { +0.0, +0.5, +0.0, -0.5, +0.0, +0.5, +0.0, -0.5 }
:running sum of products.....: { +0.0, +0.5, +0.5, +0.0, +0.0, +0.5, +0.5, +0.0 }
The sum of the products is 0 and their average is 0.
So how many integer-multiples of this sort can we get? Unfortunately, not as many as we'd like: Just the number of samples in fundamental's cycle divided by 2 -- in other words 4 for the cosine collection and 4 for the sine collection. Why is this? The answer is not so simple. See Nyquist Rate below.
Our conclusions from the above examples:
#we need a sample of waveform of a distinct length or duration; the duration or length of this snippet is called "the window" 
#the transform's fundamental frequency is the reciprocal (i.e. 1 divided by) the "window's" length or duration. If the window is 8 samples long and each sample takes 1 second then the window is 8 seconds and the fundamental frequency is 1/8 = 0.125 second (i.e. really slow).
#the number of samples taken in the window should be an integer multiple of the fundamental frequency: the powers of two { 2, 4, 8, 16 etc } are particularly congenial.
#the harmonics will be integer multiples of the fundamental frequency; the number of harmonics are allowed to be only one-half our sample size plus 0 (e.g. { 0, 1, 2, 3, 4 } for a sample size of 8.
#If our waveform has sines in it, only the sine sample-numbers will "pluck them out"
#If our waveform has cosines in it, only the cosine sample-numbers will "pluck them out"
#Sines pluck only sines of the same frequency
#Cosines pluck only cosines of the same frequency
#The amplitudes of the plucked sines or cosines will be computed by computing the individual products of the samples with their sampled sine or cosine counterparts, adding them up for each sine and cosine frequency, then dividing by the number of samples, then multiplying this by 2.
=== Let the transforms begin ===  
 
1. Our sampled waveform:
: { 1, 1, 1, 1, 0, 0, 0, 0 }
2. The fundamental frequency is 1/8 seconds
3. The integer sample size is 8
4. The various integer multiples of the fundamental will be
: {0, 1, 2, 3, 4 }
5. The various integer frequencies of the sines and cosines will be
: { 0, 1/8, 2/8, 3/8, 4/8 }
6. The sampled cosine fundamental and its harmonics:
: n=0: { 1, 1, 1, 1, 1, 1, 1, 1} 
: n=1: { 1, 0.7, 0, -0.7, -1, -0.7, 0, +0.7 }
: n=2: { 1, 0, -1, 0, 1, 0, -1, 0 }
:n=3: { 1, -0.7, 0, 0.7, -1, 0.7, 0, -0.7 }
: n=4: { 1, -1, 1, -1, 1, -1, 1, -1}
7. The sampled sine fundamental and its harmonics:
: n=0: { 0, 0, 0, 0, 0, 0, 0, 0} 
: n=1: { 0, 0.7, 1, 0.7, 0, -0.7, -1, -0.7 }
: n=2: { 0, 1, 0, -1, 0, 1, 0, -1 }
: n=3: { 0, 0.7, -1, 0.7, 0, -0.7, 1, -0.7 }
: n=4: { 0, 0, 0, 0, 0, 0, 0, 0}
To create our transform we simply multiply the counterparts (thus we have to do this 8 times, and we see that 2 of these yield 0 so they are trivial). here is an example of n=3 for the numbers of the sampled sine:
: n=3: { 1*1, 1*-0.7, 1*0, 1*0.7, 0*-1, 0*0.7, 0*0, 0*-0.7 }=
:: { 1, -0.7, 0, +0.7, 0, 0, 0, 0 }
We add these and divide by 4 to get 0.25. This is the amplitude (height, value) of this "component" n=3. If one were to write cosine equation for this harmonic "wave" it would be:
: for n=3, 0.25*cos(2Π*3*t/8) where "t" is the times of the samples { 0, 1, 2, 3, 4, 5, 6, 7 }
==== A 16-sample transform ====
500px|thumbnail|Both sine and cosine amplitudes are displayed for all 8 components.
We can get a better feeling of what is going on if we go to larger sample sizes. Our original waveform shown here is the following: 
{ -0.5, -0.5, -0.5, 1, 1, 1, -1, -1, -1, -1, -1, 0.5, 0.5, 0.5, 0.5, 0.5 }
The graphing together of sine and cosine amplitudes is somewhat difficult to look at, so we will plot the information in a different way -- in the more common presentation of "a spectrum". The "spectrum" has facinating quality of being position invariant -- unlike the varying sine-cosine harmonics that change depending on where we "start" our waveform on the cylinder, the spectrum remains the same. 
500px|thumbnail|Easier to read than the sine-cosine bars, the classical "spectrum" displays only composite amplitude (similar to the so-called root-mean-square (RMS)value). But we need the phase-angles if we intend to reconstruct the waveform. 
A spectrum does not show the amplitudes of the individual sines and cosines, but rather it combines the two into a single number for each harmonic (for more about the trigonometry behind this see Why it Works):
: V = sqrt(an^2 + bn^2)
The square root is usually taken in the positive and represents a directionless quantity: (the length of a line but not its direction). This composite amplitude V, however, contains only has half the information. The rest is contained in "the phase" φ:
: φ = arc-tangent(sine-amplitude/cosine-amplitude)
An "arc-tangent" is "the angle whose tangent is ...". On an Excel spreadsheet the ATAN function "appears" in the form of radians, where a "radian" is defined as 2π of these puppies in one circle. If we want to convert "radians" to "degrees" (360 degrees in a circle), a radian is 360 degrees/(2π) = 57.29577951 degrees, a convenient-and-easy to remember number.
500px|thumbnail|Phase is shown in degrees.
To do a reconstruction, then, either both the composite amplitudes Vn and the phases φn are required for each component n, or both the sines' and cosines' amplitudes an and bn are required for each component. Nothing comes for free.
==== A 16-sample reconstruction ====
700px|thumbnail|A sixteen-sample reconstruction of a more complicated waveform (original is shown in black). The plots show successively more terms added together for better and better reconstructions. The wiggly red line S(0-8) is as good as we can do.
Our original waveform shown here is the following, the same as appears on the cylinder above:
: { -0.5, -0.5, -0.5, 1, 1, 1, -1, -1, -1, -1, -1, 0.5, 0.5, 0.5, 0.5, 0.5 }
The original waveform is shown in black. Just below the X-axis (labelled 0.00) is the "d.c." (abbreviation for "Direct Current") or steady-state value that comes from the 0th cosine component. Our reconstruction sums this d.c. value and all the other sine and cosine terms for each component, then sums up the resulting waves into a partial reconstruction. Not all the partial-reconstruction sums are shown because the picture gets cluttered.
The odd wiggles on the final reconstruction (bold red line) is typical. See more at Gibb's phenomenon below.
=== Poor man's explanation of the discrete Fourier Transform: Discussion  ===
---A WORK IN PROGRESS--
Nyquist frequency: the maximum frequency in our "transform" = 1/2 the sampling frequency
Observe an interesting fact: when m=4, the sine  is 0 all the way down the column, but when n=4, the cosine alternates:
: { 1, -1, 1, -1, 1, -1, 1, -1 } 
These numbers represent the cosine's maximum and minimum values. If our "waveform" contains a cosine or sine that is "faster" than this, our sampling will make an error. This is related to what is called the Nyquist frequency. Our maximum sampling frequency should be less than or equal to (at worst) one-half of our sample rate. Aliasing occurs when we don't to this problem (for more see Aliasing below). 
Sometimes (for sound purposes) folks plot these as a 'sonogram' where frequency is on the Y axis, time is on the X-axis, and intensity is the color or the "brilliance" of a point in the plane.
Repeatitive numbers in the sine and cosine samples
Observe that only the following numbers appeared in the 8-sample transform when we sample the sines and cosines:
: -1, -0.71, 0, +0.71, +1
This lucky find means that if we are doing this with a microcontroller we don't have to compute vast numbers of sines and cosines, we can just store the necessary numbers in a table. It happens because our sines and cosines are periodic and related to one another by integers. This observation will be of use if we want to proceed to a "fast Fourier Transform" (see below).
But, we do have to be clever in our choice of sample size. An example (not shown) of 10 samples creates 5 harmonics for the sine and five for the cosine. But the numbers are not so fortunate and there are lots more of them. If you were to work this out on a spread-sheet you would observe the numbers below: 
: -1.00, -0.95, -0.81, -0.59, -0.31, 0, +0.31, +0.59, +0.81, +1.00
Hamming seems fond of the number "12" (cf Hamming p. 543ff).
Prelude to the 'Fast Fourier Transform' 
The "FFT" is just a computing trick that depends on the fact noted above: that all the values of sine and cosines in the table are similar (cf. Chapter 33 "The Fast Fourier Transform" in Hamming, p. 539ff). The FFT has become a highly-developed art since Hamming. See Discrete cosine transform for nice examples.
=== Poor man's explanation of the discrete Fourier Transform: What can go wrong ===
---A WORK IN PROGRESS--
Hamming describes the many issues that can arise with the discrete Fourier Transform:
: "33.5 Dangers of the Fourier Transform:
:: "...the ever present problem of aliasing (Sections 31.2, 31.6)
:: "...leakage due to the use of a finite length of record (see Sec. 34.8)
:: "...picket fence effect" (Hamming p. 543) 
==== The origin of aliasing ====
The origin of "beat frequencies" (in sound recordings: unexpected groans, whistles, whines, throbbing pulsations; in photos: weird Moire patterns) and their role in aliasing can be found in some trigonometric identities that show what happens when we multiply sines by sines, or cosines by cosines. (We can easily derive these identities if we express sine and cosine in their complex (i.e. e^ix) forms). We use the following:
:cos(x+y) = cos x*cos y - sin y*sin x
:cos(x-y) = cos x*cos y + sin y*sin x
From the above we simply derive the equations below. These show that if we multiply two sines or cosines, we get the sum frequency (x+y) and the difference frequency (x - y) and there is nothing we can do about it:
:cos x*cos y = 1/2(cos(x - y) + cos(x + y))
:sin x*sin y = 1/2(cos(x - y) - cos(x + y))
Because any Fourier transform multiplies cos x*cosy and sin x*sin y we will always get "beats". Whether or not the "beats" have any affect on what we are doing depends on how cautious we are with respect to our sample rate and our waveform that we are sampling.
==== Sampling also causes aliasing ====
Suppose we sample our wave at 4 per second (t occuring at an interval of 0.125 second), a sine waveform with a frequency of 6 per second. In other words, we have not sampled at a high enough frquency. Sampling can be thought of as multiplying our 6 Hz waveform by "the sampler" occurring at 4 per second. Let's use the simplest sampler we can: a sinewave "lifted up" so that its peak occurs at 1 and its minimum at zero:
: 0.5 + 0.5*sin(2pi*4*t)
Our sampling thus multiplies our 6 Hz sinewave by the "sampler"
: sin(2pi*6*t)*[0.5+ 0.5*sin(2pi*4*t)] = 0.5*sin(2pi*6*t) + 0.5*sin(2pi*4*t)*sin(2pi*6*t)  
And we have seen that this process of multiplication introduces "beats". The right-most term yields the "beats" at 2 and 10 Hz:
:sin x*sin y = 1/2(cos(x - y) - cos(x + y))
:0.5*sin(2pi*4*t)*sin(2pi*6*t) = 0.5*{(1/2(cos(2pi*4*t - 2pi*6*t) - cos(2pi*4*t + 2pi*6*t) }
So our sampling has produced the following new waveform:
: 0.5*sin(2pi*6*t) + 0.25*{ cos(2pi*2*t) - cos(2pi*10*t) }
Observe that we have just picked up 2 Hz and 10 Hz in addition to the original 6 Hz. 
Now, what happens when we do our transform? We create more beats! We can see this if we use the 4 Hz sine or cosine of the transform: 
: 1*cos(2pi*4*t)*{0.5*sin(2pi*6*t) + 0.25*{ cos(2pi*2*t) - cos(2pi*10*t) }
The first term creates 2 and 10, the second term creates 2 and 6, and the third term creates 6 and 14!
The process of sampling and processing with discrete Fourier transforms is like making an infinitely long paper doll: we fold our infinitely-long paper, cut one shape and unfold it to reveal the repeating pattern, ad infinitum (cf drawing on pag 514 of Hamming, and his explanation p.513). If we cut too far our shape "overlaps" into the shapes beside it. This is called "folding". 
Harmonic 6 is equivalent to 2. 6 has "folded back" to become 2, and the "2" shouldn't be there. 10 also folds back to 2.
Note that we could have done this in reverse order: multiplied, in the continuous domain, our waveform by the sine, then sampled it. The results would be the same.   
==== Aperture Effect ====
The aperture (cf Carlson p. 285, Bracewell, p. 276ff) is the time e.g. 0.001 second for a slow sampler) during which a "snap-shot" of the waveform is taken and either held constant (while an A-to-D conversion occurs, in the above audio example) or allowed to change while either the sample or (if no "hold") the conversion is occurring). Thus we see two sources of error during the instant the sample is taken: (i) the waveform may be changing during "the sample", (ii) an A-to-D error may occur. But there is a third intrinsic error which is related to "windows".
==== Window error ====
As mentioned above, the fact that we have introduced a "window "of finite time-duration during which we take our samples itself introduces more "junk.
Our analogy points to a source of problems: we may "cut" our waveform at an inopportune place and make the splice to another inopportune place, and thereby create a "discontinuity." And such discontinuities create something called 'the Gibbs phenomenon' (see more below).
[need reference here e.g. Sound Forge uses various methods:] What to do about this? Engineers have devised ways of "smoothing" the signal -- multiplying the window by a "weighting factor" so that the discontinuity is not so odious. [Blackmun, Hamming, etc. windows]   
  
==== Gibbs phenomenon ====
thumbnail|caption
>(cf Hamming p. 532ff, Bracewell p. 209). [Is this Hamming's "leakage?]
  
Some examples produce tidy results -- the reverse DFT reproduces its waveform perfectly. But if we had picked the following waveform we would not be able to reproduce it exactly. In the little picture, the original is in blue and the red is the reproduced. this problem is either caused by (i) Gibbs phonomenon or by (ii) too-high frequency content for the sample rate:
::11010000
:wave....reconstructed wave		
:1........+1.13		
:0........-0.13		
:1........+1.13		
:1........+0.88		
:0........+0.13		
:0........-0.13		
:0........+0.13		
:0........-0.13		
It appears to have "ripples" in the waveform that we cannot get rid of [etc: is this Gibbs or is this the effect of aliasing -- too much high-freq crap in the original waveform?]
=== Poor man's explanation of the discrete Fourier Transform: Why it works ===
---A WORK IN PROGRESS--
> In the final analysis, can we can convince ourselves that a waveform of a given length/duration can be expressed as "the finite sum of a integral sines and cosines with various amplitudes"?
> An important observation: weighted average: If we plot one cycle of our fundamental sine and consider the area under the curve of "the upper half" (above the X-axis) to be positive area, and the "lower half" to be negative, then we see that the area below cancels out the area above. This is also true for the cosine, since they have the same shape.
This happens always when there are an integral number of cycles of the sine or cosine, but never when the number of cycles is not integral.
If we multiply our waveform by our "reference" sine or cosine, the total positive- and negative- areas under the resulting curve (the curve that represents the product of our waveform x sine, or waveform * cosine) may not be (and probably won't be) 0. The "residual" area gives us a clue about how much of that particular "component/harmonic" is "in the waveform".    
>Why is "the component" that results from the transform just the simple average of the area? If we were to plot the "residual" area as a little rectangle, it will have either a positive-area or a negative-area) stretched over the extent of our "snippet window" = "length/duration of fundamental". Thus our rectangle's length is the "length" of the fundamental and its "height" is the area divided by the length. [Aren't things are off by a factor of 2? Why?]   
> Then the notion of "plucking out" the amplitudes by use of the "unit harmonics" may be straight-forward (if you're willing to do some algebra). It is the assertion that "a finite waveform can be expressed as the finite sum...." that is hard to swallow.
: t = 0, 1, 2, 3, 4, 5, 6, 7
: W(t) = a0*sin2Π*0*t/8 + a1*sin2Π*1*t/8 + a2*sin2Π*2*t/8 + a3*sin2Π*3*t/8 +a4*sin2Π*4*t/8 + b0*cos2Π*0*t/8 + a1*cos2Π*1*t/8 + a2*cos2Π*2*t/8 + a3*cos2Π*3*t/8 +a4*cos2Π*4*t/8
: W(t) = 0 + a1*sin2Π*1*t/8 + a2*sin2Π*2*t/8 + a3*sin2Π*3*t/8 + 0 + b0*1 + a1*cos2Π*1*t/8 + a2*cos2Π*2*t/8 + a3*cos2Π*3*t/8 +a4*cos2Π*4*t/8
: W(t) = a1*sin2Π*1*t/8 + a2*sin2Π*2*t/8 + a3*sin2Π*3*t/8 + b0 + a1*cos2Π*1*t/8 + a2*cos2Π*2*t/8 + a3*cos2Π*3*t/8 +a4*cos2Π*4*t/8
To pluck out third cosine harmonic, multiply W(t) by unit cosine 1*sin2Π*3*t/8. This generates a slew of harmonics, in essence doubling the number of terms on the right: 
: W(t)*1*sin2Π*3*t/8 = { a1*sin2Π*1*t/8 + a2*sin2Π*2*t/8 + a3*sin2Π*3*t/8 + b0 + a1*cos2Π*1*t/8 + a2*cos2Π*2*t/8 + a3*cos2Π*3*t/8 +a4*cos2Π*4*t/8 }*1*cos2Π*3*t/8
 
> concept #1: to locate a point on the plane we need two values, its "X-coordinate" and the "Y-coordinate". This is, ultimately, where the need for both the sine and the cosine waveforms comes from. If our X- and Y-axes are at right angles, we say that they  are "orthogonal", a word used interchangeably with 'perpendicular':
:"orthogonal: Greek: from orth- straight, right, true +gōnia angle: intersecting or lying at right angles; of vectors: having the scalar product of zero" (Webster's) 
> concept #2: the ultimate value of a*sine X + b*cos Y is "Z" in the third dimension. If we are to keep the cylinder analogy we really have to think about this in 3-D. The waveform is printed on the treads of a tire, the tire is mounted on a wheel on an axle that spins at the same rate as the fundamental sine and cosine. The 1st harmonic spins twice as fast. Etc.    
> concept #3 requires a bit of trigonometry: the Pythagorean theorem. Given that our "X" and "Y-axes" are perpendicular/orthogonal, and the values for "X" and "Y" are the coordinates (location) of the point in the plane, the diagonal V-- measured from the origin to the point -- has the following length:
: V = sqrt(X^2 + Y^2)
An example: On a stairs the "run" is the length of the "tread" and the rise is the (perpendicular) height of the step. The diagonal is, well ... the diagonal.
: A typical stairway has a rise of 7.2 inches, a run of 10 inches, and a diagonal of 12.5 inches. The diagonal should be sqrt(7.2^2+10^2) =12.32, and indeed that is close to the measurement of 12.5 inches.       
If this length-of-line V is given together with its "direction" we call it a "a vector". But how do we specify its "direction?"
> concept #4 requires a bit of trigonometry. A common way of describing a vector's "direction" (remember: a "vector" is the line drawn from the origin to a point on our waveform) is to give the angle, measured counter-clockwise, that it makes withthe X-axis. If our vector-line lies flat on the X-axis and points to the right, it has an angle of 0° (always described with respect to the X-axis). Straight up it has an angle of 90, straight left it has an angle of 270, straight down it has an angle of 360. 
> concept #5 requires a bit of trigonometry. The definition of "the cosine of an angle" is "run" divided by the diagonal. the definition of "the sine of an angle" is the "rise" divided by the diagonal. The two concepts can be compressed into a third definition called "the tangent": "rise"/"run".
:Example: For our typical stairway, the tangent of the stairs is rise/run = 7.2/10 = 0.72. If we were to use the diagonal (12.5) and the run (10) the cosine of our angle is run/diagonal = 10/12.5 = 0.80, and the sine of our angle is rise/diagonal = 7.2/12.5 = 0.58.
:The angle that corresponds to a tangent of 0.72 is 36 degrees, the angle that correspondes to a cosine of 0.80 is 37 degrees, the angle that corresponds to a sine of 0.58 is 35°. These are close enough so that we can use the average of ~36 degrees as "the direction of the vector with length 12.5 inches" to describe our stairs.
Basis vectors:
What is the angle between the X-axis and Y-axis? We might start this way: we draw a line and call it "the X-axis". Somewhere on it we put a point; this we call "the origin". Then off the line somewhere we put a point, say to the upper right an inch or so. If we were to draw a line from the origin through this point it would form an angle. Now move the point directly above the origin so that the X-axis and the line are perpendicular (orthogonal). The angle of our perpendicular line is 90 degrees. What is its cosine? 0.
> This is the mathematical definition of orthogonal: cosine between two lines-as-vectors is 0. 
>[So what is the point? Why does the reader want to care about this?: that for any point in an X-Y plane we can use two orthogonal vectors to locate it? these are "the basis vectors". In the "X-Y" plane we need only two: the (unit) X-leg and Y-leg of the (unit) triangle; any point in the plane can be located with the help of these two: 3*X + 4*Y locates a point at x=3, y=4. The length of "the vector" (measured from origin to the point) is sqrt(3^2 + 4^2) = 5, the angle is arctan(4/3) = 53 degrees. Given these two values L=5, angle=53 degrees, how do we locate our point? (x=5*cos(53°), Y=5*sin(53°)). But why not skip the X, Y step and go to a unit sine and unit cosine as a basis? How and why do "the harmonics" come into this?
> Here's an important observation: the product of two "vectors", i.e. a sine as "a vector" and a cosine as "a vector" times our waveform which is a bunch of vectors:
: point P =(a, b) = ax + by, point Q = (c, d) = cx + dy
What will be the sum of these two points? the simplest way would be to just add everything together in a mish-mash. But We would loos our vector. Vectors add "component ax" to component cx, "component by to component dy". The resulting vectors (a+c)x and (b+d)y are considered 'independent' and are not intermingled:
: point P + Q = (a+c)x + (b=d)y
What will the product of these two points, a product that we need for our transform? We will just do our multiplication in the "normal way" -- term by term and see what it looks like:
: product P*Q =  ax* cx + by*cx + ax*dy + by*dy
We would expect that, like most things multiplicative, x*x = x, ditto for  y*y = y
But what about y*x and x*y? Because they are at right angles to one another, both products are 0. [and why is that?]
Given that we accept the sentence above, our product leaves us with something simple: we see that we haven't "gained" any extra terms, so if we needed to we could do this again, and again (we don't need to):
: product P*Q =  a*cx + b*dy
 
>[We have to move, in an intuitive manner, from a point to a sequence of points that trace out a curve and show without handwaving . Each point can be described by a single vector (length) and an angle with respect to the X-axis, or as two perpendicular vectors. for a circle we can see this easily, and the sines and cosines for the fundamental -- the circumference of the unit circle -- . But just how do the harmonics come into this? The Harmonics spin around the Z axis-as-axle twice as fast, three times as fast, four times as fast, etc.
>We have to show the reader how this stuff works. We have cylinders or disks spinning at the "fundamental rate" of 1 revolution per 8 seconds, twice as fast 2 revolutions per 8 seconds, three times as fast (3 revolutions per 8 seconds), 4 revolutions per 8 seconds. 
Here, m and n are integers that will represent "the harmonics" as described below. They either positive or negative values. Usually they are just considered positive:
For continuous sine and cosine wavesforms:
: integral from -pi to +pi (sin mx*sin nx) = 0 if m<>n
: integral from -pi to +pi (sin mx*cos nx) = 0 
: integral from -pi to +pi (cos mx*cos nx) = 0 if m<>n
: integral from -pi to +pi (sin mx*sin mx) = pi if m<>0
: integral from -pi to +pi (cos mx*cos mx) = pi if m>0
: integral from -pi to +pi (cos mx*cos mx) = 2pi if m=0
::Proof of this can be seen if we fiddle around with the definitions of sine and cosine written in terms of their "imaginary" equivalents.
For discrete sine and cosine waveforms the following become summations over the number of samples S (e.g. S=8):
: summation from t=0 to t=S of sin(2*π*m*t/S)*sin(2*π*n*t/S) = 0 if m<>n
: summation from t=0 to t=S of sin(2*π*m*t/S)*cos(2*π*n*t/S) = 0
: summation from t=0 to t=S of cos(2*π*m*t/S)*cos(2*π*n*t/S) = 0 if m<>n
: summation from t=0 to t=S of sin(2*π*m*t/S)*sin(2*π*n*t/S) = S/2 if m=n
: summation from t=0 to t=S of cos(2*π*m*t/S)*cos(2*π*n*t/S) = S/2 if m=n 
: summation from t=0 to t=S of cos(2*π*m*t/S)*cos(2*π*n*t/S) = S if m=n
=== Poor man's explanation of the discrete Fourier Transform: References ===
---A WORK IN PROGRESS--
:Kreider, Donald L. et. al. An Introduction to Linear Algebra, Addison-Wesley, Reading, Mass, 1966. After introducing the notion of orthogonal vectors and x*y = 0, Kreider just pops onto the reader the notion of "trigonometric polynomal(s) of degree 2n +1" with an inner product" defined as
:: f*g = integral from -pi to +pi (f(x) g(x)dx)
:This is, of course, the definition of the (infinite) Fourier Transform. He then shows how to normalize the set of "vectors" derived from the sum (just the terms), and then shows via the integrals (above) of sin mx*sin nx  etc. that these are orthogonal. In a a Corollary he shows how these become a basis for "an n-dimensional Euclidean space]. He then shows how to use "the perpendicular projections" these trigonometric polynomials to determine the "Fourier coefficients". 
:Hamming, R. W., Numerical Methods for Scientists and engineers: Second Edition, Dover Publications Inc., New York, 1962, 1973. An excellent addition to any technical library.
 
::Chapter 31 Fourier Series: Periodic Functions p. 504ff, 
::Chapter 32 convergence of Fourier Series,
::Section 32.5 The Gibbs Phenomenon,
::Chapter 33 The Fast Fourier Transform
:Bracewell, Ron, The Fourier Transform and its Applications, McGraw-Hill, Inc. 1965. cf in particular Chapter 3 Convolution where he demonstrates how to slide paper tapes past one another to do discrete running means ("serial products") in the process of doing "a convolution".
:http://www.earlycinema.com/technology/mutoscope.html
  
:peripheral ref. LePage, Wilbur R., Complex Variables and the Laplace Transform for Engineers, Dover Publications Inc., New York, 1961.
:Cannon, Dynamics of Physical Systems ...
    
wvbaileyWvbailey 18:50, 16 June 2006 (UTC)
thread_title:  Poor man's explanation of the discrete Fourier Transform 

message: ---A WORK IN PROGRESS--
:Kreider, Donald L. et. al. An Introduction to Linear Algebra, Addison-Wesley, Reading, Mass, 1966. After introducing the notion of orthogonal vectors and x*y = 0, Kreider just pops onto the reader the notion of "trigonometric polynomal(s) of degree 2n +1" with an inner product" defined as
:: f*g = integral from -pi to +pi (f(x) g(x)dx)
:This is, of course, the definition of the (infinite) Fourier Transform. He then shows how to normalize the set of "vectors" derived from the sum (just the terms), and then shows via the integrals (above) of sin mx*sin nx  etc. that these are orthogonal. In a a Corollary he shows how these become a basis for "an n-dimensional Euclidean space]. He then shows how to use "the perpendicular projections" these trigonometric polynomials to determine the "Fourier coefficients". 
:Hamming, R. W., Numerical Methods for Scientists and engineers: Second Edition, Dover Publications Inc., New York, 1962, 1973. An excellent addition to any technical library.
 
::Chapter 31 Fourier Series: Periodic Functions p. 504ff, 
::Chapter 32 convergence of Fourier Series,
::Section 32.5 The Gibbs Phenomenon,
::Chapter 33 The Fast Fourier Transform
:Bracewell, Ron, The Fourier Transform and its Applications, McGraw-Hill, Inc. 1965. cf in particular Chapter 3 Convolution where he demonstrates how to slide paper tapes past one another to do discrete running means ("serial products") in the process of doing "a convolution".
:http://www.earlycinema.com/technology/mutoscope.html
  
:peripheral ref. LePage, Wilbur R., Complex Variables and the Laplace Transform for Engineers, Dover Publications Inc., New York, 1961.
:Cannon, Dynamics of Physical Systems ...
    
wvbaileyWvbailey 18:50, 16 June 2006 (UTC)
thread_title:  Poor man's explanation of the discrete Fourier Transform: References 

message: :Readers are unlikely to find this clearer.  If a reader doesn't know enough math to understand complex exponentials, burying them in tables of numbers and real trigonometry is probably not going to be something they'd care to wade through.  —Steven G. Johnson 15:36, 13 June 2006 (UTC)
replies: text: "A" for effort.  But if a picture is worth 1000 words, then it is probably worth 100000 numbers.  (Sorry)  --Bob K 17:12, 13 June 2006 (UTC)
replies: text: The quote I've heard is: "A picture may be worth a thousand words, but an equation is worth a thousand pictures."  (Another good one: "If a picture ain't worth a thousand words, forget it.") —Steven G. Johnson 17:34, 13 June 2006 (UTC)
thread_title:  Opinions cont'd 

message: The unsatisfactory section of the article could be replaced by this.
The eigenvalues of the involutary discrete fourier transform, F, are +1 and −1, because F satisfies the equation F2 = 1 and so any eigenvalue k satisfies k2 = 1.
The operators P = 2−1(1+F)  and Q = 2−1(1−F)  are idempotent :
:P2 = (2−1(1+F))2 = 2−2(1+2F+F2) = 2−2(1+2F+1) = 2−1(1+F) = P
:Q2 = (2−1(1−F))2 = 2−2(1−2F+F2) = 2−2(1−2F+1) = 2−1(1−F) = Q
If x is any vector, then Px is a eigenvector with eigenvalue +1, and Qx is a eigenvector with eigenvalue −1, because 
:FP = F2−1(1+F) = 2−1(F+F2) = 2−1(F+1) = (+1)2−1(1+F) = (+1)P .
:FQ = F2−1(1−F) = 2−1(F−F2) = 2−1(F−1) = (−1)2−1(1−F) = (−1)Q .
Any vector x is a sum of an eigenvector with eigenvalue +1 and an eigenvector with eigenvalue −1:
:x = Px + Qx
because
:1 = P + Q 
and the involutary fourier transform of this vector is
:Fx = Px − Qx
because
:F = P − Q
Bo Jacoby 15:03, 19 June 2006 (UTC)
replies: text: Hi Bo, back to your old haunts, I see?  Just to remind you, as you've been reminded repeatedly, Wikipedia is not the place for you to promote your own nonstandard transform definitions and notations (e.g. the "involutary DFT", 1^{1/2} = -1, etcetera).  This is not a question of whether they are "good" or "bad", merely whether they are nonstandard.  I hope you won't force other editors to keep reminding you of this in perpetuity. —Steven G. Johnson 02:51, 20 June 2006 (UTC)

text: Hi Steven. The article is unacceptably bad, as other readers have also remarked. Your position, to consider anything that is new to you as nonstandard, and anything that is old to you as trivial, prevents WP from excelling beyond your level. So be it. You must refer to the standardization organization that made the noninvolutary DTF definition 'standard'. Bo Jacoby 07:23, 20 June 2006 (UTC)
thread_title:  Eigenvalues and eigenvectors 

message: This is my first major Wikipedia submission; please bear with me.  I have written a quick reference to how to use the DFT in MATLAB which I would like to offer for inclusion.  What say you all?
--Cxw 19:33, 18 July 2006 (UTC)
replies: text: I would lean against including it.  Wikipedia is not a Matlab manual, and good Matlab introductions to such things are available elsewhere. —Steven G. Johnson 14:36, 25 July 2006 (UTC)

text: I agree.  FWIW, if I were creating such an example, I would include windowing.  I would also switch the roles of tmax and delf.  I.e., delf would be the independent variable (and its name would be Hz_per_bin).  We often have the luxury of larger tmax than what is necessary to produce the required Hz_per_bin.  In that case, the Welch method will usually produce a more satisfying power spectrum than fft().  --Bob K 23:51, 25 July 2006 (UTC)
replies: text: Sounds like you guys are addressing the topic of estimation of power spectra.  That's just one minor use of DFT, and as BobK points out, there are usually better tools for that job.  DFT is often used to implement circular convolution, for applications such as filtering with long FIR filters.  And there are other uses, I dare say.  These would be better things to add to the article.  An article on spectrum estimation might also be a good idea. Dicklyon 19:19, 26 July 2006 (UTC)

text: Dear Cxw. In the spirit of wikipedia you are free to contribute, and others are free to move your contribution to better places or to improve upon it. Nobody should "lean against". Welcome. Bo Jacoby 09:57, 9 August 2006 (UTC)
thread_title:  New submission: DFT use quick reference 

message: 'Sinusoid' is a new word in the context. It might be confusing to some readers. I changed it to 'wave' in accordance with the explanation given in the article sinusoid but it was changed back. The terms in the trigonometric polynomial as written are exponentials, not explicite trigonometrics. Perhaps this is the place to show a real-function expression of trigonometric polynomials involving the sine and cosine functions explicitely? If the reader has seen such an expression in some book it is nice if he recognizes it in wikipedia so that he doesn't think that the article here is about something quite different. Bo Jacoby 06:35, 16 August 2006 (UTC)
replies: text: I changed it to complex sinusoid frequencies.  I don't think anyone who is reading this section is going to be any better off by having this explained here.  Anyone who doesn't know that much is way out of their element, and this is not the place to try to fix that. Dicklyon 06:47, 16 August 2006 (UTC)

text: Yes, you are right and I feel like an ass, as I'm usually the one putting in the missing hyphens to avoid exactly such misreadings.  I will fix it to "complex-sinusoid frequencies". Dicklyon 14:58, 16 August 2006 (UTC)
thread_title:  The word 'sinusoid'  

message: "In contrast, the most obvious trigonometric interpolation polynomial is the one in which the frequencies range from 0 to N − 1 (instead of roughly − N / 2 to + N / 2 as above), similar to the inverse DFT formula. This interpolation does not minimize the slope, and is not generally real-valued for real xn; its use is a common mistake."
Dear Steven, the fact that you made this mistake yourself does not make it common. You do not have to document your mistakes in WP. :-) Bo Jacoby 06:44, 16 August 2006 (UTC)
replies: text: I have no idea what you are talking about, and your snarkiness is unwarranted.  I did not make this mistake myself, although I may have phrased the explanation poorly.  However, it is indeed a common mistake.  (You see it over and over on Usenet, when people try to differentiate a function by multiplying its DFT by the frequencies, but forgetting aliasing...then they wonder why their inverse DFT looks weird.  I deal with FFT users every day due to my software, and again I see this error repeatedly. I also see it from students when dealing with spectral methods for PDEs...as a result, I actually assigned a homework problem on exactly this issue last term.)  —Steven G. Johnson 23:49, 16 August 2006 (UTC)

text: If you want to make constructive criticism, you should avoid snide insults.  Another good tip would be to avoid manifestly false statements such as that I haven't "let" anyone else edit the article.  As for the order, actually the simple 0..N-1 case was listed there before I ever edited that section to add the symmetric case; I left it because there is a certain merit to describing the concept of trigonometric interpolation with the simplest example before you get to the more complicated case of the (typically) most useful interpolation, and there is also merit to showing two inequivalent interpolations explicitly in order to highlight the differences.   And as for the "errors in teaching" that you so politely imply, I didn't say they were my students; with my own students I assigned this question on the very first problem set to be sure they don't get confused.  Over the past ten years, I've dealt with hundreds of students who have emailed me for advice regarding FFT usage, and as I said I see this mistake over and over. —Steven G. Johnson 18:06, 17 August 2006 (UTC)

text: Would this be considered "documenting an error":  Tobacco_smoking#Health_risks_of_smoking ?  --Bob K 03:48, 18 August 2006 (UTC)
replies: text: Hi Bob. What do you think? Is tobacco smoking just a 'common error' of mathematics, or is it a deadly and costly problem of society ? Bo Jacoby 09:24, 18 August 2006 (UTC)
replies: text: I see no reason that [Wiki] mathematics should be exempt from the common courtesy of helping new people avoid old mistakes.  --Bob K 15:50, 18 August 2006 (UTC)

text: I'm afraid that no one's edits are exempt from the actions of other editors.  As for my "history of removing" your "contributions", I assume you're referring to my reversions of your edits that violate Wikipedia policy against nonstandard personal notations, a policy that has been explained to you repeatedly by numerous editors to no avail.  It is unfortunate that you cannot see the difference between this and your own discourtesy.  If you are requesting special privileges to keep your edits inviolate, or the special privilege to violate consensus policy, then I'm afraid I must decline your request.  —Steven G. Johnson 20:28, 18 August 2006 (UTC)

text: Correction of typos is always welcome, and I've never said that you don't make any useful edits. Nor do I claim to never make mistakes. I do object to false and meanspirited accusations, and to your pointlessly insulting manner above.  Don't try to twist my words to conflate different subjects.  —Steven G. Johnson 17:41, 20 August 2006 (UTC)
thread_title:  'a common mistake'