Originally Posted by
nehme007 Well, L = pi/2. Use the right L, and you should be on the right track.
The function is neither even nor odd. But the function isn't even defined from -pi/2 to 0 so it wasn't capable of being even or odd in the first place. What we can do is extend f so that it is defined from -pi/2 to 0 in a manner such that the extended function is even. That is, define f_1(x) such that f_1(x) = f(x) for 0 < x < pi/2 and f_1(-x) = f(x) for -pi/2 < x < 0. So f_1 is even and f_1 agrees exactly with f over the interval of interest (0 < x < pi/2). Now compute the Fourier series coefficients for f_1. Since f_1 is even, its Fourier series expansion only contains cosine terms. The integral you have written for a_n will give you those coefficients, provided you use the correct L. The Fourier series for f_1 is what you are calling the half range cosine series.
Of course, you could also extend f to make it an odd function. That is, you could define f_2(x) = f(x) for 0 < x < pi/2, and f_2(-x) = -f(x) for -pi/2 < x < 0. The Fourier series for f_2 contains only sine terms and is what you are calling the half range sine series. (Most texts omit the "half range" part and just call these the Fourier Sine Series and Fourier Cosine Series).
And, it's worth noting that you can do this with any function that's defined only for 0 < x < L, that is, defined only for positive x. The function doesn't have to exhibit any sort of symmetry and only has to be reasonably well behaved (whatever the requirements are for a function to have a Fourier series expansion, I forget what exactly). You can extend the function to be either even or odd, and create a both a cosine and a sine series.