Maxima Function
convert (expr, list)
When resetting the global environment is overkill, there is the convert
command, which allows one time conversions. It can accept either a single
argument or a list of units to use in conversion. When a convert operation is
done, the normal global evaluation system is bypassed, in order to avoid the
desired result being converted again. As a consequence, for inexact calculations
"rat" warnings will be visible if the global environment controlling this behavior
(ratprint
) is true. This is also useful for spot-checking the
accuracy of a global conversion. Another feature is convert
will allow a
user to do Base Dimension conversions even if the global environment is set to
simplify to a Derived Dimension.
(%i2) kg*m/s^2; kg m (%o2) ---- 2 s (%i3) convert(kg*m/s^2,[g,km,s]); g km (%o3) ---- 2 s (%i4) convert(kg*m/s^2,[g,inch,minute]); `rat' replaced 39.37007874015748 by 5000//127 = 39.37007874015748 18000000000 %in g (%o4) (-----------) (-----) 127 2 %min (%i5) convert(kg*m/s^2,[N]); (%o5) N (%i6) convert(kg*m^2/s^2,[N]); (%o6) m N (%i7) setunits([N,J]); (%o7) done (%i8) convert(kg*m^2/s^2,[N]); (%o8) m N (%i9) convert(kg*m^2/s^2,[N,inch]); `rat' replaced 39.37007874015748 by 5000//127 = 39.37007874015748 5000 (%o9) (----) (%in N) 127 (%i10) convert(kg*m^2/s^2,[J]); (%o10) J (%i11) kg*m^2/s^2; (%o11) J (%i12) setunits([g,inch,s]); (%o12) done (%i13) kg*m/s^2; (%o13) N (%i14) uforget(N); (%o14) false (%i15) kg*m/s^2; 5000000 %in g (%o15) (-------) (-----) 127 2 s (%i16) convert(kg*m/s^2,[g,inch,s]); `rat' replaced 39.37007874015748 by 5000//127 = 39.37007874015748 5000000 %in g (%o16) (-------) (-----) 127 2 s
See also and . To use this function write first load("unit")
.