### 57.1 Introduction to ezunits

`ezunits` is a package for working with dimensional quantities, including some functions for dimensional analysis. `ezunits` can carry out arithmetic operations on dimensional quantities and unit conversions. The built-in units include Systeme Internationale (SI) and US customary units, and other units can be declared. See also `physical_constants`, a collection of physical constants.

`load("ezunits")` loads this package. `demo("ezunits")` displays several examples. The convenience function `known_units` returns a list of the built-in and user-declared units, while `display_known_unit_conversions` displays the set of known conversions in an easy-to-read format.

An expression a ` b represents a dimensional quantity, with `a` indicating a nondimensional quantity and `b` indicating the dimensional units. A symbol can be used as a unit without declaring it as such; unit symbols need not have any special properties. The quantity and unit of an expression a ` b can be extracted by the `qty` and `units` functions, respectively.

A symbol may be declared to be a dimensional quantity, with specified quantity or specified units or both.

An expression a ` b `` c converts from unit `b` to unit `c`. `ezunits` has built-in conversions for SI base units, SI derived units, and some non-SI units. Unit conversions not already known to `ezunits` can be declared. The unit conversions known to `ezunits` are specified by the global variable `known_unit_conversions`, which comprises built-in and user-defined conversions. Conversions for products, quotients, and powers of units are derived from the set of known unit conversions.

As Maxima generally prefers exact numbers (integers or rationals) to inexact (float or bigfloat), so `ezunits` preserves exact numbers when they appear in dimensional quantities. All built-in unit conversions are expressed in terms of exact numbers; inexact numbers in declared conversions are coerced to exact.

There is no preferred system for display of units; input units are not converted to other units unless conversion is explicitly indicated. `ezunits` recognizes the prefixes m-, k-, M, and G- (for milli-, kilo-, mega-, and giga-) as applied to SI base units and SI derived units, but such prefixes are applied only when indicated by an explicit conversion.

Arithmetic operations on dimensional quantities are carried out by conventional rules for such operations.

- (x ` a) * (y ` b) is equal to (x * y) ` (a * b).
- (x ` a) + (y ` a) is equal to (x + y) ` a.
- (x ` a)^y is equal to x^y ` a^y when `y` is nondimensional.

`ezunits` does not require that units in a sum have the same dimensions; such terms are not added together, and no error is reported.

`ezunits` includes functions for elementary dimensional analysis, namely the fundamental dimensions and fundamental units of a dimensional quantity, and computation of dimensionless quantities and natural units. The functions for dimensional analysis were adapted from similar functions in another package, written by Barton Willis.

For the purpose of dimensional analysis, a list of fundamental dimensions and an associated list of fundamental units are maintained; by default the fundamental dimensions are length, mass, time, charge, temperature, and quantity, and the fundamental units are the associated SI units, but other fundamental dimensions and units can be declared.

Categories:Physical units ·Share packages ·Package ezunits ·