Irregular Webcomic!

Archive     Blog     Cast     Forum     RSS     Books!     Poll Results     About     Search     Fan Art     Podcast     More Stuff     Random     Support on Patreon
New comics Mon-Fri; reruns Sat-Sun
<   No. 1640   2007-07-24   >

Comic #1640

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 x2) 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.

First (1) | Previous (1639) | Next (1641) || Latest Rerun (2598) | Latest New (5218)
First 5 | Previous 5 | Next 5 | Latest 5
Miscellaneous theme: First | Previous | Next | Latest || First 5 | Previous 5 | Next 5 | Latest 5
This strip's permanent URL:
Annotations off: turn on
Annotations on: turn off

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:

  1. "double it"
  2. "add 20"
  3. "take away the number your first thought of"
  4. "double it, then add 20, then take away the number your first thought of"
Functions convert one number into another number, so let's try it. Let's start with 7.
  1. Applying function number (1) to 7, we double it and get 14.
  2. Applying function number (2) to 7, we add 20 and get 27.
  3. Applying function number (3) to 7, we take away 7 (the number we thought of) and get 0.
  4. Applying function number (4) to 7, we double it, then add 20, then take away 7, and get: 7×2 + 20 - 7 = 27.
Using algebra notation, we can apply our functions to any number x:
  1. 2x
  2. x + 20
  3. x - x
  4. 2x + 20 - x
Students 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: f1, f2, f3, f4. Now, function (1) of the number x is written as f1(x). Using this notation:
  1. f1(x) = 2x
  2. f2(x) = x + 20
  3. f3(x) = x - x = 0
  4. f4(x) = 2x + 20 - x = f2(x)
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:

  1. Change "double it" into "add 20".
  2. Change "add 20" into "take away the number you first thought of".
Let's call these transforms T1 and T2. These do not work on numbers, they work on functions. T1(7) is meaningless, but T1("double it") = "add 20". In other words:
  1. T1(f1) = f2
  2. T2(f2) = f3
We haven't specified what T1 does to any function other than f1; we could just assume it does nothing and simply gives us the same function back. The point is that T1 converts 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 q1 and with loudness p1, then:

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 (q1, q2, q3, etc.), and their loudnesses are (p1, p2, p3, 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 all possible frequencies at once, at different loudnesses. So the function F converts 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 q, find the value F(q), 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 function F is 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.

Comment from a reader:
That's not sincy! That's sinc(x)!

2017-11-05 Rerun commentary: 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.

LEGO® is a registered trademark of the LEGO Group of companies, which does not sponsor, authorise, or endorse this site.
This material is presented in accordance with the LEGO® Fair Play Guidelines.

My comics: Irregular Webcomic! | Darths & Droids | Eavesdropper | Planet of Hats | The Dinosaur Whiteboard | mezzacotta
My blogs: (daily updates) | 100 Proofs that the Earth is a Globe (science!) | Carpe DMM (long form posts) | Snot Block & Roll (food reviews)
More comics I host: The Prisoner of Monty Hall | Lightning Made of Owls | Square Root of Minus Garfield | iToons | Comments on a Postcard | Awkward Fumbles
© 2002-2024 Creative Commons License
This work is copyright and is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International Licence by David Morgan-Mar.