"Strong typing vs. strong testing"

Rob Warnock rpw3 at rpw3.org
Tue Sep 28 19:52:11 EDT 2010


EXECUTIVE SUMMARY:
 1 inch + 1 second = ~4.03e38 grams.
GORY DETAILS:
Tim Bradshaw <tfb at tfeb.org> wrote:
+---------------
| Malcolm McLean said:
| > he problem is that if you allow expressions rather than terms then
| > the experssions can get arbitrarily complex. sqrt(1 inch + 1 Second),
| > for instance.
|| I can't imagine a context where 1 inch + 1 second would not be an 
| error, so this is a slightly odd example. Indeed I think that in 
| dimensional analysis summing (or comparing) things with different 
| dimensions is always an error.
+---------------
Unless you convert them to equivalent units first. For example, in
relativistic or cosmological physics, one often uses a units basis
wherein (almost) everything is scaled to "1":
 http://en.wikipedia.org/wiki/Natural_units
When you set c = 1, then:
 Einstein's equation E = mc2 can be rewritten in Planck units as E = m.
 This equation means "The rest-energy of a particle, measured in Planck
 units of energy, equals the rest-mass of a particle, measured in
 Planck units of mass."
See also:
 http://en.wikipedia.org/wiki/Planck_units
 ...
 The constants that Planck units, by definition, normalize to 1 are the:
 * Gravitational constant, G;
 * Reduced Planck constant, h-bar; [h/(2*pi)]
 * Speed of light in a vacuum, c;
 * Coulomb constant, 1/(4*pi*epsilon_0) (sometimes k_e or k);
 * Boltzmann's constant, k_B (sometimes k).
This sometimes leads people to do things that would appear sloppy
or even flat-out wrong in MKS or CGS units, such as expressing mass
in terms of length:
 Consider the equation A=1e10 in Planck units. If A represents a
 length, then the equation means A=1.6e-25 meters. If A represents
 a mass, then the equation means A=220 kilograms. ...
 In fact, natural units are especially useful when this ambiguity
 is *deliberate*: For example, in special relativity space and time
 are so closely related that it can be useful to not specify whether
 a variable represents a distance or a time.
So it is that we find that the mass of the Sun is 1.48 km or 4.93 us, see:
 http://en.wikipedia.org/wiki/Solar_mass#Related_units
In this limited sense, then, one could convert both 1 inch and 1 second
to masses[1], and *then* add them, hence:
 1 inch + 1 second = ~4.03e38 grams.
;-} ;-}
-Rob
[1] 1 inch is "only" ~3.41e28 g, whereas 1 second is ~4.03e38 g,
 so the latter completely dominates in the sum.
-----
Rob Warnock			<rpw3 at rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /