Comment #1 on issue 1342 by docherty: Calulating a series expansion hangs
http://code.google.com/p/sympy/issues/detail?id=1342

Also discussed in this thread  
http://groups.google.com/group/sympy/t/9befd022c87583fd

The problem seems to be caused by the pattern matching
in the `core/power.py` file. It expects a term of the form
k*x**l, but if there are two terms of the same power in x it won't match.  
This gives
l=0 and the following while loop doesn't terminate.

                  term2 = rest.as_leading_term(x)
                  k, l = Wild("k"), Wild("l")
                  r = term2.match(k*x**l)
                  k, l = r[k], r[l]
...
                 while l * m < n:

A quick fix is to collect the leading term in x. Also checking that l>0  
would prevent
Sympy hanging if the match isn't made.

A patch file is attached for the proposed quick fix.

Attachments:
        series-hang-issue1342.patch  806 bytes

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to