31
$\begingroup$

Alright, let's have some fun here. I am essentially following the documentation by Wolfram, just looking at different quantities.

N[UnitConvert[Quantity["earth's gravity"]]]

9.80665m/(s)^2

Hmm, alright, fine, that's what's called the standard value for the constant g, sanctified by international convention, so I guess that's about as good as it gets.

UnitConvert[
 Quantity[WolframAlpha["earth's gravity", "MathematicaResult"]]]

9.81456m/(s)^2

Hmm, fascinating. It's close, but not the same. Anybody know what the heck that's supposed to be? Is this perhaps the gravitational acceleration at the location of the query? That would be kind of nifty... Any way at all to find out?

But wait, there's more:

N[UnitConvert[Quantity["speed of sound"]]]

343.2m/s

Cool. Turns out that this happens to be (a somewhat decent approximation of) the speed of sound in air at standard conditions, but how in the world could anyone know that? The issue in this case is that "speed of sound" is woefully under-determined. I did not specify the material I was asking about, let alone pressure and temperature. The good news is, if we ask via Wolfram Alpha, we get the same answer.

O.k., so how about this one:

N[UnitConvert[
  Quantity[WolframAlpha["speed of sound in water", 
    "MathematicaResult"]]]]

1482.3846m/s

Well, alright, we specified what we wanted more accurately, and we did get a somewhat useful result. We're not sure under what conditions this speed of sound obtains, but, hey, we're confident that there's some conditions under which the speed of sound in water has that value. Of course, not knowing what those conditions are makes an 8-digit result somewhat pointless, but let's not be too picky here.

O.k., let's try this now:

N[UnitConvert[Quantity["speed of sound in water"]]]

85487.31kg/(s)^3

Come again? What on earth is this supposed to be? Anyone know?

So, the real question here is, is there any way to make such queries as the above reliable? Is there a way to find out where exactly those numbers are coming from, and what it is they describe?

$\endgroup$
  • $\begingroup$ Ah, that is extremely helpful, thanks! However, I have used ThermodynamicData before, and the numbers are similar but not identical. They must be coming from different databases, and if that is the case the source should be available (=cited). $\endgroup$ – Pirx Aug 24 '16 at 22:21
  • 1
    $\begingroup$ P.S.: However, if I do Quantity["speed of sound carbon dioxide"], all I get is the number, with no explanation. $\endgroup$ – Pirx Aug 24 '16 at 22:26
  • $\begingroup$ FWIW 9.80665 is the "exact" value for "standard gravity" en.wikipedia.org/wiki/Standard_gravity $\endgroup$ – george2079 Aug 25 '16 at 15:45
  • $\begingroup$ Yep, that's what I said in my post. $\endgroup$ – Pirx Aug 25 '16 at 16:20
  • 3
    $\begingroup$ It's almost like natural language is a terrible way to communicate with a computer! $\endgroup$ – Daniel McLaury Aug 25 '16 at 20:08
30
$\begingroup$

Extended comment about the speed of sound and the speed of sound in water.


Speed of sound

N[UnitConvert[Quantity["speed of sound"]]]
343.2m/s

Turns out that this happens to be (a somewhat decent approximation of) the speed of sound in air at standard conditions, but how in the world could anyone know that?

Quantity[1, "speed of sound"] displays in the front-end the information about the temperature and pressure conditions:

Quantity[1, "speed of sound"]

enter image description here

By applying UnitConvert on this expression, the unit "SpeedOfSound" is converted to SI base units, which removes this information.

Speed of sound in water

N[UnitConvert[Quantity["speed of sound in water"]]]
85487.31kg/(s)^3

What is this supposed to be?

The string "speed of sound in water" is not a KnownUnitQ so, as above for "speed of sound", it is interpreted by Quantity. WolframAlpha interprets the query as intended, while Quantity interprets the string unit as

QuantityUnit@ Quantity["speed of sound in water"]
(* "InchesOfWaterColumn" "SpeedOfSound" *)

This explains the result obtained by OP when applying UnitConvert:

N@ UnitConvert[Quantity["speed of sound in water"]]
(* Quantity[85487.3, ("Kilograms")/("Seconds")^3] *)

% === N@ UnitConvert[Quantity["SpeedOfSound" * "InchesOfWaterColumn"]]
(* True *)

Here are two possible workarounds:

1) The substring "in" could be removed to avoid it being interpreted as "Inch":

Quantity["speed of sound water"]
(* Quantity[1482.35, ("Meters")/("Seconds")] *)

The result is given directly in Meters/Seconds (so we do not have the information about the pressure and temperature conditions), because there is no unit representing "speed of sound water". (Recall that we had the unit "SpeedOfSound" for the speed of sound in the air.)

2) The string could be typed within the Ctrl+= box and one could browse among the possible interpretations. We recover here the interpretations of Quantity and WolframAlpha:

enter image description here

This last image also tells us what are the temperature and pressure conditions that yielded the above value.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Speaking of physical data, I also looked into the StandardAtmosphere package, and I think this really should be flagged as obsolete and deprecated. It produces output that has units attached to them that are incompatible with the current Units system in Mathematica. For example, after loading the StandardAtmosphere package, KineticTemperature[5000 Meter] produces 255.676 Kelvin, but this cannot be processed by things like Magnitude or UnitConvert. Pressure[5000 Meter] gives a result of 540.48 Bar Milli, which is again not compatible with the Units system. $\endgroup$ – Pirx Aug 25 '16 at 1:08
  • $\begingroup$ Yes, there are a few banners missing for some packages in guide/StandardExtraPackages. $\endgroup$ – user31159 Aug 25 '16 at 1:23
  • $\begingroup$ Is there a replacement for StandardAtmosphere? $\endgroup$ – Pirx Aug 25 '16 at 1:43
  • $\begingroup$ Yes, there is StandardAtmosphereData. AirPressureData and friends can also be useful. $\endgroup$ – user31159 Aug 25 '16 at 1:46
  • 1
    $\begingroup$ I would recommend evaluating ?*Data to see what computable data are available. Usually groups of them are gathered in common guide pages, like for instance "guide/PhysicsAndChemistryDataAndComputation" for ChemicalData, ThermodynamicData and ParticleData (and others). $\endgroup$ – user31159 Aug 25 '16 at 2:08
11
$\begingroup$

A bit too long for a comment...

My best guess is that WolframAlpha["earth's gravity", "MathematicaResult"] is simply rounding to too few digits. It returns 32.2 ft/s^2, which seems pretty round for what it represents.

Now maybe that's ok to do because gravity varies around the globe:

data = GeogravityModelData[{{-90, -180.}, {90, 180.}}, "Magnitude", GeoZoomLevel -> -2];

MinMax[data]

enter image description here

But it does seem odd that different queries give slightly different answers here...

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Yes, those differing numbers are quite odd. I poked around a bit using Wolfram Alpha, and the value of the gravitational constant produced by the Wolfram Alpha within Mathematica doesn't match the results produced directly in Wolfram Alpha, and roughly corresponds to the gravitational acceleration somewhere near Calgary in Canada (or a corresponding latitude either in the northern or the southern hemisphere). $\endgroup$ – Pirx Aug 25 '16 at 1:01
  • $\begingroup$ @Pirx Does the value you obtain is the same as GeogravityModelData[Here, "Magnitude"]? $\endgroup$ – user31159 Aug 25 '16 at 1:04
  • $\begingroup$ @Xavier: No, that one comes out as 9.8024442m/(s)^2 $\endgroup$ – Pirx Aug 25 '16 at 1:11

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.