Comment #3 on issue 2264 by [email protected]: Caching problems in Order
http://code.google.com/p/sympy/issues/detail?id=2264
In my 2092 branch I cleaned up Order so it only stores symbols as the
variables of the Order. It was previously storing expressions, e.g. `O(2-x,
2-x)` would be stored with `2-x` as the symbol; this did not become `O(2-x,
x)`. This may explain the caching problem. In that branch, however, the 2nd
example (after making the change to power.py) gives
raise ValueError("cannot compute leadterm(%s, %s), got c=%s" % (self,
x, c))
ValueError: cannot compute leadterm(-1 + 2*_w**2/3, _w), got c=-1 +
2*_w**2/3
This is strange and it turns out that if there are *no* assumptions put on
`_w` then it works:
[Dbg]>>> ((2*x**2*exp(-1)/3+exp(-1)).as_leading_term(x))
2*_w**2*exp(-1)/3 + exp(-1)
[Dbg]>>> x.assumptions0
{'real': True, 'nonzero': True, 'commutative': True, 'nonpositive':
False, 'positive': True, 'negative': False, 'nonnegative': True, 'zero':
False, 'complex': True, 'imaginary': False}
[Dbg]>>> ((2*y**2*exp(-1)/3+exp(-1)).as_leading_term(y))
exp(-1)
[Dbg]>>> y.assumptions0
{}
[Dbg]>>>
And doing that replacement internally after detecting a failure yields
h[2] >>> limit(tan(x)**tan(2*x),x,pi/4)
exp(-1)
I don't know why that replacement should be necessary yet.
See my 2264 branch for these changes.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.