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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
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 Sat, 12 Apr 2014 09:16:33 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <lib09h$i6p$1@smc.vnet.net> (permalink)
References <20140411061009.8DE2B6A30@smc.vnet.net>
Lines 33
Organization Time-Warner Telecom
NNTP-Posting-Date 12 Apr 2014 09:22:33 GMT
NNTP-Posting-Host 75864d0a.news.twtelecom.net
X-Trace DXC=E7Qa;48kTgGk^S9D<aY5lLC_A=>8kQj6M;[h;PUXBgbD27hNd_eWRHDEFiONJ7[GoFX;IUlKN9\4F
X-Complaints-To abuse@twtelecom.net
X-Original-Bytes 1593
X-Received-Bytes 1697
X-Received-Body-CRC 1111265290
Xref csiph.com comp.soft-sys.math.mathematica:16786

Show key headers only | 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