$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. :)

  • $\begingroup$ i think this integral leads to a hypergeometric series and does not have a solution in the known elementary functions $\endgroup$ – Dr. Sonnhard Graubner Jun 8 '17 at 16:40
  • $\begingroup$ @Dr.SonnhardGraubner: Thanks for the attention. Mathematica already said that! :) Can the result of the mathematica be put in terms of real numbers. The imaginary $i$ seating there make me un-comfortable for further use. I should manipulate this result into many other equations $\endgroup$ – Hosein Rahnama Jun 8 '17 at 16:43
  • $\begingroup$ at this time i have no idea $\endgroup$ – Dr. Sonnhard Graubner Jun 8 '17 at 16:45
  • $\begingroup$ @Dr.SonnhardGraubner: Can give any hints on how the Mathematica's result can be obtained? :) $\endgroup$ – Hosein Rahnama Jun 25 '17 at 15:50
  • $\begingroup$ Depending on what you want to do with this, can you take the easy way out as you would when integrating the Gaussian PDF? That is, can you just expand the integrand in a Taylor series? Your integrand would be better than the Gaussian PDF, too, because the Gaussian integral suffers badly scaled numerical terms when its argument grows moderately large, whereas this one should do better in that respect. But, if what you want is something you can correlate symbolically with other results, then maybe this is not the sort of answer you seek. $\endgroup$ – thb Jun 25 '17 at 16:07

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$.

  • $\begingroup$ Hi there! :) I do appreciate your effort. I did a (+1) but I didn't get the time to investigate the details! :) Will take a look as soon as possible. :) $\endgroup$ – Hosein Rahnama Jul 5 '17 at 6:30
  • $\begingroup$ Finally, I read it all with details. I really appreciate your attention for taking the time to write this. It seems OK. Apparently, there are no restrictions for the final result. However, I would appreciate it if you provide a final answer that can be useful for future readers and also can be checked to ensure that everything is OK. I think engineers take care about the final answer too much, isn't it? ;) $\endgroup$ – Hosein Rahnama Aug 15 '17 at 9:29
  • $\begingroup$ By the way, it take me a lot of time to edit the equations and set them in a pretty way, I think you used mathtype for writing the equations. Please consider using mathjax from this site. :) $\endgroup$ – Hosein Rahnama Aug 15 '17 at 9:33
  • $\begingroup$ @H.R.: 1) ok, I will try and complete the answer. Note that I left it "unassembled" not to make too long. $\endgroup$ – G Cab Aug 15 '17 at 9:42
  • $\begingroup$ @H.R.: 2) yes, in fact, I am still using TexAide (the precessor of mathtype), because I find unsurpassed its graphical interface . Could not find a better and updated program for Linux, can you indicate any? $\endgroup$ – G Cab Aug 15 '17 at 9:49

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.

  • $\begingroup$ Can you kindly provide the steps that should be taken to obtain the Mathematica's result too? $\endgroup$ – Hosein Rahnama Jun 25 '17 at 15:32
  • 2
    $\begingroup$ Your mathematical instincts are sharper than mine, nor do I know Pochhammer, but isn't the sum on the last line nonconvergent for $x>a$? $\endgroup$ – thb Jun 25 '17 at 16:17
  • 1
    $\begingroup$ You're right I had failed to answer the question and was more playing with the Mathematica output to reduce it. How it gets some of it's hypergeometric solutions is beyond most humans, I will thank about it. The convergence of the series does seem to be for small values, there are ways to extend it but it might create more headaches. I'll add details about the Pochhammers soon just in case it is of interest. $\endgroup$ – Benedict W. J. Irwin Jun 25 '17 at 16:48
  • 1
    $\begingroup$ Ok, so I guess I have answered "Can the result of Mathematica be put in terms of real numbers?" but the hypergeometric series I used converges for |z|<1, there are extensions which can be used to get the whole complex plane (minus a few tricky bits). If you use a package like Mathematica to numerically evaluate the hypergeometric it should automatically cover this for you. Don't worry about the imaginary parts, it's more of a notational breakdown. There is a good chance there is no way of simplifying the leftover sum. $\endgroup$ – Benedict W. J. Irwin Jun 26 '17 at 9:40
  • 1
    $\begingroup$ You can use @username to notify a user with username. :) That is a good point you mentioned about the convergence and extension to complex plane. I am now curious to see how Mathematica obtained the result! I don't think that this is beyond human as Mathematica itself is built up by humans! :D $\endgroup$ – Hosein Rahnama Jun 26 '17 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.