Heyoka Taylor Adaptive Integrator
- Heyoka Taylor Adaptive Integrator is a high-order, adaptive Taylor series method that uses automatic differentiation to solve ODEs with long-term precision and robustness.
- It employs adaptive step size and order selection to control local error tolerances while delivering dense output, efficient event detection, and SIMD-enabled performance.
- Benchmark comparisons demonstrate that Heyoka outperforms traditional integrators in speed and accuracy for complex astrodynamics and celestial mechanics applications.
The Heyoka Taylor Adaptive Integrator is a general-purpose, high-order adaptive Taylor series method for the numerical solution of ordinary differential equations (ODEs), designed for high-precision and long-term integrations in astrodynamics and celestial mechanics. Heyoka achieves both speed and accuracy superior to many domain-specialized integrators, offering robust features such as automatic differentiation–based recurrence, dense output, rigorous event detection, SIMD parallelism, and high-accuracy operation with support for extended and arbitrary-precision arithmetic. The implementation is open source, available in both C++ and Python interfaces (Biscani et al., 2021, Biscani et al., 2022).
1. Mathematical Formulation
Heyoka integrates initial-value ODE problems of the form by computing the truncated Taylor expansion of about to order :
where are the normalized derivatives.
Derivatives up to order are generated using forward automatic differentiation (AD) applied to the abstract syntax tree (AST) of , exploiting recurrence relations (sum, product, quotient rules). The total computational complexity for all normalized derivatives is , where is the number of elementary sub-expressions in 0 (Biscani et al., 2021).
2. Adaptive Step Size and Error Control
Heyoka employs an adaptive step-size and order selection strategy to enforce a user-supplied local error tolerance 1. The step is accepted if the local Taylor remainder satisfies:
2
If the step fails, 3 is reduced according to
4
where 5. The Taylor order 6 is selected at integrator build time via 7 and can be tuned for optimal FLOPs per unit time (Biscani et al., 2021, Biscani et al., 2022). The method is a true one-step integrator, requiring no history or warm-up.
3. Algorithmic Architecture and Features
Automatic Differentiation and Just-in-Time Compilation
The dynamical system is encoded as a C++ AST via operator overloading. During construction, common subexpressions are eliminated and LLVM IR is generated for the full AD recurrences and Taylor expansion, yielding a just-in-time (JIT) compiled stepping kernel tailored for the user’s system.
SIMD Batch Mode and Parallelism
Heyoka supports SIMD "batch mode", in which each scalar variable is replaced by a small SIMD vector (e.g., size 2 for SSE2, 4 for AVX), enabling simultaneous integration of multiple trajectories and up to 3.3x throughput improvement. Vectorized transcendental functions are handled via SLEEF (Biscani et al., 2021).
Dense Output and High-Accuracy Mode
Taylor expansion naturally provides dense output for any state or event function, accurate to 8 at no extra runtime cost. High-accuracy mode combines compensated summation, tight tolerances, and extended-precision types to maintain invariants such as Brouwer’s law for energy drift (RMS error 9) over 0 dynamical timescales (Biscani et al., 2021).
4. Event Detection and Hybrid Dynamics
Heyoka implements robust event detection for ODEs with event functions 1 by applying its Taylor machinery to 2 in parallel with 3. The event polynomial 4 for 5 is generated at each step and roots are located using Descartes’ rule of signs and the Collins–Akritas real-root isolation algorithm, guaranteeing complete and ordered detection of all zero crossings in the interval (Biscani et al., 2022).
Events may be flagged as terminal or non-terminal. When multiple events occur in a step, heyoka isolates all triggers, selects the earliest, and propagates to the corresponding state, applying "cool-down" intervals to avoid discontinuity sticking, e.g.,
6
All event routines (including vectorized and in-place root refinement) are optimized for minimal additional overhead.
5. Implementation and API
C++ and Python Front Ends
The C++ interface uses symbolic variable declaration and function composition (through operator overloading) to define ODE systems; integrators are constructed and invoked via a single make_integrator<>() call. The Python front end (via pybind11) offers the same API semantics, enabling seamless workflow across both environments (Biscani et al., 2021).
Memory and Compute Optimizations
All Taylor coefficients are preallocated in flat memory arrays for state and events, and AD is performed in a single pass emulating a sparse forward-mode. No heap allocation is incurred at each step. Multiple kernel variants are supported: "default" (full loop unrolling for speed), "compact" (looped, reduced compile time at some speed cost).
6. Performance Benchmarks and Comparative Results
Two-body and N-body Problems
- For low-eccentricity Kepler orbits (double precision, 7, 8), heyoka achieves 916 steps/orbit and 0 energy error, whereas IAS15 requires 1100 steps/orbit for similar error (Biscani et al., 2021).
- In Sun+N-planet models, heyoka outperforms IAS15 by 2353 for 4; the crossover where force evaluations dominate occurs at 5.
Long-term Solar System and Chaotic Dynamics
- 6-body (Sun+planets) integrations over 6 years show RMS energy error consistent with Brouwer’s law, with heyoka requiring 7s per 8 years (vs. IAS15’s 9s).
- In TRAPPIST-1 system stability (7-planet, near-resonant chain, 0 draws), 10 Myr runs confirm error growth 1 and 2.
Event-driven and Large-scale Applications
- Poincaré-section computation for the Hénon–Heiles system shows heyoka baseline performance is 3–4× faster than DifferentialEquations.jl and 5–6× faster than SciPy DOP853.
- For collision-rich N-body problems and eclipse detection on irregular small bodies, event detection adds modest overhead (720% per step in collision-prone Solar System tests), with no missed or falsely flagged events (Biscani et al., 2022).
Extended and Arbitrary Precision
When operated in 80-bit or 128-bit precision, heyoka achieves energy control at or below 8 (80-bit) and 9 (128-bit), with timings of 0s and 1s, respectively, for standard Solar System benchmarks (Biscani et al., 2021).
7. Significance and Scope
Heyoka demonstrates that a general-purpose, high-order, adaptive Taylor integrator, equipped with modern automatic differentiation, event detection, JIT compilation, and parallelism, can both rival and surpass traditional symplectic and non-symplectic methods (such as WHFast, IAS15, RKF7/8) across challenging gravitational, collisional, and chaotic regimes. It particularly excels in high-precision, multi-million year integrations, stiff/forced systems, close encounters, and event-driven hybrid dynamics. The algorithmic transparency, dense output, and open-source availability permit direct integration into computational workflows for astrodynamics, planetary science, and dynamical astronomy (Biscani et al., 2021, Biscani et al., 2022).