4

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.

matheorem
  • 17,132
  • 8
  • 45
  • 115

1 Answers1

2

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)]

Glenn Welch
  • 186
  • 6
  • Thank you so much for your observation. I think there is chaos in temperature quantity manipulation as described in https://mathematica.stackexchange.com/q/287389/4742 . Now you add one more example. – matheorem Jul 09 '23 at 03:34
  • But anyway, this does not solve my problem : ) – matheorem Jul 09 '23 at 03:35
  • 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. – lericr Jul 09 '23 at 15:22