1
$\begingroup$

I'm trying to calculate analytically the integral below

$$ I = \int_{-\infty}^{+\infty} -\frac{2 \mathrm{e}^{k^2/2 + 5} k^2 (k^2 + 10)}{(\mathrm{e}^{k^2/2 + 5} - 1)^2} \mathrm{d}k $$

I've already plotted it and I'm pretty sure this integral converges. However, it seems Mathematica doesn't give me an expression for it.

Any clues? Thanks!

$\endgroup$
6
  • 2
    $\begingroup$ You haven't given an integral. You've only given a function. $\endgroup$
    – Michael E2
    Apr 25, 2020 at 2:45
  • 4
    $\begingroup$ There is no analytical antiderivative. Try numerical integration. There is no analytical antiderivative even for $\frac{1}{e^{k^2}-1}$ never mind the much more complicated integrand you show. $\endgroup$
    – Nasser
    Apr 25, 2020 at 3:03
  • $\begingroup$ Thanks @Nasser! $\endgroup$
    – sined
    Apr 25, 2020 at 3:11
  • 1
    $\begingroup$ It converges. NIntegrate[f[k], {k, -\[Infinity], \[Infinity]}] gives 0.440988. $\endgroup$ Apr 25, 2020 at 4:39
  • 1
    $\begingroup$ I modified the expression to an integral by guessing. Please check whether it expresses what you originally meant. $\endgroup$ Apr 25, 2020 at 7:36

1 Answer 1

6
$\begingroup$

So the function is cannot be analytically integrated, but it converges when you do numerical integration:

f[k_] := ((2 Exp[k^2/2 + 5] k^2  (k^2 + 10))/(Exp[k^2/2 + 5] - 1)^2)

NIntegrate[f[k], {k, -∞, ∞}] 

which gives 0.440988.

It is worth noticing that the (numerical) integral up to an unknown value $k_{max}$ can actually be well approximated (for $k>1$) by a sigmoid fit:

![enter image description here

where the points are the result from the numerical integral, and the solid line is this fit: $$ \frac{1}{2.26922 + \mathrm{e}^{2.36821(2.03168-x)}}. $$

$\endgroup$
6
  • $\begingroup$ Thank you for the detailed explanation. Now the integral converged for a range of parameters. However, for some parameters I obtain the following message: NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in k near {k} = {5.31442*10^7}. NIntegrate obtained -4.89281*10^40+3.28288*10^28 I and 2.2012203052999983`*^40 for the integral and error estimates. Do you know how could I fix it? $\endgroup$
    – sined
    Apr 27, 2020 at 22:15
  • 1
    $\begingroup$ See this question: mathematica.stackexchange.com/questions/109772/… $\endgroup$ Apr 27, 2020 at 22:16
  • $\begingroup$ Dear @SuperCiocia, I've read this question already. However, for my case, I can use WorkingPrecision->100 and AccuracyGoal-> Infinity that the problem still remains: $\endgroup$
    – sined
    Apr 27, 2020 at 22:36
  • $\begingroup$ Then they might be as big numbers that Mathematica can store and handle. $\endgroup$ Apr 27, 2020 at 22:39
  • $\begingroup$ It could be. But notice that I've renormalized the parameters of my integral and I'm still getting this error: NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in k near {k} = {1.1053624000288337238*10^10}. NIntegrate obtained -11.988785460816550537 and 0.0037401556395867222549`20. for the integral and error estimates. $\endgroup$
    – sined
    Apr 27, 2020 at 23:10

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