常量 (pi, inf, 光速, …)
datum::pi π, the ratio of any circle’s circumference to its diameter 圆周率datum::inf ∞, infinity 无穷大datum::nan “not a number” (NaN); 注意: NaN is not equal to anything, even itself 非数字
datum::e base of the natural logarithm 自然常数datum::sqrt2 square root of 2datum::sqrt2pi square root of 2πdatum::eps machine epsilon: the difference between 1 and the value least greater than 1 that is representable (type and machine dependent)
datum::log_min log of minimum non-zero value (type and machine dependent)datum::log_max log of maximum value (type and machine dependent)datum::euler Euler’s constant, aka Euler-Mascheroni constant
datum::gratio golden ratiodatum::m_u atomic mass constant (in kg)datum::N_A Avogadro constant
datum::k Boltzmann constant (in joules per kelvin)datum::k_evk Boltzmann constant (in eV/K)datum::a_0 Bohr radius (in meters)
datum::mu_B Bohr magnetondatum::Z_0 characteristic impedance of vacuum (in ohms)datum::G_0 conductance quantum (in siemens)
datum::k_e Coulomb’s constant (in meters per farad)datum::eps_0 electric constant (in farads per meter)datum::m_e 电子质量 (in kg)
datum::eV 电子伏 (in joules)datum::ec 元电荷 (in coulombs)datum::F 法拉第常数 (in coulombs)
datum::alpha fine-structure constantdatum::alpha_inv inverse fine-structure constantdatum::K_J 约瑟夫逊常数
datum::mu_0 magnetic constant (in henries per meter)datum::phi_0 magnetic flux quantum (in webers)datum::R 摩尔气体常数 (in joules per mole kelvin)
datum::G 牛顿万有引力常数 (in newton square meters per kilogram squared)datum::h 普朗克常数 (in joule seconds)datum::h_bar Planck constant over 2 pi, aka reduced Planck constant (in joule seconds)
datum::m_p 质子质量 (kg)datum::R_inf Rydberg constant (in reciprocal meters)datum::c_0 真空中光速 (m/s)
datum::sigma Stefan-Boltzmann constant 斯忒藩-玻耳兹曼常数,σ=5.67×10-8W/(m2·K4)datum::R_k von Klitzing constant (in ohms)datum::b Wien wavelength displacement law constant
The constants are stored in the Datum\ class, where type is either float or double;
for convenience, Datum\ is typedefed as datum, and Datum\ is typedefed as fdatum
注意: datum::nan is not equal to anything, even itself; to check whether a scalar x is finite, use std::isfinite(x)
The physical constants were mainly taken from NIST 2018 CODATA values, and some from WolframAlpha (as of 2009-06-23)
示例代码如下:
cout << "2.0 * pi = " << 2.0 * datum::pi << endl;
cout << "speed of light = " << datum::c_0 << endl;
cout << "log_max for floats = ";
cout << fdatum::log_max << endl;
cout << "log_max for doubles = ";
cout << datum::log_max << endl;
运行结果:
Armadillo version: 9.900.1 (Nocturnal Misbehaviour)
2.0 * pi = 6.28319
speed of light = 2.99792e+008
log_max for floats = 88.7228
log_max for doubles = 709.783
请按任意键继续. . .