4
$\begingroup$

When define the temperature of a variable in Celsius, Mathematica 9.0 does not calculate the right answer when multiplying by boltzmann constant.

Example:

Temperature1 = Quantity[100, "Celsius"];

Temperature2 = Quantity[373.15, "Kelvins"];

Temperature1 * Quantity["BoltzmannConstant"]

Temperature2 * Quantity["BoltzmannConstant"]
Quantity[1.38065*10^-21, "Joules"] <-- WRONG Answer

Quantity[5.15189*10^-21, "Joules"] <-- CORRECT Answer

Mathematica should be able to manage this units conversion, or there is something I'm doing wrong?

$\endgroup$
4
  • $\begingroup$ You can send a bug report to [email protected] ¯\(°_o)/¯ $\endgroup$
    – ssch
    Commented Sep 19, 2013 at 19:33
  • $\begingroup$ What version are you using, I have got different output on V9.010 $\endgroup$
    – Kuba
    Commented Sep 19, 2013 at 19:34
  • $\begingroup$ I have the same version V9.010 $\endgroup$
    – Pedro
    Commented Sep 19, 2013 at 20:07
  • $\begingroup$ For me it doesn't compute, I get Quantity[373.15,Times["BoltzmannConstant","Kelvins"]]. Am I supposed to do something more with this to get it in Joules? $\endgroup$
    – C. E.
    Commented Sep 19, 2013 at 20:13

1 Answer 1

3
$\begingroup$

Ignoring the fact that I don't get the same results using Mathematica 9.0.1.0...

From the tutorial on temperature units:

When working with absolute temperatures, it is imperative to first standardize the units, to allow for proper unit conversions.

In this case it appears that you have to standardise both your temperatures and $k_b$ to obtain the result that you expect, i.e.

UnitConvert[Temperature1, "Kelvins"] UnitConvert[Quantity["BoltzmannConstant"],"Joules"/"Kelvins"]

(* 5.15189*10^-21 J *)
$\endgroup$
5
  • $\begingroup$ Thank you. My bad, I thought that mathematica would handle everything on its own. This is very tricky when having multiple variables and functions with different units. $\endgroup$
    – Pedro
    Commented Sep 20, 2013 at 16:05
  • $\begingroup$ @Pedro - I sympathise, although it is a useful feature in practice it is difficult to use correctly -- especially when absolute temperatures are present. PS An up-vote is usually considered thanks enough! $\endgroup$ Commented Sep 20, 2013 at 16:11
  • $\begingroup$ Ok. I received an answer from Wolfram Technical Support. They are stating that this is a bug and that they are sending and incident report to the developers. $\endgroup$
    – Pedro
    Commented Sep 20, 2013 at 21:48
  • $\begingroup$ This is a better way to see the error: t1 = Quantity[100, "Celsius"]; t2 = Quantity[327.15, "Kelvins"]; kk = Quantity[1, "BoltzmannConstant"]; UnitSimplify[(t1*kk)] UnitSimplify[(t2*kk)] $\endgroup$
    – Pedro
    Commented Sep 24, 2013 at 18:30
  • $\begingroup$ Any updates on this? $\endgroup$
    – Sterling
    Commented Dec 11, 2020 at 2:58

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.