2
$\begingroup$

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.

$\endgroup$
1
  • 4
    $\begingroup$ Try UnitConvert@Quantity["MolarGasConstant"] $\endgroup$
    – Carl Woll
    Nov 9, 2017 at 23:45

2 Answers 2

2
$\begingroup$

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

enter image description here

But to answer your direct question:

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"]
$\endgroup$
1
$\begingroup$

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")]
$\endgroup$

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.