"""The seven constants that define the SI, and what they make of a metre and a second.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from labkit import Q, const, versions # noqa: E402 print("computed:", versions()) print() print("The seven defining constants of the SI (exact by definition since 20 May 2019)") rows = [ ("caesium frequency", "delta_nu_Cs", f"{const.delta_nu_Cs.magnitude:,.0f} Hz", "the second"), ("speed of light", "c", f"{const.c.magnitude:,.0f} m/s", "the metre"), ("Planck constant", "h", f"{const.h.magnitude:.8e} J s", "the kilogram"), ("elementary charge", "e", f"{const.e.magnitude:.9e} C", "the ampere"), ("Boltzmann constant", "k", f"{const.k_B.magnitude:.6e} J/K", "the kelvin"), ("Avogadro constant", "N_A", f"{const.N_A.magnitude:.8e} /mol", "the mole"), ("luminous efficacy", "K_cd", f"{const.K_cd.magnitude:.0f} lm/W", "the candela"), ] for name, sym, value, unit in rows: print(f" {name:<20} {sym:<12} {value:>24} fixes {unit}") print() second = (1 / const.delta_nu_Cs).to("s") print("One second is 9,192,631,770 ticks of the caesium clock;") print(f" one tick lasts {second.to('ps').magnitude:.4f} ps") metre_time = (Q(1, "m") / const.c).to("ns") print("One metre is the distance light travels in 1/299,792,458 of a second:") print(f" that is {metre_time.magnitude:.4f} ns") ns_light = (const.c * Q(1, "ns")).to("cm") print(f"In one nanosecond light travels {ns_light.magnitude:.2f} cm = {ns_light.to('inch').magnitude:.2f} inches") print() drift = Q(50, "microgram") print("Le Grand K and its copies drifted apart by about 50 micrograms in a century:") print(f" 50 micrograms out of 1 kilogram = {(drift / Q(1, 'kg')).to('dimensionless').magnitude:.0e} of the whole") print(f" = {(drift / Q(1, 'kg')).to('dimensionless').magnitude * 1e8:.0f} parts in a hundred million")