Integrate is giving finite result for divergent integral

Expanded in response to comment by OP

The result in the question also is obtained with Mathematica "10.3.0 for Microsoft Windows (64-bit) (October 9, 2015)".

Integrate[Exp[c x]/x, {x, -a, a}]
(* ConditionalExpression[-ExpIntegralEi[-a c] + ExpIntegralEi[a c], 
   Re[a] > 0 && Im[a] == 0] *)

which can be simplified for a > 0 && c > 0.

FullSimplify[s1, a > 0 && c > 0]
(* 2 SinhIntegral[a c] *)

(The same result is obtained for a > 0 && c < 0 but not for a > 0 && c == 0.) This is the Cauchy Principal Value result.

Integrate[Exp[c x]/x, {x, -a, a}, Assumptions -> a > 0, PrincipalValue -> True]
(* 2 SinhIntegral[a c] *)

which seems strange, because PrincipalValue -> False is the default. Thus,

Integrate[Exp[c x]/x, {x, -a, a}, Assumptions -> a > 0 && c > 0]

returns unevaluated with the expected error message

Integrate::idiv: Integral of E^(c x)/x does not converge on {-a,a}. >>

Giving a and c specific real values likewise produces this error message, as noted by the OP's comment. Perhaps, Integrate becomes confused, when no constraints are placed on the parameters a and c.


It appears that this is a bug, and Mathematica is incorrectly evaluating the Cauchy Principal Value of the integral despite the default PrincipalValue -> False (and continues to do so even if you manually specify this).


Since PrincipalValueis by default set it to False (thanks, @bbgodfrey), it helps to indicate that a is a positive real number:

Integrate[Exp[c x]/x, {x, -a, a}, Assumptions -> a > 0]

Mathematica graphics

The way to look at Integrate is that it tries to find a generic integral over a complex line. Sometimes you have to give it extra information to get it to think right. Sometimes even when you do, it still has trouble analyzing the complex-number situation.

Compare with this complex line integral that goes around zero:

Integrate[Exp[c x]/x, {x, -a, I, a}, Assumptions -> a > 0]
(*
ConditionalExpression[
 -ExpIntegralEi[-a c] + ExpIntegralEi[a c],
 (c == 0 || Im[c] <= 0 || Re[c] <= 0 || a Im[c] + Re[c] <= 0) &&
  (Re[c] >= 0 || c == 0 || Im[c] <= 0 || a Im[c] <= Re[c])]
*)

Note: This integral is off by Pi I, so this falls into the doesn't-quite-get-it-right category.


A more direct way to get divergence, assuming you know where the singularity is:

Integrate[Exp[c x]/x, {x, -a, 0, a}]

Mathematica graphics