Translating Between Fourier Sine Series and Fourier Cosine Series A mathematician can choose to represent a target function defined from $0$ to $L$ using a Fourier Sine Series or a Fourier Cosine Series at her discretion, by temporarily introducing either an odd extension or an even extension, respectively, regardless of whether the target function is actually even, odd, or neither.  I want to know if there is a way to translate one type of series into the other, once the choice has been made.
I am working with the sinesum function in Pure Data as a means of synthesizing waveshapes, which seems to eat numeric Fourier Sine Series coefficients as parameters.  However, I need to shift some waves vertically, which is easier to do with a Fourier Cosine Series.  There is a cosinesum function which eats Fourier Cosine Series coefficients, but it is not as well documented as sinesum.

*

*Given the numeric Fourier Sine Series coefficients of a target wave, can I convert them into numeric Fourier Cosine Series coefficients mathematically?


*If I can reverse engineer the pattern of the numeric coefficients as a mathematical expression, can I then convert that expression into an expression for the Fourier Cosine Series coefficients?
Note that I am not seeking a solution like this, where the answer contains an explicitly shifted series of the other type, but the unshifted series the mathematician would have arrived at if she'd used a different extension of the target function.
 A: There certainly is a rigorous conversion between cosine expansion of the even extension, and the sine expansion of the odd extension. But it definitely does not express $\sin(mx)$ as a finite sum of $\cos(nx)$'s. On $[0,\pi]$, the computation of the cosine Fourier coefficients of $\sin(x)$ is, up to uniform constants,
$$
\hbox{$n$th coefficient} \;=\; \int_0^\pi \sin(x)\cdot \cos(nx)\;dx
\;=\;
{1\over 4i} \int_0^\pi \Big(e^{i(1+n)x}-e^{i(-1+n)}+e^{i(1-n)x}
-e^{-i(1+n)x}\Big)\;dx
$$
The integral is $0$ for $n$ odd, because the integrals of the individual terms are $0$. For $n$ even, it is
$$
\;=\; {1\over 4i}\Big({-2\over i(1+n)} - {-2\over i(-1+n)}
+ {-2\over i(1-n)} - {-2\over -i(1+n)}\Big)
$$
$$
\;=\; {1\over 2}\Big(
{1\over 1+n} - {1\over -1+n} + {1\over 1-n} - {1\over -(n+1)}
\Big)
$$
The first and fourth, and second and third, do not cancel each other, but add, and the result is non-zero. That is, the cosine coefficient of the even extension of $\sin(x)$ from $[0,\pi]$ to $[-\pi,\pi]$ is non-zero for infinitely-many indices.
