Scientific.Physics.PhysicalQuantities

Package Scientific :: Package Physics :: Module PhysicalQuantities |
[frames] | no frames]

# Module PhysicalQuantities

Physical quantities with units.

This module provides a data type that represents a physical quantity together with its unit. It is possible to add and subtract these quantities if the units are compatible, and a quantity can be converted to another compatible unit. Multiplication, subtraction, and raising to integer powers is allowed without restriction, and the result will have the correct unit. A quantity can be raised to a non-integer power only if the result can be represented by integer powers of the base units.

The values of physical constants are taken from the 1986 recommended values from CODATA. Other conversion factors (e.g. for British units) come from various sources. I can't guarantee for the correctness of all entries in the unit table, so use this at your own risk.

SI derived units; these automatically get prefixes: Y (1E+24), Z (1E+21), E (1E+18), P (1E+15), T (1E+12), G (1E+09), M (1E+06), k (1E+03), h (1E+02), da (1E+01), d (1E-01), c (1E-02), m (1E-03), mu (1E-06), n (1E-09), p (1E-12), f (1E-15), a (1E-18), z (1E-21), y (1E-24)

Hz Hertz 1/s N Newton m*kg/s**2 Pa Pascal N/m**2 J Joule N*m W Watt J/s C Coulomb s*A V Volt W/A F Farad C/V ohm Ohm V/A S Siemens A/V Wb Weber V*s T Tesla Wb/m**2 H Henry Wb/A lm Lumen cd*sr lx Lux lm/m**2 Bq Becquerel 1/s Gy Gray J/kg Sv Sievert J/kg

Prefixed units for ohm:

Yohm, Zohm, Eohm, Pohm, Tohm, Gohm, Mohm, kohm, hohm, daohm, dohm, cohm, mohm, muohm, nohm, pohm, fohm, aohm, zohm, yohm

Prefixed units for rad:

Yrad, Zrad, Erad, Prad, Trad, Grad, Mrad, krad, hrad, darad, drad, crad, mrad, murad, nrad, prad, frad, arad, zrad, yrad

Prefixed units for mol:

Ymol, Zmol, Emol, Pmol, Tmol, Gmol, Mmol, kmol, hmol, damol, dmol, cmol, mmol, mumol, nmol, pmol, fmol, amol, zmol, ymol

Prefixed units for cd:

Ycd, Zcd, Ecd, Pcd, Tcd, Gcd, Mcd, kcd, hcd, dacd, dcd, ccd, mcd, mucd, ncd, pcd, fcd, acd, zcd, ycd

Prefixed units for Pa:

YPa, ZPa, EPa, PPa, TPa, GPa, MPa, kPa, hPa, daPa, dPa, cPa, mPa, muPa, nPa, pPa, fPa, aPa, zPa, yPa

Prefixed units for Hz:

YHz, ZHz, EHz, PHz, THz, GHz, MHz, kHz, hHz, daHz, dHz, cHz, mHz, muHz, nHz, pHz, fHz, aHz, zHz, yHz

Prefixed units for Wb:

YWb, ZWb, EWb, PWb, TWb, GWb, MWb, kWb, hWb, daWb, dWb, cWb, mWb, muWb, nWb, pWb, fWb, aWb, zWb, yWb

Prefixed units for lm:

Ylm, Zlm, Elm, Plm, Tlm, Glm, Mlm, klm, hlm, dalm, dlm, clm, mlm, mulm, nlm, plm, flm, alm, zlm, ylm

Prefixed units for Bq:

YBq, ZBq, EBq, PBq, TBq, GBq, MBq, kBq, hBq, daBq, dBq, cBq, mBq, muBq, nBq, pBq, fBq, aBq, zBq, yBq

Prefixed units for lx:

Ylx, Zlx, Elx, Plx, Tlx, Glx, Mlx, klx, hlx, dalx, dlx, clx, mlx, mulx, nlx, plx, flx, alx, zlx, ylx

Prefixed units for A:

YA, ZA, EA, PA, TA, GA, MA, kA, hA, daA, dA, cA, mA, muA, nA, pA, fA, aA, zA, yA

Prefixed units for C:

YC, ZC, EC, PC, TC, GC, MC, kC, hC, daC, dC, cC, mC, muC, nC, pC, fC, aC, zC, yC

Prefixed units for F:

YF, ZF, EF, PF, TF, GF, MF, kF, hF, daF, dF, cF, mF, muF, nF, pF, fF, aF, zF, yF

Prefixed units for H:

YH, ZH, EH, PH, TH, GH, MH, kH, hH, daH, dH, cH, mH, muH, nH, pH, fH, aH, zH, yH

Prefixed units for K:

YK, ZK, EK, PK, TK, GK, MK, kK, hK, daK, dK, cK, mK, muK, nK, pK, fK, aK, zK, yK

Prefixed units for J:

YJ, ZJ, EJ, PJ, TJ, GJ, MJ, kJ, hJ, daJ, dJ, cJ, mJ, muJ, nJ, pJ, fJ, aJ, zJ, yJ

Prefixed units for Sv:

YSv, ZSv, ESv, PSv, TSv, GSv, MSv, kSv, hSv, daSv, dSv, cSv, mSv, muSv, nSv, pSv, fSv, aSv, zSv, ySv

Prefixed units for N:

YN, ZN, EN, PN, TN, GN, MN, kN, hN, daN, dN, cN, mN, muN, nN, pN, fN, aN, zN, yN

Prefixed units for S:

YS, ZS, ES, PS, TS, GS, MS, kS, hS, daS, dS, cS, mS, muS, nS, pS, fS, aS, zS, yS

Prefixed units for T:

YT, ZT, ET, PT, TT, GT, MT, kT, hT, daT, dT, cT, mT, muT, nT, pT, fT, aT, zT, yT

Prefixed units for W:

YW, ZW, EW, PW, TW, GW, MW, kW, hW, daW, dW, cW, mW, muW, nW, pW, fW, aW, zW, yW

Prefixed units for V:

YV, ZV, EV, PV, TV, GV, MV, kV, hV, daV, dV, cV, mV, muV, nV, pV, fV, aV, zV, yV

Prefixed units for g:

Yg, Zg, Eg, Pg, Tg, Gg, Mg, kg, hg, dag, dg, cg, mg, mug, ng, pg, fg, ag, zg, yg

Prefixed units for sr:

Ysr, Zsr, Esr, Psr, Tsr, Gsr, Msr, ksr, hsr, dasr, dsr, csr, msr, musr, nsr, psr, fsr, asr, zsr, ysr

Prefixed units for m:

Ym, Zm, Em, Pm, Tm, Gm, Mm, km, hm, dam, dm, cm, mm, mum, nm, pm, fm, am, zm, ym

Prefixed units for Gy:

YGy, ZGy, EGy, PGy, TGy, GGy, MGy, kGy, hGy, daGy, dGy, cGy, mGy, muGy, nGy, pGy, fGy, aGy, zGy, yGy

Prefixed units for s:

Ys, Zs, Es, Ps, Ts, Gs, Ms, ks, hs, das, ds, cs, ms, mus, ns, ps, fs, as, zs, ys

Fundamental constants: c speed of light 299792458.*m/s mu0 permeability of vacuum 4.e-7*pi*N/A**2 eps0 permittivity of vacuum 1/mu0/c**2 Grav gravitational constant 6.67259e-11*m**3/kg/s**2 hplanck Planck constant 6.6260755e-34*J*s hbar Planck constant / 2pi hplanck/(2*pi) e elementary charge 1.60217733e-19*C me electron mass 9.1093897e-31*kg mp proton mass 1.6726231e-27*kg Nav Avogadro number 6.0221367e23/mol k Boltzmann constant 1.380658e-23*J/K

Time units: min minute 60*s h hour 60*min d day 24*h wk week 7*d yr year 365.25*d

Length units: inch inch 2.54*cm ft foot 12*inch yd yard 3*ft mi (British) mile 5280.*ft nmi Nautical mile 1852.*m Ang Angstrom 1.e-10*m lyr light year c*yr Bohr Bohr radius 4*pi*eps0*hbar**2/me/e**2

Area units: ha hectare 10000*m**2 acres acre mi**2/640 b barn 1.e-28*m

Volume units: l liter dm**3 dl deci liter 0.1*l cl centi liter 0.01*l ml milli liter 0.001*l tsp teaspoon 4.92892159375*ml tbsp tablespoon 3*tsp floz fluid ounce 2*tbsp cup cup 8*floz pt pint 16*floz qt quart 2*pt galUS US gallon 4*qt galUK British gallon 4.54609*l

Mass units: amu atomic mass units 1.6605402e-27*kg oz ounce 28.349523125*g lb pound 16*oz ton ton 2000*lb

Force units: dyn dyne (cgs unit) 1.e-5*N

Energy units: erg erg (cgs unit) 1.e-7*J eV electron volt e*V Hartree Wavenumbers/inverse cm me*e**4/16/pi**2/eps0**2/hbar**2 Ken Kelvin as energy unit k*K cal thermochemical calorie 4.184*J kcal thermochemical kilocalorie 1000*cal cali international calorie 4.1868*J kcali international kilocalorie 1000*cali Btu British thermal unit 1055.05585262*J

Prefixed units for eV:

YeV, ZeV, EeV, PeV, TeV, GeV, MeV, keV, heV, daeV, deV, ceV, meV, mueV, neV, peV, feV, aeV, zeV, yeV

Power units: hp horsepower 745.7*W

Pressure units: bar bar (cgs unit) 1.e5*Pa atm standard atmosphere 101325.*Pa torr torr = mm of mercury atm/760 psi pounds per square inch 6894.75729317*Pa

Angle units: deg degrees pi*rad/180

Temperature units: degR degrees Rankine (5./9.)*K degC degrees Celcius <PhysicalUnit degC> degF degree Fahrenheit <PhysicalUnit degF>

Classes
| PhysicalQuantity Physical quantity with units
| PhysicalUnit Physical unit

Functions
description() Return a string describing all available units. |
`bool` |
isPhysicalQuantity(x) Returns: `True` if x is a PhysicalQuantity |
`bool` |
isPhysicalUnit(x) Returns: `True` if x is a PhysicalUnit |

Variables
| prefix = ``'``y``'``
| unit = ``'``s``'``
| value = `1e-24`

Function Details

### isPhysicalQuantity(x) |
Parameters: `x` (any) - an object Returns: `bool` `True` if x is a PhysicalQuantity

### isPhysicalUnit(x) |
Parameters: `x` (any) - an object Returns: `bool` `True` if x is a PhysicalUnit