using units in Maxima?



> --- Barton Willis <willisb at unk.edu> wrote:

> > > In his example, done in Mathcad, he includes units with 
> > > his value assignments and calculations.  It it possible to do such
> > > a thing in Maxima?  If so, how?  Thanks.
> > >
> > >-Ron Crummett
> >
> >Maybe something simple will work for you:
> >
> >(%i1) l : 6.23 * 'feet$
> >(%i2) w : 5.89 * 'feet$
> >(%i3) area = l * w;
> >(%o3) area=36.694699999999997*feet^2
> >(%i4) subst(feet = mile / 5280,%);
> >(%o4) area=1.3162412477043157*10^-6*mile^2

> Definitely the simplest option.

Further tip on units -
I found sublis (substitution in parallel into an expression) useful for unit
conversion
An example from chemistry for converting arsenic or beryllium
concentrations:

(%i27)
sublis(['ugAs='umolAs/75,'ugBe='umolBe/9,'dL='L/10],200*'ugAs/'dL),numer;
(%o27) (26.666666666666668*umolAs)/L

(%i32)
sublis(['ugAs='umolAs/75,'ugBe='umolBe/9,'dL='L/10],200*'ugBe/'dL),numer;
(%o32) (222.2222222222222*umolBe)/L

The conversion factors can be wrapped into a list 
 with a meaningful name (if you know SI is a system of units);
(%i28) toSI:['ugAs='umolAs/75,'ugBe='umolBe/9,'dL='L/10];
(%o28) [ugAs=umolAs/75,ugBe=umolBe/9,dL=L/10]

(%i29) sublis(toSI,200*'ugAs/'dL),numer;
(%o29) (26.666666666666668*umolAs)/L

(%i30) sublis(toSI,2000*'ugAs/'L),numer;
(%o30) (26.666666666666668*umolAs)/L


Nigel