Sympy zoo

136 views
Skip to first unread message

Paul Royik

unread,
Jun 7, 2015, 7:52:52 AM6/7/15
to sy...@googlegroups.com
Why 1/0 is complex infinity and log(0) is complex infinity?

I also found a bug with oo**zoo. It is recursion error.

Kalevi Suominen

unread,
Jun 8, 2015, 5:05:24 AM6/8/15
to sy...@googlegroups.com


On Sunday, June 7, 2015 at 2:52:52 PM UTC+3, Paul Royik wrote:
Why 1/0 is complex infinity and log(0) is complex infinity?

They are shorthand notations for the limits of  1/z  and  log(z)  as  z  tends to  0. The default domain in SymPy is the complex field, so the limits are computed in a complex neighbourhood of  0.

Paul Royik

unread,
Jun 8, 2015, 10:55:30 AM6/8/15
to sy...@googlegroups.com
Thank you.
How to make it work in real field?

Francesco Bonazzi

unread,
Jun 8, 2015, 2:10:23 PM6/8/15
to sy...@googlegroups.com
Are you sure that SymPy's behaviour is well-defined?

In [1]: z = Symbol('z', imaginary=True)

In [2]: z.is_imaginary
Out[2]: True

In [3]: z.is_real
Out[3]: False

In [4]: limit(1/z, z, 0)
Out[4]:

In [5]: type(_)
Out[5]: sympy.core.numbers.Infinity


Aaron Meurer

unread,
Jun 8, 2015, 4:18:09 PM6/8/15
to sy...@googlegroups.com
My guess is that limit() doesn't look at assumptions. Also, limit
uses real limits, not complex limits (which are much harder to work
with algorithmically).

The oo**zoo thing is a bug. Please open an issue in the issue tracker about it.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/20e274b7-fcfd-4467-b1b4-80be23c3b4de%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

Francesco Bonazzi

unread,
Jun 10, 2015, 7:56:34 AM6/10/15
to sy...@googlegroups.com


On Monday, 8 June 2015 22:18:09 UTC+2, Aaron Meurer wrote:
My guess is that limit() doesn't look at assumptions.  Also, limit
uses real limits, not complex limits (which are much harder to work
with algorithmically).


Apparently not even Mathematica implements complex limits:

In[1]:= Limit[1/x, x->0]                                                                                  

Out[1]= Infinity

In[2]:= Limit[1/x, x->0, Assumptions -> NotElement[x, Reals]]                                            

                                                                                   
1
Limit::cas: Warning: contradictory assumption(s) x \[NotElement] Reals && 0 < x < ---- encountered.
                                                                                 
4096

             
1
Out[2]= Limit[-, x -> 0, Assumptions -> x \[NotElement] Reals]
              x



 I guess that SymPy's limit( ... ) should raise an exception if the parameter is not real. Do you agree?

Reply all
Reply to author
Forward
0 new messages