4
$\begingroup$

In MMA 13.2, if we run

Quantity[1, 1/"DegreesCelsius"]

it automatically throw a message

enter image description here

But if we run

unit = 1/"DegreesCelsius";
Quantity[1, unit]

it gives result without message.

enter image description here

It seems that MMA does not evaluate completely in this case. If we evaluate the output, then it will throw message.

I want to know if there is a function like completeEvaluate, so that completeEvaluate@Quantity[1, unit] will throw a message.

$\endgroup$

1 Answer 1

2
$\begingroup$

I believe that what you are observing is a bug in Quantity. 'Quantity[1, "DegreesCelsius"^(-1)]' is not processed the same way as 'Quantity[1, 1/"DegreesCelsius"]'.

In[50]:= Quantity[1, "DegreesCelsius"^(-1)] // InputForm

Out[50]//InputForm=
Quantity[1, "DegreesCelsius"^(-1)]

In[49]:= Quantity[1, 1/"DegreesCelsius"] // InputForm

During evaluation of In[49]:= Quantity::ctunit: Compound unit given with absolute 1/(DegreesCelsius); converting to Kelvins.

Out[49]//InputForm=
Quantity[5483/20, "Kelvins"^(-1)]
$\endgroup$
3
  • $\begingroup$ Thank you so much for your observation. I think there is chaos in temperature quantity manipulation as described in mathematica.stackexchange.com/q/287389/4742 . Now you add one more example. $\endgroup$
    – matheorem
    Jul 9 at 3:34
  • $\begingroup$ But anyway, this does not solve my problem : ) $\endgroup$
    – matheorem
    Jul 9 at 3:35
  • $\begingroup$ It's really not at all chaotic. The only unfortunate thing is that prior to implementing the *Differrence units Mathematica tried to do something sensible with the input instead of rejecting it as unsafe. While @GlennWelch's answer seems to demonstrate a bug, that's not really the core of your problem. To fix your problem, use the units that are appropriate for the semantics you are trying to formalize. $\endgroup$
    – lericr
    Jul 9 at 15:22

Your Answer

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

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