Next: , Previous: About physical dimension, Up: Physical dimension

5.3.2 Making physical dimension quantities

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)
     ANTIK-USER> #_24.5_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)
     ANTIK-USER> (pqval #m(#_1.0_km #_2.0_s #_3.0_kg))
     #m(1000.000000000000000d0 2.000000000000000d0 3.000000000000000d0)
— Class: antik:physical-quantity

Class precedence list: physical-quantity, standard-object, t

A quantity with a dimension and possibly a unit, e.g. length or meter.

— Function: antik:check-dimension obj units &optional errorp zeros-have-any-dimension

t if one of these cases hold:

— Function: antik:make-pq magnitude unit-expression &optional scalar-dimension

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. Unitless dimensions (e.g., 'length) are interpeted as units in the :system-of-units. If scalar-dimension is t and 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.

— Generic Function: antik:pqval pq

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.

— Macro: antik:with-pq physical-quantities &body body

Ensure that the named physical dimension quantities are of the right dimensions, or convert them from plain numbers using the current system of units as specified by (nf-option :system-of-units).

— Variable: antik:*zero-is-dimensionless*

Numbers with zero magnitude are made dimensionless.