be the piecewise-continuous function giving a parametrization of the equilateral triangle in the complex plane:
is defined in the initialization code using the function UnitStep
. The Fourier series is then given by
defined in the initialization code produces the sequence
; the function
then sums the terms of the Fourier series in the same order.
The slider marked "angle" controls the angle between the gray vector from the origin and the positive
. The slider marked "number of terms" controls the number of terms in the partial sum, which equals the number of orange circles and gray vectors, from 1 to 50. The accuracy of the approximations, in the sense of the norm, improves as
increases. But interestingly, the graph "wobbles" more when
is odd. This is presumably because in that case the last term (which rotates in the positive direction) has no term with opposite rotation to compensate. The blue curve is the Fourier approximation, while the red dot shows the parametrization of the triangle.
 E. M. Stein and R. Shakarchi, Fourier Analysis
: An Introduction
, Princeton, NJ: Princeton University Press, 2003.
 F. A. Farris, Creating Symmetry
: The Artful Mathematics of Wallpaper Patterns
, Princeton, NJ: Princeton University Press, 2015.