unit package has reached loadable state (woo hoo!)
Subject: unit package has reached loadable state (woo hoo!)
From: C Y
Date: Sun, 24 Apr 2005 20:59:58 -0700 (PDT)
The unit.mac package in the contrib directory has now (finally) reached
the point where it can be loaded. (I.e. I finally switched from my
ft.mac test file to the real deal.) It's not terribly impressive yet,
but it can do a few neat tricks with derived units. This session shows
roughly where things are right now. If anybody wants to fill in more
unit definitions... :-).
Todo:
convert(expr,[myunits]) type function
temperature (ick)
going back over various discussions and picking up stray feature ideas
Several more ambitious ideas I'm not ready to work on yet.
Also, I wanted to thank everybody, particularly Robert and most
especially Barton. Unit.mac would still be nothing but a mess of
unworkable code without their help.
CY
Maxima 5.9.1.1cvs http://maxima.sourceforge.net
Using Lisp SBCL 0.8.20
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1) load("./newunits.mac");
*******************************************************************
* Units version 0.10 *
* Definitions based on the NIST Reference on *
* Constants, Units, and Uncertainty *
* Conversion factors from various sources including *
* NIST and the GNU units package *
*******************************************************************
Initializing unit arrays...
Done.
(%o1) ./newunits.mac
(%i2) dontusequantity(%frequency);
(%o2)/R/ [%frequency]
(%i3) setunits([m, kg, s, N, Pa, J, W]);
(%o3) done
(%i4) inches;
`rat' replaced 0.0254 by 127//5000 = 0.0254
127 m
(%o4)/R/ -----
5000
(%i5) millimeters;
m
(%o5)/R/ ----
1000
(%i6) grams;
kg
(%o6)/R/ ----
1000
(%i7) centigrams;
kg
(%o7)/R/ ------
100000
(%i8) s;
(%o8) s
(%i9) minutes;
s
(%o9)/R/ --
60
(%i10) N;
(%o10)/R/ N
(%i11) dyn;
N
(%o11)/R/ ------
100000
(%i12) Pa;
(%o12)/R/ Pa
(%i13) torr;
`rat' replaced 133.32239 by 44663//335 = 133.3223880597015
44663 Pa
(%o13)/R/ --------
335
(%i14) J;
(%o14)/R/ J
(%i15) eV;
`rat' replaced 1.6021765e-19 by 1//6241509596477042688 = 1.6021765e-19
J
(%o15)/R/ -------------------
6241509596477042688
(%i16) kg/(m*s^2);
(%o16)/R/ Pa
(%i17) kg*m/s^2;
(%o17)/R/ N
(%i18) kg*m^2/s^2;
(%o18)/R/ J
(%i19) kg*m^2/s^3;
(%o19)/R/ W
(%i20) kg*m^2/s^4;
W
(%o20)/R/ -
s
(%i21) kg^2*m^3/s^5;
(%o21)/R/ N W
(%i22) setunits([cm, grains, minutes, dyne, torr, electron_volt]);
(%o22) done
(%i23) inches;
`rat' replaced 0.0254 by 127//5000 = 0.0254
127 cm
(%o23)/R/ ------
50
(%i24) millimeters;
cm
(%o24)/R/ --
10
(%i25) grams;
`rat' replaced 15.43235835294143 by 16883//1094 = 15.43235831809872
16883 gr
(%o25)/R/ --------
1094000
(%i26) centigrams;
`rat' replaced 15.43235835294143 by 16883//1094 = 15.43235831809872
16883 gr
(%o26)/R/ ---------
109400000
(%i27) s;
(%o27) 60 %min
(%i28) minutes;
(%o28)/R/ %min
(%i29) N;
(%o29)/R/ 100000 dyn
(%i30) dyn;
(%o30)/R/ dyn
(%i31) Pa;
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
335 torr
(%o31)/R/ --------
44663
(%i32) torr;
`rat' replaced 133.32239 by 44663//335 = 133.3223880597015
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
(%o32)/R/ torr
(%i33)
J;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o33)/R/ 6241509596477042688 eV
(%i34) eV;
`rat' replaced 1.6021765e-19 by 1//6241509596477042688 = 1.6021765e-19
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o34)/R/ eV
(%i35) kg/(m*s^2);
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
335 torr
(%o35)/R/ --------
44663
(%i36) kg*m/s^2;
(%o36)/R/ 100000 dyn
(%i37) kg*m^2/s^2;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o37)/R/ 6241509596477042688 eV
(%i38) setunits([N]);
(%o38) done
(%i39) N;
(%o39)/R/ N
(%i40) dyn;
N
(%o40)/R/ ------
100000
(%i41) Pa;
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
335 torr
(%o41)/R/ --------
44663
(%i42) torr;
`rat' replaced 133.32239 by 44663//335 = 133.3223880597015
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
(%o42)/R/ torr
(%i43) J;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o43)/R/ 6241509596477042688 eV
(%i44) eV;
`rat' replaced 1.6021765e-19 by 1//6241509596477042688 = 1.6021765e-19
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o44)/R/ eV
(%i45) kg/(m*s^2);
kg*m/s^2;
`rat' replaced .0075006156130264 by 335//44663 = .0075006157221861
335 torr
(%o45)/R/ --------
44663
(%i46) (%o46)/R/ N
(%i47) kg*m^2/s^2;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o47)/R/ 6241509596477042688 eV
(%i48) kg^2*m^3/s^5;
(%o48)/R/ N W
(%i49) kg^2*m^3/s^4;
`rat' replaced 15.43235835294143 by 16883//1094 = 15.43235831809872
84415 cm gr W
(%o49)/R/ -------------
3282 %min
(%i50) kg^2*m^4/s^5;
`rat' replaced 6.24150959647704e+18 by 6241509596477042688//1 =
6.24150959647704
e+18
(%o50)/R/ 6241509596477042688 eV W
(%i51) showabbr(watt);
(%o51) W
(%i52) showfullname(N);
(%o52) [%Newton, Newtons]
(%i53) showfullname(m);
(%o53) [meter, meters]
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com