DGS Studio

Polar & Fourier Curves

Alternating Fourier coefficients

Bounded numerical curves. Cosine a₀ adds to the constant term.

polar_fourier keeps harmonics through N = 40. The cosine coefficients are aₙ = (-1)^n/(n+1). The radius is constant + Σ aₙ cos(nθ) from n = 0 to N, plus the sine sum from n = 1. a₀ = (-1)^0/(0+1) is included, and because cos(0) = 1 it shifts the whole radius. The sine coefficients stay at the default 0, so only the cosine family shapes the radius.

The factor (−1)ⁿ flips the sign of every other harmonic, so neighboring waves pull the radius in opposite directions. Raising N from this value adds those next terms without changing the formula for aₙ.

Equation

polar_fourier(N=40, coefficients=(-1)^n/(n+1))

Graph preview

Graph preview of polar_fourier(N=40, coefficients=(-1)^n/(n+1))
A static sample of this expression. The studio draws the full interactive result.

What the Fourier sum is doing

A Fourier pattern builds a complicated shape from simple waves. For a polar Fourier curve, the radius is a constant plus a cosine sum from n = 0 and a sine sum from n = 1. The cosine coefficient a₀ is an extra constant, added on top of the constant parameter, because cos(0·θ) is 1.

A larger N keeps more harmonics. Early terms decide the broad shape. Later terms are usually smaller and add finer wobble. The same idea appears in the ordinary sum y = Σ cos(nx)/n, whose infinite form is −ln|2 sin(x/2)| away from multiples of 2π.

Reading the input

Try a change

Generate Graph posts the expression to the studio graph engine and draws the result on the homepage. The editable field is the entire input, including every line.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples