# A complex and difficult integral

I want to evaluate the following integral in mathematica, but it gave no result. Any help is appreciated!

Integrate[Cos[n*x]/(Exp[2*Pi*Sqrt[x]] - 1), {x, 0, Infinity}]

• Solution expressed by infinite sum: Sum[(Sqrt[2] MeijerG[{{1}, {}}, {{3/4, 1, 5/4}, {}}, (k^4 \[Pi]^4)/(4 n^2)])/( k^2 \[Pi]^3), {k, 1, \[Infinity]}] Jul 11, 2017 at 12:02
• How you got this, pls explain, thanks in advance. Jul 11, 2017 at 13:10

Maybe I'm wrong, but it does not seem to me to be an analytically solvable integral.

In such a case, it remains to solve numerically and graphically the following is obtained:

sol = Table[{n, NIntegrate[Cos[n x]/(Exp[2 Pi Sqrt[x]] - 1), {x, 0, Infinity}]}, {n, -20, 20}];

ListPlot[sol]


Specifically, for n = 0 the integral can be resolved analytically and yields 1/12.

In these cases, it is a good habit to consult the manual for excellence: Table of Integrals, Series and Products [Seventh Edition] - Gradshteyn, Ryzhik (1220 pages). In particular, the integral that resembles the one in question is the following:

$$\int_0^{\infty} \frac{1-\cos(a\,x)}{e^{2 \pi x}-1}\,\frac{\text{d}x}{x} = \frac{a}{4} + \frac{1}{2}\,\ln\left(\frac{1-e^{-a}}{a}\right).$$

In the light of this, the theorem on the derivation under the integral sign is applicable, it is possible to derive both members twice as much as $a$, obtaining:

$$\int_0^{\infty} \frac{x\,\cos(a\,x)}{e^{2 \pi x} - 1}\,\text{d}x = \frac{1}{2\,a^2} + \frac{1}{2\left(2 - e^{-a} - e^a\right)}$$

where, in both cases, $a \ne 0$ (for $a = 0$ everything is trivialized). If at this point you set $x = \sqrt{t}$ and $a = n$, you get:

$$\int_0^{\infty} \frac{\cos(n\,\sqrt{t})}{e^{2 \pi \sqrt{t}} - 1}\,\text{d}t = \frac{1}{n^2} + \frac{1}{2 - e^{-n} - e^n}.$$

Which is terribly similar to yours, but it's not yours! In your case or you are happy with numerical results, or you can transfer the problem from an improper integral to a numeric series, choose you!

• Thank you but I need values and formula. Your plot idea is amazing. Jul 11, 2017 at 13:14
• This is an off-topic comment -- I am using this post in test(s) of my Markdown-to-Mathematica converter. Oct 1, 2022 at 16:59

This is only answer from comment:

We have: $$\cos (n x)=\sum _{j=0}^{\infty } \frac{(-1)^j (n x)^{2 j}}{(2 j)!}$$ and $$\frac{1}{\exp \left(2 \pi \sqrt{x}\right)-1}=\sum _{k=1}^{\infty } \exp \left(-2 \pi k \sqrt{x}\right)$$

put to integral:

$$\int_0^{\infty } \frac{\cos (n x)}{\exp \left(2 \pi \sqrt{x}\right)} \, dx=\int_0^{\infty } \left(\sum _{j=0}^{\infty } \frac{(-1)^j (n x)^{2 j}}{(2 j)!}\right) \sum _{k=1}^{\infty } \exp \left(-2 \pi k \sqrt{x}\right) \, dx=\sum _{j=0}^{\infty } \sum _{k=1}^{\infty } \int_0^{\infty } \frac{(-1)^j (n x)^{2 j} \exp \left(-2 \pi k \sqrt{x}\right)}{(2 j)!} \, dx=\sum _{j=0}^{\infty } \sum _{k=1}^{\infty } (-1)^j k^{-2-4 j} n^{2 j} \pi ^{-\frac{5}{2}-4 j} \Gamma \left(\frac{3}{2}+2 j\right)=\sum _{k=1}^{\infty } \frac{\sqrt{2} G_{1,3}^{3,1}\left(\frac{k^4 \pi ^4}{4 n^2}| \begin{array}{c} 1 \\ \frac{3}{4},1,\frac{5}{4} \\ \end{array} \right)}{k^2 \pi ^3}$$

Mathematica can't find this sum: $$\sum _{j=0}^{\infty } (-1)^j k^{-2-4 j} n^{2 j} \pi ^{-\frac{5}{2}-4 j} \Gamma \left(\frac{3}{2}+2 j\right)$$

Sum[(-1)^j k^(-2 - 4 j) n^(2 j) \[Pi]^(-(5/2) - 4 j)
Gamma[3/2 + 2 j], {j, 0, Infinity}, Regularization -> "Borel",
Assumptions -> {{n, k} > 0, {n, k} \[Element] Integers}]
(* ? *)


,then I used a Maple.

$$\int_0^{\infty } \frac{\cos (n x)}{-1+e^{2 \pi \sqrt{x}}} \, dx=\sum _{k=1}^{\infty } \frac{\sqrt{2} G_{1,3}^{3,1}\left(\frac{k^4 \pi ^4}{4 n^2}| \begin{array}{c} 1 \\ \frac{3}{4},1,\frac{5}{4} \\ \end{array} \right)}{k^2 \pi ^3}$$

You may expand MeijerG function in Sum:

(Sqrt[2] MeijerG[{{1}, {}}, {{3/4, 1, 5/4}, {}}, (k^4 \[Pi]^4)/(4 n^2)])/(k^2 \[Pi]^3) // FunctionExpand // Expand


$$\int_0^{\infty } \frac{\cos (n x)}{-1+e^{2 \pi \sqrt{x}}} \, dx=\sum _{k=1}^{\infty } \left(\frac{\left(\frac{k^4}{n^2}\right)^{3/4} \pi ^{3/2} \cos \left(\frac{k^2 \pi ^2}{n}\right)}{\sqrt{2} k^2}-\frac{\sqrt{2} k \pi ^{3/2} \cos \left(\frac{k^2 \pi ^2}{n}\right) C\left(\frac{k \sqrt{2 \pi }}{\sqrt{n}}\right)}{n^{3/2}}+\frac{\sqrt[4]{\frac{k^4}{n^2}} \pi ^{3/2} \sin \left(\frac{k^2 \pi ^2}{n}\right)}{\sqrt{2} n}-\frac{\sqrt{2} k \pi ^{3/2} S\left(\frac{k \sqrt{2 \pi }}{\sqrt{n}}\right) \sin \left(\frac{k^2 \pi ^2}{n}\right)}{n^{3/2}}\right)$$

And now you have to find a Closed from of Sum.