Data functions (like ElementData) and physical units
- To: mathgroup at smc.vnet.net
- Subject: [mg83022] Data functions (like ElementData) and physical units
- From: John Jowett <John.M.Jowett at gmail.com>
- Date: Wed, 7 Nov 2007 06:55:21 -0500 (EST)
The new data functions (like ElementData, ParticleData, ...) in
Mathematica Version 6 are tremendously useful.
However one aspect of their design seems unfortunate to me. That is
the way the units of physical quantities are given. For example,
ParticleData["Muon", "Mass", "Units"] evaluates to
ElementData["Iron", "ThermalExpansion", "Units"]
In my opinion, it's a great pity that this was not integrated with the
Units and PhysicalConstants packages which provides symbols (rather
than strings) for units. The two evaluations given above could have
Mega ElectronVolt SpeedOfLight^-2
and one would immediately be able to simplify expressions without
worrying about units, convert to other systems etc.
A solution to this would be to recursively parse the unit strings and
convert them to expressions of this kind. I think this could be done,
roughly as follows:
Strings of the form "aPerB" would have to be converted to fractions
(as far as I have seen, "Per" or "Reciprocal" occur at most
The strings would then be split at uppercase letters (except where
substrings like SpeedOfLight coincide with names of constants...).
Then one has to to capitalize the "p" and remove the plural "s" when
splitting "Megapascals" into (Mega Pascal) ...
This would open up the possibility of having a function that returned
physical quantities with their units attached:
rather than the present
and would greatly reduce the chances making wrong calculations like
AstronomicalData["Sun", "Mass"]/ParticleData["Muon", "Mass"]
which most people would expect to be a dimensionless ratio.
Has anyone already written the code required to do this ? Does
anyone from Wolfram want to comment on this design decision ?
Prev by Date:
Re: Crash with simple plot command
Next by Date:
Matrix multiplication speed up
Previous by thread:
FW: Problem with Manipulate. Problem Solved.
Next by thread:
Re: Data functions (like ElementData) and physical units