Consider the integral $\int _0 ^\infty dx\ x \tanh( \pi x) \sqrt {x^2 + a^2}$, where $a$ is a real number. This integral is divergent. We note that an asymptotic expansion of the integrand about $x =\infty$ reveals it to have an expansion of the kind, $x^2 \tanh(\pi x) + \frac{a^2}{2} \tanh (\pi x ) + O(\frac{1}{x}) $

So we can think of "defining" the regulated value of the integral as the quantity that one gets after subtracting off the asymptotic divergence. Hence a possibly sensible definition is to say,

$$\lim_ {M \rightarrow \infty} \left [ \int _0 ^M dx \left ( x \tanh( \pi x) \sqrt {x^2 + a^2 } \right ) - \int_0 ^M dx \left ( x^2 \tanh(\pi x) + \frac{a^2}{2} \tanh (\pi x ) \right ) \right ]$$

I believe that the above is a finite quantity.

  • I would like to know how Mathematica can be gotten to compute this above quantity (may be numerically) for any given $a$

If you are worried about motivations then you can think of QFT.


2 Answers 2


This is at least how I might start such a problem:

First define a function that calculates the numerical integral (using your definition) from 0 to some number:

res[a_?NumericQ, xmax_?NumericQ] := 
 res[a, xmax] = 
   x Tanh[Pi x] Sqrt[x^2 + a^2] - (a^2/2 + x^2) Tanh[\[Pi] x], {x, 0, 
    xmax}, WorkingPrecision -> 50]

You might notice that I have creates res so that it remembers its own values, I anticipate doing some convergence testing later on and it will advantageous to compare results from previous iterations. Let's look at what happens for a=1 and how it converges as xmax gets larger:

Table[res[1, 10^k], {k, 1, 6}] // Column


its looks decently well behaved, so I might have luck with a function that looks for convergence to a certain number of "digits"

conv[a_?NumericQ, d_?NumericQ] := {10^#, res[a, 10^#]} &@
  FixedPoint[# + 1 &, 1, 
   SameTest -> (-Log10@
         Abs[(res[a, 10^#1] - res[a, 10^#2])/res[a, 10^#1]] > d &)]

I happened to have this function also output the xmax needed as well, but it's certainly not needed. Here's a test case (again a=1) (where I want to get 5 "digits"):

conv[1, 5]
(* {1000000,  -0.25344837443111616373463057913994844439842599461908} *)

You might find you will need to go back and adjust the working precision or other options for NIntegrate to various values of a and xmax)


You can also look at NLimit (and please read the docs for it so you can see how its approximating the limit).


NLimit[res[1, xmax], xmax -> ∞, WorkingPrecision -> 50]
(* -0.253448526436653269615367431483292411155527711 *)

Personally, I would use the previous approach, but that's my "cautious" side and lets me set a goal of how converged of a result I want.

  • $\begingroup$ SO taking the "limit" will not work? As in Mathematica knows how to take "limits" - right? So can't one use that inbuilt feature somehow? $\endgroup$
    – user6818
    Commented Apr 16, 2014 at 20:14
  • $\begingroup$ I'd have gone a bit farther and use the Shanks transformation: SequenceLimit[Table[res[1, 10^k], {k, 1, 6}]]. $\endgroup$ Commented Jun 3, 2015 at 10:29
 lst = Table[{a, 
    NIntegrate[(-(a^2/2) + x (-x + Sqrt[a^2 + x^2]))*Tanh[π*x], {x, 0, ∞}]},
    {a, 0.2, 1, 0.05}];


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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