Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unexpected behavior of log() in complex plane

For the log() to be defined properly in the complex plane we need to agree on where its cut is located. So, for sage it is easy to check that the cut is located on the negative Re-axis (as is most common), namely

sage: var('eps')
sage: limit(log(-1+i*eps),eps=0,dir='+')
sage: limit(log(-1+i*eps),eps=0,dir='-')

Ok. Now I want to use this with symbolic variables. So I do

sage: var('w eps')
sage: forget()
sage: assume(w,'real')
sage: assume(w>0)
sage: limit(log(-w+i*eps),eps=0,dir='+')
I*pi + log(w)
sage: limit(log(-w+i*eps),eps=0,dir='-')
-I*pi + log(w)

Ok. That is correct. Now I want to get a little more adventurous, namely

sage: var('w ec eps')
sage: forget()
sage: assume(w,'real')
sage: assume(ec,'real')
sage: assume(eps,'real')
sage: assume(w>0)
sage: assume(w<ec)
sage: limit(log(w-ec+i*eps),eps=0,dir='+')
I*pi + log(-ec + w)
sage: limit(log(w-ec+i*eps),eps=0,dir='-')
-I*pi + log(-ec + w)

Oops? This is wrong. The argument of the log() has not been turned into the absolute value its real part, i.e. ec-w. This also contradicts the previous simpler startup examples.

Just for backup. Mathematica will give you

In[6]:= Limit[Log[w-ec+I eps],eps->0,Direction->-1,Assumptions->{w>0,w<ec}]
Out[6]= I Pi+Log[ec-w]
In[7]:= Limit[Log[w-ec+I eps],eps->0,Direction->1,Assumptions->{w>0,w<ec}]
Out[7]= -I Pi+Log[ec-w]

As I was expecting and at variance with sage's output.