rs-core

Core utilities


Project maintained by CaptainCrowbar Hosted on GitHub Pages — Theme by mattgraham

Physical constants

Core utility library by Ross Smith

#include "rs-core/constants.hpp"
namespace RS;

Contents

Introduction

All of the constants defined here follow the conventions of the standard <numbers> header. Each constant is defined in two forms:

constexpr double name = [value as double];
template <std::floating_point T> constexpr T name_v = [value as T];

For the physical and astronomical constants, long and short versions of the constant names are provided. The short names (but not the full names) are in the RS::Constants sub-namespace to avoid name collisions when the symbols are not needed.

The values quoted here are illustrative, mostly quoted to 4 significant figures. The values actually supplied in the header are accurate to the precision of the type or to the best known precision, whichever is appropriate.

Conversion factors

Constant Value
arcsec 4.848×10-6 rad
arcmin 2.909×10-4 rad
degree 0.01745 rad
inch 0.0254 m
foot 0.3048 m
yard 0.9144 m
mile 1609 m
nautical_mile 1852 m
ounce 0.02835 kg
pound 0.4536 kg
short_ton 907.2 kg
long_ton 1016 kg
pound_force 4.448 N
erg 10-7 J
foot_pound 1.356 J
calorie 4.184 J
kilocalorie 4184 J
ton_tnt 4.184×109 J
horsepower 745.7 W
mmHg 133.3 Pa
atmosphere 101300 Pa
zero_celsius 273.15 K

Physical constants

Sources:

Values related to quantity of substance are given in kilomoles to avoid intrusive factors of 1000 in expressions.

Constant Symbol Value
alpha_particle_mass m_alpha 6.645×10-27 kg
atomic_mass_constant m_u 1.661×10-27 kg
avogadro_constant N_A 6.022×1026 kmol-1
boltzmann_constant k 1.381×10-23 J/K
electron_mass m_e 9.109×10-31 kg
elementary_charge ec 1.602×10-19 C
fine_structure_constant alpha 7.297×10-3 dimensionless
first_radiation_constant c_1 3.742×10-16 W m2
gravitational_constant G 6.674×10-11 m3 kg-1 s-2
josephson_constant K_J 4.836×1014 Hz V-1
molar_gas_constant R 8314 J kmol-1 K-1
neutron_mass m_n 1.675×10-27 kg
planck_constant h 6.626×10-34 J s
proton_mass m_p 1.673×10-27 kg
rydberg_constant R_inf 1.097×107 m-1
second_radiation_constant c_2 0.01439×10-2 m K
speed_of_light c 2.998×108 m/s
stefan_boltzmann_constant sigma 5.670×10-8 W m-2 K-4
vacuum_impedance Z_0 376.7 Ω
vacuum_permeability mu_0 1.257×10-6 N A-2
vacuum_permittivity epsilon_0 8.854×10-12 F m-1
von_klitzing_constant R_K 25810 Ω
wien_constant b_W 2.898×10-3 m K

Astronomical constants

Sources:

Constant Symbol Value
astronomical_unit au 1.496×1011 m
light_year ly 9.461×1015 m
parsec pc 3.086×1016 m
earth_mass M_earth 5.972×1024 kg
earth_radius R_earth 6.378×106 m
standard_gravity g_0 9.807 m s-2
julian_day jd 86400 s
sidereal_day d_sid 86160 s
tropical_year y_trop 3.156×107 s
julian_year jy 3.156×107 s
sidereal_year y_sid 3.156×107 s
lunar_mass M_moon 7.346×1022 kg
lunar_radius R_moon 1.738×106 m
lunar_distance a_moon 3.844×108 m
sidereal_month sid_mon 2.361×106 s
synodic_month syn_mon 2.551×106 s
jupiter_mass M_jup 1.899×1027 kg
jupiter_radius R_jup 7.149×107 m
solar_mass M_sun 1.988×1030 kg
solar_radius R_sun 6.957×108 m
solar_temperature T_sun 5772 K
solar_luminosity L_sun 3.828×1026 W
solar_visual_magnitude Mv_sun 4.81 mag
solar_bolometric_magnitude Mbol_sun 4.74 mag
solar_bolometric_correction BC_sun -0.07 mag
bolometric_luminosity_constant L_0 3.013×1028 W
age_of_universe t_0 4.351×1017 s