0
$\begingroup$

I'm trying to get the R+ Solutions to a school problem with solve. Everything works fine with Dom -> Reals but when I try Dom -> PositiveReals it throws no solutions even if they exists.

(* Data *)

epsilon = 0.3;
Tinf = Quantity[295.15, "Kelvins"];
Q = Quantity[5000, "Watts"/"Meters"^2];
h = Quantity[10, "Watts"/("Meters"^2*"Kelvins")];
sigma = Quantity[5*10^-8, "Watts"/("Meters"^2*"Kelvins"^4)];

(* Equations *)

Qconv[T_] := h (T - Tinf)
Qrad[T_] := sigma*epsilon*(T^4 - Tinf^4)
Solve[Q == Qconv[T] + Qrad[T], T, Reals]

Executing this code throws

{{T -> Quantity[-1055.54, "Kelvins"]}, {T -> Quantity[605.245, "Kelvins"]}}

But when I limit the solution to R+

Input: Solve[Q == Qconv[T] + Qrad[T], T, PositiveReals]
Ouput: {}

Why is this happening ? How do I fix this "error" ?

Edit

As explained in comments Element[Quantity[#, "Kelvins"], PositiveReals] never returns True.

Is there a way to Take the QuantityMagnitude[] for Domain comparation ?

$\endgroup$
3
  • 1
    $\begingroup$ Element[Quantity[605.2454186793566`, "Kelvins"], PositiveReals] does not return True. It's somewhat ambiguous to look at signs of quantities: if Quantity[20, "DegreesFahrenheit"] is positive, is it's corresponding value in Celsius positive too? $\endgroup$
    – Greg Hurst
    Oct 11, 2021 at 23:17
  • $\begingroup$ Thanks. I thought because Kelvin is an absolute scale it doesn't have those problems but it seems actually it has them. But can we take the QuantityMagnitud at certain Unit (ex. Celsius, Kelvin, Fahrenheit)? $\endgroup$ Oct 11, 2021 at 23:24
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Oct 11, 2021 at 23:25

1 Answer 1

1
$\begingroup$

I can recommend you to add the restriction $T>0$ into the Solve parameters, for instance:

epsilon = 0.3;
Tinf = Quantity[295.15, "Kelvins"];
Q = Quantity[5000, "Watts"/"Meters"^2];
h = Quantity[10, "Watts"/("Meters"^2*"Kelvins")];
sigma = Quantity[5*10^-8, "Watts"/("Meters"^2*"Kelvins"^4)];

(*Equations*)

Qconv[T_] := h (T - Tinf)
Qrad[T_] := sigma*epsilon*(T^4 - Tinf^4)
Solve[{Q == Qconv[T] + Qrad[T], T > 0}, T, Reals]

In this way the solver finds this particular positive real solution only.

$\endgroup$
1
  • $\begingroup$ +1 The inequality should contain a Quantity, i.e., Solve[{Q == Qconv[T] + Qrad[T], T > Quantity[0, "Kelvins"]}, T]. It works with just 0 but if you used any other threshold, it wouldn't work without the Quantity $\endgroup$
    – Bob Hanlon
    Oct 12, 2021 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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