Fourier Epicycles
Rebuild a path from rotating epicycles (Fourier series visualization).
About this tool
Compare shape and reconstruction
Choose a shape and 1–256 terms, including the constant DC term, then calculate. Move the progress control to compare the original point with the tip of the Fourier vector sum. The outlined marker is the original; the filled marker is the reconstruction. Their connecting segment shows the pointwise error. Coordinates and errors are dimensionless.
Sampling and Fourier terms
Each shape has 256 samples evenly spaced by path length, without repeating the closing sample. Polygon samples lie on their exact straight edges. The heart is first approximated by a closed polyline with 2048 vertices, then sampled along that polyline; its analytic arc length is not calculated. Both circles have radius 0.6, centre (0.15, −0.1), and start at the rightmost point.
With zₙ = xₙ + i yₙ, the coefficients are cₖ = (1/N) Σₙ zₙ exp(−2πikn/N). At progress u, the reconstruction is Σₖ cₖ exp(2πiku). DC comes first and is drawn as a constant offset vector, without a rotating circle. The remaining terms are selected by descending coefficient magnitude, with ties ordered by k. Frequencies run from −128 to 127, with the Nyquist term included only once. Dominant k is the first selected non-DC term; with only DC there is none.
Two different errors
RMS and maximum sample error compare reconstruction and original at the same 256 sample positions. Selecting more terms cannot increase the mean squared sample error. All 256 terms recover those samples up to floating-point rounding. Between samples, the Fourier interpolation can still leave the original shape, even with all terms selected. The pointwise error below the drawing compares the two positions at your exact chosen progress. Amplitude selection is not a lowest-frequency cutoff and does not guarantee the smallest error between samples.
For the counterclockwise circle, two terms give DC = (0.15, −0.1) and k = 1. At 25% the tip is (0.15, 0.5); clockwise it is (0.15, −0.7) with k = −1. Keeping only DC leaves a sample RMS error of 0.6.
Playback
One complete traversal takes eight seconds. This is a viewing speed, not a physical period or frequency. Progress 0% and 100% give the same position. Focusing or editing a probe control pauses playback. A hidden view freezes the phase and resumes only if it was playing; returning after navigation retains the paused result. Reloading or changing language restores valid settings and waits for Calculate.
Reference
NumPy: discrete Fourier transform conventions and normalization. The forward transform here uses the 1/N normalization.