Message Boards Message Boards

1 Reply
2 Total Likes
View groups...
Share this post:

Unit Cancelation Problem ~ Why does the syntax matter?

Posted 11 years ago
 In[1]:= Quantity["AvogadroConstant"]
         Quantity["AvogadroConstant"] Quantity["Mole"]
         Quantity["AvogadroConstant"] Quantity["Mole"]/Quantity["Liter"]
         Quantity["AvogadroConstant"] (Quantity["Mole"]/Quantity["Liter"])
         Quantity["AvogadroConstant"] Quantity["Mole/Liter"]
        (Quantity["AvogadroConstant"] Quantity["Mole"])/Quantity["Liter"]
 Out[1]= 1 Avogadro constants
 Out[2]= 1 mol
Out[3]= 6.022141 x 10^23
Out[4]= 1 mol Avogadro constants / L
Out[5]= 1 mol Avogadro constants / L
Out[6]= 1 mol Avogadro constants / L
Out[7]= 6.022141 x 10^23 / L
My question is why doesn't the output from the 4th, 5th, & 6th lines match the 7th line, specifically regarding units.  Avogadro constants and moles clearly cancel when multiplied as in line three.   Why isn't Mathematica canceling these units in the 4th, 5th, and 6th input lines?

This is a simplified example of this problem, as I am trying to perform some more complicated calculations and the units are giving me this difficulty in not canceling when multiplying Molarity and Avogadro's Constant as in input line 6. 
POSTED BY: Nathan Burrows
Posted 11 years ago
Use UnitConvert to simplify. In some involved units it is customary to retain the individual unit parts even if they are of the same dimension. In this way you can decide for yourself what you want to collapse and what not.
POSTED BY: Peter Fleck
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract