Message Boards Message Boards


Keep only positive and real solutions from Solve?

Posted 3 years ago
4 Replies
2 Total Likes

Hi people,

I have a problem where I get four solutions to an equation system. Two imaginary, one negative and one positive. Can I somehow automatically tell Mathematica to only keep the real and positive answer?

Sort of:

Solve[equation1==equation2, x]//Real//Positive

Thanks! //Freddy, Sweden

4 Replies

It would be useful to have a complete self-contained example. Anyway, could try equation1==equation2 && x>0 as first argument to Solve.


Solve[equation1==equation2&& x > 0, x, Reals] 


 Solve[{equation1==equation2, x > 0}, x, Reals] 


Thanks a bunch, people! =D

Posted 5 months ago

Hi everybody, I have the same question, but I have hundreds of variables in my system of equations.

In my large system of equations including numerous variables, I use the following structure:

      eq3==eq4&& ....]

and I do not specify any variable, so the solver tries to solve the system for all the variables.

Now the question is instead of this format:

      eq3==eq4&& ....&&, x1>0,x2>0,..., Reals] 

How can I ask the solver to return a non-zero positive solution for all the variables? Thanks

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract