Fourmilab Home Page

Computation with
Physical Units

 

Attached is a description of a potential patent application on computation with physical units. The applicability of such a patent could be quite broad within the CAD and engineering computation fields overall. I started working on this invention in 1967 and just completed a working prototype within the Eagle Project in July of this year. This technology will be embodied in AutoCAD Release 11 and its attached solid modeling facilities.

Background

Existing digital computers, including the firmware and software associated with them, perform computation on pure, or dimensionless numbers. When computers are used to model physical and engineering phenomena, the dimensions of the quantities involved (length, mass, time, temperature, etc.) are neither stored by the computer, involved in the process of calculation, nor checked for validity in arithmetic operations (although it is an error, for example, to add a quantity representing time to one representing mass).

Consequently, the burden of maintaining the dimensions associated with values stored in the computer falls upon the programmer. This requires extensive manual bookkeeping and is prone to error. In addition, since the units of measurement used within a program are not known to the computer, converting a program designed for one system of units (for example, English units such as inches and pounds) to another (perhaps the metric units of meters and kilograms), is a complicated, tedious, and error-prone process of reprogramming.

The Invention

The invention is a means of encoding all the units used in physics and engineering in a compact and efficiently-processed form, and extending to the architecture of computers to generalise digital computation from dimensionless pure numbers to operations involving physical units. The invention can be realised in computer hardware, in microcode (firmware), or in software: the usual trade-offs among cost, performance, and security in these various realisations apply to this invention.

Dimensioned data storage

Existing digital computers store computational data in registers or memory as pure numbers. A datum, however stored, is represented as a numeric item:

Value

where Value is an integer or floating-point quantity stored in the computer's standard representation.

This invention extends the computer's representation of each datum to include the exponents of a set of fundamental dimensioned quantities which, together, suffice to represent the dimensions of all physical measurements. In addition, the invention specifies standard units for all numeric Value fields, defined in terms of the fundamental definitions. The storage representing a computational item in a system embodying the invention may be represented as:

Value d1 d2 dn

where the dn fields contain the exponents of the fundamental units in which the computer operates, and the Value field is in terms of the units so-defined.

If the computing system has been defined to operate using the International System of Measurement (S.I.), [Any complete and internally consistent system of units can be used with this invention; the choice of the system of units does not affect any of the claims for it.] the dimension exponent quantities would be defined as follows:

Exponent Quantity Unit
d1 Length Metre
d2 Mass Kilogram
d3 Time Second
d4 Electric current Ampere
d5 Temperature Kelvin
d6 Luminous intensity Candela

A quantity which represented length, for example 1 millimetre, would be stored as:

0.001 1 0 0 0 0 0

The value of this datum is given by the product of its Value field and the powers of the fundamental units given by the dimension fields:

0.001 × Metre1 Kilogram0 Second0 Kelvin0 Candela0

hence:

0.001 × Metre

which is one millimetre.

Now let's consider a quantity with dimensions of time, such as one minute. It would be stored as:

60 0 0 1 0 0 0

or:

60 × Metre0 Kilogram0 Second1 Kelvin0 Candela0

and hence:

60 × Second

As long as the underlying system of units is complete, any physical unit can be represented in this form. A unit of force, dynes, would be stored as:

0.00001 1 1 −2 0 0 0

or:

0.00001 × Metre1 Kilogram1 Second−2 Kelvin0 Candela0

and hence:

0.00001 × Metre1 Kilogram1 Second−2

Dimensionless (or “pure”) numbers, such as scale factors, angular measurements, and the dimensionless constants of physics are stored with zeroes in all the dimension fields. A computer incorporating this invention can run existing programs not involving physical units by representing all numbers in old programs as dimensionless numbers; while this enables old software to be used without modification, doing so foregoes the benefits of the invention.

Dimensional Arithmetic

The fundamental arithmetic operations performed by digital computers can be extended to operate on the dimensional quantities described by this invention. The operations of addition and subtraction first verify equality of all dimension exponents of the operands; inequality indicates an invalid operation and should raise an exception identifying the error. If the exponents agree, the Value fields are added or subtracted and the result is stored with the same dimensions as the operands.

The multiplication operation multiplies the Value fields of its operands, and stores the sum of the operand exponent fields in the result.

The division operation divides the Value field of the first operand by the Value field of the second and sets the dimension exponent fields of the result by subtracting the exponents of the second operand from those of the first.

Dimensional Conversion

All dimensionally compatible units are interconvertible. This invention describes a computing system that operates in a standard internal system of physical units. It can operate on quantities in any system of measurement by converting them to its internal units.

This conversion is mediated by a “Unit Definition Datum”. This object defines the relationship between an arbitrary unit and the internal representation in terms of its dimensions and a linear equation that converts internal values (those on which the computer operates) to external values (in any dimensionally compatible units). A unit definition is an object of the form:

Factor Bias d1 d2 dn

An external unit in this system of measurement is converted into a computational quantity by multiplying it by the Factor, adding the Bias, and setting its dimensions to those of the internal unit. If X is the quantity in external units, its Value field in internal units is given by:

Value = X × Factor + Bias

All the dimension fields of the computational quantity are set to those of the unit definition.

To convert an internal computational unit to an external unit, dimensional compatibility is verified by checking that the dimension fields of the computational unit are identical to those of the unit definition, then the value in external units is computed as:

Value − Bias
X   =  
Factor

For example, a computer based on the S.I. units as described above would define the “inch” unit with the unit definition datum:

0.0254 0 1 0 0 0 0 0

Since zero inches equals zero metres, the Bias field in this unit definition is zero. Bias permits definition of units in which the zero point in one system differs from that in another. For example, an S.I.-based computer would define degrees Fahrenheit as:

0.55556 255.3722 0 0 0 0 1 0

To convert an external measurement, say 32° Fahrenheit, into a computational quantity with a value field in degrees Kelvin, the computation would be:

Value = X × Factor + Bias
Value = X × 0.55556 + 255.3722
Value = 32 × 0.55556 + 255.3722
Value = 273.15

This Value field thus stores the temperature in degrees Kelvin corresponding to the external Fahrenheit measurement. Conversion of an internal temperature to an external Fahrenheit measurement would proceed as follows. Let's assume the internal temperature was the boiling point of water:

Then the conversion using the Fahrenheit unit definition would be:

X = (Value − Bias)/Factor
X = (Value − 255.3722)/0.55556
X = (373.15 − 255.3722)/0.55556
X = 212

Dimension Definitions

This invention improves computer systems by adding computation involving physical units to the operations performed by the computer, and by providing for automated conversion of the computer's native system of units to any system of units. The invention also includes the facility to store, associated with the computer system, a collection of physical units defined as described by the invention, and a means, using the dimensional arithmetic defined by the invention, to compose the basic units into expressions of arbitrary complexity to represent all physical units.

Claims