Calculate Fourier series of $f(x)=x^2$ , $x \in \ [-\pi,\pi]$

Calculate Fourier series of $f(x)=x^2$ , $x \in \ [-\pi,\pi]$ and determine module and phase spectrum

$$f(x)=\frac{a_0}{2}+\sum_{n=1}^{+\infty} a_n \ \cos(nx) \ + \ b_n \ \sin(nx)$$


$$a_0=\frac{1}{\pi} \int_{-\pi}^{\pi} x^2 \ dx=\frac{2}{3} \pi^2$$


$$a_n=\frac{1}{\pi} \int_{-\pi}^{\pi} x^2 \ \cos(nx) \ dx=\frac{1}{\pi} \ \frac{2(\pi^2 n^2-2) \sin(n \pi)+4 \pi n \cos(n \pi)}{n^3}=\frac{4 (-1)^n}{n^2}$$


$$b_n=0 \qquad \forall n\ge 1$$

because $f$ is even

$$f(x)=\frac{\pi^2}{3}+4 \ \sum_{n=1}^{+\infty} \frac{(-1)^n}{n^2} \ \cos(nx)$$


How can I determine module and phase spectrum?

Should I calculate the Fourier series coefficients in different values of n, then calculate module and phase of the result?


Thanks!


HINT

The amplitude spectrum is $$\{|a_{|i|}|\},\quad i=-\infty\dots\infty.$$ The phase spectrum is $$\{(-1)^i\pi\},\quad i=-\infty\dots\infty.$$ Both of the spectra are discrete. If time sequence is measurement in seconds then step of the spectra is 1 Hz.