[Maxima] units.mac temperature conversion

Robert Dodier robert.dodier at gmail.com
Mon Nov 26 10:37:25 CST 2007


Edward,

You might consider this other units package, ezunits.
http://maxima.cvs.sourceforge.net/maxima/maxima/share/contrib/ezunits/
I've just committed some changes, which will appear in the 5.14.0
release, or you can get the ezunits.mac from cvs.

Ezunits is a rather simple-minded units package.
Units are indicated by a backtick ` character, e.g. 100 ` m.
Units need not be declared or set up before using them; a unit
is anything which appears on the rhs of the backtick.
It doesn't attempt to convert units automatically, you can request
that units be converted, e.g. 100 ` m ` ft converts m to ft.
It doesn't try to disallow some conversions; maybe that should be
optional.

A few examples.

load (ezunits);
11 ` sheep + 6 ` sheep;
 => 17 ` sheep
(7 ` sheep)^3;
 => 343 ` sheep^3
17 ` sheep + 19 ` goats;
 => 19 ` goats + 17 ` sheep
17 ` sheep + 19 ` goats, sheep=100 * US\$, goats=50 * US\$;
 => 2650 ` US$

/* Stefan-Boltzmann constant */
56697/10000/10^8 ` W/m^2/K^4 ` Btu/h/ft^2/R^4;
 => 18899/10619175641040 ` Btu/h/ft^2/R^4

... and converting Fahrenheit to Celsius:

-40 ` degF ` degC;
 => (- 40) ` degC
0 ` degC ` degF;
 => 32 ` degF
212 ` degF ` degC;
 => 100 ` degC

Sorry, there isn't any documentation yet, although rtestezunits.mac
has many examples. Still in progress so I'll be interested to hear
any comments.

HTH

Robert Dodier


More information about the Maxima mailing list