how to compute this integral for fourier series I am trying to find the Fourier sine and cosine series of $\frac{1}{(1+x^2)}$ from $0$ to $2$, and do not know where to even begin to evaluate this integral: $\int \frac{sin(nx)}{(1+x^2)} dx$ (and similarly for the cosine series too).   I found $a_0$ since integrating the function gives the arctan function.  Can someone please help with the sine and cosine extensions? 
 A: Initially, I want to solve this problem by using residue theorem. But I find that the integrand is odd function so that this method is invalid personally.
Then, I guess this integral can not be presented as a closed form. I solve this problem as follow
We can factorize the integrand as:
$$
\dfrac{\sin(nx)}{1+x^2}=\dfrac{\sin(nx)}{(x-i)(x+i)}=\dfrac{1}{2i}(\dfrac{\sin(nx)}{x-i}-\dfrac{\sin(nx)}{x+i})
$$
So the integral is
$$
I=\dfrac{1}{2i}(\int_0^2\dfrac{\sin(nx)}{x-i}dx-\int_0^2\dfrac{\sin(nx)}{x+i}dx)
$$
Note that 
$$
\int_0^2\dfrac{\sin(nx)}{x-i}dx \stackrel{x-i=t}{=} \int_{-i}^{2-i}\dfrac{\sin(n(t+i))}{t}dt=\int_{-i}^{2-i}\dfrac{\sin(nt)\cos(ni)+\cos(nt)\sin(ni)}{t}dt\\
=\cosh(n)\int_{-i}^{2-i}\dfrac{\sin(nt)}{t}dt+i\sinh(n)\int_{-i}^{2-i}\dfrac{\cos(nt)}{t}dt\\
=\cosh(n)(Si((2-i)n)+Si(in))+i\sinh(n)(Ci((2-i)n)-Ci(-in))
$$
where
$$
Si(x)=\int_0^x\frac{\sin(t)}{t}dt\qquad Ci(x)=\gamma+\ln(x)+\int_0^x\frac{\cos(t)-1}{t}dt
$$
and $\gamma$ is Euler constant.
Similarly, we have
$$
\int_0^2\dfrac{\sin(nx)}{x+i}dx=\cosh(n)(Si((2+i)n)-Si(in))+i\sinh(n)(-Ci((2+i)n)+Ci(in))
$$
In summary, we have:
$$
I=\dfrac{1}{2}[(Ci(in)-Ci(n(i+2))-Ci(-in)+Ci(n(2-i)))\sinh(n)-(Si(n(i+2))+Si(n(2-i)))i\cosh(n)]
$$
I can only calculate to here.
