       RE: Getting Delayed rules from NSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg14247] RE: [mg14220] Getting Delayed rules from NSolve
• From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
• Date: Mon, 12 Oct 1998 13:51:32 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Dennis Benjami wrote:
____________________
I am using NSolve to get numerical solutions from a set of simultaneous
equations. The problem I am facing is extracting the physically
reasonable solution from the supplied list of rules. For Example,

In:=
Chop[NSolve[ Elim, {RP1,RP2}] /. P2t ->5 10^-6 ]

Out=
{{RP2 -> -7.26519017625297269`*^-7,RP1 -> 2.36086513207038839`*^-6},
{RP2 -> 0.0000102421050739988284`,RP1 -> 5.26971403312072794`*^-7},
{RP2 -> 3.73302832515359561`*^-7, RP1 -> 2.23274575728650503`*^-7}}

Only the third set is reasonable, given that RP1 and RP2 > 0 and RP1
+RP2 < 1 10^-6.

I would like to use Replace with a /; condition to select a  particular
value. However, I can only use /; with delayed Rules (:> instead of
->).
___________________

I don't know why your attempt didn't work because you didn't indicate
what the code was.  However, the code below should work.  First suppose
'soln' is you set of solutions.

soln={{RP2 -> -7.26519017625297269`*^-7,RP1 ->
2.36086513207038839`*^-6},
{RP2 -> 0.0000102421050739988284`,RP1 -> 5.26971403312072794`*^-7},
{RP2 -> 3.73302832515359561`*^-7, RP1 -> 2.23274575728650503`*^-7}};

Cases[soln,{_->a_,_->b_}/;(a>0&&b>0&&a+b<10^-6)]

Cheers,
Ted Ersek

```

• Prev by Date: (q) motifps
• Next by Date: RE: How to control the default plot size?
• Previous by thread: Re: Getting Delayed rules from NSolve
• Next by thread: Re: Getting Delayed rules from NSolve