Tuesday, April 01, 2008

Using light units!

One of my favorite programs is the Unix 'units' program. This program can convert from cm to miles for example. The really cool thing about it is that all of the definitions are in a special 'language' and stored in a file called units.dat.

Many years ago I taught units a very cool trick by substituting the value for the speed of light with 1 and changing the length of a second to meters. This creates the awesome ability to quickly change mass to energy and vice-versa.

Currently I use the version of units that comes with CGWIN.

To create a light_units.dat file apply the following changes to a new /usr/share/light_units.dat file.

$ diff -dtw --unified=1 units.dat light_units.dat
--- units.dat 2001-12-13 07:22:13.001000000 -0800
+++ light_units.dat 2004-08-21 18:25:18.965594600 -0700
@@ -291,3 +291,4 @@

-s ! # Duration of 9192631770 periods of the radiation
+#s ! # Duration of 9192631770 periods of the radiation
+s 2.9979246e+08 m
second s # corresponding to the transition between the two hyperfine
@@ -574,2 +575,29 @@
#
+# Information to compare energy usage and generation to energy released
+# from nuclear devices. For giving a rough idea.
+#
+
+ton_e 1e+9 calorie
+ # kilotons as a metric mass measurement
+ # (kilotonnes) of TNT gives a value of
+ # 1000 c/g, well within the reported range,
+ # while treating it as "kilo short tons of
+ # TNT" gives 1102 c/g, at the extreme
+ # upper end of the reported range. Thus a
+ # kiloton can be called a "kilo metric ton
+ # of TNT" and a "kilo short ton of TNT"
+ # with about equal validity.
+ # Should this be Thermochemical Calorie? or IT Calorie?
+#
+# http://www.english.uiuc.edu/maps/poets/g_l/levine/bombing.htm
+#
+hiroshima 12.5 kton_e # 08-06-45, 3600 kg, 9ft 9in, littleboy, u235, 118,661 killed
+nagasaki 22.0 kton_e # 08-09-45, 4050 kg, 11ft 4in, fatman, pu239, 73,884 killed
+littleboy hiroshima
+fatman nagasaki
+
+nova 10^44 J
+#
+
+#
# Dimensions. These are here to help with dimensional analysis and
@@ -691,3 +719,2 @@
#
-
sec s
@@ -885,3 +912,4 @@
pi 3.14159265358979323846
-c 2.99792458e8 m/s # speed of light in vacuum (exact)
+#c 2.99792458e8 m/s # speed of light in vacuum (exact)
+c 1 # The distance of a second is 2.997 meters ergo
light c
@@ -889,3 +917,3 @@
epsilon0 1/mu0 c^2 # permittivity of vacuum (exact)
-energy c^2 # convert mass to energy
+#energy c^2 # convert mass to energy
e 1.602176462e-19 C # electron charge
@@ -1089,2 +1117,3 @@
# NIST publication 811
+ly lightyear
lightsecond c s
@@ -1534,3 +1563,4 @@
earthradius_polar 6356912.0 m
-earthradius_equatorial 6378388.0 m # Could be wrong? 6378136.3 m better?
+#earthradius_equatorial 6378388.0 m # Could be wrong? 6378136.3 m better?
+earthradius_equatorial 6378136.3 m
landarea 148.847e6 km^2
@@ -1557,3 +1587,4 @@
venusradius 6.3 Mm
-marsradius 3.43 Mm
+#marsradius 3.43 Mm
+marsradius 3397.2 km
jupiterradius 72 Mm
@@ -1664,3 +1695,3 @@
# extended.
-nauticalmile 1852 m # Supposed to be one minute of latitude at
+#nauticalmile 1852 m # Supposed to be one minute of latitude at
# the equator. That value is about 1855 m.
@@ -1671,2 +1702,3 @@
# 1954. The UK switched in 1970.
+nauticalmile 2 earthradius_equatorial pi / 21600

No comments: