Quantcast
Channel: Active questions tagged units - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 41

Getting Molecular Weight for Stoichiometry Calculations

$
0
0

I love the units system in Mathematica, it's an extremely useful addition to the language. Unfortunately there are still some sharp corners that I run into on a daily basis. For example, if I want to do a stoichiometry calculation, I would like to be able to do the following:

Vol = Quantity[300,"Microliters"]Concentration = Quantity[2,"Millimolar"]CdMW = ChemicalData["CadmiumOxide","MolecularWeight"]mgCd = UnitConvert[Concentration*Vol*CdMW,"Milligrams"]

But this does not work, because "MolecularWeight" reports units of AtomicMassUnit, which Mathematica indicates is incompatible with "Grams"/"Moles", even though in practice (at least for stoichiometry calculations) they are effectively the same.

I have a workaround using the following code:

CdMW = Quantity[QuantityMagnitude[ChemicalData["CadmiumOxide","MolecularWeight]],"Grams"/"Moles"]

But I find this to be quite inelegant, and somewhat less than readable.

Is this the best way to do this, or is there a better approach?


Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>