Re: Solve problem
- To: mathgroup at smc.vnet.net
- Subject: [mg98036] Re: Solve problem
- From: "m.g." <mg at michaelgamer.de>
- Date: Sat, 28 Mar 2009 05:44:47 -0500 (EST)
- References: <gqia5h$oj3$1@smc.vnet.net>
On 27 Mrz., 11:35, araldocampan... at gmail.com wrote: > I have a Solve[...] which gives me solutions like > {{b1 -> -2, a1 -> -1 }, {b1 -> 0.5, a1 -> 3}} > or like > {{a1 -> 1, b1 -> 3}} > > How can I get the positive value for a1, which is 3 > in the first case and 1 in the second one? > > Bruno Hello Bruno, maybe you think of the following: A system of equations - yust as it came in my mind :-) In[42]:= gls={2 x+3 y==2,7 x-5 y^2==3} Out[42]= {2 x+3 y==2,7 x-5 y^2==3} the solution In[43]:= lsg=Solve[gls,{x,y}] // N Out[43]= {{x->0.506033,y->0.329311}, {x->4.64397,y->-2.42931}} extracting values In[45]:= temp={x,y} /. lsg Out[45]= {{0.506033,0.329311},{4.64397,-2.42931}} Selecting positive solution: In[49]:= Select[temp,#[[2]]>0&] Out[49]= {{0.506033,0.329311}} Greetings Mike