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}?
>
- References:
- extract only positive solutions
- From: Gabby Domingo <gbdomingo@gmail.com>
- extract only positive solutions