Fourier Series Curve Fitting
The elephant curve demonstrates the power of Fourier series to approximate any closed curve using a sum of sinusoidal terms.
Parametric Equations
The elephant is defined by two parametric equations x(t) and y(t), where t ranges from 0 to 2π:
x(t) = Σ [Aₖ·cos(k·t) + Bₖ·sin(k·t)]
y(t) = Σ [Cₖ·cos(k·t) + Dₖ·sin(k·t)]The Four Parameters
The “four parameters” refer to four complex Fourier coefficients that encode the essential shape of the elephant. Each complex number has real and imaginary parts, giving us 8 degrees of freedom total.
The Fifth Parameter
Von Neumann’s quote suggests adding a 5th parameter to “wiggle the trunk.” This is implemented as a localized sinusoidal perturbation:
x(t) += A₅ · e^(-(t-π)²/σ²) · sin(ω·t)The Gaussian envelope e^(-(t-π)²/σ²) ensures the wiggle only affects the trunk region.
Mathematical Insight
This visualization illustrates a profound truth in curve fitting: with enough parameters, you can fit any data. The danger is that such models may capture noise rather than underlying patterns - a phenomenon called overfitting.