I'd say you found a bug. Could you report it in our issue tracker?

By the way, an easier way to deal with branch cuts symbolically is to
use the exp_polar object. exp_polar(pi*I) represents "just above" the
negative real axis and exp_polar(-pi*I) represents "just below" it.
And similar for other arguments. In other words, exp_polar(x) is just
like exp(x) except it "keeps track" of which branch it is on (so e.g.,
exp_polar(0) != exp_polar(2*pi*I)).

polarify(), unpolarify(), and polar_list() are also useful functions
when working with exp_polar.

Aaron Meurer

On Sun, Dec 1, 2013 at 7:19 AM, Xaver <[email protected]> wrote:
> I am having some very trivial issues getting proper branch cuts of
> elementary functions in the complex plane.
>
> In [1]: from sympy import *
>
> Exmpl. 1-------------------sqrt()---------------------------
> 1st numerically
>
> In [2]: N(sqrt(-1.+I*1e-10))
> Out[2]: 5.0e-11 + 1.0*I
>
> In [3]: N(sqrt(-1.-I*1e-10))
> Out[3]: 5.0e-11 - 1.0*I
>
> Ok. sqrt-branch seems to lie on neg. Re-axis and is selected properly
> 2nd same thing symbolically
>
> In [5]: eps=symbols('eps')
>
> In [6]: limit(sqrt(-1+I*eps),eps,0,'+')
> Out[6]: I
>
> In [7]: limit(sqrt(-1+I*eps),eps,0,'-')
> Out[7]: I
>
> In [8]: limit(sqrt(-1-I*eps),eps,0,'+')
> Out[8]: I
>
> In [9]: limit(sqrt(-1-I*eps),eps,0,'-')
> Out[9]: I
>
> Oops? Symbolic sqrt() does not seem to handle the branch cut properly(?)
>
> Exmpl. 2----------------------------------------------
> 1st numerically
>
> In [10]: log(-1-I*1e-10)
> Out[10]: 5.0e-21 - 3.14159265348979*I
>
> In [11]: log(-1+I*1e-10)
> Out[11]: 5.0e-21 + 3.14159265348979*I
>
> Ok. log-branch seems to lie on neg. Re-axis and is selected properly
>
> 2nd same thing symbolically
>
> In [12]: limit(log(-1+I*eps),eps,0,'+')
> Out[12]: I*pi
>
> In [13]: limit(log(-1+I*eps),eps,0,'-')
> Out[13]: I*pi
>
> In [14]: limit(log(-1-I*eps),eps,0,'+')
> Out[14]: I*pi
>
> In [15]: limit(log(-1-I*eps),eps,0,'-')
> Out[15]: I*pi
>
> Oops? Symbolic log() does not seem to handle the branch cut properly(?)
>
> I could probably 'find' more of that behavior with other elementary
> functions.
> So, what am I doing wrong?
>
> Xaver
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to