How to make Solve[] yield only real positive values?

I know there may be duplicates, But I have not found any question with a concrete answer for the case I am treating.

If I have a determinant:

Det[f[x]]==0


And I want to solve it for x:

Solve[Det[f[x]]==0,x]


In general, there may be real negative roots, and also imaginary roots.

Question: How can I make Mathematica give me only the real and positive roots of the solution?

Attemp: I tried using Assumptions but it seems to only work for assuming constants under derivatives. Also I tried with:

Refine[Solve[Det[f[x]]==0,x],x>0]


but it doesn't work either.

E.g.

f[x_] := {{2 + x, x^2}, {1 + x, x^3 - 2}}
Det[f[x]]


-4 - 2 x - x^2 + x^3 + x^4

All roots are

NSolve[Det[f[x]] == 0, x]


{{x -> -1.70528}, {x -> -0.422555 - 1.15516 I}, {x -> -0.422555 + 1.15516 I}, {x -> 1.55039}}

Real and positive:

NSolve[Det[f[x]] == 0 && x > 0, x]


{{x -> 1.55039}}

• Solve[Det[f[x]] == 0 && x > 0, x] works as well, though it gives the answer as a root object. take N[ ] to find the numerical value. – bill s Oct 18 '16 at 14:24
• Thank you, that worked for me. The other question I have is if I can do that but given some constat $a$ for example. How can Mathematica know that I am defining a positive real value? I tried using Refine[], but I don't know if I am applying it right because it doesn't seem to work for me. – Saavestro Oct 18 '16 at 21:27
• What I am trying to say is: given a solution {{x->a},{x->-a}}, discard the negative value of x. – Saavestro Oct 18 '16 at 21:32
• That is a different issue. See, e.g., here. – corey979 Oct 18 '16 at 21:43