On Sep 19, 2010, at 11:24 AM, Nicholas Kinar wrote: > >> That would be cool to have implemented, though. Or maybe some kind of >> lambda thing, so you could just say >> >> collect(expr, lambda i: i.is_Indexed, lambda=True) >> >> and it would collect all Indexed terms. >> >> Also, as far as making the Indexed separation work, maybe some kind of >> lambda support in as_independent would work too, like >> >> expr.as_independent(lambda i: i.is_Indexed and i[3] == n + 1, lambda=True) >> >> I am assuming is_Indexed is an actual property of Basic, and that you are >> using M(i, j, n) instead of M(i, j)**n. (By the way, don't try these >> Nicholas. They don't work yet; they are just ideas). >> >> Any ideas? >> >> And of course, if Atoms worked correctly with Indexed (as per issue 2058), >> then you could just run a loop around collect() and as_independent(). >> > I kind of like this idea as well. Perhaps it would be also possible for the > user to indicate on which side of an expression the terms should be collected. > > Nicholas
Generally it's easiest to convert an Equality into a regular expression and then convert it back (like I showed in my first email to this thread). If you only want to manipulate one side of an Equality, you could do Eq(manipulation(expr.lhs), expr.rhs), i.e., only do it to whatever side and then rebuild the Equality. Basically, Equality support in SymPy right now is shabby at best, because only a few functions really handle them correctly, so your best bet is to not use them in intermediate calculations. Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.