Hi,
sympy doesn't have a built-in automatic method to do this kind of
simplifications. factor() doesn't help here because it works on the
whole expression and must give a product if expression has factors.
collect() doesn't help either, because it's not smart about what
subexpressions to factor out (that's by design). You can, however,
take all the low-level tools and compose them to get an algorithm for
your purpose. See for example
https://gist.github.com/mattpap/c59ed5529744c06f23b1, where I use
factor(), multiset_partitions() and count_ops() to get the desired
behavior. This approach is horribly inefficient, so this isn't
anything we would provide by default in sympy (or at least run by
default in simplify()).
Mateusz
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sympy+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/25f22412-038b-420b-af5f-05733d251f99%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.