Re: Collecting Positive and Negative Terms
- To: mathgroup at smc.vnet.net
- Subject: [mg112320] Re: Collecting Positive and Negative Terms
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 9 Sep 2010 04:22:57 -0400 (EDT)
- References: <firstname.lastname@example.org> <email@example.com>
On Sep 7, 9:59 pm, Michael Knudsen <micknud... at gmail.com> wrote: > On Aug 14, 12:32 pm, Bob Hanlon <hanl... at cox.net> wrote: > >> myExpression = a + b - c; >> >> DeleteCases[myExpression, Times[-1, ___]] >> >> a+b > > Dammit! I was a little too fast with my reply. For some reason, it > fails when I apply to one of my big expressions. Both postive and > negative terms survive then. > > Here is an example of when it goes wrong: > > http://commondatastorage.googleapis.com/michael_knudsen_various/SplitExpression.nb > > -- > Michael Knudsen Try Cases[myExpression,Times[_?Negative,__]] and DeleteCases[myExpression,Times[_?Negative,__]] .