# Untitled Document

## Introduction to the Dimensional Analysis Package

This document describes a new dimensional analysis package for Maxima. There is an older Maxima package for dimensional analysis that is similar to the one that was shipped with the commercial Macsyma system. The software described in this document differs greatly from the older package.

The new dimensional analysis code was written by Barton Willis of the University of Nebraska at Kearney. The complete distribution contains source code, texinfo documentation, a file for testing (in standard Maxima "rtest" form), and a TeX file that provides additional documentation and examples of how to use the package. You may download the distribution from www.unk.edu/acad/math/people/willisb and you may contact the author at willisb@unk.edu.

To use the dimensional analysis package, you must first load the file dimension.mac. Provided this file has been installed in a directory that Maxima can find, load it with the command

    (C1) load("dimension.mac")$

Alternatively, you can compile dimension.mac with the command

    (C1) compile_file("dimension.mac")$

After it has been compiled, load it with

    (C2) load("dimension.o")$

The compiled code runs about thirty percent faster than the interpreted code.

Use qput to define the dimension of a variable; thus to define x to be a length, t a time, and c a speed, use

    (C1) qput(x,"length",dimension)$
    (C2) qput(t,"time",dimension)$
    (C3) qput(c,"length"/"time",dimension)$

To find the dimension of an expression, use the dimension function. For example,

    (C4) dimension(c*t/5);
    (D4) 				    length
    (C5) dimension(c-x/t);
    				    length
    (D5) 				    ------
    				     time

When an expression is dimensionally inconsistent, dimension should signal an error

    (C6) dimension(c-x);

    Expression is dimensionally inconsistent.

Any symbol may be used to represent a dimension; if you like, you can use "L" instead of "length" for the length dimension. It isn't necessary to use strings for the dimensions; however, doing so reduces the chance of conflicting with other variables. Thus to use the dimensions "M","L", and "T", for mass, length, and time, respectively, use the commands

    (C1) qput(x,"L",dimension)$
    (C2) qput(t,"T",dimension)$
    (C3) qput(c,"L"/"T",dimension)$
    (C4) qput(m,"M",dimension)$

Then

    (C4) dimension(m * 'diff(x,t));
    				      L M
    (D4) 				      ---
    				       T

An equation is dimensionally consistent if either one side of the equality vanishes or if both sides have the same dimensions. Thus

    (C5) dimension(x=c*t);

    (D5) 				       L
    (C6) dimension(x=0);

    (D6) 				       L
    (C7) dimension(x=c);

    Expression is dimensionally inconsistent.

The dimension function supports most Maxima operators and it automatically maps over lists. For example,

    (C1) dimension([x^3,x.t,x/t,x^^2]);
    				 3	 L   2
    (D1) 			       [L , L T, -, L ]
    					 T

The dimension of a subscripted symbol is the dimension of the non-subscripted variable. For example,

    (C1) dimension(x[3]);
    (D1) 				       L

When the dimensions of a symbol are undefined, dimension returns an unevaluated expression

    (C2) dimension(z);
    (D2) 				 dimension(z)

The remaining functions in the package, dimensionless, dimension_as_list, and natural_unit require that all expressions have dimensions that are members of the list fundamental_dimensions. The default value of this list is

    (C1) fundamental_dimensions;

    (D1) 			     [mass, length, time]

A user may redefine this list; to use "M", "L", and "T" for the fundamental dimensions, make the assignment

    (C2) fundamental_dimensions : ["M", "L", "T"]$

The list fundamental_dimensions must be nonempty, but it can have any finite cardinality.

To find the dimensions of an expression as a list of the exponents of the fundamental dimensions, use the dimension_as_list function

    (C3) dimension_as_list('diff(x,t,3));

    (D3) 				  [0, 1, - 3]

Thus the dimension of the third derivative of x with respect to t is L / T^3.

To find the dimensionless expressions that can be formed as a product of elements of a list of atoms, use the dimensionless function. For example,

    (C1) dimensionless([c,t,x]);

    Dependent equations eliminated:  (1)
    				     x
    (D1) 				   [---, 1]
    				    c t

Finally, to find quantities that have a given dimension, use the natural_unit function. To find an expression with dimension time, use the command

    (C1) natural_unit("T",[x,c]);

    Dependent equations eliminated:  (1)
    				       x
    (D1) 				      [-]
    				       c

## Definitions for Dimensional Analysis

Variable: FUNDAMENTAL_DIMENSIONS
  FUNDAMENTAL_DIMENSIONS is a list of the fundamental dimensions. The default value is ["mass", "length", "time"]; however, a user may redefine it to be any nonempty list of atoms. The function dimension doesn't use this list, but the other functions in the dimensional analysis package do use it.

Function: DIMENSION (e)
  Return the dimension of the expression e. If e is dimensionally inconsistent, signal an error. The dimensions of the symbols in the expression e should be first defined using qput.

Function: DIMENSION_AS_LIST (e)
  Return the dimension of the expression e as a list of the exponents of the dimensions in the list fundamental_dimensions. If e is dimensionally inconsistent, signal an error.

Function: DIMENSIONLESS ([e1,e2,...,en])

  Return a basis for the dimensionless quantities that can be formed as a product of powers of the expressions e1, e2, ..., en.

Function: NATURAL_UNIT (q, [e1,e2,...,en])

  Return a basis for the quantities that can be formed as a product of powers of the expressions e1, e2, ..., en that have the same dimension as does q.

This document was generated on 7 April 2002 using the texi2html translator version 1.51a.