Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2014

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: checking the sign of all terms in a long expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132566] Re: checking the sign of all terms in a long expression
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 12 Apr 2014 05:15:59 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20140411061009.8DE2B6A30@smc.vnet.net>

Depnding on your intent:

toCheck = a + a b + a b c + a c - b + b c + d - e (f + g);

Cases[toCheck, Times[-1, __]]

{-b, -e (f + g)}

Cases[toCheck // ExpandAll, Times[-1, __]]

{-b, -e f, -e g}

Bob Hanlon

On Fri, Apr 11, 2014 at 2:10 AM, dantimatter <google at dantimatter.com> wrote:

>
> hello all
> is there to check the signs of all terms in a symbolic expression, like
>
> toCheck = a + a b + a b c + a c - b + bc + d ....
>
> in this case, with the assumption that the a, b, c etc are all positive,
> only one term is negative (b by itself) and the rest are positive.  I have
> expressions like this that have a hundred or more terms and i'm worried i
> might not be catching all those that are of a different sign.
>
> thanks
>
>




  • Prev by Date: Using FindRoot with free parameters
  • Next by Date: Re: OnError [Thread"::"tdlen"]
  • Previous by thread: R: checking the sign of all terms in a long expression
  • Next by thread: Re: checking the sign of all terms in a long expression