I am trying to solve an equation by assuming that all the variables are real and strictly positive. I can use the keyword Reals for the argument dom in the Solve function Solve[expr,vars,dom]. Is there an equivalent for strictly positive Reals? Something like PosReals


There's a misunderstanding here. The third "dom" argument is not simply a set over which we solve the equation. There are only a few choices that can be used for the domain argument, and they have very specific effects on how Solve works. An example from the documentation:

If dom is Reals, or a subset such as Integers or Rationals, then all constants and function values are also restricted to be real.

So you can't use e.g.

Solve[x^2 == 1, x, Interval[{0, Infinity}]]

The proper way to do this, as @belisarius said, is to append the constraint to the system of equations:

Solve[x^2 == 1 && x > 0, x]

In version 10 we can also do

Solve[x^2 == 1 && x ∈ Interval[{0, Infinity}], x]

or even

Solve[x^2 == 1, x ∈ Interval[{0, Infinity}]]
  • $\begingroup$ That totally makes sense now +1. Thanks a lot! $\endgroup$ – Remi.b Mar 27 '15 at 0:45

New in Mathematica 12 is PositiveReals (and others like NonNegativeIntegers, etc):

Solve[x^2 == 1, x, PositiveReals]

{{x -> 1}}

{Solve [ x^2 == 1, {x}], Solve [ x^2 == 1 && x > 0, {x}]}
(* {{{x -> -1}, {x -> 1}}, {{x -> 1}}}*)

If you are dealing with multiple variables, I suggest you to use Assumptions under function Refine, like below

Refine[Reduce[{52*n^2 + 19*n*nb - 42*n*nf > 0, 52*n^2 - 61*n*nb - 42*n*nf > 0}, {n, nb, nf}], Assumptions -> n > 0 && nb > 0 && nf > 0]

This feature can be used for most type operations. For reference, please see Assumptions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.