Solve integral: $\int_{0}^{\pi}\sum_{k=1}^{\infty}(\frac{k^2\sin{kx}}{2^k})dx$ Solve integral:$$\int_{0}^{\pi}\sum_{k=1}^{\infty}(\frac{k^2\sin{kx}}{2^k})dx  $$
 Prove that $$\int_{-\infty}^{+\infty}\frac{e^{ax}}{1+e^x}dx=\sum_{n=-\infty}^{+\infty}\frac{(-1)^n}{a+n}, \qquad 0<a<1.$$
I need some references for similar problems.Online book or pdf with related problems.Thank you!!  
 A: Hint for the first integral:
$$
\begin{align}
\sum_{k=1}^\infty k^2x^k
&=\frac{x+x^2}{(1-x)^3}\\
&=-\frac14\frac{\frac{x^{1/2}+x^{-1/2}}2}{\left(\frac{x^{1/2}-x^{-1/2}}2\right)^3}\\
\end{align}
$$
However, the function is periodic, so the integral over $[0,\infty)$ doesn't converge.
A: For the first problem, consider $$S=\sum_{k=1}^{\infty}\frac{k^2\sin{(kx)}}{2^k}$$
$$C=\sum_{k=1}^{\infty}\frac{k^2\cos{(kx)}}{2^k}$$ $$C+ i S=\sum_{k=1}^{\infty}\frac{k^2\, e^{ikx}}{2^k}=-\frac{2 e^{i x} \left(2+e^{i x}\right)}{\left(-2+e^{i x}\right)^3}$$ $$ C-i S=\sum_{k=1}^{\infty}\frac{k^2\, e^{-ikx}}{2^k}=\frac{2 e^{i x} \left(1+2 e^{i x}\right)}{\left(-1+2 e^{i x}\right)^3}$$ making
$$S=\frac{1}{2} i \left(\frac{2 e^{i x} \left(2+e^{i x}\right)}{\left(-2+e^{i
   x}\right)^3}+\frac{2 e^{i x} \left(1+2 e^{i x}\right)}{\left(-1+2 e^{i
   x}\right)^3}\right)=\frac{2 \sin (x) (7-20 \cos (x))}{(4 \cos (x)-5)^3}$$ and then, the periodicity issue already pointed out by robjohn if you need to integrate from $0$ to $\infty$.
However, if you integrate between $2n\pi$ and $2(n+1)\pi$, the result would simply be equal to $0$. May be, this is what you want.
