Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16786

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

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: checking the sign of all terms in a long expression
Date 2014-04-12 09:16 +0000
Message-ID <lib09h$i6p$1@smc.vnet.net> (permalink)
References <20140411061009.8DE2B6A30@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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@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
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: checking the sign of all terms in a long expression Bob Hanlon <hanlonr357@gmail.com> - 2014-04-12 09:16 +0000

csiph-web