Fourier Series Approximation to Equilateral Triangle

This Demonstration shows Fourier series approximations to the function tracing an equilateral triangle, shown in green, in the complex plane. The vector representing each additional term (gray) is shown, along with its encompassing circle (orange). The blue curve represents a partial sum of the Fourier series, with the selected number of terms. The red dot shows the parametrization of the triangle.

Let be the piecewise-continuous function giving a parametrization of the equilateral triangle in the complex plane:

The function is defined in the initialization code using the function UnitStep. The Fourier series is then given by.

The function 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 axis between and . 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.