emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

calc units


From: Jochen Küpper
Subject: calc units
Date: 18 Apr 2002 19:27:16 -0400
User-agent: XEmacs/Gnus

I have send the following to gnu.emacs.sources before.  It would be
great if the attached updated constants could be incorporated into
calc.  The defvar math-standard-units supersedes the according
definition in current calc-units.el.

Greetings,
Jochen
-- 
University of North Carolina                       phone: +1-919-962-4403
Department of Chemistry                            phone: +1-919-962-1579
Venable Hall CB#3290 (Kenan C148)                    fax: +1-919-843-6041
Chapel Hill, NC 27599, USA                            GnuPG key: 44BCCD8E

;; calc-units-update.el -- update for calc-units.el, a calculator for Emacs
;;
;; Copyright (C) 2002 Jochen Küpper
;;
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 2, or (at your
;; option) any later version.
;;
;; It is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
;; License for more details.
;;
;; This file udates the units calc uses to CODATA 1998, plus some
;; addtional new values.  For CODATA 1998 references see one of
;; - Journal of Physical and Chemical Reference Data, 28(6), 1713-1852, 1999.
;; - Reviews of Modern Physics, 72(2), 351-495, 2000.
;; - http://physics.nist.gov/cuu/Constants/index.html


(require 'calc)
(defvar math-standard-units
  '( ;; Length
     ( m       nil                      "*Meter" )
     ( in      "2.54 cm"                "Inch" )
     ( ft      "12 in"                  "Foot" )
     ( yd      "3 ft"                   "Yard" )
     ( mi      "5280 ft"                "Mile" )
     ( au      "149597870691. m"        "Astronomical Unit" ) ;; NASA JPL 
(http://neo.jpl.nasa.gov/glossary/au.html)
     ( lyr     "9460536207068016 m"     "Light Year" )
     ( pc      "206264.80625 au"        "Parsec" )
     ( nmi     "1852 m"                 "Nautical Mile" )
     ( fath    "6 ft"                   "Fathom" )
     ( u       "1 um"                   "Micron" )
     ( mil     "in/1000"                "Mil" )
     ( point   "in/72"                  "Point (1/72 inch)" )
     ( tpt     "in/72.27"               "Point (TeX conventions)" )
     ( Ang     "1e-10 m"                "Angstrom" )
     ( mfi     "mi+ft+in"               "Miles + feet + inches" )
     
     ;; Area
     ( hect    "10000 m^2"              "*Hectare" )
     ( acre    "mi^2 / 640"             "Acre" )
     ( b       "1e-28 m^2"              "Barn" )
     
     ;; Volume
     ( l       "1e-3 m^3"               "*Liter" )
     ( L       "1e-3 m^3"               "Liter" )
     ( gal     "4 qt"                   "US Gallon" )
     ( qt      "2 pt"                   "Quart" )
     ( pt      "2 cup"                  "Pint" )
     ( cup     "8 ozfl"                 "Cup" )
     ( ozfl    "2 tbsp"                 "Fluid Ounce" )
     ( floz    "2 tbsp"                 "Fluid Ounce" )
     ( tbsp    "3 tsp"                  "Tablespoon" )
     ( tsp     "4.92892159375 ml"       "Teaspoon" )
     ( vol     "tsp+tbsp+ozfl+cup+pt+qt+gal" "Gallons + ... + teaspoons" )
     ( galC    "4.54609 l"              "Canadian Gallon" )
     ( galUK   "4.546092 l"             "UK Gallon" )
     
     ;; Time
     ( s       nil                      "*Second" )
     ( sec     "s"                      "Second" )
     ( min     "60 s"                   "Minute" )
     ( hr      "60 min"                 "Hour" )
     ( day     "24 hr"                  "Day" )
     ( wk      "7 day"                  "Week" )
     ( hms     "wk+day+hr+min+s"        "Hours, minutes, seconds" )
     ( yr      "365.25 day"             "Year" )
     ( Hz      "1/s"                    "Hertz" )

     ;; Speed
     ( mph     "mi/hr"                  "*Miles per hour" )
     ( kph     "km/hr"                  "Kilometers per hour" )
     ( knot    "nmi/hr"                 "Knot" )
     ( c       "2.99792458e8 m/s"       "Speed of light" )     
     
     ;; Acceleration
     ( ga      "9.80665 m/s^2"          "*\"g\" acceleration" )

     ;; Mass
     ( g       nil                      "*Gram" )
     ( lb      "16 oz"                  "Pound (mass)" )
     ( oz      "28.349523125 g"         "Ounce (mass)" )
     ( ton     "2000 lb"                "Ton" )
     ( tpo     "ton+lb+oz"              "Tons + pounds + ounces (mass)" )
     ( t       "1000 kg"                "Metric ton" )
     ( tonUK   "1016.0469088 kg"        "UK ton" )
     ( lbt     "12 ozt"                 "Troy pound" )
     ( ozt     "31.103475 g"            "Troy ounce" )
     ( ct      ".2 g"                   "Carat" )
     ( amu     "1.66053873e-27 kg"      "Unified atomic mass" ) ;; CODATA 1998

     ;; Force
     ( N       "m kg/s^2"               "*Newton" )
     ( dyn     "1e-5 N"                 "Dyne" )
     ( gf      "ga g"                   "Gram (force)" )
     ( lbf     "4.44822161526 N"        "Pound (force)" )
     ( kip     "1000 lbf"               "Kilopound (force)" )
     ( pdl     "0.138255 N"             "Poundal" )

     ;; Energy
     ( J       "N m"                    "*Joule" )
     ( erg     "1e-7 J"                 "Erg" )
     ( cal     "4.1868 J"               "International Table Calorie" )
     ( Btu     "1055.05585262 J"        "International Table Btu" )
     ( eV      "ech V"                  "Electron volt" )
     ( ev      "eV"                     "Electron volt" )
     ( therm   "105506000 J"            "EEC therm" )
     ( invcm   "h c/cm"                 "Energy in inverse centimeters" )
     ( Kayser  "invcm"                  "Kayser (inverse centimeter energy)" )
     ( men     "100/invcm"              "Inverse energy in meters" )
     ( Hzen    "h Hz"                   "Energy in Hertz")
     ( Ken     "k K"                    "Energy in Kelvins")
     ( Wh      "W h"                    "Watt hour")
     ( Ws      "W s"                    "Watt second")

     ;; Power
     ( W       "J/s"                    "*Watt" )
     ( hp      "745.7 W"                "Horsepower" )

     ;; Temperature
     ( K       nil                      "*Degree Kelvin"     K )
     ( dK      "K"                      "Degree Kelvin"      K )
     ( degK    "K"                      "Degree Kelvin"      K )
     ( dC      "K"                      "Degree Celsius"     C )
     ( degC    "K"                      "Degree Celsius"     C )
     ( dF      "(5/9) K"                "Degree Fahrenheit"  F )
     ( degF    "(5/9) K"                "Degree Fahrenheit"  F )

     ;; Pressure
     ( Pa      "N/m^2"                  "*Pascal" )
     ( bar     "1e5 Pa"                 "Bar" )
     ( atm     "101325 Pa"              "Standard atmosphere" )
     ( torr    "atm/760"                "Torr" )
     ( mHg     "1000 torr"              "Meter of mercury" )
     ( inHg    "25.4 mmHg"              "Inch of mercury" )
     ( inH2O   "2.490889e2 Pa"          "Inch of water" ) ;; NIST 
(http://physics.nist.gov/Pubs/SP811/appenB9.html)
     ( psi     "6894.75729317 Pa"       "Pound per square inch" )

     ;; Viscosity
     ( P       "0.1 Pa s"               "*Poise" )
     ( St      "1e-4 m^2/s"             "Stokes" )

     ;; Electromagnetism
     ( A       nil                      "*Ampere" )
     ( C       "A s"                    "Coulomb" )
     ( Fdy     "ech Nav"                "Faraday" )
     ( e       "1.602176462e-19 C"      "Elementary charge" ) ;; CODATA 1998
     ( ech     "1.602176462e-19 C"      "Elementary charge" ) ;; CODATA 1998
     ( V       "W/A"                    "Volt" )
     ( ohm     "V/A"                    "Ohm" )
     ( mho     "A/V"                    "Mho" )
     ( S       "A/V"                    "Siemens" )
     ( F       "C/V"                    "Farad" )
     ( H       "Wb/A"                   "Henry" )
     ( T       "Wb/m^2"                 "Tesla" )
     ( G       "1e-4 T"                 "Gauss" )
     ( Wb      "V s"                    "Weber" )

     ;; Luminous intensity
     ( cd      nil                      "*Candela" )
     ( sb      "1e4 cd/m^2"             "Stilb" )
     ( lm      "cd sr"                  "Lumen" )
     ( lx      "lm/m^2"                 "Lux" )
     ( ph      "1e4 lx"                 "Phot" )
     ( fc      "10.76391 lx"            "Footcandle" ) ;; NIST 
(http://physics.nist.gov/Pubs/SP811/appenB9.html)
     ( lam     "1e4 lm/m^2"             "Lambert" )
     ( flam    "1.07639104e-3 lam"      "Footlambert" )

     ;; Radioactivity
     ( Bq      "1/s"                    "*Becquerel" )
     ( Ci      "3.7e10 Bq"              "Curie" )
     ( Gy      "J/kg"                   "Gray" )
     ( Sv      "Gy"                     "Sievert" )
     ( R       "2.58e-4 C/kg"           "Roentgen" )
     ( rd      ".01 Gy"                 "Rad" )
     ( rem     "rd"                     "Rem" )

     ;; Amount of substance
     ( mol     nil                      "*Mole" )

     ;; Plane angle
     ( rad     nil                      "*Radian" )
     ( circ    "2 pi rad"               "Full circle" )
     ( rev     "circ"                   "Full revolution" )
     ( deg     "circ/360"               "Degree" )
     ( arcmin  "deg/60"                 "Arc minute" )
     ( arcsec  "arcmin/60"              "Arc second" )
     ( grad    "circ/400"               "Grade" )
     ( rpm     "rev/min"                "Revolutions per minute" )

     ;; Solid angle
     ( sr      nil                      "*Steradian" )

     ;; other physical quantities (CODATA 1998)
     ( h       "6.62606876e-34 J s"     "*Planck's constant" )
     ( hbar    "h / 2 pi"               "Planck's constant" )
     ( mu0     "4 pi 1e-7 H/m"          "Permeability of vacuum" )
     ( Grav    "6.673e-11 m^3/kg^1/s^2" "Gravitational constant" )
     ( Nav     "6.02214199e23 / mol"    "Avagadro's constant" )
     ( me      "9.10938188e-31 kg"      "Electron rest mass" )
     ( mp      "1.67262158e-27 kg"      "Proton rest mass" )
     ( mn      "1.67492716e-27 kg"      "Neutron rest mass" )
     ( mu      "1.88353109e-28 kg"      "Muon rest mass" )
     ( Ryd     "10973731.568549 /m"     "Rydberg's constant" )
     ( k       "1.3806503e-23 J/K"      "Boltzmann's constant" )
     ( fsc     "7.297352533e-3"         "Fine structure constant" )
     ( muB     "927.400899e-26 J/T"     "Bohr magneton" )
     ( muN     "5.05078317e-27 J/T"     "Nuclear magneton" )
     ( mue     "-928.476362e-26 J/T"    "Electron magnetic moment" )
     ( mup     "1.410606633e-26 J/T"    "Proton magnetic moment" )
     ( R0      "8.314472 J/mol/K"       "Molar gas constant" )
     ( V0      "22.710981e-3 m^3/mol"   "Standard volume of ideal gas" )
))

(provide 'calc-units-update)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]