# Constraining solution's sign with NSolve

I am solving some equations in 4 variables, however, there are many solutions which are basically the same but changing relative signs of each other ... i.e. {x->-1,y->1} and {x->1,y->-1}. Nevertheless I am only interested in solutions with positive values for x and negative values for y. Is there anyway to implement this in NSolve? I was trying to add an additional equation

NSolve[eq1==a&&eq2==b ... &&y<0,{x,y}]


However, this is not working. Is it the wrong way tom implement it?

-
Solve everything and then Select desired solutions? –  BoLe May 24 '13 at 9:38
At this stage that wouldn't be a problem, however later conditions may get more involved and I was wondering whether there would be an automated way to do it ... –  pablo May 24 '13 at 9:43
can you show more of your actual code? For me e.g. this is working: NSolve[(x + y)^2 + (x - y)^2 == 1 && (x + y)^4 + (x - y)^4 == 1 && x > 0 && y > 0, {x, y}] gives only the positive solution wheras NSolve[(x + y)^2 + (x - y)^2 == 1 && (x + y)^4 + (x - y)^4 == 1, {x, y}] gives all four solutions. –  Thies Heidecke May 24 '13 at 9:45
Sorry, the equations are rather long to copy it here and with greek letters, superscript, etc.. so it woudl be a nightmare to copy. Then I guess for some reason, for this equation, implementing this kind of condition takes Mathematica a long time, so I will go with Select in the end I guess Thanks a lot! –  pablo May 24 '13 at 9:47
@pablo You may switch to FindRoot. How would you specify x > 0 then? –  BoLe May 24 '13 at 9:49

solution = With[{n = 10, r := RandomReal[{-1, 1}]},
Table[{x -> r, y -> r, z -> r, w -> r}, {n}]];

Select[solution,
With[{u = Apply[ArcTan, {x, y} /. #]}, -.5 Pi < u < 0] &]


Or:

Cases[solution, {x -> a_ /; a > 0, y -> b_ /; b < 0, __}]

-
This will do the job :) Thanks a lot! –  pablo May 24 '13 at 9:56