# Strange behavior of Limit in Mathematica 9 and 10 (bug?)

fixed in 10.1

Consider a complex logarithm where the branch cut is defined along the negative axis. Then for $r$ and $\eta$ real and positive we can write

$\lim_{\eta \to 0} \log(-r+ i \eta) = log (r) + i \pi \\ \lim_{\eta \to 0} \log(-r- i \eta) = log (r) - i \pi$

which reflects the fact that in the first case ($+ i \eta$) we are approaching the branch cut from above, while in the second case ($-i \eta$) from below.

In Mathematica one can use Limit to reproduce this behavior, i.e. by writing

Log[-m^2 - I eta]
Limit[%, eta -> 0, Assumptions -> m^2 > 0]
Log[-m^2 + I eta]
Limit[%, eta -> 0, Assumptions -> m^2 > 0]


In the first case I get Log[m^2] - I Pi and in the second Log[m^2] + I Pi. This is correct and fine.

However, if I write

a + Log[-m^2 - I eta]
Limit[%, eta -> 0, Assumptions -> m^2 > 0]
a + Log[-m^2 + I eta]
Limit[%, eta -> 0, Assumptions -> m^2 > 0]


something very weird happens. In both cases Mathematica 10 returns a + Log[m^2] + I Pi. To me this is obviously wrong. Since a does not depend on eta it should not influence the imaginary part in any way. By the way you can basically replace a by anything (e.g 1 or "a") and still get the same wrong result.

I checked this with different Mathematica versions and the problem is present starting with version 9. Mathematica 7 and 8 on the contrary return correct results in all cases.

So is there something I'm missing about the way how Limit works, or is it a bug?

P.S. I though that it might make sense to discuss this here before reporting it to WRI. If it isn't a bug, then of course there is also nothing to report.

• Actually I'm surprised that it works at all, since strictly speaking the limit doesn't exist (you usually use a notation like $\lim_{\eta\to 0^+}$ to indicate the extra condition that you are calculating a one-sided limit). However I don't know under which conditions Mathematica considers a limit to be one-sided. Mar 18, 2015 at 11:23
• @celtschk You actually can specify the direction of a one-sided limit using Direction. However, again Limit[Log[-m^2 + I eta], eta -> 0, Assumptions -> m^2 > 0, Direction -> -1] and Limit[Log[-m^2 + I eta], eta -> 0, Assumptions -> m^2 > 0, Direction -> 1] give correct results, while Limit[a+Log[-m^2 + I eta], eta -> 0, Assumptions -> m^2 > 0, Direction -> -1] and Limit[a+Log[-m^2 + I eta], eta -> 0, Assumptions -> m^2 > 0, Direction -> 1] produce wrong output in MMA 9 and 10 but evaluate properly in MMA 7 and 8.
– vsht
Mar 18, 2015 at 13:06
• Definitely a bug. Mar 18, 2015 at 16:02
• @DanielLichtblau Thanks, then I'll report it to WRI.
– vsht
Mar 18, 2015 at 16:05
• I reported it. If you like you can have your name attached to the report. Just let Tech Services know the link to this MSE discussion, and that it was a bug I had filed today. Mar 18, 2015 at 16:23

Not an answer, but possible hint as to what's going on:

Try the following in Mathematica 9 and 10.0.

(*1*) Limit[1 + Log[-a - I y], y → 0, Direction → -1, Assumptions → {a > 0}]
(* 1 + I*π + Log[a]*)

(*2*) Limit[1 + Log[-x - I y], y → 0, Direction → -1, Assumptions → {x > 0}]
(* 1 - I*π + Log[x]  <-- in v9 only.*)


In v9, the one with x is right, the one with a (and any other letter) is wrong. Clearly, Wolfram is encouraging users to use x as the variable.

In v10.0, Wolfram concedes, and all letters give the wrong result.

• Interesting. I tried to look at ClearAttributes[Limit, Protected]; ClearAttributes[Limit, ReadProtected]; ?? Limit but it seems like Limit is implemeted in C, not in Wolfram Language. Anyway, now it looks more like a bug to me rather than some peculiarity of Limit.
– vsht
Mar 18, 2015 at 14:16

This has been fixed in 10.1 on windows:

 \$Version


code for the above

 expr1 = Log[-m^2 - I eta];
Limit[expr1, eta -> 0, Assumptions -> m^2 > 0]
expr2 = Log[-m^2 + I eta];
Limit[expr2, eta -> 0, Assumptions -> m^2 > 0]
a + expr1;
Limit[%, eta -> 0, Assumptions -> m^2 > 0]
a + expr2;
Limit[%, eta -> 0, Assumptions -> m^2 > 0]