physical-quantities
A library for processing physical quantities: values, units, (and uncertainty).

Features:

  • Each quantity has a value, an (optional) unit, and an (optional) uncertainty.
  • Calculations are done using special functions like q+ or qsqrt.
  • Units and uncertainty are affected by calculations:
    • Unit combination
    • Error propagation
  • Units can be converted.
  • Convenient read-macro to define quantities: #q(1 kg).
  • Value, unit, and uncertainty can be accessed, if needed.
  • SI units are predefined.
  • Any other units can be defined.

Usage:

(require :asdf) (asdf:load-system :physical-quantities) (use-package :physical-quantities} (define-si-units) (define-read-macros) (let (m c E) ;; Define the mass (setf m #q(1.00 +/- 0.01 kg)) ;; The speed of light (setf c #q(299792458 m / s)) ;; E = m * c^2 (setf E (q* m (qpow c 2))) ;; Print E, converted to petajoule (print #q(E -> PJ)))

Homepage:

https://github.com/mrossini-ethz/physical-quantities

Installation:

physical-quantities can be installed through Quicklisp.

License:

GPL