15

Mathematica (as of v. 11.1.0) does not recognize that this special case of Frullani's integral converges:

Integrate[(ArcTan[a*x] - ArcTan[b*x])/x, {x, 0, Infinity}]
(* Integrate::idiv: Integral of ArcTan[a x]/x-ArcTan[b x]/x does not converge 
   on {0,\[Infinity]}.
   Integrate[(ArcTan[a*x] - ArcTan[b*x])/x, {x, 0, Infinity}] *)

This should converge because the integrand is well-defined at zero and is $ O(1/x^2)$ as $ x \to \infty $.

Using the formula given, with $ f(x) = \tan^{-1} (x) $, we should have

$$ \int_0^\infty dx\,\frac{\tan^{-1}(a\,x)-\tan^{-1}(b\,x)}{x} = -\frac{\pi}{2} \ln \left(\frac{b}{a}\right) $$

NIntegrate crunches through just fine for $ a = 1 $ and $ b = 2 $.

NIntegrate[(ArcTan[1*x] - ArcTan[2*x])/x, {x, 0, Infinity}]
(* -1.08879 *)

This matches the exact result:

-(Pi/2)*Log[2/1] // N
(* -1.08879 *)
Pillsy
  • 18,498
  • 2
  • 46
  • 92

2 Answers2

20

The integral does not converge if a and b are real and have opposite signs:

Series[(ArcTan[a*x] - ArcTan[b*x])/x, {x, Infinity, 2}]

Mathematica graphics

As @shadowray pointed out, it does converge if a and b are positive and Integrate[] is passed that as an assumption. It also works with

Integrate[(ArcTan[a*x] - ArcTan[b*x])/x, {x, 0, Infinity}, Assumptions -> a < 0 && b < 0]
Michael E2
  • 235,386
  • 17
  • 334
  • 747
16

Although Integrate usually finds the condition in which the integral converges,

Integrate[Exp[-a x], {x, 0, Infinity}]

enter image description here

it's better to provide your own condition in the form of Assumptions.

Integrate[(ArcTan[a*x] - ArcTan[b*x])/x, {x, 0, Infinity}, Assumptions->{Re[a]>0, Re[b]>0}]

enter image description here

Integrate[(ArcTan[a*x] - ArcTan[b*x])/x, {x, 0, Infinity}, Assumptions->{Re[a]<0, Re[b]<0}]

enter image description here

W.Mason
  • 371
  • 1
  • 2
  • 6