# Getting physical units of MolarGasConstant

I want to be able to get the MKS units and value of the molar gas constant $R$. If I enter Quantity["MolarGasConstant"], Mathematica returns $1R$, which is quite useless for my purposes. I can easily look up the information elsewhere. What I want Mathematica to tell me is that $R=8.31\; \text{J}/(\text{mol}\cdot K)$. Assume that I don't remember the specifics of this constant, such as its units.

I used to be able to get this kind of information from Mathematica.

• Try UnitConvert@Quantity["MolarGasConstant"] Nov 9, 2017 at 23:45

These days a great place to start is Wolfram|Alpha:

UnitConvert@Quantity["MolarGasConstant"]

Then convert the output to SI or Metric units:

UnitConvert[
Quantity[8.31446, ("Kilograms" ("Meters")^2)/(
"Kelvins" "Moles" ("Seconds")^2)], "SI"]

UnitConvert[
Quantity[8.31446, ("Kilograms" ("Meters")^2)/(
"Kelvins" "Moles" ("Seconds")^2)], "Metric"]

As Carl notes, you can express the gas constant in terms of base SI units with

r = UnitConvert[Quantity[1, "MolarGasConstant"]]
Quantity[8.31446, ("Kilograms"*"Meters"^2)/("Kelvins"*"Moles"*"Seconds"^2)]

and then use QuantityMagnitude[] to extract the number, or QuantityUnit[] to extract the unit:

{QuantityMagnitude[r], QuantityUnit[r]}
{8.31446, ("Kilograms"*"Meters"^2)/("Kelvins"*"Moles"*"Seconds"^2)}

To check that the resulting unit is compatible with $\rm{J}/(\rm{mol}\cdot\rm{K})$, you can have UnitDimensions[] perform the decomposition into base quantities along with the associated exponents:

UnitDimensions["Joules"/("Moles" "Kelvins")]
{{"AmountUnit", -1}, {"LengthUnit", 2}, {"MassUnit", 1},
{"TemperatureUnit", -1}, {"TimeUnit", -2}}

UnitDimensions[("Kilograms"*"Meters"^2)/("Kelvins"*"Moles"*"Seconds"^2)]
{{"AmountUnit", -1}, {"LengthUnit", 2}, {"MassUnit", 1},
{"TemperatureUnit", -1}, {"TimeUnit", -2}}

or just attempt to perform a conversion with UnitConvert[], which also yields the conversion factor in the process:

UnitConvert[("Kilograms"*"Meters"^2)/("Kelvins"*"Moles"*"Seconds"^2),
"Joules"/("Moles" "Kelvins")]
Quantity[1, "Joules"/("Kelvins"*"Moles")]