Re: Getting Delayed rules from NSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg14305] Re: [mg14220] Getting Delayed rules from NSolve
• From: Jurgen Tischer <jtischer at col2.telecom.com.co>
• Date: Tue, 13 Oct 1998 01:21:20 -0400
• References: <199810070700.DAA13673@smc.vnet.net.>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi Dennis,

In[1]:= ru = {{RP2 -> -7.265190176252972*^-7,
RP1 -> 2.360865132070388*^-6},
{RP2 -> 0.00001024210507399882,
RP1 -> 5.269714033120727*^-7},
{RP2 -> 3.733028325153595*^-7,
RP1 -> 2.232745757286505*^-7}}

Out[1]=
{{RP2 -> -7.265190176252972*^-7,
RP1 -> 2.360865132070388*^-6},
{RP2 -> 0.00001024210507399882,
RP1 -> 5.269714033120727*^-7},
{RP2 -> 3.733028325153595*^-7,
RP1 -> 2.232745757286505*^-7}}

In[2]:= {RP1, RP2} /.
Cases[ru, {_ -> a_, _ -> b_} /;  a > 0 && b > 0 && a + b < 10^(-6)]

Out[2]= {{2.232745757286505*^-7, 3.733028325153595*^-7}}

Jurgen

Dennis Benjamin wrote:

> Hi All:
>
>         I am using NSolve to get numerical solutions from a setof simultaneous
> equations. The problem I am facing is extracting the physically
> reasonable solution from the supplied list of rules. For Example,
>
> In[199]:=
> Chop[NSolve[ Elim, {RP1,RP2}] /. P2t ->5 10^-6 ]
>
> Out[199]=
> {{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
> ->). Any ideas how to do this? Alternatively, a different approach to
> getting the pair of numbers
>
> 3.73302832515359561`*^-7
> 2.23274575728650503`*^-7
>
> from the above list of rules.
>
> Thanks!
>
> Dennis Benjami

```

• Prev by Date: Re: graphing implicit function
• Next by Date: Math3.0/Win98: SaveSelectionAs->Metafile clips the image?
• Previous by thread: Getting Delayed rules from NSolve
• Next by thread: RE: Getting Delayed rules from NSolve