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

New issue 1686 by asmeurer: collect() doesn't always collect derivatives  
correctly
http://code.google.com/p/sympy/issues/detail?id=1686

In [1]: print collect(expand((1 + 2*x*f(x))/f(x) + (-x + f(x))*diff(f(x),  
x)/f(x)**2), f(x).diff(x))
2*x + (1 + D(f(x), x))/f(x) - x*D(f(x), x)/f(x)**2

This should be 1 + 2*x*f(x))/f(x) + (-x + f(x))*D(f(x), x)/f(x)**2 or  
something similar (classify_ode(),
which uses collect(), requires that the terms in front of D(f(x), x) be  
collected to match the
expression).

And another one:

In [6]: print collect(expand(-(x*sin(f(x)/x)/f(x) + cos(f(x)/x))*diff(f(x),  
x) + cos(f(x)/x)*f(x)/x),
f(x).diff(x))
-D(f(x), x)*cos(f(x)/x) + cos(f(x)/x)*f(x)/x - x*D(f(x), x)*sin(f(x)/x)/f(x)

This should be -(x*sin(f(x)/x)/f(x) + cos(f(x)/x))*D(f(x), x) +  
cos(f(x)/x)*f(x)/x (in other words, it
should more or less un-expand the expression).

If it weren't for this issue, classify_ode() could call expand() before  
calling collect(), which would
enable it to classify ODEs that have been factored in a strange way (see  
line 541 in ode.py and
test_unexpanded_Liouville_ODE in test_ode.py)

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