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


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

Re: extract only positive solutions

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-02-18 11:31 +0000
Last post2012-02-18 11:31 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#8600 — Re: extract only positive solutions

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-02-18 11:31 +0000
SubjectRe: extract only positive solutions
Message-ID<jho27c$5to$1@smc.vnet.net>
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}?
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web