Next: , Previous: Physical dimension, Up: Physical dimension

5.3.1 Introduction

Antik has a class physical-quantity which is used to represent values that have physical dimension, such as mass or length; e.g.

     ANTIK-USER> #_35_km
     ANTIK-USER> (* #_5_m #_8_kg)
     ANTIK-USER> (expt #_12_m 2)
     (* #_5_kg #_8_m/s^2)

Mathematical operations are allowed on these objects,

     ANTIK-USER> (+ #_35_km #_12_miles)

Of course, such math must be sensible,

     ANTIK-USER(3): (+ #_35_km #_12_kg)
     debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING {10040293F1}>:
       The quantities 3.500d+4m and 12.00kg are not both physical quantities with the same physical dimension.

Note also that fractional exponents are acceptable:

     ANTIK-USER> (expt #_16_m 1/2)

Each of these quantities has units associated with it – meters, kilograms, etc., and those units must be of the appropriate dimension for the physical quantity. All quantities are stored internally in the SI system of units, and converted to desired units either when printed or when an explicit conversion is requested.

The inspiration for this software came from Gordon Novak's work. Names, abbreviations, and definitions of units come from NIST.