3

(This applies only to version 10)

I obtain these two properties of silicon:

a = ElementData[14, "CrustAbundance"]
b = ElementData[14, "MeteoriteAbundance"]

both are given in units of g/g. Then I divide these two values

a/b

and get an odd result, which with I cannot further reasonably calculate with or plot.

(Quantity[0.000034, ("Grams")/("Grams")]) Quantity[3.6*10^6, (1/#1 &)[("Grams")/("Grams")]]
m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Mockup Dungeon
  • 1,854
  • 12
  • 16

2 Answers2

4

This is definitely bad behavior in the units code; here's the simpler version:

In[12]:= Power[Quantity[2, "Grams"/"Grams"], -1]
Out[12]= Quantity[1/2, (1/#1 &)[("Grams")/("Grams")]]

I've already sent a report to developers about this, but as an additional work-around you can use UnitSimplify on the results from ElementData to get the simpler(nondimensional) form:

In[17]:= UnitSimplify[ElementData[14, "CrustAbundance"]]
Out[17]= 0.27

and UnitSimplify won't remove quantity expressions if the units still belong:

In[19]:= UnitSimplify[ElementData[14, "VickersHardness"]]
Out[19]= Quantity[9.63*10^3, "Megapascals"]
Nick Lariviere
  • 1,536
  • 13
  • 9
4

In my opinion, units provided by the curated data sets aren't quite ready prime time, and therefore I use this answer to shut them off.

SetSystemOptions[SystemOptions["DataOptions"] /. True -> False]

a = ElementData[14, "CrustAbundance"]
b = ElementData[14, "MeteoriteAbundance"]
a/b
(* 0.27, 0.14, 2 *)
bobthechemist
  • 19,693
  • 4
  • 52
  • 138