ucon.constants¶
Physical constants with CODATA 2022 uncertainties.
ucon.constants¶
Physical constants with CODATA 2022 uncertainties.
The 2019 SI redefinition made 7 constants exact by definition. Measured constants carry uncertainties that propagate through calculations.
Examples¶
from ucon.constants import c, h, G from ucon import units
E = mc²¶
mass = units.kilogram(1) energy = mass * c ** 2 energy.dimension Dimension.energy
E = hν (photon energy)¶
frequency = units.hertz(5e14) energy = h * frequency
Gravitational force (uncertainty propagates)¶
F = G * units.kilogram(1) * units.kilogram(1) / units.meter(1) ** 2 F.uncertainty is not None True
Constant
dataclass
¶
A physical constant with CODATA uncertainty.
Attributes¶
symbol : str Standard symbol (e.g., "c", "h", "G"). name : str Full name (e.g., "speed of light in vacuum"). value : float Numeric value in SI units. unit : Unit | UnitProduct SI unit of the constant. uncertainty : float | None Standard uncertainty. None indicates exact (by definition). source : str Data source (default: "CODATA 2022"). category : str Category: "exact", "derived", "measured", or "session".
Examples¶
from ucon.constants import speed_of_light speed_of_light.symbol 'c' speed_of_light.is_exact True speed_of_light.as_number() <299792458 m/s>
all_constants()
¶
get_constant_by_symbol(symbol)
¶
Look up a constant by symbol or alias.
Parameters¶
symbol : str Symbol to look up (e.g., "c", "h", "G", "hbar", "ℏ").
Returns¶
Constant | None The matching constant, or None if not found.
Examples¶
from ucon.constants import get_constant_by_symbol c = get_constant_by_symbol("c") c.name 'speed of light in vacuum' get_constant_by_symbol("hbar").symbol 'ℏ'
__getattr__(name)
¶
Lazy attribute access for constants and aliases.