MathGroup Archive 2012

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

Search the Archive

Re: extract only positive solutions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125025] Re: extract only positive solutions
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 18 Feb 2012 06:25:59 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201202171123.GAA25395@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 at 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}?
>



  • Prev by Date: Re: Documentation for GridBoxSpacings
  • Next by Date: Re: extract only positive solutions
  • Previous by thread: extract only positive solutions
  • Next by thread: Re: extract only positive solutions