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?
UnitConvert[Quantity[25, "DegreesCelsius"], "Kelvin"]I get298.15 K. If it wasn't able to differentiate between absolute and non-absolute wouldn't I just get 25 K? – sgdsgyhetwaraw Jan 28 '19 at 18:07bugstag to this question. – march Jan 28 '19 at 18:23T = UnitConvert[Quantity[25, "DegreesCelsius"], "Kelvin"];). All equations from physics assume that quantities are in Kelvins. – Roman Jan 28 '19 at 21:33UnitConvert[]gives an erroneous result. – Alex Trounev Jan 29 '19 at 00:46UnitConvertandTimesare non-commutative operations for quantities with units of temperature, which is exactly why many people are suggesting toUnitConvertfirst. Otherwise, an expression involving products ofQuantitys inside aUnitConvertneeds to be scanned first to convert the temperature quantities before converting units. And what do you do if you multiply all of the quantities first, save it to a variable, and thenUnitConvert? There's no way to get that right. – march Jan 30 '19 at 00:03UnitConvertit had better correctly convert units. WRI simply mis-implemented this function. If it has to scan the expression to work properly then it has to scan the expression to work properly. It's good to know why this bug happens, but this is still a bug. Sure the correct way might be slower, but that's where you use heuristics andOptionsto allow people to speed it up rather than leaving gotchas and bugs for users to fall into – b3m2a1 Jan 30 '19 at 02:26