Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Constants and physical conventions

Use this page when a calculation depends on a physical constant, an astronomical conversion scale, or the distinction between a nominal convention and a measured property.

Representation contract

Contract fieldCurrent representation
Mathematical objectScalar physical constants and named conversion scales used as coefficients in scientific relations.
Physical conventionCGS unless a symbol explicitly names another unit; CODATA 2018, revised-SI exact values, IAU nominal conversions, and cited photometric conventions are distinguished.
Runtime ownerjaxstro.constants owns raw numeric values and their source comments.
Shape and unit policyPublic values are scalar Python numbers; units are encoded by symbol names and documentation rather than a runtime Quantity wrapper.
Transform boundaryConstants may appear inside jit, vmap, and grad, but they are static coefficients rather than differentiated inputs.
EvidenceSource-backed cards in Constants and unit conventions and constant tests check values, derivations, and stored-precision identities.
Downstream interpretation boundaryA constant does not select a domain unit system, define code units, or establish that a model using it is scientifically valid.

Coefficients need conventions

A number becomes interpretable only after its unit and authority are known. For example, Newtonian gravity in CGS uses

F=Gm1m2r2,[G]=cm3g1s2.F = G\frac{m_1m_2}{r^2}, \qquad [G] = \mathrm{cm^3\,g^{-1}\,s^{-2}}.

G_CGS is therefore compatible with masses in grams, lengths in centimeters, and times in seconds. Substituting a value expressed in another unit system without a conversion produces a numerically valid array and a physically invalid calculation.

Selected conventions include:

See (1) when checking that a kernel’s base units match the constant it consumes.

Raw constants and quantity constants

jaxstro.constants remains the backwards-compatible raw-CGS surface. The separate jaxstro.quantity.constants module wraps selected values in explicit units and attaches inspectable metadata:

from jaxstro import constants as C
import jaxstro.quantity as q

raw_g = C.G_CGS
typed_g = q.constants.G
source = q.constants.metadata("G")

The two surfaces answer different boundary needs. Raw constants keep inner kernels small; quantity constants make dimensional checks explicit at public boundaries.

Shape, transforms, and evidence

The values are scalar and broadcast according to ordinary JAX rules when combined with arrays. Gradients flow through variables around a constant, but there is no runtime uncertainty model for the coefficient itself. If a research question treats a constant as uncertain, the caller must represent that uncertain parameter explicitly rather than differentiate with respect to a module-level literal.

The generated source cards identify exact sources, stored values, derivations, code locations, and assertion-bearing tests. They do not prove the scientific adequacy of every downstream equation that imports the constants.