Computing with Units

Version 1.88.J04


1. Overview

Units is a program for computations on values expressed in terms of different measurement units. It is an advanced calculator that takes care of the units. You can try it here:

Suppose you want to compute the mass, in stones, of water that fills to the depth of 7 inches a rectangular area 5 yards by 4 feet 3 inches. You recall from somewhere that 1 liter of water has the mass of 1 kilogram. To obtain the answer, you multiply the water's volume by its specific mass. Enter this after You have above:

5 yards * (4 feet + 3 in) * 7 in * 1 kg/liter

then enter stones after You want and hit the Enter key or press the Compute button. The following will appear in the result area:

5 yards * (4 feet + 3 in) * 7 in * 1 kg/liter = 165.82427 stones

You did not have to bother about conversions between yards, feet, inches, liters, kilograms, and stones. The program did it all for you behind the scenes.

Units supports complicated expressions and a number of mathematical functions, as well as units defined by linear, nonlinear, and piecewise-linear functions. See user's manual for detailed specifications.

Units has an extensive data base that, besides units from different domains, cultures, and periods, contains many constants of nature, such as:

pi          ratio of circumference to diameter
c           speed of light
e           charge on an electron
h           Planck's constant
force       acceleration of gravity

As an example of using these constants, suppose you want to find the wavelength, in meters, of a 144 MHz radio wave. It is obtained by dividing the speed of light by the frequency. The speed of light is 186282.39 miles/sec. But, you do not need to know this exact number. Just press Clear and enter this after You have:

c / 144 MHz

Enter m after You want and hit the Enter key. You will get this result:

c /144MHz = 2.0818921 m

Other examples of computations:

Feet and inches to metric: 6 ft + 4 in = 193.04 cm
Fahrenheit to Celsius:     tempF(97) = tempC(36.111111)
Baking:                    2 cups flour_sifted = 226.79619 g
Electron flow:             5 mA = 3.1207548e16 e/sec
Energy of a photon:        h * c / 5896 angstrom = 2.1028526 eV
Mass to energy:            1 g * c^2 = 21.480764 kilotons tnt
Weight as force:           5 force pounds = 22.241108 newton

(The unit pound is a unit of mass. To get force, you multiply it by force, which is a name for standard gravity acceleration. Note that g, customarily used for that constant, is already taken as the standard abbreviation for the gram).

You can explore the units data base with the help of the four buttons under You have field. By entering any string in You have field and pressing the Search button, you obtain a list of all unit names that contain that string as a substring. For example, if you enter year at You have and press Search, you get a list of about 25 different kinds of year, including marsyear and julianyear.

Pressing Definition displays this in the result area:

year = tropicalyear = 365.242198781 day = 31556926 s,

which tells you that year is defined as equal to tropicalyear, which is equal to 365.242198781 days or 31556926 seconds.

If you now enter tropicalyear at You have and press the Source button, you open a browser on the unit data base at the place containing the definition of tropicalyear. You find there a long comment explaining that unit. You may then freely browse the data base to find other units and facts about them.

Pressing Conformable units will give you a list of all units for measuring the same property as tropicalyear, namely the length of a time interval. The list contains over 80 units.

Instead of the applet shown above, you can use Units as a stand-alone application. As it is written in Java, you can use it under any operating system that supports Java Runtime Environment (JRE) release 1.5.0 or later. To install Units on your computer, download the Java archive (JAR) file that contains the executable Java classes. Save the JAR file in any directory, under any name of your choice, with extension .jar. If your system has an association of .jar files with javaw command (which is usually set up when you install JRE), just double-click on the JAR file icon. If this does not work, you can type

java -jar jarfile

at the command prompt, where jarfile is the name you gave to the JAR file. Each way should open the graphic interface of Units, similar to one at the beginning of this page.

With Units installed on your computer, you can use it interactively from command line, or invoke it from scripts. It imitates then almost exactly the behavior of GNU Units from which it has evolved. See user's manual for details.

You also have a possibility to modify the file that contains unit definitions, or add your own definitions in separate file(s). (The applet can only use its own built-in file.)

The complete package containing the JAR and the Java source can be downloaded as a gzipped tar file from the SourceForge project page.


License

The program is a Java development of GNU Units 1.88, a program written in C by Adrian Mariano (adrian@cam.cornell.edu). The file units.dat containing the units data base was created by Adrian Mariano, and is maintained by him. The package contains the latest version obtained from GNU Units repository.

GNU Units copyright © 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by Free Software Foundation, Inc. Java version copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by Roman Redziejowski.

The program is free software: you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Latest change 2011-04-04