Comment #4 on issue 3627 by prasoon9...@gmail.com: Order malfunctions with sin(x)
http://code.google.com/p/sympy/issues/detail?id=3627

This issue is really twisted. I'll try to explain why the endless recursion is happening.(You should import calculate_series from gruntz)

Let's try this-
calculate_series(sin(x)**1.2, x)

Now, in the calculate_series function, it tries to get at least one term of the required expansion. So, it calls nseries and provides the number of terms to which the series is to be calculated.

nseries returns a series with an order term. Now, if there is only the order term in the series, then, calculate_series again calls nseries. This time, the series is calculated to twice as many terms as last time.

Again, calculate_series checks if the returned series has any terms other than the order terms. If so, calculate_series will just return the smallest term in the series. Otherwise, it will again call nseries asking it to give the series to twice as many terms as last time.I hope you are with me till here.

In the current case, (sin(x)**1.2).nseries(x, n=4) is called. Inside nseries, it generates a term like:t = (x + O(x**3))**1.2This term is to be added to O(x**4), that is:t = t+ O(x**4)Now, when adding an order term to an expression, SymPy checks whether the other term (in this case 't') also has an odder term or not. So here, SymPy checks whether t has an order term or not.

So, we need to determine whether t has an order term. If t is a simple 'Add' object, then it's straightforward to determine this. In our case, t is a 'Pow' object.

Now, the Order function (that calculates order) works by finding the leading term. So, it calls the function compute_leading_term() but this function in turn calls to calculate_series(). And the recursion continues on and on.I am still trying to see how this can be fixed. Any ideas?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to