TITLE: Evaluating sum $\sum_{m=0}^{\infty}\frac{(2-\delta_m^0)(-1)^m \lambda_0}{a(\lambda_0^2 -(\frac{m\pi}{a}))}\cos(m\pi x/a)$
QUESTION [7 upvotes]: How Can I evaluate the following sum$$\sum_{m=0}^{\infty}\frac{2-\delta_m^0}{a}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}\cos\left(\frac{m\pi x}{a}\right)=\frac{\cos(\lambda_0 x)}{\sin(\lambda_0 a)}$$
I have read this in a research paper 

I have tried evaluating the sum using finite cosine transform 
We have $$\frac{2}{a}\frac{1}{\lambda_0}+\frac{2}{a}\sum_{m=0}^{\infty}\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}\cos\left(\frac{m\pi x}{a}\right)=f(x)$$
So
$$\frac{(-1)^m \lambda_0}{\lambda_0^2 -(\frac{m\pi}{a})}=\int_{0}^{a} f(x)\cos\left(\frac{m\pi x}{a}\right) dx $$
How to find $f(x)$ ?
And Is there any other way to evaluate the sum ?
Thanks In advance.

REPLY [2 votes]: Focusing on the main task of the problem in the OP I shall calculate the sum starting at $m=1$ and dropping the overall factor $\lambda$, i.e. the expression
$$f(x) = \frac{2 }{a} \sum _{m=1}^{\infty } \frac{(-1)^m \cos \left(\frac{\pi  m x}{a}\right)}{\lambda ^2-\frac{\pi  m}{a}}\tag{1}$$
Assuming $\lambda ^2 \lt \frac{\pi}{a}$ we write 
$$\frac{1}{\lambda ^2-\frac{\pi  m}{a}} = - \int_{0}^{\infty} e^{-t (\frac{\pi  m}{a}-\lambda ^2)}\, dt\tag{2}$$
and 
$$\cos(\frac{m \pi x}{a}) = \Re \exp(i \frac{m \pi x}{a})$$
Substituting this into $(1)$ the /geometric) sum can be done under the integral:
$$\sum _{m=1}^{\infty } (-1)^m \exp \left(\frac{i \pi  m x}{a}\right) \exp \left(-t \left(\frac{\pi  m}{a}-\lambda ^2\right)\right)\\=
-\frac{e^{t \left(-\left(\frac{\pi }{a}-\lambda ^2\right)\right)+\frac{\pi  t}{a}+\frac{i \pi  x}{a}}}{e^{\frac{\pi  t}{a}}+e^{\frac{i \pi  x}{a}}}$$
Integrating the negative this over $t$ according to $(2)$ and applying the missing factor gives
$$-\frac{2}{\pi} 
\left(-e^{\frac{i \pi  x}{a}}\right)^{\frac{a \lambda ^2}{\pi }} B(-e^{\frac{i \pi  x}{a}},1-\frac{a \lambda ^2}{\pi },0)\tag{3}$$
Here $B$ is the incomplete Beta function defined by
$$B(z,a,b) = \int_{0}^{z} t^{a-1} (1-t)^{b-1}$$
We now have to take the real part.
Selecting the simplified case $\lambda \to 0$ expression $(3)$ reduces to
$$\frac{2}{\pi} \log \left(1+e^{\frac{i \pi  x}{a}}\right)$$
The real part and hence the sum is
$$f(\lambda\to 0)=\frac{1}{\pi} \log \left(4 \cos \left(\frac{\pi  x}{2 a}\right)^2\right)\tag{4}$$
The case $0 \lt \lambda ^2 (\lt \frac{\pi}{a})$ can be extracted from $(3)$ as well. It will be left as an exercise in complex arithmetic to the reader.
For any $\lambda \ne \sqrt{\frac{\pi m}{a}}$ the sum can be expressed by the Hurwitz-Lerch transcendent as follows
$$f= \frac{1}{\pi} 
\left(
e^{\frac{i \pi  x}{a}} \Phi \left(-e^{\frac{i \pi  x}{a}},1,1-\frac{a \lambda ^2}{\pi }\right)
+e^{-\frac{i \pi  x}{a}} \Phi \left(-e^{-\frac{i \pi  x}{a}},1,1-\frac{a \lambda ^2}{\pi }\right)
\right)\tag{5}$$
$\Phi $ is defined as
$$\Phi(z,s,a) = \sum_{k=0}^{\infty} z^k (k+a)^{-s} $$