Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Integration Polynomial

New issue 2650 by asmeurer: non-determinism in integrate()
http://code.google.com/p/sympy/issues/detail?id=2650

Tomo and I just went through a lot of grief in https://github.com/sympy/sympy/pull/573 over what appeared to be some bizzare caching problem. In the end, it was caused by this part of risch.py:

347     poly_part = Add(*[ poly_coeffs[i]*monomial
348         for i, monomial in enumerate(monoms) ])

The problem is that momons is a set, so the result of enumerate(monoms) is completely arbitrary. In fact, I've see list(set) return a different result for the same set within the *same* session before. This leads to integrate() sometimes returning different (though still correct) results than others. It may even lead to being able to do it in once case and not in another (I'm not sure of this, though, and I haven't actually seen it). In the case that I saw, it returned cos**2 in one case and -sin**2 in another; both are valid because they differ by a constant.

We should order the monoms. Actually, earlier, I would have liked it if the monoms were ordered in a way that made it easier to debug. I think it was grlex that I found the most useful, though I could be wrong. But any canonical sorting would be better than none. Will default_sort_key always give the same thing even though the elements of monoms are Dummys?

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

Reply via email to