# Why does using different units but same physical value give different result?

I'm trying to define a variable with the value of the thermal constant $$V_T$$. The value of the thermal constant is given in Volts as $$V_T = \frac{k T}{q}$$, where $$k$$ is the Boltzmann constant and $$q$$ is the charge on an electron.

Why am I getting different results from the following two inputs:

k = Quantity["BoltzmannConstant"];
q = Quantity["ElementaryCharge"];
T = UnitConvert[Quantity[25, "DegreesCelsius"], "Kelvin"];
Subscript[v, t] = UnitConvert[(k T)/q, "Volts"]


Which is returning the expected value of Quantity[0.0256926, "Volts"].

k = Quantity["BoltzmannConstant"];
q = Quantity["ElementaryCharge"];
T = Quantity[25, "DegreesCelsius"];
Subscript[v, t] = UnitConvert[(k T)/q, "Volts"]


Which is returning the unexpected value of Quantity[0.590610, "Volts"].

The only difference between the two is that in the first one I convert the from Celsius to Kelvin; however, the inherent physical value is not changing. So when I convert to Volts, shouldn't I get the same result from both inputs?

• @march I might not be understanding what you are saying correctly, but it seems that Mathematica does know the difference between an absolute and non-absolute unit, because when I do UnitConvert[Quantity[25, "DegreesCelsius"], "Kelvin"] I get 298.15 K. If it wasn't able to differentiate between absolute and non-absolute wouldn't I just get 25 K? – w1res Jan 28 '19 at 18:07
• Hmm. I take back my comment! When I run your code on my own copy of Mathematica, I get the same result for both. Try quitting the kernel and trying again. If it still give you the wrong answer, then perhaps this is a bug. What version are you using? – march Jan 28 '19 at 18:10
• @march I just tried again and I'm still getting the different answers. I even tried restarting my computer and nothing changed. I'm on Mathematica 11.3. I will submit a support ticket and see what they say. Thanks for testing it. – w1res Jan 28 '19 at 18:21
• Never use Celsius when doing physics, it only leads to trouble. Physical units cannot deal with offsets, and the conversion between temperature units is a kludge: the system has to guess somehow whether you mean an absolute temperature (take offset into account) or a temperature difference (don't take offset into account). – Roman Jan 28 '19 at 19:33
• I would also check this out: reference.wolfram.com/language/tutorial/TemperatureUnits.html – chuy Jan 28 '19 at 21:25

Correct Temperature Conversion Code

k = Quantity["BoltzmannConstant"];
q = Quantity["ElementaryCharge"];
T1 = UnitConvert[Quantity[25, "DegreesCelsius"], "Kelvins"];
Subscript[v, t] = UnitConvert[k T1/q, "SI"]

(*Quantity[2.56926, "Centivolts"]*)

• Can you say exactly how the OP is using UnitConvert incorrectly? – Jason B. Jan 29 '19 at 14:43
• @JasonB. I showed how to use correctly. And how to use incorrectly showed OP. He did not specify in which unit system the conversion is performed. See tutorials: UnitConvert[quantity, targetunit] attempts to convert the specified quantity to the specified targetunit. A targetunit specification can also be one of the following unit systems: "SIBase", "SI", "Imperial", or "Metric". When using heterogeneous units, it is necessary to specify the unit system. – Alex Trounev Jan 29 '19 at 15:08
• You showed that both you and OP are using documented syntax for UnitConvert, and you claim that yours is correct while his is incorrect. So where on the documentation page for UnitConvert does it say that you must use a unit system rather than a target unit when using heterogeneous units? – Jason B. Jan 29 '19 at 17:06
• See Scope UnitConvert[{Quantity[3., "Feet"], Quantity[8., "Inches"], Quantity[3., "Pounds"], Quantity[8., "Ounces"]}, "SI"] – Alex Trounev Jan 29 '19 at 17:32
• There is something weird going on, because 2.15 mV is the incorrect value. The correct value is 25.7 mV. So both your methods agree with eachother, but they return the wrong value. Also, according to the link you posted, the default for the second parameter on UnitConvert is SIBase, so I wouldn't expect it to make a difference whether it is implied through the defaults or explicitly added. – w1res Jan 31 '19 at 16:19

I contacted support and they said they were "able to reproduce the issue." It seems like this is unintended behavior and will be fixed.