This forms part of a project I am doing and I wish to see how well complex fourier series approximates a smooth curve such as this one. After tedious integration by parts, I have attained an answer which has imaginary numbers in, although I have been advised that $C_{n}$ must be real.
Ignoring that, when trying to plot what I have derived to see how well it approximates the original function, the graph is not much like the original function. I have checked my work repeatedly but I must have made an error.
The answer I have attained is: $\sum_{n=-N}^{N} \Bigg(\dfrac{i(-1)^n}{(n-1)^2} - \dfrac{i(-1)^n}{(n+1)^2} \Bigg) e^{inx}$
If this answer is correct, is the fact that the fourier series is trying to approximate a smooth function mean it's hard to be correct? The discontinuous functions I have approximated have worked brilliantly with a suitably large n.
Any help with this would be greatly appreciated!
The coefficient I get is
$$\frac{4 i (-1)^n n}{(n^2-1)^2},$$ which is not the same as yours.
For $n = 1,$ mathematica gives $$-\frac{1}{6} i \pi \left(2 \pi ^2-3\right)$$
and for $n=-1,$ $$\frac{1}{6} i \pi \left(2 \pi ^2-3\right)$$