This is the piecewise function I am currently working with $$ f(x) = \begin{cases} -5 \qquad\qquad\ -2 <= x < -1 \\ (3-x^2) \qquad -1< x<1 \\5 \qquad\qquad\qquad1<x<=2 \end{cases} $$
And I working to try and find the coefficients that would correspond to this fourier series, I will focus on $a_m$ for $m >= 1$ but I am having a similar issue when computing $b_m$. The problem I am facing is that I am getting coefficients that are excessively complex, out of the ordinary for other problems of this type that I have seen, I do not know if what I have computed is correct or incorrect but I lack confidence in my answer.
I go to calculate $a_m = \frac{1}{2}\displaystyle \int_{-2 }^{2}f(x)cos(\frac{m\pi}{2}x)dx$ and find that the integral simplifies to $\frac{1}{2}\displaystyle \int_{-1 }^{1}(3-x^2)cos(\frac{m\pi}{2}x)dx$ which I then proceed to evaluate using integration by parts. I have checked my calculus several times and compared with other sources to double check my work here so I am fairly confident that I am fine here (though obviously I could be making a mistake).
The problem for me arises when I have terms in my coefficient $a_m$ like $cos(\frac{m\pi}{2})$ or $sin(\frac{m\pi}{2})$ because I am used to seeing something like $cos(m\pi)$ or $sin(m\pi)$. I understand that for these more convenient terms that I am used to seeing as you summate with even/odd values of $m$ the trigonometric functions alternate between $-1$ and $1$ or are always $0$ so they can be simplified in a manner like, I don't know, $(-1)^m$ or $(-1)^{m+1}$ which then allows me to simplify my Fourier series into something more manageable.
The terms in the coefficient which consist of $cos(\frac{m\pi}{2})$ or $sin(\frac{m\pi}{2})$ alternate between -1, 1, and 0. Do not know how to simplify this and my resulting Fourier series just looks like a mess or ends up appearing incorrect after some failed attempts of simplifying.
Is this confusion indicative that my calculations have gone awry or that I am missing something? Need help on how to calculate this coefficient when the internal arguments of cos() or sin() appear in this form.