Live data from Hacker News

What Is the Fourier Transform?

quantamagazine.org

31–40 of 214 posts

Re: What Is the Fourier Transform?

#32
post #25

Earlier quoted context omitted.

Back in my uni days I did not get why that works. Why are sine waves special? Turns out... they are not! You can do the same thing using a different set of functions, like Legendre polynomials, or wavelets.

To be maximally pedantic, sine waves (or complex exponentials through Euler's formula), ARE special because they're the eigenfunctions of linear time-invariant systems. For anybody reading this without a linear algebra background, this just means using sine waves often makes your math a lot less disgusting when representing a broad class of useful mathematical models. Which to your point: You're absolutely correct th…

>They're eigenfunctions of linear time-invariant systems

For someone reading this with only a calculus background, an example of this is that you get back a sine (times a constant) if you differentiate it twice, i.e. d^2/dt^2 sin(nt) = -n^2 sin(nt). Put technically, sines/cosines are eigenfunctions of the second derivative operator. This turns out to be really convenient for a lot of physical problems (e.g. wave/diffusion equations).

Re: What Is the Fourier Transform?

#33
If you like Fourier, you're going to love Laplace (or its discrete counterpart, the z transform).

This took me down a very fascinating and intricate rabbit hole years ago, and is still one of my favorite hobbies. Application of Fourier, Laplace, and z transforms is (famously) useful in an incredibly wide variety of fields. I mostly use it for signal processing and analog electronics.

Re: What Is the Fourier Transform?

#34

Shameless plug: If you are interested in Fourier Transform and signal processing you might enjoy my somewhat artistic 3D visualisation of the fourier transform as well as the fractional fourier transform [1] (Fractional fourier transform on the top face of the cube) And for short time fourier transform showing how a filter kernel is shiftes across the signal. [2] [1]: https://static.laszlokorte.de/frft-cube/ [2]: htt…

I love the visualization! Thanks for sharing.

How do you compute the fractional FT? My guess is by interpolating the DFT matrix (via matrix logarithm & exponential) -- is that right, or do you use some other method?

Re: What Is the Fourier Transform?

#35
post #27
post #5

Earlier quoted context omitted.

Only if it is band-limited.

You are being confused with #samples needed for perfect reconstruction, i.e. Nyquist sampling frequency. Fourier series/transforms work regardless of the bandwidth of the signal, as long as the integral exists, i.e. it must vanish at infinity. Essentially it's just projection in infinite-dimensional vector spaces.

That's what is commonly understood by reconstruction: perfect reconstruction. And for that you need a band-limited signal. Otherwise he would have said approximate- or lossy reconstruction.

Re: What Is the Fourier Transform?

#36
To add another suggestion for understanding the Fourier transform, personally the first explanation that ever clicked with me was the Aho/Hopcroft/Ullman algorithms textbook.

Rather than talking about sine and cosine waves, they motivate the Fourier transform entirely in terms of polynomials. Imagine you want to multiply two polynomials (p(x) and q(x)). The key is to recognize that there are two ways to represent each polynomial:

1. "Coefficient form," as a set of coefficients [p_0, p_1, p_2, ..., p_d] where p(x) = p_0 + p_1x + p_2x^2 + ... + p_dx^d, OR

2. "Sample form," as a set of sampled points from each polynomial, like [(0, p(0)), (1, p(1)), (2, p(2)), ..., (d, p(d))]

Now, naive multiplication of p(x) and q(x) in coefficient form takes O(d^2) scalar multiplications to get the coefficients of p(x)q(x). But if you have p(x) and q(x) in sample form, it's clear that the sample form of p(x)q(x) is just [(0, p(0)q(0)), (1, p(1)q(1)), ...], which requires only O(d) multiplications!

As long as you have enough sample points relative to the degree, these two representations are equivalent (two points uniquely defines a line, three a quadratic, four a cubic, etc.). The (inverse) Fourier transform is just a function that witnesses this equivalence, i.e., maps from representation (1) to representation (2) (and vice-versa). If the sample points are chosen cleverly (not just 1/2/3/...) it actually becomes possible to compute the Fourier transform in O(d log d) time with a DP-style algorithm (the FFT).

So, long story short, if you want to multiply p(x) and q(x), it's best to first convert them to "sample" form (O(d log d) time using the FFT), then multiply the sample forms pointwise to get the sample form of p(x)q(x) (O(d) time), and then finally convert them back to the "coefficient" form (O(d log d) using the inverse FFT).

Re: What Is the Fourier Transform?

#37

Shameless plug: If you are interested in Fourier Transform and signal processing you might enjoy my somewhat artistic 3D visualisation of the fourier transform as well as the fractional fourier transform [1] (Fractional fourier transform on the top face of the cube) And for short time fourier transform showing how a filter kernel is shiftes across the signal. [2] [1]: https://static.laszlokorte.de/frft-cube/ [2]: htt…

I love the visualization! Thanks for sharing. How do you compute the fractional FT? My guess is by interpolating the DFT matrix (via matrix logarithm & exponential) -- is that right, or do you use some other method?

I am glad you like it!

Yes the simplest way to think of it is to exponentiate the dft matrix to an exponent between 0 and 1 (1 being the classic dft). But then the runtime complexity is O(n^2) (vector multiplied with precomputed matrix) or O(n^3) opposed to the O(n log n) of fast fourier transform. There are tricks to do a fast fractional fourier transform by multiplying and convolving with a chirp signal. My implementation is in rust [1] compiled to web assembly, but it is based on the matlab of [2] who gladly answered all my mails asking many questions despite already being retired.

[1]: https://github.com/laszlokorte/svelte-rust-fft/tree/master/s...

[2]: https://nalag.cs.kuleuven.be/research/software/FRFT/

Re: What Is the Fourier Transform?

#38
post #2

Always blew my mind that every signal can be recreated simply by adding different sine waves together.

I swear I read in a text book once that Fourier discovered this while a boat. He looked out at the waves on the ocean and saw how there were many different sized waves combining to make up the larger waves. I could never find it again, but that visual helped me understand how the Fourier transform works.

Re: What Is the Fourier Transform?

#40
post #21

Earlier quoted context omitted.

And of infinite duration, if you want to split hairs.

Same thing! :-) In the purest sense, finite bandwidth requires infinite duration and finite duration requires infinite duration. The real world is somewhere in between. It must involve quantum mechanics (in a way I don't really understand), as maximum bandwidth/minimum wavelength bump up against limits such as the Planck length and virtual particles in a vacuum.

The Heisenberg uncertainty principle in quantum mechanics comes about precisely because position and momentum are a Fourier transform pair.
Post reply on HN