I'm currently trying to find the cosine Fourier series of $f(x) = \left | \sin \frac{\pi n }{L} x\right |$ on the interval $0 < x < L$.
I first started by calculating the first term of the sequence. $$a_{0} = \frac{1}{2L} \int_{0}^{L} \sin \left (\frac{\pi}{\beta }x \right ) dx$$, where $\beta = L/n$. So after integration, $$a_{0} = \frac{1}{\pi n}\left ( 1 - \cos \pi n \right ) = \frac{1}{\pi n}\left ( 1 - (-1)^{n} \right ).$$ Now when I try to solve for the next Fourier coefficient I end up getting $0$ as all terms on the interval seem to cancel. $$a_{n} = \frac{1}{L} \int_{0}^{L} \sin\left ( \frac{\pi x}{\beta } \right )\cos\left ( \frac{\pi nx}{L } \right )dx = \frac{1}{2L} \int_{0}^{L} \sin\left ( \frac{\pi x}{\beta } + \frac{\pi nx}{L }\right )-\sin\left ( \frac{\pi nx}{L } - \frac{\pi x}{\beta }\right )dx. $$ since $\beta = L/n$, we have, $$a_{n} = \frac{1}{2L} \int_{0}^{L} \sin\left ( \frac{2\pi x}{\beta } \right )dx = -\frac{\beta}{4 \pi L} \left ( \cos \frac{2 \pi }{L/n} L - cos (0)\right ) = -\frac{1}{4 \pi n}\left ( \cos (2 \pi n) - 1\right ) $$ The last term I arrived at should all cancel to zero since $n = 1, 2, 3, ...$
So what is the significance of this? I am perfectly fine with accepting that the fourier series is $0$ for most terms, but the fact still stand that $a_{0} =\frac{1}{\pi n}\left ( 1 - (-1)^{n} \right ).$ This bothers me since $a_{0}$ is a single term and should have no n's in it.
If you have any insight to what the solution to this problem could be please let me know. Thank you.
$f(x)=|\sin (\pi n x/L)|$ for a fixed value of n. You need to calculate $$\int_0^L f(x) \cos( m x) dx $$ and $$\int_0^Lf(x) \sin (m x) dx$$ for each $m\in \{0\}\cup N$ in order to calculate the co-efficients.