Why does WolframAlpha omit the $n=4$ and $n=8$ term in this Fourier series?

84 Views Asked by At

I tried to determine the Fourier series of the function:

$$ f(x) = \begin{cases} x+\pi, & -\pi \le x < -\frac{\pi}{2} \\ \frac{\pi}{2}, & -\frac{\pi}{2} \le x <\frac{\pi}{2} \\ \pi-x, & \frac{\pi}{2} \le x <\pi \end{cases}$$

on Wolfram (LINK) Alpha and for some reason there are no $\cos{4x}$, $\cos{8x},..$ terms. When calculating the coefficients of this series by hand I get: $$a_n =\frac{2 (-1)^{n-1}}{\pi n^2} \\b_n=0 $$

Which sort of reproduces what Wolfram Alpha says but I am not sure why terms are missing and why some of the coefficients don't match. Any ideas?

2

There are 2 best solutions below

4
On BEST ANSWER

The terms are there but have coefficients $0$, so they're omittted.

Your Wolfram results also lists no $\sin(nx)$ terms, also corresponding to your $b_n=0$.

The $a_n$ that don't match must be your own calculation errors.

1
On

For $$ \int_{-\pi}^\pi f(x) \cos(nx)\;dx $$ Maple gets $$ 2,-1,\frac{2}{9},0,{\frac{2}{25}},-\frac{1}{9},{\frac{2}{49}},0,{\frac{2}{81}},-\frac{1}{25}, {\frac{2}{121}},0 $$ for $n=1,2,\dots,12$. (For $b_n$ you have to divide by the appropriate denominator.)