Modified in 0.9.1
PhysicalConstants is a global table giving the values units and definitions of many constants needed for calculations. Each constant is a table with three elements, value, unit and description. For the electron mass one has for example:
print(PhysicalConstants.me.value)
which returns:
9.1093837139e-31
the electron mass. The unit of the constant is stored in the variable .unit, for the electron mass this is:
print(PhysicalConstants.me.units)
which returns:
kg
A description of the constant can be obtained from the variable .description:
print(PhysicalConstants.me.description)
which returns:
Electron mass in kilogram
A printout of all information can be obtained when one directly prints the original variable. For the electron mass this is:
print(PhysicalConstants.me)
which returns:
-- Electron mass in kilogram 9.109383713900000E-31 --[[ kg ]]--
The values are those of CODATA 2022 (P. J. Mohr et al., Rev. Mod. Phys. 97, 025002 (2025)); Quanty 0.9.0 and earlier used CODATA 2014. PhysicalConstants.cAU is the speed of light in Hartree atomic units, $1/\alpha$, the value used by the relativistic atomic operators.
A list of all implemented constants can be obtained by printing all elements in the global table PhysicalConstants:
for constant,var in pairs(PhysicalConstants) do io.write(string.format("PhysicalConstants.%s\n",constant)) io.write(string.format(" %17.10E [%s]\n",var.value,var.units)) io.write(string.format(" %s\n",var.description)) end
which returns:
PhysicalConstants.RK 2.5812807459E+04 [Ohm] Klaus von Klitzing constant in units of Ohm PhysicalConstants.ge -2.0023193044E+00 [] Electron g factor PhysicalConstants.R 8.3144626182E+00 [J mol^-1 K^-1] Molar gas constant in Joule per mole per Kelvin PhysicalConstants.NA 6.0221407600E+23 [mol^-1] Avogadro constant in units of number of particles per mole PhysicalConstants.a0 5.2917721054E-11 [m] Bohr radius in meter PhysicalConstants.mun -9.6623653000E-27 [J T^-1] Neutron magnetic moment in Joule per Tesla PhysicalConstants.me 9.1093837139E-31 [kg] Electron mass in kilogram PhysicalConstants.lPlanck 1.6162550000E-35 [m] Planck length in meter PhysicalConstants.mPlanck 2.1764340000E-08 [kg] Planck mass in kilogram PhysicalConstants.mumu -4.4904483000E-26 [J T^-1] Muon magnetic moment in Joule per Tesla PhysicalConstants.lambdaCtau 6.9777100000E-16 [m] Tau Compton wavelength in units of meter PhysicalConstants.e 1.6021766340E-19 [C] Elementary charge in units of Coulomb PhysicalConstants.muN 5.0507837393E-27 [J T^-1] Nuclear magneton in Joule per Tesla PhysicalConstants.c 2.9979245800E+08 [m s^-1] speed of light in vacuum in meter per second PhysicalConstants.tPlanck 5.3912470000E-44 [s] Planck time in seconds PhysicalConstants.mue -9.2847646917E-24 [J T^-1] Electron magnetic moment in Joule per Tesla PhysicalConstants.malpha 6.6446573450E-27 [kg] alpha particle mass in kilogram PhysicalConstants.h 6.6260701500E-34 [J s] Planck's constant in Joule second PhysicalConstants.mu 1.6605390689E-27 [kg] Atomic mass constant in kilogram PhysicalConstants.mmu 1.8835316270E-28 [kg] Muon mass in kilogram PhysicalConstants.gd 8.5743823350E-01 [] Deuteron g factor PhysicalConstants.alpha 7.2973525643E-03 [] fine-structure constant (1/(4 pi epsilon0) e^2/(hbar c) PhysicalConstants.lambdaCn 1.3195909038E-15 [m] Neutron Compton wavelength in units of meter PhysicalConstants.hbar 1.0545718176E-34 [J s] Planck's constant divided by 2 pi in Joule second PhysicalConstants.gmu -2.0023318412E+00 [] Muon g factor PhysicalConstants.kB 1.3806490000E-23 [J K^-1] Boltzmann constant in units of Joule per Kelvin PhysicalConstants.md 3.3435837768E-27 [kg] Deuteron mass in kilogram PhysicalConstants.muB 9.2740100657E-24 [J T^-1] Bohr magneton in Joule per Tesla PhysicalConstants.mu0 1.2566370613E-06 [N A^-2] Magnetic constant (vacuum permeability) in Newton per Ampare squared PhysicalConstants.lambdaCp 1.3214098536E-15 [m] Proton Compton wavelength in units of meter PhysicalConstants.epsilon0 8.8541878188E-12 [F m^-1] Electric constant (vacuum permittivity) in Farads per meter PhysicalConstants.G0 7.7480917299E-05 [S] Conductance quantum in units of Siemens PhysicalConstants.gn -3.8260855200E+00 [] Neutron g factor PhysicalConstants.re 2.8179403205E-15 [m] classical electron radius in meter PhysicalConstants.F 9.6485332123E+04 [C mol^-1] Faraday constant in units of Coulomb per mole PhysicalConstants.sigma 5.6703744192E-08 [W m^-2 K^-4] Stefan-Boltzmann constant in Wat per meter square per Kelvin to the forth power PhysicalConstants.mud 4.3307350870E-27 [J T^-1] Deuteron magnetic moment in Joule per Tesla PhysicalConstants.mn 1.6749275006E-27 [kg] Neutron mass in kilogram PhysicalConstants.TPlanck 1.4167840000E+32 [K] Planck temperature in Kelvin PhysicalConstants.mup 1.4106067955E-26 [J T^-1] Proton magnetic moment in Joule per Tesla PhysicalConstants.R0 1.2906403730E+04 [Ohm] Resistance quantum in units of Ohm PhysicalConstants.KJ 4.8359784842E+14 [Hz V^_1] Josephson constant in Herz per Volt PhysicalConstants.G 6.6743000000E-11 [m^3 kg^-1 s^-2] Newtonian constant of graviation in units of meter cubed per kilogram per second squared PhysicalConstants.lambdaCe 2.4263102354E-12 [m] Electron Compton wavelength in units of meter PhysicalConstants.Phi0 2.0678338485E-15 [Wb] Magnetic flux quantum in units of Weber PhysicalConstants.mp 1.6726219259E-27 [kg] Proton mass in kilogram PhysicalConstants.mtau 3.1675400000E-27 [kg] Tau mass in kilogram PhysicalConstants.gp 5.5856946893E+00 [] Proton g factor PhysicalConstants.Z0 3.7673031341E+02 [Ohm] Characteristic impedance of vacuum in Ohm PhysicalConstants.lambdaCmu 1.1734441100E-14 [m] Muon Compton wavelength in units of meter PhysicalConstants.cAU 1.3703599918E+02 [] speed of light in Hartree atomic units (= 1/alpha, dimensionless)