There are two main ways to make physical quantities: the function make-pq, and the reader macro #_
ANTIK-USER> (make-pq 24.5d0 'm/s)
#_24.500000000000000d0_m/s
ANTIK-USER> #_24.5_m/s
#_24.500000000000000d0_m/s
To get the magnitude and units of a physical quantity, use pqval. It returns three values: the magnitude, units, and whether a single unit expression applies to all elements of the grid magnitude:
ANTIK-USER> (pqval #_24.5_m/s)
24.5
(/ METER SECOND)
T
ANTIK-USER> (pqval #m(#_1.0_km #_2.0_s #_3.0_kg))
#m(1000.000000000000000d0 2.000000000000000d0 3.000000000000000d0)
#(METER SECOND KILOGRAM)
NIL
Class precedence list:
physical-quantity, standard-object, tA quantity with a dimension and possibly a unit, e.g. length or meter.
- obj is a pdq and units have the same dimension as obj,
- obj is zero and zeros-have-any-dimension is
t,- obj and units represent a dimensionless quantity,
- obj and units are grids of the same length, and for each pair of corresponding elements, one of the above is true.
Make a physical dimension quantity (PDQ). Allow for the possiblity that magnitude is already a
pdq; in this case, check that the physical dimension is correct, and pass it on. This can be used as a way of assigning default units to a number. If sysunits is specified, unitless dimensions (e.g., 'length) are interpeted as units in that system. If scalar-dimension istand magnitude is not a scalar, the unit-expression applies to each element of the magnitude. Otherwise it must be a grid or list of the shape as the magnitude.
Format the physical dimension quantity in units different than the default. Note that sysunits-additional-units must be a list.
Get the numerical value and the units of the physical dimension quantity. Returns the magnitude, the units, and whether units are the same for each element of a sequence or grid.