The least well-determined physical constants

In this example we will use the scipy.constants.physical_constants dictionary to determine which are the least-accurately known constants. To do this we need the relative uncertainties in the constants' values; the code below uses a structured array to calculate these and outputs the least well-determined constants.

import numpy as np
from scipy.constants import physical_constants

def make_record(k, v):
    Return the record for this constant from the key and value of its entry
    in the physical_constants dictionary.

    name = k
    val, units, abs_unc = v
    # Calculate the relative uncertainty in ppm
    rel_unc = abs_unc / abs(val) * 1.e6
    return name, val, units, abs_unc, rel_unc

dtype = [('name', 'S50'), ('val', 'f8'), ('units', 'S20'),
         ('abs_unc', 'f8'), ('rel_unc', 'f8')]
constants = np.array([make_record(k, v) for k,v in physical_constants.items()],
                     dtype=dtype )

# List the 10 constants with the largest relative uncertainties
for rec in constants[::-1][:10]:
    print('{:.0f} ppm: {:s} = {:g} {:s}'.format(rec['rel_unc'],
              rec['name'].decode(), rec['val'], rec['units'].decode()))

The output is shown below. Note that $G$ is not known to better than about 120 ppm.

9447 ppm: weak mixing angle = 0.2223 
5812 ppm: proton rms charge radius = 8.775e-16 m
980 ppm: deuteron rms charge radius = 2.1424e-15 m
545 ppm: proton magn. shielding correction = 2.5694e-05 
545 ppm: proton mag. shielding correction = 2.5694e-05 
120 ppm: Newtonian constant of gravitation = 6.67384e-11 m^3 kg^-1 s^-2
119 ppm: Newtonian constant of gravitation over h-bar c = 6.70837e-39 (GeV/c^2)^-2
92 ppm: tau mass = 3.16747e-27 kg
91 ppm: tau mass energy equivalent = 2.84678e-10 J
91 ppm: proton-tau mass ratio = 0.528063