1/* A small database of elementary unit conversions */ 2 3/* Undefined and therefore treated as basic units: 4 * 5 * m kg s A K mol 6 * 7 */ 8 9declare_unit_conversion 10 (Hz = 1/s, /* hertz: Frequency */ 11 hertz = Hz, 12 N = kg*m/s^2, /* newton: Force */ 13 newton = N, 14 Pa = N/m^2, /* pascal: Pressure */ 15 pascal = Pa, 16 J = N*m, /* joule: Work, energy */ 17 joule = J, 18 W = J/s, /* watt: Power */ 19 watt = W, 20 C = s*A, /* coulomb: Electric charge */ 21 coulomb = C, 22 V = J/C, /* volt: Electromotive force */ 23 volt = V, 24 F = C^2/J, /* farad: Electric capacitance */ 25 farad = F, 26 Ohm = J*s/C^2, /* ohm: Electric resistance */ 27 ohm = Ohm, 28 S = 1/Ohm, /* siemens: Electric conductance */ 29 siemens = S, 30 Wb = J/A, /* weber: Magnetic flux */ 31 weber = Wb, 32 T = J/m^2/A, /* tesla: Magnetic flux density*/ 33 tesla = T, 34 H = J/A^2, /* henry: Inductance */ 35 henry = H, 36 37 fm = m/10^15, 38 pm = m/10^12, 39 nm = m/10^9, 40 microm = m/10^6, 41 micron = microm, 42 mm = m/1000, 43 km = 1000*m, 44 Mm = 1000000*m, 45 Gm = 1000000000*m, 46 47 fg = g/10^15, 48 pg = g/10^12, 49 ng = g/10^9, 50 microg = g/10^6, 51 mg = kg/1000000, 52 g = kg/1000, 53 Mg = 1000*kg, 54 Gg = 1000000*kg, 55 56 fs = s/10^15, 57 ps = s/10^12, 58 ns = s/10^9, 59 micros = s/10^6, 60 ms = s/1000, 61 ks = 1000*s, 62 Ms = 1000000*s, 63 Gs = 1000000000*s, 64 65 fA = A/10^15, 66 pA = A/10^12, 67 nA = A/10^9, 68 microA = A/10^6, 69 microampere = microA, 70 mA = A/1000, 71 ampere = A, 72 amp = A, 73 kA = 1000*A, 74 MA = 1000000*A, 75 GA = 1000000000*A, 76 77 fK = K/10^15, 78 pK = K/10^12, 79 nK = K/10^9, 80 microK = K/10^6, 81 microkelvin = microK, 82 mK = K/1000, 83 kelvin = K, 84 kK = 1000*K, 85 MK = 1000000*K, 86 GK = 1000000000*K, 87 88 fmol = mol/10^15, 89 pmol = mol/10^12, 90 nmol = mol/10^9, 91 micromol = mol/10^6, 92 micromole = micromol, 93 mmol = mol/1000, 94 mole = mol, 95 kmol = 1000*mol, 96 Gmol = 1000000*mol, 97 Mmol = 1000000000*mol, 98 99 fHz = Hz/10^15, 100 pHz = Hz/10^12, 101 nHz = Hz/10^9, 102 microHz = Hz/10^6, 103 microhertz = microHz, 104 mHz = Hz/1000, 105 kHz = 1000*Hz, 106 MHz = 1000000*Hz, 107 GHz = 1000000000*Hz, 108 109 fN = N/10^15, 110 pN = N/10^12, 111 nN = N/10^9, 112 microN = N/10^6, 113 micronewton = microN, 114 mN = N/1000, 115 kN = 1000*N, 116 MN = 1000000*N, 117 GN = 1000000000*N, 118 119 fPa = Pa/10^15, 120 pPa = Pa/10^12, 121 nPa = Pa/10^9, 122 microPa = Pa/10^6, 123 micropascal = microPa, 124 mPa = Pa/1000, 125 kPa = 1000*Pa, 126 MPa = 1000000*Pa, 127 GPa = 1000000000*Pa, 128 129 fJ = J/10^15, 130 pJ = J/10^12, 131 nJ = J/10^9, 132 microJ = J/10^6, 133 microjoule = microJ, 134 mJ = J/1000, 135 kJ = 1000*J, 136 MJ = 1000000*J, 137 GJ = 1000000000*J, 138 139 fW = W/10^15, 140 pW = W/10^12, 141 nW = W/10^9, 142 microW = W/10^6, 143 microwatt = microW, 144 mW = W/1000, 145 kW = 1000*W, 146 MW = 1000000*W, 147 GW = 1000000000*W, 148 149 fC = C/10^15, 150 pC = C/10^12, 151 nC = C/10^9, 152 microC = C/10^6, 153 microcoulomb = microC, 154 mC = C/1000, 155 kC = 1000*C, 156 MC = 1000000*C, 157 GC = 1000000000*C, 158 159 fV = V/10^15, 160 pV = V/10^12, 161 nV = V/10^9, 162 microV = V/10^6, 163 microvolt = microV, 164 mV = V/1000, 165 kV = 1000*V, 166 MV = 1000000*V, 167 GV = 1000000000*V, 168 169 fF = F/10^15, 170 pF = F/10^12, 171 nF = F/10^9, 172 microF = F/10^6, 173 microfarad = microF, 174 mF = F/1000, 175 kF = 1000*F, 176 MF = 1000000*F, 177 GF = 1000000000*F, 178 179 fOhm = Ohm/10^15, 180 pOhm = Ohm/10^12, 181 nOhm = Ohm/10^9, 182 microOhm = Ohm/10^6, 183 mOhm = Ohm/1000, 184 kOhm = 1000*Ohm, 185 MOhm = 1000000*Ohm, 186 GOhm = 1000000000*Ohm, 187 188 fS = S/10^15, 189 pS = S/10^12, 190 nS = S/10^9, 191 microS = S/10^6, 192 microsiemens = microS, 193 mS = S/1000, 194 kS = 1000*S, 195 MS = 1000000*S, 196 GS = 1000000000*S, 197 198 fWb = Wb/10^15, 199 pWb = Wb/10^12, 200 nWb = Wb/10^9, 201 microWb = Wb/10^6, 202 microweber = microWb, 203 mWb = Wb/1000, 204 kWb = 1000*Wb, 205 MWb = 1000000*Wb, 206 GWb = 1000000000*Wb, 207 208 fT = T/10^15, 209 pT = T/10^12, 210 nT = T/10^9, 211 microT = T/10^6, 212 microtesla = microT, 213 mT = T/1000, 214 kT = 1000*T, 215 MT = 1000000*T, 216 GT = 1000000000*T, 217 218 fH = H/10^15, 219 pH = H/10^12, 220 nH = H/10^9, 221 microH = H/10^6, 222 microhenry = microH, 223 mH = H/1000, 224 kH = 1000*H, 225 MH = 1000000*H, 226 GH = 1000000000*H, 227 228 micrometer = m/1000000, 229 micron = micrometer, 230 cm = m/100, 231 meter = m, 232 kilometer = km, 233 234 /* International Astronomical Union best estimate (2009) according to Wikipedia */ 235 astronomical_unit = 149597870700 * m, 236 AU = astronomical_unit, 237 238 julian_year = (365 + 1/4) * 86400 * s, 239 light_year = julian_year * 299792458 * m / s, 240 241 parsec = 360 * 60 * 60 / (2 * %pi) * astronomical_unit, 242 pc = parsec, 243 244 microgram = kg/1000000000, 245 metric_ton = Mg, 246 kilogram = kg, 247 gram = g, 248 249 microsecond = s/1000000, 250 second = s, 251 252 hectare = 10000*m^2, 253 ha = hectare, 254 255 liter = m^3/1000, 256 l = liter, 257 ml = l / 1000, 258 259 candela = cd, 260 lumen = cd, 261 lux = lumen/m^2, 262 263 becquerel = 1/s, 264 Bq = becquerel, 265 266 gray = J/kg, 267 Gy = gray, 268 sievert = gray, 269 Sv = sievert, 270 271 katal = mol/s, 272 kat = katal); 273 274texput (mOhm, "\\mathrm{m\\Omega}"); 275texput (Ohm, "\\mathrm{\\Omega}"); 276texput (kOhm, "\\mathrm{k\\Omega}"); 277texput (MOhm, "\\mathrm{M\\Omega}"); 278texput (GOhm, "\\mathrm{G\\Omega}"); 279 280texput (micrometer, "\\mu \\mathrm{m}"); 281texput (microm, "\\mu \\mathrm{m}"); 282texput (micron, "\\mu \\mathrm{m}"); 283texput (microgram, "\\mu \\mathrm{g}"); 284texput (microg, "\\mu \\mathrm{g}"); 285texput (microsecond, "\\mu \\mathrm{s}"); 286texput (micros, "\\mu \\mathrm{s}"); 287texput (microampere, "\\mu \\mathrm{A}"); 288texput (microamp, "\\mu \\mathrm{A}"); 289texput (microA, "\\mu \\mathrm{A}"); 290texput (microkelvin, "\\mu \\mathrm{K}"); 291texput (microK, "\\mu \\mathrm{K}"); 292texput (micromole, "\\mu \\mathrm{mol}"); 293texput (micromol, "\\mu \\mathrm{mol}"); 294texput (microhertz, "\\mu \\mathrm{Hz}"); 295texput (microHz, "\\mu \\mathrm{Hz}"); 296texput (micronewton, "\\mu \\mathrm{N}"); 297texput (microN, "\\mu \\mathrm{N}"); 298texput (micropascal, "\\mu \\mathrm{Pa}"); 299texput (microPa, "\\mu \\mathrm{Pa}"); 300texput (microjoule, "\\mu \\mathrm{J}"); 301texput (microJ, "\\mu \\mathrm{J}"); 302texput (microwatt, "\\mu \\mathrm{W}"); 303texput (microW, "\\mu \\mathrm{W}"); 304texput (microcoulomb, "\\mu \\mathrm{C}"); 305texput (microC, "\\mu \\mathrm{C}"); 306texput (microvolt, "\\mu \\mathrm{V}"); 307texput (microV, "\\mu \\mathrm{V}"); 308texput (microfarad, "\\mu \\mathrm{F}"); 309texput (microF, "\\mu \\mathrm{F}"); 310texput (microOhm, "\\mu \\Omega"); 311texput (microsiemens, "\\mu \\mathrm{S}"); 312texput (microS, "\\mu \\mathrm{S}"); 313texput (microweber, "\\mu \\mathrm{Wb}"); 314texput (microWb, "\\mu \\mathrm{Wb}"); 315texput (microtesla, "\\mu \\mathrm{T}"); 316texput (microT, "\\mu \\mathrm{T}"); 317texput (microhenry, "\\mu \\mathrm{H}"); 318texput (microH, "\\mu \\mathrm{H}"); 319 320texput (metric_ton, "\\mathrm{metric\\ ton}"); 321 322declare_unit_conversion 323 (feet = 3048/10000 * m, 324 /* International pound avoirdupois */ 325 pound_mass = 45359237/10^8 * kg, 326 minute = 60*s, 327 hour = 3600*s, 328 day = 86400*s, 329 week = 7*86400*s, 330 month = (30 + 7/16)*86400*s, 331 year = (365 + 1/4)*86400*s, 332 Btu = 1055*J, 333 R = 5/9*K); 334 335declare_unit_conversion 336 (inch = feet/12, 337 yard = 3*feet, 338 mile = 5280*feet, 339 gallon = 231*inch^3, 340 slug = pound_force*s^2/foot, 341 ounce = pound_mass/16, 342 /* grain = ???, */ 343 /* assume gravitational acceleration = 980.665 cm/s^2 */ 344 pound_force = pound_mass*196133/6096*ft/s^2, 345 acre = 55*88*yard^2, 346 psi = pound_force/inch^2, 347 cfm = feet^3/minute, 348 349 ft = feet, 350 foot = feet, 351 lbm = pound_mass, 352 oz = ounce, 353 lbf = pound_force, 354 horsepower = 550 * pound_force * foot / s, 355 hp = horsepower, 356 357 short_ton = 2000*lbm, 358 rod = 33/2*feet, 359 360 quart = gallon / 4, 361 pint = quart / 2, 362 cup = pint / 2, 363 gill = cup / 2, 364 fluid_ounce = cup / 8, 365 fl_oz = fluid_ounce, 366 tablespoon = fluid_ounce / 2, 367 teaspoon = tablespoon / 3, 368 tbsp = tablespoon, 369 tsp = teaspoon); 370