Expand description
Physical constants as dimension-typed symbolic expressions. Physical constants as dimension-typed symbolic expressions.
Each constant displays as its standard symbol (e.g., “c” for speed of light) and evaluates to its exact value when numerical evaluation is requested. All values are exact — defined by the 2019 SI redefinition or by international agreement.
§Examples
use symplex::prelude::*;
use symplex::units::*;
use symplex::units::constants;
let ctx = Context::new();
let c = constants::speed_of_light(&ctx);
let m = Mass::symbol(&ctx, "m");
let energy = Energy::from_ex(m.inner() * c.inner() * c.inner()); // E = mc²
// Displays symbolically, not as "89875517873681764*m"
assert_eq!(format!("{}", energy.inner()), "m*c^2");Functions§
- avogadro_
constant - Avogadro constant: N_A = 6.02214076 × 10²³ mol⁻¹ (exact since 2019 SI redefinition).
- boltzmann_
constant - Boltzmann constant: k_B = 1.380649 × 10⁻²³ J/K (exact since 2019 SI redefinition).
- elementary_
charge - Elementary charge: e = 1.602176634 × 10⁻¹⁹ C (exact since 2019 SI redefinition).
- gravitational_
constant - Newtonian gravitational constant: G ≈ 6.67430 × 10⁻¹¹ m³/(kg·s²).
- physical_
constants_ dimmap - Pre-built dimension map containing all physical constants.
- planck_
constant - Planck constant: h = 6.62607015 × 10⁻³⁴ J·s (exact since 2019 SI redefinition).
- reduced_
planck_ constant - Reduced Planck constant: ℏ = h/(2π) (exact).
- speed_
of_ light - Speed of light in vacuum: c = 299,792,458 m/s (exact since 2019 SI redefinition).
- standard_
gravity - Standard acceleration of gravity: g₀ = 9.80665 m/s² (exact by definition, 1901).