Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Simplify
New issue 3862 by [email protected]: rcollect doesn't work as expected
http://code.google.com/p/sympy/issues/detail?id=3862
According to rcollect, it recursively collects Adds. But I could not get
it to do much with this expression
In [126]: print a
(a0*a1*a2*a3*a4 + a0*a1*a2 + a0*a1*a4 + a0*a3*a4 + a0 + a2*a3*a4 + a2 +
a4)/(a1*a2*a3*a4 + a1*a2 + a1*a4 + a3*a4 + 1)
In [127]: rcollect(a, a0, a1, a2, a3, a4)
Out[127]:
a₀⋅(a₁⋅a₂⋅a₃⋅a₄ + a₁⋅a₂ + a₁⋅a₄ + a₃⋅a₄ + 1) + a₂⋅(a₃⋅a₄ + 1) + a₄
──────────────────────────────────────────────────────────────────
a₁⋅(a₂⋅a₃⋅a₄ + a₂ + a₄) + a₃⋅a₄ + 1
On the other hand, a true recursive collect does something
In [122]: collect(a, a0, lambda x: collect(x, a1, lambda y: collect(y, a2,
lambda z: collect(z, a3))))
Out[122]:
a₀⋅(a₁⋅(a₂⋅(a₃⋅a₄ + 1) + a₄) + a₃⋅a₄ + 1) + a₂⋅(a₃⋅a₄ + 1) + a₄
───────────────────────────────────────────────────────────────
a₁⋅(a₂⋅(a₃⋅a₄ + 1) + a₄) + a₃⋅a₄ + 1
Maybe this wasn't the intention of rcollect, though. It's not clear from
the docstring.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.