Skip to main content

Module constants

Module constants 

Source
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).