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


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

Re: extract only positive solutions

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: extract only positive solutions
Date 2012-02-18 11:31 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jho27c$5to$1@smc.vnet.net> (permalink)
References <201202171123.GAA25395@smc.vnet.net>

Show all headers | View raw


sol = {{-.532, .932}, {.34, 23}};

Select[sol, And @@ Positive[#] &]

{{0.34, 23}}

Cases[sol, _?(And @@ Positive[#] &)]

{{0.34, 23}}

Cases[sol, {_?Positive ..}]

{{0.34, 23}}

DeleteCases[sol, {___, _?NonPositive, ___}]

{{0.34, 23}}

DeleteCases[sol, _?(Or @@ NonPositive[#] &)]

{{0.34, 23}}


Bob Hanlon


On Fri, Feb 17, 2012 at 6:23 AM, Gabby Domingo <gbdomingo@gmail.com> wrote:
> hi all! how do you extract only positive solutions to a solver, like
> NSolve?
>
> sol={{-.532,.932},{.34,23}}
>
> and extract {.34,.23}?
>

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


Thread

Re: extract only positive solutions Bob Hanlon <hanlonr357@gmail.com> - 2012-02-18 11:31 +0000

csiph-web