Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using a Quantity with the unit of "DegreesCelsius" multiplication doesn't work as expected. If you have 10 degrees and multiply it by 2 you get 20 degrees instead of the expected 293,15 degrees. This becomes a real problem if you use the temperature directly in a formula, eg. the ideal gas law. Example code:

t = Quantity[10, "DegreesCelsius"];
T = UnitConvert@t;
UnitConvert[2 * t] // N (* => 293.15 K *)
2 * T // N (* => 566.3 K *)

Is there a way to fix this behaviour to work as I expect it to?

share|improve this question
What you are getting is correct. The operations you are doing are not orderless -- order matters. – m_goldberg Feb 20 '14 at 1:50
How does UnitConvert know I didn't want the increment and return 20K? – george2079 Feb 20 '14 at 2:59
@george2079 UnitConvert in this case behaves like f[x_]:=x+273.15 so the two problems look like f[2*10] = 20 + 273.15 = 293.15 and 2*f[10] = 2(10 + 273.15) = 566.3. – bobthechemist Feb 20 '14 at 3:41
From my point of view, there is no meaning in "double the temperature". – Jason Feb 20 '14 at 7:33

Most quantity conversions convert between quantities that have a common zero point (e.g., 0 Kg and 0 Lb are same) and these will work as the OP desires. For temperatures and other quantities where the zero points differ (e.g., 0 °K and 0 °C are not the same), one must be more careful.

I suggest the following workflow.

  1. Convert all temperature readings to one system.
  2. Do all computations in that uniform system.
  3. Back convert any results if necessary.
share|improve this answer
Related topic on Physics.SE – Kuba Feb 20 '14 at 12:50
I hope the new FormulaData takes this into account – Rojo Mar 2 '14 at 23:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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