Fourier curves
Inspired by Cliff Pickovers tweet and powered by my fascination about the Fourier transform, I took the time to derive and implement the Fourier series of a two dimensional piecewise linear parametric curve.
By clicking on the empty canvas you can design your custom shape. If you close the path, the Fourier series will be animated similarly to the video mentioned above. Have fun!
Derivation
The following derivation shows a way to obtain the equations of the Fourier series of a two dimensional piecewise linear parametric curve. Please be aware, that this is certainly not the most efficient way to derive it.
We will treat the \(x\) and \(y\) component of the function separately. Therefore, we calculate the Fourier series for both components separately.
Fourier series
The complex Fourier series is defined as
with
Our component functions \(y(t)\) are piecewise linear and can be defined as
Let’s calculate the Fourier coefficients. We start with \(k=0\):
Now we look at the general case \(k>0\):
The first term simplifies to
We now look at the second term
Fortunately, we know the identity
We can use it, by applying the coordinate transformation to our integral
We obtain
Now we have to integrals of the identity above. The first integral is
with \(a = ik\omega (T_{i+1} - T_i) \) and \(n=0\). It follows
The second integral is
with \(a = ik\omega (T_{i+1} - T_i) \) and \(n=1\).
It follows
We insert the results back into our equation
We replace the exponential terms with \(\sin\) and \(\cos\)
We now look again at our first term from above and separate it
into
and
We combine the result of the second term with first equation of the separation
Now we incorporate the second part of the separation.
With the helping variable
follows
The resulting formula is
We note that we can \(\frac{1}{T}\frac{1}{k\omega} = \frac{1}{2\pi k}\) and finally obtain
In the final step, we can express our result as
with coefficients
and