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)

The following two tabs change content below.

Bilgecan Dede

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

19 thoughts on “Follow up to Fourier Series

  • 1 February 2019 at 22:30
    Permalink

    The Fibonacci series function looks like a brain seen from above! (Have you ever heard about human connectome project? http://www.humanconnectomeproject.org/ – I think it could be really interesting if you “read” the numeric function of the brain pathways )

    Reply
  • 16 February 2019 at 21:37
    Permalink

    Really great follow-up to your previous work…Inspiring!! Thank you!
    -Carl Schell – Michigan, USA

    Reply
  • 18 May 2019 at 00:30
    Permalink

    Poga – Can you model the “Golden Ratio” and “Fibonacci Numbers” to see if you can get square waves to form?
    – What is a Fourier Series? (Explained by drawing circles) – Smarter Every Day 205 –

    A great Youtube video above ^

    Reply
  • 7 July 2019 at 14:39
    Permalink

    Hi,
    Thank you for this awesome tutorial, can you please give more details about the part (We are left with the second term. But it is trivial to solve).

    Reply
  • 10 August 2019 at 00:18
    Permalink

    Hi,
    Thanks for your great post. I am trying to fit a curve to the profile of a gear-shaped geometry using the FFT analysis. Can you give me some guidance on how to select my base equation?
    I can provide more information on the shape I’m trying to fit a curve to.

    Reply
  • 9 October 2019 at 12:30
    Permalink

    what about 1000 harmonics then?

    Reply
  • 24 December 2019 at 01:02
    Permalink

    ooooh man.. you made me love math again.. I started hating it when I was not able to understand !!! I should put some interest in maths again..

    Would you please suggest me.. where should I begin learning again.. I’m a software engineer btw, and understand enough basic visual “methematics”.. but you ‘ve killllled me.

    Reply
  • 30 January 2020 at 14:30
    Permalink

    Mükemmel bir çalışma olmuş, elinize sağlık. Odtü ee de okuyorum ancak sizin anlattığınız kadar net okulda anlayamamıştım sağolun.

    Reply
  • 1 February 2020 at 23:53
    Permalink

    hi every body.H(ve liked your works about Fourier’s Series and I Hope send me the source file of all your work’s.thenk you from Algeria.

    Reply
  • 20 August 2020 at 01:52
    Permalink

    I cannot understand what the two circles mean and how they are related to the Fourier series.

    Reply
  • 27 November 2020 at 20:18
    Permalink

    Is there a software that will allow me to input the number of vectors and their amplitude as well as the spin direction and speed, and outputs the picture being created.

    Reply
  • 17 April 2021 at 17:22
    Permalink

    Thanks for your awesome blog. Pl. give us a series for a heart-shaped curve with the amplitude and frequency of each term.

    Reply
  • 16 February 2022 at 08:08
    Permalink

    This is my first visit. These days I am learning about Fourier series and while I as searching Youtube and found a post by ‘SmarterEveryday’ channel and that led me here. This is a fantastic blog. From now on I will study the contents of this blog. Animation is amazing. Concept is much more amazing. Thank you.

    Reply
  • 18 February 2022 at 15:28
    Permalink

    Visualization of Fourier sum is very Interesting. I became to know that you used Mathematica package to write the animation program. I also did some Fourier series stuff for various periodic curves using Mathematica. My usage is only up to Manipulate[ ] command. They are nowhere near our animation. For some curves I summed up to 100,000 terms. I Wish I have your animation program. I am still learning Mathematica and Fourier series. Your series is great. Thank you.

    Reply
  • 7 November 2022 at 14:48
    Permalink

    Hi , great work bro !

    Reply
  • 3 September 2024 at 20:07
    Permalink

    Love from Nepal

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.