error in limit involving exp, sinh and an assumption (maybe related to caching)

60 views
Skip to first unread message

Rüdiger Braun

unread,
Nov 1, 2016, 4:23:35 PM11/1/16
to sympy
Hi all!

The following code

(compana16) braun:~/git/compana16$ ipython
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:49:02)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python'
s own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sympy

In [2]: sympy.__version__
Out[2]: '1.0'

In [3]: x = sympy.Symbol('x')

In [4]: a = sympy.Symbol('a', positive=True)

In [5]: f = sympy.exp(x*(-a-1)) * sympy.sinh(x)

In [6]: f.limit(x, sympy.oo)
Out[6]: oo



produces false output.  Correct is 0
I think it is somehow related to caching.  If caching is turned off, then the product in [5] cannot even be constructed.

(compana16) braun:~/git/compana16$ export SYMPY_USE_CACHE='no'
(compana16) braun:~/git/compana16$ ipython
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:49:02)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python'
s own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import sympy

In [2]: sympy.__version__
Out[2]: '1.0'

In [3]: x = sympy.Symbol('x')

In [4]: a = sympy.Symbol('a', positive=True)

In [5]: f = sympy.exp(x*(-a-1))

In [6]: g = sympy.sinh(x)

In [7]: h = f*g
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/home/braun/miniconda3/envs/compana16/lib/python3.5/site-packages/sympy/core/assumptions.py in getit(self)
   
240         try:
--> 241             return self._assumptions[fact]
   
242         except KeyError:

KeyError: 'zero'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
/home/braun/miniconda3/envs/compana16/lib/python3.5/site-packages/sympy/core/assumptions.py in getit(self)
   
240         try:
--> 241             return self._assumptions[fact]
   
242         except KeyError:

KeyError: 'zero'



This goes on until a RecursionError kicks in.

Best regards

Rüdiger Braun

Aaron Meurer

unread,
Nov 7, 2016, 3:40:08 PM11/7/16
to sy...@googlegroups.com
Can you open an issue in the issue tracker for this?

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 https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/a1ca0361-3668-4ea0-b199-0ce08ab2a76b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Francesco Bonazzi

unread,
Nov 7, 2016, 7:12:51 PM11/7/16
to sympy
I think we should merge Kirpichev's fork into SymPy. He has fixed lots of issues with limits.

Rüdiger Braun

unread,
Nov 9, 2016, 3:24:18 PM11/9/16
to sympy
I opened a ticket under number

#11833

Rüdiger Braun

unread,
Nov 9, 2016, 3:26:19 PM11/9/16
to sympy
The problem is not present in Kirpichev's fork (diofant).
Reply all
Reply to author
Forward
0 new messages