Status: Accepted
Owner: ness...@googlemail.com
Labels: Type-Defect Priority-High Series
New issue 2264 by ness...@googlemail.com: Caching problems in Order
http://code.google.com/p/sympy/issues/detail?id=2264
The limit following limit hangs:
limit(exp(1/sin(x))/exp(cot(x)), x, 0)
This is because (1+O(x))/x is not distributed to 1/x + O(x)/x, which upsets
various limit/series parts. In this case the term comes from power.py, and
the following patch fixes it:
--- a/sympy/core/power.py
+++ b/sympy/core/power.py
@@ -643,7 +643,7 @@ def _eval_nseries(self, x, n):
# factor the w**4 out using collect:
return 1/collect(prefactor, x)
if rest.is_Order:
- return (1 + rest)/prefactor
+ return 1/prefactor + rest/prefactor
n2 = rest.getn()
if n2 is not None:
n = n2
But now limit(tan(x)**tan(2*x),x,pi/4) fails.
This is a caching issue (disabling cache makes the limit work again!). The
following change in order.py brutally fixes that (but is clearly
suboptimal):
--- a/sympy/series/order.py
+++ b/sympy/series/order.py
@@ -206,7 +206,7 @@ def as_expr_variables(self, order_symbols):
order_symbols = order_symbols + (s,)
return self.expr, order_symbols
- @cacheit
+ #@cacheit
def contains(self, expr):
"""
Return True if expr belongs to Order(self.expr, *self.variables).
Someone (perhaps me if I have time, currently working on something else)
needs to debug what is happening.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.