Maxima Function
setunits (list)
By default, the unit package does not use any derived dimensions, but will convert all units to the seven fundamental dimensions using MKS units.
(%i2) N; kg m (%o2) ---- 2 s (%i3) dyn; 1 kg m (%o3) (------) (----) 100000 2 s (%i4) g; 1 (%o4) (----) (kg) 1000 (%i5) centigram*inch/minutes^2; 127 kg m (%o5) (-------------) (----) 1800000000000 2 s
In some cases this is the desired behavior. If the user wishes to use other
units, this is achieved with the setunits
command:
(%i6) setunits([centigram,inch,minute]); (%o6) done (%i7) N; 1800000000000 %in cg (%o7) (-------------) (------) 127 2 %min (%i8) dyn; 18000000 %in cg (%o8) (--------) (------) 127 2 %min (%i9) g; (%o9) (100) (cg) (%i10) centigram*inch/minutes^2; %in cg (%o10) ------ 2 %min
The setting of units is quite flexible. For example, if we want to get back to kilograms, meters, and seconds as defaults for those dimensions we can do:
(%i11) setunits([kg,m,s]); (%o11) done (%i12) centigram*inch/minutes^2; 127 kg m (%o12) (-------------) (----) 1800000000000 2 s
Derived units are also handled by this command:
(%i17) setunits(N); (%o17) done (%i18) N; (%o18) N (%i19) dyn; 1 (%o19) (------) (N) 100000 (%i20) kg*m/s^2; (%o20) N (%i21) centigram*inch/minutes^2; 127 (%o21) (-------------) (N) 1800000000000
Notice that the unit package recognized the non MKS combination of mass, length, and inverse time squared as a force, and converted it to Newtons. This is how Maxima works in general. If, for example, we prefer dyne to Newtons, we simply do the following:
(%i22) setunits(dyn); (%o22) done (%i23) kg*m/s^2; (%o23) (100000) (dyn) (%i24) centigram*inch/minutes^2; 127 (%o24) (--------) (dyn) 18000000
To discontinue simplifying to any force, we use the uforget command:
(%i26) uforget(dyn); (%o26) false (%i27) kg*m/s^2; kg m (%o27) ---- 2 s (%i28) centigram*inch/minutes^2; 127 kg m (%o28) (-------------) (----) 1800000000000 2 s
This would have worked equally well with uforget(N)
or
uforget(%force)
.