Skip to content

Commit

Permalink
Merge #811
Browse files Browse the repository at this point in the history
811: Update to new SI definition and CODATA 2018 r=hgrecco a=Jellby

The SI has been redefined, by giving exact values to the Planck, Boltzmann and Avogadro constants, and the elementary charge. There are also new recommended values for other constants (CODATA 2018).

I've rewritten the `constants-en.txt` and `default-en.txt` according to these changes and also, I believe, for a better structure. The most significant changes:

* All units and constants defined from a few "experimental" values.
* For as much as I could find them, all factors are exact, except when noted. Floating point representation can introduce inaccuracies, though.
* US and imperial units may have changed their "reference" (to what I considered is most reasonable or authoritative), in practice values stay the same within floating point errors.
* Added some units and quantities.
* Fixed some units like Nm or au and parsec.
* Set the default Btu to the "ISO" Btu, and the default year to the Julian year (as recommended by the IAU)
* Defined units of the Gaussian system consistently, which makes them have different dimensionality from the corresponding SI units. Added a Gaussian context to allow conversions (with some caveats).
* Removed some units for which I could find no definition or reasonable use: chemical_faraday, physical_faraday, sidereal_hour, sidereal_minute, sidereal_second, work_year, work_month (they can of course be added back, hopefully with a better formal definition).
* Added atomic and Planck systems.
* Rearranged the order of units to "importance" (kind of) or field, rather than alphabetic.

I'm happy to undo some of the changes if they are considered undesirable. Note if/when #809 is accepted, I'd like to apply some minor fixes here.


Had to modify a couple of tests:

* For some reason (floating point errors, I guess), 4 mM -> mole/liter is no longer equal to 4e-3 M, only "almost equal".
* Updated the value of the Boltzmann constant in a test, a difference of 1.45e-5 % seems to be too much.

Co-authored-by: Jellby <[email protected]>
  • Loading branch information
bors[bot] and Jellby committed May 25, 2019
2 parents 7fb8391 + 620e5d1 commit b5127a2
Show file tree
Hide file tree
Showing 5 changed files with 686 additions and 371 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Other contributors, listed alphabetically, are:
* Felix Hummel <[email protected]>
* Francisco Couzo <[email protected]>
* Giel van Schijndel <[email protected]>
* Ignacio Fdez. Galván <[email protected]>
* James Rowe <[email protected]>
* Jim Turner <[email protected]>
* Joel B. Mohler <[email protected]>
Expand Down
100 changes: 60 additions & 40 deletions pint/constants_en.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,73 @@
# Default Pint constants definition file
# Based on the International System of Units
# Language: english
# Source: http://physics.nist.gov/cuu/Constants/Table/allascii.txt
# :copyright: 2013 by Pint Authors, see AUTHORS for more details.
# Source: https://physics.nist.gov/cuu/Constants/
# https://physics.nist.gov/PhysRefData/XrayTrans/Html/search.html
# :copyright: 2013,2019 by Pint Authors, see AUTHORS for more details.

ln10 = 2.302585092994046
#### MATHEMATICAL CONSTANTS ####
# As computed by Maxima with fpprec:50

speed_of_light = 299792458 * meter / second = c
standard_gravity = 9.806650 * meter / second ** 2 = g_0 = g_n = gravity
vacuum_permeability = 4 * pi * 1e-7 * newton / ampere ** 2 = mu_0 = magnetic_constant
vacuum_permittivity = 1 / (mu_0 * c **2 ) = epsilon_0 = electric_constant
impedance_of_free_space = mu_0 * c = Z_0 = characteristic_impedance_of_vacuum
#pi = 3.1415926535897932384626433832795028841971693993751 = π # pi
tansec = 4.8481368111333441675396429478852851658848753880815e-6 # tangent of 1 arc-second ~ arc_second/radian
ln10 = 2.3025850929940456840179914546843642076011014886288 # natural logarithm of 10
wien_x = 4.9651142317442763036987591313228939440555849867973 # solution to (x-5)*exp(x)+5 = 0 => x = W(5/exp(5))+5
wien_u = 2.8214393721220788934031913302944851953458817440731 # solution to (u-3)*exp(u)+3 = 0 => u = W(3/exp(3))+3

# 0.000 000 29 e-34
planck_constant = 6.62606957e-34 J s = h
hbar = planck_constant / (2 * pi) = ħ
#### DEFINED EXACT CONSTANTS ####

# 0.000 80 e-11
newtonian_constant_of_gravitation = 6.67384e-11 m^3 kg^-1 s^-2
speed_of_light = 299792458 m/s = c = c_0 # since 1983
planck_constant = 6.62607015e-34 J s = h # since May 2019
elementary_charge = 1.602176634e-19 C = e # since May 2019
avogadro_number = 6.02214076e23 # since May 2019
boltzmann_constant = 1.380649e-23 J K^-1 = k = k_B # since May 2019
standard_gravity = 9.80665 m/s^2 = g_0 = g0 = g_n = gravity # since 1901
standard_atmosphere = 1.01325e5 Pa = atm = atmosphere # since 1954
conventional_josephson_constant = 4.835979e14 Hz / V = K_J90 # since Jan 1990
conventional_von_klitzing_constant = 2.5812807e4 ohm = R_K90 # since Jan 1990

# 0.000 000 035 e-19
# elementary_charge = 1.602176565e-19 C = e
#### DERIVED EXACT CONSTANTS ####
# Floating-point conversion may introduce inaccuracies

# 0.000 0075
molar_gas_constant = 8.3144621 J mol^-1 K^-1 = R
zeta = c / (cm/s) = ζ
dirac_constant = h / (2 * π) = ħ = hbar = atomic_unit_of_action = a_u_action
avogadro_constant = avogadro_number * mol^-1 = N_A
molar_gas_constant = k * N_A = R
faraday_constant = e * N_A
conductance_quantum = 2 * e ** 2 / h = G_0
magnetic_flux_quantum = h / (2 * e) = Φ_0 = Phi_0
josephson_constant = 2 * e / h = K_J
von_klitzing_constant = h / e ** 2 = R_K
stefan_boltzmann_constant = 2 / 15 * π ** 5 * k ** 4 / (h ** 3 * c ** 2) = σ = sigma
first_radiation_constant = 2 * π * h * c ** 2 = c_1
second_radiation_constant = h * c / k = c_2
wien_wavelength_displacement_law_constant = h * c / (k * wien_x)
wien_frequency_displacement_law_constant = wien_u * k / h

# 0.000 000 0024 e-3
fine_structure_constant = 7.2973525698e-3
#### MEASURED CONSTANTS ####
# Recommended CODATA-2018 values
# To some extent, what is measured and what is derived is a bit arbitrary.
# The choice of measured constants is based on convenience and on available uncertainty.
# The uncertainty in the last significant digits is given in parentheses as a comment.

# 0.000 000 27 e23
avogadro_number = 6.02214129e23 mol^-1 = N_A
newtonian_constant_of_gravitation = 6.67408e-11 m^3/(kg s^2) = _ = gravitational_constant # (15)
rydberg_constant = 1.0973731568160e7 * m^-1 = R_∞ = R_inf # (21)
electron_g_factor = -2.00231930436256 = g_e # (35)
atomic_mass_constant = 1.66053906660e-27 kg = m_u # (50)
electron_mass = 9.1093837015e-31 kg = m_e = atomic_unit_of_mass = a_u_mass # (28)
proton_mass = 1.67262192369e-27 kg = m_p # (51)
neutron_mass = 1.67492749804e-27 kg = m_n # (95)
lattice_spacing_of_Si = 1.920155716e-10 m = d_220 # (32)
K_alpha_Cu_d_220 = 0.80232719 # (22)
K_alpha_Mo_d_220 = 0.36940604 # (19)
K_alpha_W_d_220 = 0.108852175 # (98)

# 0.000 0013 e-23
boltzmann_constant = 1.3806488e-23 J K^-1 = k
#### DERIVED CONSTANTS ####

# 0.000 021 e-8
stefan_boltzmann_constant = 5.670373e-8 W m^-2 K^-4 = σ

# 0.000 0053 e10
wien_frequency_displacement_law_constant = 5.8789254e10 Hz K^-1

# 0.000 055
rydberg_constant = 10973731.568539 m^-1

# 0.000 000 40 e-31
electron_mass = 9.10938291e-31 kg = m_e

# 0.000 000 074 e-27
neutron_mass = 1.674927351e-27 kg = m_n

# 0.000 000 074 e-27
proton_mass = 1.672621777e-27 kg = m_p
fine_structure_constant = (2 * h * R_inf / (m_e * c)) ** 0.5 = α = alpha
vacuum_permeability = 2 * α * h / (e ** 2 * c) = µ_0 = mu_0 = mu0 = magnetic_constant
vacuum_permittivity = e ** 2 / (2 * α * h * c) = ε_0 = epsilon_0 = eps_0 = eps0 = electric_constant
impedance_of_free_space = 2 * α * h / e ** 2 = Z_0 = characteristic_impedance_of_vacuum
coulomb_constant = α * hbar * c / e ** 2 = k_C
classical_electron_radius = α * hbar / (m_e * c) = r_e
thomson_cross_section = 8 / 3 * π * r_e ** 2 = σ_e = sigma_e
Loading

0 comments on commit b5127a2

Please sign in to comment.