The King suite verifies the lowered-isothermal Poisson ODE integration, the
lowered-Maxwellian volume density (the 3-D density entering the Poisson
source, distinct from the projected King K-function), and the matched velocity
DF. Test file: tests/validation/test_king_physics.py (see the
test dashboard for the live per-suite count); figures:
scripts/validate_king.py.
What is verified¶
Each row maps to one or more assertions in test_king_physics.py. The
Tolerance is the exact bound the test enforces; the Measured value is
regenerated by scripts/validate_king.py (which prints an expected-vs-measured
PASS/FAIL table for every figure).
Property | Tolerance (as tested) | Measured | Anchor |
|---|---|---|---|
ODE boundary condition | 0.0 (exact) | King’s dimensionless Poisson equation | |
Concentration , –15 | abs | max | King (1966) Table II |
Volume density shape | max rel | oracle | |
Tidal truncation () | 100% | 100% | self-consistent from |
Velocity boundedness () | 100% | 100.00% | lowered-Maxwellian on |
Velocity isotropy | rel spread | isotropic DF | |
Dispersion profile | rel per bin | max rel | analytic lowered-Maxwellian 2nd moment |
Unscaled virial ratio | 0.505 (no rescale) | ||
DF sampling differentiability () | AD central-FD | rel err |
|
Figures¶
Generated by scripts/validate_king.py (prints expected-vs-measured PASS/FAIL
for every panel). Each figure recomputes the same quantities the tests assert.

Figure 1:Concentration relation. progenax (line) on King (1966) Table II (open circles) across the full tabulated range –15. Residuals (panel b) stay within the band — max . requires enlarging the ODE domain beyond the package default (see What this suite does not test); the figure does so per row.

Figure 2:Volume density vs an independent oracle (). KingProfile.density
(dashed) coincides with the “King DF integral” — the direct velocity-space
integral of the defining DF, computed
independently (solid) — and with the sample (points) to
max rel (panel b). This confirms the lowered-Maxwellian
volume density
is the form used in the Poisson source.

Figure 3:Velocity-space equilibrium (). (a) Sampled on the analytic King 2nd moment (per-bin rel ). (b) Every velocity satisfies — 100% bound. (c) The unscaled IC sits at virial : the matched lowered-Maxwellian DF is a true equilibrium with no external rescale.

Figure 4:Table-routed speed draws vs the exact quadrature oracle (,
). Since the 2026-06 memory batch, KingVelocityDF draws
speeds from a precomputed CDF table by default (SpeedCDFTable at —
the exact King reduction , identity-test guarded); the
per-star quadrature is retained as speed_method="quadrature". The two
distributions are variate-paired and statistically indistinguishable (KS
, gate ; moment ratios to ). Script:
scripts/validate_speed_routing.py; see
performance & memory.

Figure 5:Concentration sweep. Normalized density for ; dotted lines and
floor markers give each model’s natural , matching King (1966)
Table II (). Higher ⇒ more extended, more
concentrated. from_W0_rc auto-sizes the ODE domain from , so the full
tabulated range (to , ) integrates without a manual
xi_max.
Differentiability¶
The King IC pipeline is built for gradient-based inference: the model observables a likelihood uses — the density profile and the velocity scale — are differentiable w.r.t. the structural parameters that one fits to data.

Figure 6:Gradient validation (autodiff vs central finite difference). for each structural parameter : (a) core radius , (b) concentration , (c) total mass . Autodiff (line) and finite difference (circles) agree to max rel.\ err across the parameter range — so can be inferred jointly by gradient descent or HMC.
What is differentiable in the King model.
Parameter | Differentiable? | Notes |
|---|---|---|
(core radius) | ✅ machine precision | The spatial scale; gradients flow through positions, density, and velocities. |
(total mass) | ✅ machine precision | Sets the velocity scale . |
(concentration) | ✅ (profile observables) | Flows through the |
(scalar tidal radius) | ✅ (zero-crossing slope) | is finite and exact — the unclamped crossing carries the implicit-function-theorem slope (the original silent-zero hazard was found and fixed by the gradient audit). Verified AD-vs-FD to ( at , ). |
How to run¶
# physics tests (~30 s on CPU; ODE integration dominates)
pytest tests/validation/test_king_physics.py -v
# regenerate the five figures with PASS/FAIL tables
python scripts/validate_king.pyWhat this suite does not test¶
Multi-mass / anisotropic / rotating King — out of scope here. These are the generalizations formalized by Gieles & Zocchi (2015); progenax will implement them natively as its own differentiable lowered-model family (see the roadmap), rather than depending on an external package.
References¶
King (1966) is the original (Table II concentrations transcribed verbatim in the per-paper note). Theory and the factor-of-9 ODE derivation are at King profile; the lowered-Maxwellian DF at King velocity distribution functions.
- King, I. R. (1966). The structure of star clusters. III. Some simple dynamical models. The Astronomical Journal, 71, 64–75. 10.1086/109857
- Gieles, M., & Zocchi, A. (2015). A family of lowered isothermal models. Monthly Notices of the Royal Astronomical Society, 454, 576–592. 10.1093/mnras/stv1848