Solution (source code)

= Solution

With the real <Fourier series> convention,
$$
\boxed{f(\theta)\sim\frac{a_0}{2}+\sum_{n=1}^\infty[a_n\cos(n\theta)+b_n\sin(n\theta)],}
$$
where the <Fourier coefficients> are
$$
\boxed{a_n=\frac1\pi\int_{-\pi}^{\pi}f(t)\cos(nt)\,dt\quad(n\ge0),\qquad
b_n=\frac1\pi\int_{-\pi}^{\pi}f(t)\sin(nt)\,dt\quad(n\ge1).}
$$
For a square-integrable periodic <function>, <Parseval's identity> is
$$
\boxed{\frac1\pi\int_{-\pi}^{\pi}|f(t)|^2\,dt=\frac{|a_0|^2}{2}+\sum_{n=1}^\infty(|a_n|^2+|b_n|^2).}
$$
The <Fourier coefficients> require integrability, and the stated <Parseval identity> requires square integrability. The expansion agrees with $f$ in the <L2 space> sense; for piecewise smooth data it converges pointwise to the average of the two one-sided limits. Without such qualifications an arbitrary periodic <function> need not have a pointwise-convergent <Fourier series>.