Next: Functions and Variables for Units, Previous: unit, Up: unit [Contents][Index]

### 93.1 Introduction to Units

The unit package enables the user to convert between arbitrary units and work with dimensions in equations. The functioning of this package is radically different from the original Maxima units package - whereas the original was a basic list of definitions, this package uses rulesets to allow the user to chose, on a per dimension basis, what unit final answers should be rendered in. It will separate units instead of intermixing them in the display, allowing the user to readily identify the units associated with a particular answer. It will allow a user to simplify an expression to its fundamental Base Units, as well as providing fine control over simplifying to derived units. Dimensional analysis is possible, and a variety of tools are available to manage conversion and simplification options. In addition to customizable automatic conversion, units also provides a traditional manual conversion option.

Note - when unit conversions are inexact Maxima will make approximations resulting in fractions. This is a consequence of the techniques used to simplify units. The messages warning of this type of substitution are disabled by default in the case of units (normally they are on) since this situation occurs frequently and the warnings clutter the output. (The existing state of ratprint is restored after unit conversions, so user changes to that setting will be preserved otherwise.) If the user needs this information for units, they can set unitverbose:on to reactivate the printing of warnings from the unit conversion process.

unit is included in Maxima in the share/contrib/unit directory. It obeys normal Maxima package loading conventions:

    (%i1) load("unit")$
    *******************************************************************
    *                       Units version 0.50                        *
    *          Definitions based on the NIST Reference on             *
    *              Constants, Units, and Uncertainty                  *
    *       Conversion factors from various sources including         *
    *                   NIST and the GNU units package                *
    *******************************************************************

    Redefining necessary functions...
    WARNING: DEFUN/DEFMACRO: redefining function TOPLEVEL-MACSYMA-EVAL ...
    WARNING: DEFUN/DEFMACRO: redefining function MSETCHK ...
    WARNING: DEFUN/DEFMACRO: redefining function KILL1 ...
    WARNING: DEFUN/DEFMACRO: redefining function NFORMAT ...
    Initializing unit arrays...
    Done.

The WARNING messages are expected and not a cause for concern - they indicate the unit package is redefining functions already defined in Maxima proper. This is necessary in order to properly handle units. The user should be aware that if other changes have been made to these functions by other packages those changes will be overwritten by this loading process.

The unit.mac file also loads a lisp file unit-functions.lisp which contains the lisp functions needed for the package.

Clifford Yapp is the primary author. He has received valuable assistance from Barton Willis of the University of Nebraska at Kearney (UNK), Robert Dodier, and other intrepid folk of the Maxima mailing list.

There are probably lots of bugs. Let me know. `float` and `numer` don’t do what is expected.

TODO : dimension functionality, handling of temperature, showabbr and friends. Show examples with addition of quantities containing units.

Categories: Physical units · Share packages · Package unit ·

Next: Functions and Variables for Units, Previous: unit, Up: unit [Contents][Index]