Continuing to follow the steps provided by the blog author Michael Trott, we used the latter image to create a set of points in the \(x\)-\(y\) plane. The points are subdivided into a set of curves (in this case, 8) and then approximated with a Fourier series. While it only takes 2 sentences to describe what we did, it took many, many lines of code provided by Mr. Trott. (We highly recommend downloading the .cdf provided by the link and running it in Mathematica. If you want to upload your own image and make your own curves, it helps to know that not everything that you run in the .cdf is directly related to making curves. It can be boiled down to a lot fewer lines of code - but it's still a lot.)

All of the above should make some ask "What is a Fourier Series?" In short, a Fourier series is a sum of sines and cosines used to approximate another function. Since trigonometric functions are used, Fourier series are especially good at approximating periodic (that is, repeating) functions. The more sines and cosines used, the better the approximation (in general).

For example, consider the curve on the left, below.

On the right, we approximate the curve with a set of Fourier series. We start with just \( 0.358+0.34\sin(1.28x)-1.03\cos(1.28x)\): that's the curve that is mostly flat. We then add more and more sine and cosine terms to better approximate the orginal curve. The 5th curve shown in the animation is \(0.358+\big(0.34\sin(1.28x)-1.03\cos(1.28x)\big) + \big(-5.34\sin(2.56x)+0.19\cos(2.56x)\big)\)

To make the pumpkin, each of the 8 curves needed a different number of sines and cosines to make it look good. The first part drawn, and by far the longest, needed the most: 180 sines and cosines!! We then plotted it for increasing values of \(t\), making it look it was being drawn.

The following animation shows how the approximation gets better and better by adding more and more terms to the series:

We thought another Halloweeny picture would be good. We did another Google image search, this time for "bat clip art", and came up with the picture below:

We followed the same procedure outlined by the Wolfram blog and made the following animations:

Finally, we thought the following image was pretty cool, suggested by another part of the Wolfram post. It shows, with increasing levels of opacity (i.e., the better the approximation the more opaque), various approximations of the bat by Fourier series.

So what good are Fourier series? Many of us view functions like \(1.03\cos(1.28x)\) as not-very-simple-or-intuitive. So why use them? There are 3 main reasons.

First, some problems involving functions are really hard to solve in general, but (amazingly) not so bad when the functions are trig functions. So approximating the real function with lots of trig functions (i.e., a Fourier series) makes finding an approximate solution easy.

Second, some data demonstrates oscillating, or periodic, behavior. (An easy example is sound waves.) One way of analyzing the data is to analyze the Fourier series that approximates it. We can also compress data this way - instead of storing all the information supplied by a sound wave, we can store only the Fourier coefficients, taking much less space.

Finally, Fourier himself was interested in approximating curves with sums of sine waves with the intent to draw cool pictures. He never went very far with it, though; on his death bed, he is reported to have said: "Si seulement j'avais animé une citrouille. Ensuite, ma vie aurait été complet," which translates roughly to "If only I had animated a pumpkin. Then my life would have been complete."