Square Petal
r = Σ_(k=1)^(1 + floor(mod(t, 10))) sin((2k−1) · 5θ)/(2k−1)
Open in the app The dials and keys named below are the app's.
What it draws
The radius is a Fourier partial sum, built from odd harmonics of 5θ. Take only the first term and it is sin(5θ), the ordinary five-petalled rose. Every extra term adds the next odd multiple, sin(15θ)/3, then sin(25θ)/5, each one weaker than the last.
That series is the square wave. As the terms accumulate the radius stops easing smoothly between its extremes and starts holding near them, so the petals lose their round tips and gain flat ends and square shoulders.
Why five petals
Every term is an odd multiple of 5θ, so the whole sum repeats ten times in a turn. Five of those are positive and five negative, and a negative radius plots on the opposite side, which lands each negative lobe on top of a positive one. Five petals is what remains. This is the usual rule for sin(nθ): an odd n gives n petals, an even one gives 2n.
The overshoot that never leaves
The square wave this converges to has amplitude π/4 ≈ 0.785, but the partial sums reach 0.93 and stay there. Adding terms narrows the bump without lowering it: the excess is about 9% of the jump, and it survives every partial sum however long. That is the Gibbs phenomenon, and here it is the small lip at the corner of each petal.
Try
- Watch one cycle. The term count climbs from 1 to 10 over ten seconds at Speed 1, then drops back to a plain rose and starts again.
- Drop Stack to 1. Only the current outline stays, so each term count is seen clean rather than layered over its own past.
- Change the 5 to a 4: sum(sin((2k−1) · 4θ)/(2k−1), k, 1, 1 + floor(mod(t, 10))). An even multiple gives eight petals instead of five.
- Hold the count still at three terms with sum(sin((2k−1) · 5θ)/(2k−1), k, 1, 3). The shape stops moving, halfway between a rose and a square.