Evaluates an SPK Type 21 (Extended Modified Difference Array) record.
This is a pure-Elixir transliteration of the SPICELIB spke21.f routine
(Fred Krogh's DAINT algorithm). The Python reference implementation is
whiskie14142/spktype21, which itself was translated from the FORTRAN source.
Algorithm overview
Given a reference epoch TL and query epoch ET, the algorithm evaluates position and velocity by:
- Computing delta = ET - TL.
- Building the FC (forward-coefficient) and WC (weight-coefficient) arrays from the stepsize vector G.
- Seeding W with reciprocals: W[j] = 1/(j+1).
- Evolving W via a KS-loop until KS = 1 (position phase).
- Performing position interpolation: P = REFPOS + Δ (REFVEL + Δ Σ DT·W).
- Evolving W one more step to KS = 0 (velocity phase).
- Performing velocity interpolation: V = REFVEL + Δ * Σ DT·W.
All indices below follow Python 0-based convention; the comments show the original Fortran 1-based names for cross-reference.