Re: Collecting Positive and Negative Terms

• To: mathgroup at smc.vnet.net
• Subject: [mg111753] Re: Collecting Positive and Negative Terms
• From: Albert Retey <awnl at gmx-topmail.de>
• Date: Thu, 12 Aug 2010 05:29:59 -0400 (EDT)
• References: <i3tnsg\$s5l\$1@smc.vnet.net>

```Hi,

> I'm currently doing calculations often involving very large
> expressions with a lot of unknown parameters. To investigate whether
> an expression is positive or negative, I usually expand it using the
> Expand command and manually copy and paste the positive and negative
> terms into new expressions and simplify them using FullSimplify. In my
> case it often turns out that comparing the two is much easier than
> looking at the entire expression as a whole.
>
> However, it's very cumbersome to do all this manually. Is there an
> easy way in Mathematica to pick out terms begging with + (or -) in a
> sum?

If your expr is a sum of products (which is what Expand usually
creates...), the following should work:

Cases[expr, Times[_?Positive, ___]]

Cases[expr, Times[_?Positive, ___]]

for an expression with more diversity of terms you might need to adopt
the pattern or maybe even the approach. If the above isn't good enough
for your case, it would be a good idea to post an example so people know
what you are working with...

hth,

albert

```

• Prev by Date: Re: Random points in triangle
• Next by Date: Re: Frontend suggestions
• Previous by thread: Collecting Positive and Negative Terms
• Next by thread: Re: Collecting Positive and Negative Terms