1 [caption]: xkcq: A webcomic of jokes you need a degree in mathematics to understand 1 [caption]: At the home of the Fourier transform family... 1 {Two young Fourier transforms are playing with some wooden block on the floor of a bedroom, while the parents of one of them look on from outside the doorway. One of the kids is a sinc( x ) function, the other is an odd function that looks a bit like sin( x )exp(- a x 2 ) for a around 0.2 or so.} 1 Mrs Fourier Transform: {a cosine} I wish Sincy would stop playing with that imaginary friend of his. 1 Mr Fourier Transform: {a square pulse} Don't worry. It's just a phase he's going through.

I've parodied Randall Munroe's excellent xkcd once before. This time around I had the joke in my head, and wanted to do it, and realised that it was more like something I'd expect to see in xkcd than here. So what the heck.

One point of criticism I'll make about xkcd (and this also applies to Ryan North's otherwise excellent Dinosaur Comics, and a bunch of other webcomic artists inspired by North) is the use of mouseover tooltips on the comic image itself to hide additional joke material.

I don't like them and I refuse to use them. They deliberately hide information from the readers, which to me seems perverse. (Although not as perverse as DVD Easter eggs. If you're going to put extra content on to a DVD, what is the purpose of hiding it from the buyers?? No, don't bother trying to explain it to me - I've heard all the arguments before and I don't accept any of them.)

Of course, being a parody of xkcd, there is a tooltip gag hidden under this comic, forming an exception to my rule. It is as follows:

I don't do Fourier jokes with enough frequency.

Which brings us to Fourier transforms. If you don't know some of the fundamental properties of Fourier transforms, or even what a Fourier transform is, you won't get today's comic. I recognise the potential irony in that statement, given the preceding comments, but I shall now attempt to explain enough about Fourier transforms to allow all readers to appreciate the comic.

The Fourier transform (named after French mathematician Joseph Fourier) is a specific method of converting a mathematical function into another mathematical function. A function is itself a method of converting one number into another number. We're now two levels of abstraction deep, so let's talk about functions first.

Behind the mathematical jargon, functions are pretty easy to grasp intuitively. Here are four different examples of functions:

"double it" "add 20" "take away the number your first thought of" "double it, then add 20, then take away the number your first thought of"

Applying function number (1) to 7, we double it and get 14. Applying function number (2) to 7, we add 20 and get 27. Applying function number (3) to 7, we take away 7 (the number we thought of) and get 0. Applying function number (4) to 7, we double it, then add 20, then take away 7, and get: 7×2 + 20 - 7 = 27.

2x x + 20 x - x 2x + 20 - x

1

2

3

4

1

f 1 (x) = 2x f 2 (x) = x + 20 f 3 (x) = x - x = 0 f 4 (x) = 2x + 20 - x = f 2 (x)

Functions convert one number into another number, so let's try it. Let's start with 7.Using algebra notation, we can apply our functions to any numberStudents of algebra will realise that function (3) is really equal to 0: this function converts any number at all into 0. That's a perfectly good function too. All a function has to do is convert any number you think of into some other number. You may also notice that function (4) is actually identical to function (2): it will gave the same answer no matter what number you think of first. Let's give our functions names:. Now, function (1) of the numberis written as). Using this notation:This is just the mathematical notation for writing down the functions described by "double it", "add 20", and so on.

Now, a functional transform, like the Fourier transform, converts any given function into another function. Here some examples of functional transforms:

Change "double it" into "add 20". Change "add 20" into "take away the number you first thought of".

1

2

1

1

T 1 (f 1 ) = f 2 T 2 (f 2 ) = f 3

1

1

1

Let's call these transformsand. These do not work on numbers, they work on(7) is meaningless, but("double it") = "add 20". In other words:We haven't specified what Tdoes to any function other than; we could just assume it does nothing and simply gives us the same function back. The point is that Tconverts any given function into some other function (not necessarily a different one). The Fourier transform is an example of a transform like this, but one which converts functions into other functions in a very specific way.

There is a large class of functions that represent real world phenomena, such as sound waves (to pull an example out of the air). You can represent a sound wave arriving at a point (such as your ear) as a function of the number of seconds after a sound begins; lets call this function simply f. The function of the number of seconds might be equal to the pressure of the air wave at your ear drum. At x=0 seconds, the pressure is normal room air pressure, so f(0) is P, say. At x=1 second, the pressure will be slightly higher (or lower), and the function f(1) = P + p, where p is a small number compared to P. And so on.

Sound waves oscillate around the standard air pressure, and the speed of the oscillation governs the pitch (or frequency) of the note we hear. So if we know how fast the function f(x) changes as we change the value of time x, we have a measure of the frequency of the note we are hearing. Also, if we know the maximum size of the variation p, we know how loud the note sounds.

So let's define a new function F, only we won't make it a function of time x, we'll make it a function of note frequency - we're running out of different f's, so let's call that q. We'll define F(q) to be equal to the loudness p of the note at the frequency q.

What does this new function look like? If we have a single note in our sound wave, at frequency q 1 and with loudness p 1 , then:

F ( q 1 ) = p 1 ;

( ) = ; F(q) = 0 for any other value of q.

1

2

3

1

2

3

F ( q 1 ) = p 1 ;

( ) = ; F ( q 2 ) = p 2 ;

( ) = ; F ( q 3 ) = p 3 ;

( ) = ; etc.;

F(q) = 0 for any other value of q.

But it's rare to have a single note in a sound wave. If we have a bunch of notes all playing at once at different frequencies (, etc.), and their loudnesses are (, etc.), then:This is also quite rare. Sound waves have distortions and interference from other places and all sorts of stuff going on, so real sound waves that reach your ear are actually a combination of, at different loudnesses. So the functionconverts every possible frequency into the loudness that exists at that exact frequency. If you want to know what you're hearing, you pick a frequency, find the value), and that tells you how much noise at that frequency is hitting your ear. You can repeat this for any frequency you like.

Frequency spectrum analyser display as typically seen on hi-fi amplifiers or software media players. Audio frequencies are marked across the bottom in hertz, from 60 to 20,000. Loudness is shown vertically, in decibels, with the loudest sound reproducible by the system being labelled as 0, and softer sounds with negative numbers (as is usual for these measurements). * And that's how media player software does it: by calculating Fourier transforms. Hi-fi hardware amplifiers can get out of it with a shortcut, by using electronic hardware filters rather than actually calculating a Fourier transform.

As you may be able to imagine, this functionis useful to people like sound engineers. It's also interesting to audiophiles and those who know a bit about the physics of sound. You may be familiar with the displays of audio spectrum analysers, such as that shown on the right. What these show is the loudness of the sound, but only within certain frequency ranges - not the overall sound. So you can see how loud the bass notes are, how loud the high pitched sounds are, and how loud the mid-tones are, all independently.

The trouble is, with a sound recording and measuring device, you can't (directly) measure F(q) - the loudness of sound at each frequency. All you can measure is the sound wave itself f(x) - the variation in air pressure with time.

But - here's the good bit - F(q) is a functional transform of f(x). There is a certain transform T that converts f(x) into F(q). That transform is called the Fourier transform.

The Fourier transform is a very specific and mathematically well-defined transform. I won't go into the details of how you actually do it, because that requires calculus, but that's beside the point here. The point is that you can do a Fourier transform on any function you care to name. And it has the extraordinarily useful property that when you do it to a function, it gives you another function that describes the strength of the various frequencies in the original function.

If you measure the pressure of a sound wave over time, and then Fourier transform that measurement, you get the incredibly useful F(q) function that tells you how loud each frequency is*. This has much wider applications, anywhere that waves are involved - which is just about everywhere once you get into the nitty-gritty physics of stuff. It's incredibly important in the study of light, for example, and comes up regularly in optical design and testing, which is what I do for a living.

So now you have the groundwork. There's just a couple more things you need to know.

Functions are commonly represented as graphs, which look more or less like the parents and kids in the comic above. Functions important in Fourier transform theory often come in one of two different types, which are called even and odd. An even function is mirror symmetrical around the middle - the left and right sides are as if reflected in the line down the middle. Examples of this are mummy function, daddy function, and little Sincy at bottom left. Odd functions are rotationally symmetric about the centre point - the left side is the same as the right side, but upside down. Little Sincy's friend is an example of an odd function.

It happens that even functions are nice and have well-defined Fourier transforms in the real numbers that we're all familiar with. Odd functions are not so nice - their Fourier transforms do not produce results in the real numbers. The Fourier transform of an odd function is a function that produces imaginary numbers. Furthermore, imaginary numbers can be considered to be numbers with what is called a phase component. Real numbers all have a phase equal to zero (so it can be ignored), whereas imaginary numbers have a non-zero phase.

That's enough to understand today's comic. Imaginary numbers and phases are a whole other annotation in themselves, and this one is long enough already, so I don't want to go into those today.

That's not sincy! That's sinc(x)!

Comment from a reader:Pulling in a comic from the future, imaginary numbers and phases are indeed a whole other annotation, which I went into on another day . Reading that immediately after (or before) this annotation should hopefully provide even more insight.