3
$\begingroup$

Bug introduced in 9.0 or earlier and fixed in 10.4.0


I just discovered that Integrate with simple poles in its integrand sometimes gives different results depending on number type of its limit (Exact vs Inexact).

(*Approximate upper limit*)
Integrate[1/z, {z, -1 - I, -1 + .5 I}] // N

-0.235002 + 5.03414 I

(*Exact upper limit*)
Integrate[1/z, {z, -1 - I, -1 + 1/2 I}] // N

-0.235002 - 1.24905 I

The second result is the one that everyone would agree with as it properly accounts for crossing the logarithmic cut running along the negative axis.

Two questions:

  1. Is this the correct behavior of Integrate? I can't seem to find this behavior mentioned in the documentation.

  2. I have a huge Mathematica notebook (containing some 35 Integrate calls) that is supposed to compute integrals symbolically and/or numerically depending on the type of its limit. e.g. of the form:

    f[a_,b_] := Integrate[1/z, {z, a, b}]
    

    What would be some quick ways to get around this bug? I noticed NIntegrate correctly accounts for the branch cut, but it only works if there's nothing symbolic left.

$\endgroup$
  • $\begingroup$ What happens if you do Integrate[1/z, {z, -1 - I, -1 + t I}] /. t -> {1/2, 0.5}? $\endgroup$ – J. M. will be back soon Dec 14 '15 at 14:01
  • $\begingroup$ @J.M. The initial Integration step takes forever and finally gives a ConditionalExpression. After replacing, you get Undefined for both cases. (btw you can't do your replace-list trick when there is a ConditionalExpression) $\endgroup$ – QuantumDot Dec 14 '15 at 14:08
  • $\begingroup$ Reported as a bug. $\endgroup$ – Daniel Lichtblau Dec 14 '15 at 19:37
  • $\begingroup$ @DanielLichtblau With Mathematica's branch-cut convention for Log, isn't $\int_a^b \frac{dx}{x} = \ln(b/a)$ always true for any $a, b \in \mathbb{C}$? What's the deal with all the CondintionalExpressions that it spits out? $\endgroup$ – QuantumDot Jan 4 '16 at 17:29
  • $\begingroup$ Maybe. But Integrate is not going to figure out that that always corrects for Log[b]-Log[a]. $\endgroup$ – Daniel Lichtblau Jan 4 '16 at 20:05
2
$\begingroup$

These integrals in the complex plane are ambiguous in that the paths are not specified. Perhaps, the first Integrate to the long way around z = 0, as in

Integrate[1/z, {z, -1 - I, +1 - I, +1 + 1/2 I, -1 + 1/2 I}] // Simplify
(* 1/4 I (7  π - 4 ArcTan[1/2] + I Log[64/25]) *)
% // N
(* -0.235002 + 5.03414 I *)

The same result is obtained from

Integrate[1/z, {z, -1 - I, +1 - I, +1 + .5 I, -1 + .5 I}]

The only way I know to be sure that the desired path is taken is to express the integral as

I Integrate[1/(-1 + I y), {y, -1, .5 }]
(* -0.235002 - 1.24905 I *)
$\endgroup$
  • $\begingroup$ Well, I thought that in a computer program like Mathematica, one would have a consistent convention which would most naturally be straight path. If Mathematica just picks whatever contour it wants, I would call this a catastrophic design flaw. $\endgroup$ – QuantumDot Dec 14 '15 at 19:22
  • $\begingroup$ @QuantumDot I would think so too, but I am unable to find a discussion of this point in the documentation. Contour integrals are so common that they should be covered explicitly. $\endgroup$ – bbgodfrey Dec 14 '15 at 19:40
2
$\begingroup$

This bug has been fixed as of Mathematica 10.4.0.

Integrate[1/z, {z, -1 - I, -1 + .5 I}]

(* -0.235002 - 1.24905 I *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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