Re: subsidiary conditions in Solve?
- To: mathgroup at smc.vnet.net
- Subject: [mg17349] Re: [mg17324] subsidiary conditions in Solve?
- From: BobHanlon at aol.com
- Date: Mon, 3 May 1999 01:45:53 -0400
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 5/1/99 5:29:03 AM, sandra at rgmiller.Stanford.EDU writes: >I'm trying to solve simultaneous equations, and I'd like to include some >subsidiary conditions which place restrictions on quantities (like the >variance) to be positive. Examples of these conditions are: > > 2 2 >E (M) > (E(M)) > >and > 2 >sigma > 0 > M > >Here's a simple example -- in this case, I'd like to rule out the solution >x=-3. I'm following p. 825, "3.4.9 Solving Equations with Subsidiary >Conditions" of the 1999 Mathematica Book. > >In[92]:= subsid1 = Greater[x,0] > >Out[92]= x > 0 > >In[93]:= Solve[x^2 + x - 6 == 0, subsid1] > >General::ivar: x > 0 is not a valid variable. > > 2 >Out[93]= Solve[-6 + x + x == 0, x > 0] > > >What am I doing wrong? > The subsidiary conditions given in section 3.4.9 are themselves equations (equalities) not inequalities. Here are some alternatives for inequaliities. Select[Solve[x^2 + x - 6 == 0, x], (x /. #)>0&] {{x -> 2}} Cases[Solve[x^2 + x - 6 == 0, x], x_?((x /. #)>0&)] {{x -> 2}} Cases[Solve[x^2 + x - 6 == 0, x], x_?(Positive[x /. #]&)] {{x -> 2}} Needs["Algebra`InequalitySolve`"] InequalitySolve[x^2 + x - 6 == 0 && x > 0, x] x == 2 Bob Hanlon