Computing the Integral $\int\tanh[b(x-a)]\cos\beta x\,dx$ $1$. Recently, I encountered the following integral in a physical problem
$$I(a,b,\beta)=\int\tanh[b(x-a)]\cos\beta x\,dx,$$
where $a,\,b,\,\beta$ are some real numbers. Mathematica gives this results which looks really complicated. 

I want to know how the result of mathematica can be obtained?

Also, the Re and FullSimplify commands in Mathematica didn't make any further simplification. 

Can the result of mathematica be put in terms of real numbers? 

The imaginary $i$ seating there makes me un-comfortable for further use. I should substitute this result into many other equations 
I am hopeful to get a simpler form for the anti-derivative as I believe that humans do much better than machines and programs (see this post as a proof!) :) 
My thought was to write a Taylor expansion for $\cos\beta x$ and then going through. In that case we encounter the following integrals 
$$J_{2n}(a,b,\beta)=\int x^{2n}\tanh[b(x-a)]\,dx,\qquad n=0,1,2,\dots$$
which I couldn't manage to get a nice closed form for them.
$2$. If there is no way to get a simpler anti-derivative then I am interested to obtain a simple form for the following definite integral
$$I=\int_{-l}^{l}\tanh[b(x-a)]\cos\beta x\,dx,$$
where $\beta=\frac{n\pi}{l}$ and $n$ is a positive integer so obviously $\cos\beta l=(-1)^n,\,\sin\beta l=0$.
Any help or hint is appreciated. :)
 A: If we consider the series expansion of the hypergeometric functions about $x=0$
$$
_2F_1(a,b;c;z) = \sum_{n=0}^\infty \frac{(a)_n (b)_n}{(c)_n} \frac{z^n}{n!}
$$
we also have 
$$
\frac{\left(-\frac{i \beta}{2b}\right)_n}{\left(1-\frac{i \beta}{2 b}\right)_n} = \frac{\beta}{\beta+2inb}\\
\frac{\left(\frac{i \beta}{2b}\right)_n}{\left(1+\frac{i \beta}{2 b}\right)_n} = \frac{\beta}{\beta-2inb}
$$
with $(\cdot)_n$ the rising Pochhammer function, otherwise the first argument $(1)_n$ will cancel with the $n!$ in the series definition. So we can write the result as 
$$
_2F_1\left(1,-\frac{i \beta}{2b},1-\frac{i \beta}{2 b},-e^{2b(x-a)}\right)=\sum_{n=0}^\infty \frac{(-1)^n\beta e^{2nb(x-a)}}{\beta+2inb}=\beta\sum_{n=0}^\infty \frac{(-1)^n(\beta-2inb)e^{2nb(x-a)}}{\beta^2+4b^2n^2}\\
_2F_1\left(1,\frac{i \beta}{2b},1+\frac{i \beta}{2 b},-e^{2b(x-a)}\right)=\sum_{n=0}^\infty \frac{(-1)^n\beta e^{2nb(x-a)}}{\beta-2inb}=\beta\sum_{n=0}^\infty \frac{(-1)^n(\beta+2inb)e^{2nb(x-a)}}{\beta^2+4b^2n^2}
$$
Then your integral is written
$$
I=\frac{\sin(\beta x)}{\beta} - ie^{-i\beta x}\sum_{n=0}^\infty \frac{(-1)^n(\beta-2inb)e^{2nb(x-a)}}{\beta^2+4b^2n^2}+ie^{i\beta x}\sum_{n=0}^\infty \frac{(-1)^n(\beta+2inb)e^{2nb(x-a)}}{\beta^2+4b^2n^2}
$$
we can have that
$$
\sum_{n=0}^\infty \frac{\beta(-1)^n}{\beta^2+4 b^2 n^2} = \frac{2b + \beta\pi\text{csch}\left(\frac{\beta \pi}{2b}\right)}{4b\beta}
$$
so we can reduce $I$ further to 
$$
I=\frac{\sin(\beta x)}{\beta}-\left(2b+\beta \pi \text{csch}\left(\frac{\beta \pi}{2 b}\right)\right)\frac{\sin(\beta x)}{2 b \beta} -2be^{-i\beta x}\sum_{n=0}^\infty \frac{(-1)^nne^{2nb(x-a)}}{\beta^2+4b^2n^2}-2be^{i\beta x}\sum_{n=0}^\infty \frac{(-1)^nne^{2nb(x-a)}}{\beta^2+4b^2n^2}
$$
which is
$$
I=-\beta \pi \text{csch}\left(\frac{\beta \pi}{2 b}\right)\frac{\sin(\beta x)}{2 b \beta} -4b\cos(\beta x)\sum_{n=0}^\infty \frac{(-1)^nne^{2nb(x-a)}}{\beta^2+4b^2n^2}
$$
I'm not sure how to evaluate the last sum, but there are no more $i$'s in the expression.
I may have made some mistakes somewhere but hopefully this is a tiny bit useful.

Edit: To see the Pochhammer identity use this relation which is just stating
$$
\frac{a(a+1)(a+2)\cdots(a+n-1)}{(a+1)(a+2)\cdots(a+n)}=\frac{a}{(a+n)}
$$
substitute $a=-\frac{i \beta}{2b}$ and $a=\frac{i \beta}{2b}$ to get the two identities used above. 
A: The following steps lead to express the integral of your interest by a convergent series, 
or in terms of the Lerch zeta function, so they may be, possibly, of some help.
Starting from
$$ \bbox[lightyellow] {  
I\left( {x,a,b,\beta } \right) = \int {\tanh \left( {b\left( {x - a} \right)} \right)\,\cos \beta x\,dx} 
 } \tag{1} $$
and making the substitution
$$
y = b\left( {x - a} \right),\quad x = {y \over b} + a
$$
we get
$$ \bbox[lightyellow] {  
I\left( {y,a,b,\beta } \right) = {1 \over b}\int {\tanh y\,\cos \left( {{\beta  \over b}y + \beta a} \right)\,dy} 
 } \tag{2} $$
So we can reduce the analysis to the integral
$$ \bbox[lightyellow] {  
\eqalign{
  I_{\,r} \left( {y,c,d} \right) &= \int {\tanh y\,\cos \left( {c\,y + d} \right)\,dy}    \cr 
  &  = \,\cos \left( d \right)\int {\tanh y\cos \left( {c\,y} \right)\,dy}  - \sin \left( d \right)\int {\tanh y\sin \left( {c\,y} \right)\,dy}  \cr} 
 } \tag{3} $$
According to fundamental theorem of calculus, one of the many anti-derivatives of the above integrands can be expressed in terms of definite integrals
$$ \bbox[lightyellow] {  
\eqalign{
  C\left( {y,c} \right) &= \int_{t\, = \,0}^{\;y} {\tanh t\cos \left( {c\,t} \right)\,dt}    \cr 
  &  = \int_{t\, = \,0}^{\;y} {{{\sinh t} \over {\cosh t}}\cos \left( {c\,t} \right)\,dt}   \cr 
& = \int_{t\, = \,0}^{\;y} {{{d\left( {\cosh t} \right)} \over {\cosh t}}\cos \left( {c\,t} \right)}     \cr 
  &  = \ln \left( {\cosh y} \right)\cos \left( {c\,y} \right) + c\int_{t\, = \,0}^{\;y} {\ln \left( {\cosh t} \right)\sin \left( {c\,t} \right)dt\,}  \cr} 
 } \tag{4.a} $$
and
$$ \bbox[lightyellow] {  
\eqalign{
   S\left( {y,c} \right) &= \int_{t\, = \,0}^{\;y} {\tanh t\sin \left( {c\,t} \right)\,dt}     \cr 
  &  = \ln \left( {\cosh y} \right)\sin \left( {c\,y} \right) - c\int_{t\, = \,0}^{\;y} {\ln \left( {\cosh t} \right)\cos \left( {c\,t} \right)dt\,}  \cr} 
 } \tag{4.b} $$
Now we have that
$$ \bbox[lightyellow] {  
\ln \left( {\cosh t} \right) = \ln \left( {{{e^{\,t}  + e^{\, - t} } \over 2}} \right) = t - \ln 2 + \ln \left( {1 + e^{\, - 2t} } \right)
 } \tag{5} $$
The integral of the first two terms, multiplied by $\cos(ct)$ or $\sin(ct)$, is quite simple.
Concerning the third, since $|e^{-2t}|<1$ for positive $t$ , we can expand it in power series of $e^{-2t}$.
Then, on the single terms of the expansion we can use the fact that
$$ \bbox[lightyellow] {  
\eqalign{
  & \int {e^{\,\lambda \,x} \cos xdx}  = {{e^{\,\lambda \,x} \left( {\lambda \cos x + \sin x} \right)} \over {\lambda ^{\,2}  + 1}}  \cr 
  & \int {e^{\,\lambda \,x} \sin xdx}  = {{e^{\,\lambda \,x} \left( {\lambda \sin x - \cos x} \right)} \over {\lambda ^{\,2}  + 1}} \cr} 
 } \tag{6.a} $$
Otherwise, we can consider that
$$ \bbox[lightyellow] {  
\eqalign{
 J &= \int_{t\, = \,0}^{\;y} {\ln \left( {1 + e^{\, - 2t} } \right)e^{\, - ict} dt\,}  \cr   
&=  \sum\limits_{0\, \le \,k} {\left( { - 1} \right)^k \int_{t\, = \,0}^{\;y} {{{e^{\, - \left( {2\left( {k + 1} \right) + ic} \right)t} } \over {k + 1}}dt\,} }    \cr 
  &  = {1 \over 2}\sum\limits_{0\, \le \,k} {\left( { - 1} \right)^k {{1 - e^{\, - \left( {2\left( {k + 1} \right) + ic} \right)y} } \over {\left( {k + 1 + ic/2} \right)\left( {k + 1} \right)}}}    \cr 
  &  = {1 \over {ic}}\left( {\sum\limits_{0\, \le \,k} {\left( { - 1} \right)^k {{1 - e^{\, - \left( {2\left( {k + 1} \right) + ic} \right)y} } \over {\left( {k + 1} \right)}}}  - \sum\limits_{0\, \le \,k} {\left( { - 1} \right)^k {{1 - e^{\, - \left( {2\left( {k + 1} \right) + ic} \right)y} } \over {\left( {k + 1 + ic/2} \right)}}} } \right)  \cr 
  &  = {1 \over {ic}} {\left( {\sum\limits_{0\, \le \,k} {{{\left( { - 1} \right)^k } \over {\left( {k + 1} \right)}}}  - \sum\limits_{0\, \le \,k} {{{\left( { - 1} \right)^k } \over {\left( {k + 1 + ic/2} \right)}}} } \right) -
 \\   \frac{1}{ic} e^{\, - (2 + ic)y} \left( {\sum\limits_{0\, \le \,k} {{{e^{\, - \left( {2y - i\pi } \right)k} } \over {\left( {k + 1} \right)}}}  + \sum\limits_{0\, \le \,k} {{{e^{\, - \left( {2y - i\pi } \right)k} } \over {\left( {k + 1 + ic/2} \right)}}} } \right)}  \cr} 
 } \tag{6.b} $$
and express the last in terms of the Lerch zeta function
Now, remounting the steps back to (4), having put that 
$$
0 \le y = b\left( {x - a} \right),\quad \;c = \beta /b,\quad \;d = \beta \,a
$$
and since we can reconduce the two components $C(y,c), \;S(y,c)$ to $0 \le y$, we get
$$ \bbox[lightyellow] {  
\eqalign{
  & C\left( {y,c} \right) = C\left( { - y,c} \right)\quad \left| {\;0 \le y} \right.\quad  =   \cr 
  &  = \int_{t\, = \,0}^{\;y} {\tanh t\cos \left( {c\,t} \right)\,dt}  =   \cr 
  &  = \ln \left( {\cosh y} \right)\cos \left( {c\,y} \right) + c\int_{t\, = \,0}^{\;y} {\ln \left( {\cosh t} \right)\sin \left( {c\,t} \right)dt\,}  =   \cr 
  &  = \ln \left( {1 + e^{\, - 2\,y} } \right)\cos \left( {c\,y} \right) + {1 \over c}\sin \left( {c\,y} \right) - \ln 2 +   \cr 
  &  - c\sum\limits_{0\, \le \,k} {\left( { - 1} \right)^{\,k} {{e^{\, - 2\left( {k + 1} \right)\,y} \left( {2\left( {k + 1} \right)\sin (cy) + c\cos (cy)} \right) - c} \over {\left( {k + 1} \right)\left( {4\left( {k + 1} \right)^{\,2}  + c^{\,2} } \right)}}}  \cr} 
 } \tag{7.a} $$
and
$$ \bbox[lightyellow] {  
\eqalign{
  & S\left( {y,c} \right) =  - S\left( { - y,c} \right)\quad \left| {\;0 \le y} \right.\quad  =   \cr 
  &  = \int_{t\, = \,0}^{\;y} {\tanh t\sin \left( {c\,t} \right)\,dt}  =   \cr 
  &  = \ln \left( {\cosh y} \right)\sin \left( {c\,y} \right) - c\int_{t\, = \,0}^{\;y} {\ln \left( {\cosh t} \right)\cos \left( {c\,t} \right)dt\,}  =   \cr 
  &  = \ln \left( {1 + e^{\, - 2\,y} } \right)\sin (cy) + {1 \over c}\left( {1 - \cos (cy)} \right) +   \cr 
  &  + c\sum\limits_{0\, \le \,k} {\left( { - 1} \right)^{\,k} {{e^{\, - 2\left( {k + 1} \right)\,y} \left( {2\left( {k + 1} \right)\cos (cy) - c\sin (cy)} \right) - 2\left( {k + 1} \right)} \over {\left( {k + 1} \right)\left( {4\left( {k + 1} \right)^{\,2}  + c^{\,2} } \right)}}}  \cr} 
 } \tag{7.b} $$
after which, the (3) gives:
$$ \bbox[lightyellow] {  
\eqalign{
  & I_{\,r} \left( {y,c,d} \right) = \int {\tanh y\,\cos \left( {c\,y + d} \right)\,dy}  =   \cr 
  &  = \,\cos \left( d \right)C(y,c) - \sin \left( d \right)S(y,c) \cr} 
 } \tag{7.c} $$
So we get a solution expressed by a converging sum.
We also easily get from the above an asymptotic expression  for $y \to \infty$. 
