unit/constant: update the values and uncertainties for 2018 CODATA

This commit is contained in:
Dan Kortschak
2019-12-23 20:06:52 +10:30
parent 99c9c9662f
commit 9ee9ca86f4
17 changed files with 76 additions and 79 deletions

View File

@@ -9,5 +9,5 @@ package constant
import "gonum.org/v1/gonum/unit"
// AtomicMass is the atomic mass constant (mᵤ), one twelfth of the mass of an unbound atom of carbon-12 at rest and in its ground state.
// The dimension of AtomicMass is kg. The standard uncertainty of the constant is 2e-35 kg.
const AtomicMass = unit.Mass(1.66053904e-27)
// The dimension of AtomicMass is kg. The standard uncertainty of the constant is 5e-37 kg.
const AtomicMass = unit.Mass(1.6605390666e-27)

View File

@@ -13,8 +13,8 @@ import (
)
// Avogadro is the Avogadro constant (A), the number of constituent particles contained in one mole of a substance.
// The dimension of Avogadro is mol^-1. The standard uncertainty of the constant is 7.4e+15 mol^-1.
const Avogadro = avogadroUnits(6.022140857e+23)
// The dimension of Avogadro is mol^-1. The constant is exact.
const Avogadro = avogadroUnits(6.02214076e+23)
type avogadroUnits float64

View File

@@ -16,13 +16,13 @@ func TestAvogadroFormat(t *testing.T) {
format string
want string
}{
{"%v", "6.022140857e+23 mol^-1"},
{"%v", "6.02214076e+23 mol^-1"},
{"%.1v", "6e+23 mol^-1"},
{"%50.1v", " 6e+23 mol^-1"},
{"%50v", " 6.022140857e+23 mol^-1"},
{"%1v", "6.022140857e+23 mol^-1"},
{"%#v", "constant.avogadroUnits(6.022140857e+23)"},
{"%s", "%!s(constant.avogadroUnits=6.022140857e+23 mol^-1)"},
{"%50v", " 6.02214076e+23 mol^-1"},
{"%1v", "6.02214076e+23 mol^-1"},
{"%#v", "constant.avogadroUnits(6.02214076e+23)"},
{"%s", "%!s(constant.avogadroUnits=6.02214076e+23 mol^-1)"},
} {
got := fmt.Sprintf(test.format, Avogadro)
if got != test.want {

View File

@@ -13,8 +13,8 @@ import (
)
// Boltzmann is the Boltzmann constant (k), it relates the average relative kinetic energy of particles in a gas with the temperature of the gas.
// The dimensions of Boltzmann are kg m^2 K^-1 s^-2. The standard uncertainty of the constant is 7.9e-30 kg m^2 K^-1 s^-2.
const Boltzmann = boltzmannUnits(1.38064852e-23)
// The dimensions of Boltzmann are kg m^2 K^-1 s^-2. The constant is exact.
const Boltzmann = boltzmannUnits(1.380649e-23)
type boltzmannUnits float64

View File

@@ -16,13 +16,13 @@ func TestBoltzmannFormat(t *testing.T) {
format string
want string
}{
{"%v", "1.38064852e-23 kg m^2 K^-1 s^-2"},
{"%v", "1.380649e-23 kg m^2 K^-1 s^-2"},
{"%.1v", "1e-23 kg m^2 K^-1 s^-2"},
{"%50.1v", " 1e-23 kg m^2 K^-1 s^-2"},
{"%50v", " 1.38064852e-23 kg m^2 K^-1 s^-2"},
{"%1v", "1.38064852e-23 kg m^2 K^-1 s^-2"},
{"%#v", "constant.boltzmannUnits(1.38064852e-23)"},
{"%s", "%!s(constant.boltzmannUnits=1.38064852e-23 kg m^2 K^-1 s^-2)"},
{"%50v", " 1.380649e-23 kg m^2 K^-1 s^-2"},
{"%1v", "1.380649e-23 kg m^2 K^-1 s^-2"},
{"%#v", "constant.boltzmannUnits(1.380649e-23)"},
{"%s", "%!s(constant.boltzmannUnits=1.380649e-23 kg m^2 K^-1 s^-2)"},
} {
got := fmt.Sprintf(test.format, Boltzmann)
if got != test.want {

View File

@@ -13,7 +13,7 @@ import (
)
// ElectricConstant is the electric constant (ε₀), the value of the absolute dielectric permittivity of classical vacuum.
// The dimensions of ElectricConstant are A^2 s^4 kg^-1 m^-3. The constant is exact.
// The dimensions of ElectricConstant are A^2 s^4 kg^-1 m^-3. The standard uncertainty of the constant is 1.3e-21 A^2 s^4 kg^-1 m^-3.
const ElectricConstant = electricConstantUnits(8.854187817620389e-12)
type electricConstantUnits float64

View File

@@ -9,5 +9,5 @@ package constant
import "gonum.org/v1/gonum/unit"
// ElementaryCharge, is the elementary charge constant (e), the magnitude of electric charge carried by a single proton or electron.
// The dimensions of ElementaryCharge are A s. The standard uncertainty of the constant is 9.8e-28 A s.
const ElementaryCharge = unit.Charge(1.6021766208e-19)
// The dimensions of ElementaryCharge are A s. The constant is exact.
const ElementaryCharge = unit.Charge(1.602176634e-19)

View File

@@ -13,8 +13,8 @@ import (
)
// Faraday is the Faraday constant, the magnitude of electric charge per mole of electrons.
// The dimensions of Faraday are A s mol^-1. The standard uncertainty of the constant is 0.00059 A s mol^-1.
const Faraday = faradayUnits(96485.33289)
// The dimensions of Faraday are A s mol^-1. The constant is exact.
const Faraday = faradayUnits(96485.33212)
type faradayUnits float64

View File

@@ -16,13 +16,13 @@ func TestFaradayFormat(t *testing.T) {
format string
want string
}{
{"%v", "96485.33289 A s mol^-1"},
{"%v", "96485.33212 A s mol^-1"},
{"%.1v", "1e+05 A s mol^-1"},
{"%50.1v", " 1e+05 A s mol^-1"},
{"%50v", " 96485.33289 A s mol^-1"},
{"%1v", "96485.33289 A s mol^-1"},
{"%#v", "constant.faradayUnits(96485.33289)"},
{"%s", "%!s(constant.faradayUnits=96485.33289 A s mol^-1)"},
{"%50v", " 96485.33212 A s mol^-1"},
{"%1v", "96485.33212 A s mol^-1"},
{"%#v", "constant.faradayUnits(96485.33212)"},
{"%s", "%!s(constant.faradayUnits=96485.33212 A s mol^-1)"},
} {
got := fmt.Sprintf(test.format, Faraday)
if got != test.want {

View File

@@ -8,5 +8,5 @@ package constant
import "gonum.org/v1/gonum/unit"
// FineStructure is the fine structure constant (α), it describes the strength of the electromagnetic interaction between elementary charged particles. The standard uncertainty of the constant is 1.7e-12 .
const FineStructure = unit.Dimless(0.0072973525664)
// FineStructure is the fine structure constant (α), it describes the strength of the electromagnetic interaction between elementary charged particles. The standard uncertainty of the constant is 1.1e-12 .
const FineStructure = unit.Dimless(0.0072973525693)

View File

@@ -19,58 +19,55 @@ import (
)
const (
elementaryCharge = 1.6021766208e-19
fineStructure = 7.2973525664e-3
elementaryCharge = 1.602176634e-19
fineStructure = 7.2973525693e-3
lightSpeed = 2.99792458e8
planck = 6.626070040e-34
planck = 6.62607015e-34
)
var constants = []Constant{
{
Name: "AtomicMass", Value: 1.660539040e-27,
Name: "AtomicMass", Value: 1.66053906660e-27,
Dimensions: []Dimension{{massName, 1}},
Comment: "AtomicMass is the atomic mass constant (mᵤ), one twelfth of the mass of an unbound atom of carbon-12 at rest and in its ground state.",
Uncertainty: 0.000000020e-27,
Uncertainty: 0.00000000050e-27,
},
{
Name: "Avogadro", Value: 6.022140857e23,
Dimensions: []Dimension{{moleName, -1}},
Comment: "Avogadro is the Avogadro constant (A), the number of constituent particles contained in one mole of a substance.",
Uncertainty: 0.000000074e23,
Name: "Avogadro", Value: 6.02214076e23,
Dimensions: []Dimension{{moleName, -1}},
Comment: "Avogadro is the Avogadro constant (A), the number of constituent particles contained in one mole of a substance.",
},
{
Name: "Boltzmann", Value: 1.38064852e-23,
Dimensions: []Dimension{{massName, 1}, {lengthName, 2}, {timeName, -2}, {temperatureName, -1}},
Comment: "Boltzmann is the Boltzmann constant (k), it relates the average relative kinetic energy of particles in a gas with the temperature of the gas.",
Uncertainty: 0.00000079e-23,
Name: "Boltzmann", Value: 1.380649e-23,
Dimensions: []Dimension{{massName, 1}, {lengthName, 2}, {timeName, -2}, {temperatureName, -1}},
Comment: "Boltzmann is the Boltzmann constant (k), it relates the average relative kinetic energy of particles in a gas with the temperature of the gas.",
},
{
Name: "ElectricConstant", Value: 1 / (4 * math.Pi * 1e-7 * lightSpeed * lightSpeed),
Dimensions: []Dimension{{currentName, 2}, {timeName, 4}, {massName, -1}, {lengthName, -3}},
Comment: "ElectricConstant is the electric constant (ε₀), the value of the absolute dielectric permittivity of classical vacuum.",
Dimensions: []Dimension{{currentName, 2}, {timeName, 4}, {massName, -1}, {lengthName, -3}},
Comment: "ElectricConstant is the electric constant (ε₀), the value of the absolute dielectric permittivity of classical vacuum.",
Uncertainty: 0.0000000013e-12,
},
{
Name: "ElementaryCharge", Value: elementaryCharge,
Dimensions: []Dimension{{currentName, 1}, {timeName, 1}},
Comment: "ElementaryCharge, is the elementary charge constant (e), the magnitude of electric charge carried by a single proton or electron.",
Uncertainty: 0.0000000098e-19,
Dimensions: []Dimension{{currentName, 1}, {timeName, 1}},
Comment: "ElementaryCharge, is the elementary charge constant (e), the magnitude of electric charge carried by a single proton or electron.",
},
{
Name: "Faraday", Value: 96485.33289,
Dimensions: []Dimension{{currentName, 1}, {timeName, 1}, {moleName, -1}},
Comment: "Faraday is the Faraday constant, the magnitude of electric charge per mole of electrons.",
Uncertainty: 0.00059,
Name: "Faraday", Value: 96485.33212,
Dimensions: []Dimension{{currentName, 1}, {timeName, 1}, {moleName, -1}},
Comment: "Faraday is the Faraday constant, the magnitude of electric charge per mole of electrons.",
},
{
Name: "FineStructure", Value: fineStructure,
Comment: "FineStructure is the fine structure constant (α), it describes the strength of the electromagnetic interaction between elementary charged particles.",
Uncertainty: 0.0000000017e-3,
Uncertainty: 0.0000000011e-3,
},
{
Name: "Gravitational", Value: 6.67408e-11,
Name: "Gravitational", Value: 6.67430e-11,
Dimensions: []Dimension{{massName, -1}, {lengthName, 3}, {timeName, -2}},
Comment: "Gravitational is the universal gravitational constant (G), the proportionality constant connecting the gravitational force between two bodies.",
Uncertainty: 0.00031e-11,
Uncertainty: 0.00015e-11,
},
{
Name: "LightSpeedInVacuum", Value: lightSpeed,
@@ -79,14 +76,14 @@ var constants = []Constant{
},
{
Name: "MagneticConstant", Value: 2 * fineStructure * planck / (elementaryCharge * elementaryCharge * lightSpeed),
Dimensions: []Dimension{{currentName, 2}, {timeName, 4}, {massName, -1}, {lengthName, -3}},
Comment: "MagneticConstant is the magnetic constant (μ₀), the magnetic permeability in a classical vacuum.",
Dimensions: []Dimension{{currentName, 2}, {timeName, 4}, {massName, -1}, {lengthName, -3}},
Comment: "MagneticConstant is the magnetic constant (μ₀), the magnetic permeability in a classical vacuum.",
Uncertainty: 0.00000000019e-6,
},
{
Name: "Planck", Value: planck,
Dimensions: []Dimension{{massName, 1}, {lengthName, 2}, {timeName, -1}},
Comment: "Planck is the Planck constant (h), it relates the energy carried by a photon to its frequency.",
Uncertainty: 0.000000081e-34,
Dimensions: []Dimension{{massName, 1}, {lengthName, 2}, {timeName, -1}},
Comment: "Planck is the Planck constant (h), it relates the energy carried by a photon to its frequency.",
},
{
Name: "StandardGravity", Value: 9.80665,

View File

@@ -13,8 +13,8 @@ import (
)
// Gravitational is the universal gravitational constant (G), the proportionality constant connecting the gravitational force between two bodies.
// The dimensions of Gravitational are m^3 kg^-1 s^-2. The standard uncertainty of the constant is 3.1e-15 m^3 kg^-1 s^-2.
const Gravitational = gravitationalUnits(6.67408e-11)
// The dimensions of Gravitational are m^3 kg^-1 s^-2. The standard uncertainty of the constant is 1.5e-15 m^3 kg^-1 s^-2.
const Gravitational = gravitationalUnits(6.6743e-11)
type gravitationalUnits float64

View File

@@ -16,13 +16,13 @@ func TestGravitationalFormat(t *testing.T) {
format string
want string
}{
{"%v", "6.67408e-11 m^3 kg^-1 s^-2"},
{"%v", "6.6743e-11 m^3 kg^-1 s^-2"},
{"%.1v", "7e-11 m^3 kg^-1 s^-2"},
{"%50.1v", " 7e-11 m^3 kg^-1 s^-2"},
{"%50v", " 6.67408e-11 m^3 kg^-1 s^-2"},
{"%1v", "6.67408e-11 m^3 kg^-1 s^-2"},
{"%#v", "constant.gravitationalUnits(6.67408e-11)"},
{"%s", "%!s(constant.gravitationalUnits=6.67408e-11 m^3 kg^-1 s^-2)"},
{"%50v", " 6.6743e-11 m^3 kg^-1 s^-2"},
{"%1v", "6.6743e-11 m^3 kg^-1 s^-2"},
{"%#v", "constant.gravitationalUnits(6.6743e-11)"},
{"%s", "%!s(constant.gravitationalUnits=6.6743e-11 m^3 kg^-1 s^-2)"},
} {
got := fmt.Sprintf(test.format, Gravitational)
if got != test.want {

View File

@@ -13,8 +13,8 @@ import (
)
// MagneticConstant is the magnetic constant (μ₀), the magnetic permeability in a classical vacuum.
// The dimensions of MagneticConstant are A^2 s^4 kg^-1 m^-3. The constant is exact.
const MagneticConstant = magneticConstantUnits(1.2566370614692394e-06)
// The dimensions of MagneticConstant are A^2 s^4 kg^-1 m^-3. The standard uncertainty of the constant is 1.9e-16 A^2 s^4 kg^-1 m^-3.
const MagneticConstant = magneticConstantUnits(1.2566370621238374e-06)
type magneticConstantUnits float64

View File

@@ -16,13 +16,13 @@ func TestMagneticConstantFormat(t *testing.T) {
format string
want string
}{
{"%v", "1.2566370614692394e-06 A^2 s^4 kg^-1 m^-3"},
{"%v", "1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"},
{"%.1v", "1e-06 A^2 s^4 kg^-1 m^-3"},
{"%50.1v", " 1e-06 A^2 s^4 kg^-1 m^-3"},
{"%50v", " 1.2566370614692394e-06 A^2 s^4 kg^-1 m^-3"},
{"%1v", "1.2566370614692394e-06 A^2 s^4 kg^-1 m^-3"},
{"%#v", "constant.magneticConstantUnits(1.2566370614692394e-06)"},
{"%s", "%!s(constant.magneticConstantUnits=1.2566370614692394e-06 A^2 s^4 kg^-1 m^-3)"},
{"%50v", " 1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"},
{"%1v", "1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3"},
{"%#v", "constant.magneticConstantUnits(1.2566370621238374e-06)"},
{"%s", "%!s(constant.magneticConstantUnits=1.2566370621238374e-06 A^2 s^4 kg^-1 m^-3)"},
} {
got := fmt.Sprintf(test.format, MagneticConstant)
if got != test.want {

View File

@@ -13,8 +13,8 @@ import (
)
// Planck is the Planck constant (h), it relates the energy carried by a photon to its frequency.
// The dimensions of Planck are kg m^2 s^-1. The standard uncertainty of the constant is 8.1e-42 kg m^2 s^-1.
const Planck = planckUnits(6.62607004e-34)
// The dimensions of Planck are kg m^2 s^-1. The constant is exact.
const Planck = planckUnits(6.62607015e-34)
type planckUnits float64

View File

@@ -16,13 +16,13 @@ func TestPlanckFormat(t *testing.T) {
format string
want string
}{
{"%v", "6.62607004e-34 kg m^2 s^-1"},
{"%v", "6.62607015e-34 kg m^2 s^-1"},
{"%.1v", "7e-34 kg m^2 s^-1"},
{"%50.1v", " 7e-34 kg m^2 s^-1"},
{"%50v", " 6.62607004e-34 kg m^2 s^-1"},
{"%1v", "6.62607004e-34 kg m^2 s^-1"},
{"%#v", "constant.planckUnits(6.62607004e-34)"},
{"%s", "%!s(constant.planckUnits=6.62607004e-34 kg m^2 s^-1)"},
{"%50v", " 6.62607015e-34 kg m^2 s^-1"},
{"%1v", "6.62607015e-34 kg m^2 s^-1"},
{"%#v", "constant.planckUnits(6.62607015e-34)"},
{"%s", "%!s(constant.planckUnits=6.62607015e-34 kg m^2 s^-1)"},
} {
got := fmt.Sprintf(test.format, Planck)
if got != test.want {