DGS Studio

Polar & Fourier Curves

Fourier with sine and cosine

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

polar_fourier keeps harmonics through N = 20. The cosine coefficients are aₙ = 1/(n+1). The radius is constant + Σ aₙ cos(nθ) from n = 0 to N, plus the sine sum from n = 1. a₀ = 1/(0+1) is included, and because cos(0) = 1 it shifts the whole radius. This example also sets the sine coefficients to bₙ = 1/(2*n+1). Sine starts at n = 1, so there is no b₀.

Cosine coefficients 1/(n+1) and sine coefficients 1/(2*n+1) are different families. Compare a term of each at the same n to see which family is larger. Raising N from this value adds those next terms without changing the formula for aₙ.

Equation

polar_fourier(N=20, coefficients=1/(n+1), sine_coefficients=1/(2*n+1))

Graph preview

Graph preview of polar_fourier(N=20, coefficients=1/(n+1), sine_coefficients=1/(2*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