3
$\begingroup$

(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")]]
$\endgroup$
7
  • $\begingroup$ both in V9 and WolframAlpha, I get a dimensionless number. $\endgroup$
    – lalmei
    Oct 23, 2014 at 11:49
  • $\begingroup$ Yep, you only get units in V10. I should have added this: only in V10. $\endgroup$ Oct 23, 2014 at 11:56
  • $\begingroup$ @MockupDungeon Well, just click the edit link and add it than (you can also add the correct tag). $\endgroup$
    – Ajasja
    Oct 23, 2014 at 11:57
  • $\begingroup$ OK, done, incl. tag. $\endgroup$ Oct 23, 2014 at 12:00
  • $\begingroup$ As a workaround, since you know that the "Grams"/"Grams" should provide a dimensionless value, use QuantityMagnitude. a = ElementData[14, "CrustAbundance"] // QuantityMagnitude; b = ElementData[14, "MeteoriteAbundance"] // QuantityMagnitude; a/b gives 1.9. $\endgroup$
    – Bob Hanlon
    Oct 23, 2014 at 14:28

2 Answers 2

4
$\begingroup$

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.