# Follow up to Fourier Series

I would like to first thank Destin Sandlin and then everyone for their support and interest. Here in this article I will try to answer couple of questions I have received with the video. Then, I guess I will not write about Fourier series for a while, since I have written about it a lot and I hate to repeat myself 🙂 I apologize that this article is going to be a little technical for a popular science blog.

**Q1: Would it be possible to Fourier transform a polygon, i.e. square, pentagon etc?**

Thank you Daniel Shiffman. Yes, since a regular polygon can be thought of a periodic curve, it can be expanded into Fourier series. Here I show how it can be expanded:

Assume \(f(x)\) represents the regular n-polygon.

Our goal is to expand this function \(f(x)\) into Fourier series:

\(\displaystyle{ f(x) =\frac{1}{2} a_0 + \sum \limits_{n} \left(a_n \cos(n x) + b_n \sin(n x)\right)}\)

But instead, let me write this Fourier series in other form, since carrying out the calculations will be easier:

\(\displaystyle{f(x) =\sum \limits_{m = -\infty}^{\infty} c_m e^{i m x}}\),

since \(e^x = \cos x + i \sin x\), where \(i = \sqrt{-1}\), imaginary number. OK, the punchline of Fourier analysis is to find the \(c_m\) coefficients.

\(\displaystyle{c_m = \frac{1}{2 \pi} \int \limits_{0}^{2\pi}f(x) e^{-i m x} dx}\)

First thing I can do is to separate the polygon into n segments:

\(\displaystyle{c_m = \frac{1}{2 \pi} \sum \limits_{j = 0}^n \int \limits_{x_j}^{x_{j+1}}f(x) e^{-i m x} dx}\),

such that each integration is simply over a line. I can use integration by parts, and massage the terms a little bit:

\(\displaystyle{ \int \limits_{x_j}^{x_{j+1}}f(x) e^{-i m x} dx = \left.\left[f(x)\frac{e^{-im x}}{-i m}\right]\right|_{x_{j}}^{x_{j+1}} – \int \limits_{x_j}^{x_{j+1}}s_j \frac{e^{-im x}}{-i m}dx}\).

Where \(s_j \) is the slope of \(f(x)\) at the \(j\)th segment, \(s_j = df/dt\), which is a constant! As I take the summation over all segments of the polygon, the first term vanishes, since our starting point is that \(f(x)\) is periodic! We are left with the second term. But it is trivial to solve:

\(\displaystyle{c_m = \frac{1}{2 \pi} \sum \limits_{j = 0}^n \int \limits_{x_j}^{x_{j+1}}s_j\frac{e^{-im x}}{i m} dx} = -\frac{1}{2\pi m^2} \sum \limits_{j = 0}^n \sigma_j e^{-i m x_j} \),

where \(\sigma_j = s_j – s_{j-1}\). But, since again it is periodic, \(s_0 = s_n\). From this, we can find the \(n\)th slope by,

\(s_{j-1} = \frac{1}{2\pi}\sum \limits_{j = 0}^{n-1}x_j \sigma_j\).

Now I will add animations of some of the polygons according to the rules I have described above. The real part will be the \(x\), and imaginary part will be the \(y\) component. Since I want to center the polygon, I have set \(j = 0\) term to be zero. Because of this, I can change the summation slightly:

\(\displaystyle{f(x) =\sum \limits_{l = 1 mod 2n} \frac{e^{i (2 + n l) x}}{(2+ nl)^2}}\)

Here are some of the polygons in Fourier series:

Square:

Pentagon:

It is also possible to generate some cooler shapes, such as stars etc. One only needs to take the superposition of two polygons with asymmetric harmonics, that is no common divisor between \(n_1\) and \(n_2\):

\(\displaystyle{f(x) =\sum \limits_{l = 1 mod 2n} \frac{e^{i (n_1 + n_2 l) x}}{(n_1+ n_2 l)^2}}\)

Here I generate one such shape, a star:

**Q2: How would the function look like if harmonics follow Fibonacci series, i.e. 1, 1, 2, 3, 5, 8, 13, 21, etc.?**

Thank you Laura Kinnischtzke for the suggestion. Here how it looks like in polar form,

\(\displaystyle{ f(\theta) = \sum \limits_{n \in F_n} \left(\frac{c}{n} \cos(n \theta) + \frac{c}{n} \sin(n \theta) \right)}\)

where \(F_n = F_{n-1} + F_{n-2}\), which is Fibonacci set.

The function in one period is a fractal, and looks like a Weierstrass function:

…and here is the 100 harmonics added, just because I can (it looks cool).

Animations: Doga Kurkcuoglu (Bilgecan Dede)

#### Bilgecan Dede

#### Yazar: Bilgecan Dede (tümünü gör)

- Bouncing Cubes and π (3Blue1Brown) - 14 Ocak 2019
- Fourier Serisi yazısına ek: - 23 Aralık 2018
- Follow up to Fourier Series - 23 Aralık 2018
- Where the hell is 1/3, or Introduction to Chaos - 14 Aralık 2018
- Purrier Series (Meow) and Making Images Speak - 11 Aralık 2018