About This Simulation
This interactive animation demonstrates the concept of the Fourier series. The core idea, discovered by Joseph Fourier, is that any periodic signal (or in our case, a closed 2D shape) can be represented as a sum of simple sinusoids (sines and cosines). In the complex plane, this is visualized as a series of rotating vectors, often called epicycles.
Each vector represents a term in the Fourier series. The length of the vector corresponds to the amplitude of the sinusoid, and its rotation speed corresponds to the frequency. By adding these vectors tip-to-tail, the final point traces out the original shape.
How to Use
- Zoom & Follow: Toggles a mode that automatically zooms in and follows the tip of the drawing vectors.
- Manual Zoom/Pan: Use the **mouse wheel** to zoom. Hold the **Spacebar** and **click and drag** to pan. This will disable "Zoom & Follow" mode.
- Play Demo: Click the "Play Demo" button to watch the simulation automatically cycle through the predefined shapes.
- Draw a Shape: Click and drag your mouse (or use your finger on a touch screen) on the black canvas to draw a continuous, closed loop.
- Clear Drawing: Click the "Clear Drawing" button to erase your path and start over.
Future Directions
This visualization could be extended in several ways:
- Color & Style Options: Add controls to change the colors of the path, vectors, and background.
- Performance Optimization: For a very large number of points or vectors, the Discrete Fourier Transform (DFT) can be slow. A Fast Fourier Transform (FFT) algorithm could be implemented.
- Mathematical Details: Display the complex coefficients ($$c_n$$) and their corresponding frequencies. The coefficients are calculated using the formula: $$ c_n = \frac{1}{N} \sum_{k=0}^{N-1} x_k \cdot e^{-i \cdot 2\pi \cdot n \cdot k / N} $$ where $N$ is the number of points and $x_k$ are their complex coordinates.