Define the same initial-value problem twice
The primary and companion each have unit mass. The inner planet is massless, so it does not change their circular relative orbit. At the initial time both relative position vectors point along the positive first axis. The inner orbit lies in the first two coordinate directions; the outer orbit is tilted about the first axis.
The companion-primary relative angular speed uses their total mass. Its prescribed displacement is therefore the expression below. In the primary-centered frame, the planet feels the primary, the companion and the indirect acceleration of the primary. Every term is three-dimensional.
The saved direct reference was actually integrated with REBOUND 5.2.2 and IAS15 at an accuracy parameter of one hundred-billionth. It stores Cartesian states every 0.005 secular times. The browser uses downsampled states for the named presets and an adaptive Dormand–Prince method for new parameter choices. The averaged prediction starts from the angular-momentum and eccentricity vectors derived from those same initial Kepler elements.
Reading: REBOUND 5.2.2 official Kozai example and IAS15 integrator · Tremaine & Yavetz, Why do Earth satellites stay up?, arXiv:1309.5244v1
Extract orbit elements from the saved states
At each saved time, take the position-velocity cross product and form the eccentricity vector below. Its length is the osculating eccentricity; the angle of angular momentum to the outer normal is the mutual inclination. No sine curve or separately drawn eccentricity history enters this extraction.
The inner two-body energy varies because the companion exchanges energy with the planet. For a circular companion there is instead a conserved rotating Hamiltonian. Its final term subtracts the outer angular speed times the axial angular momentum. The indirect potential remains present.
This distinction makes a useful error test. A nearly constant inner Kepler energy is not the right criterion for a correct restricted three-body calculation. The circular rotating Hamiltonian should remain constant to numerical accuracy while the osculating elements oscillate. The provided scientific tests also differentiate that Hamiltonian along the full force and check that its derivative vanishes.
Reading: REBOUND 5.2.2 official Kozai example and IAS15 integrator · Tremaine & Yavetz, Why do Earth satellites stay up?, arXiv:1309.5244v1
Check the integrator before judging the approximation
For the default first three secular times, the browser’s adaptive integrator was compared with the independent saved IAS15 states. The maximum eccentricity difference was about four ten-millionths. The largest position difference was about eight ten-thousandths of the inner semimajor axis. Accumulated fast orbital phase error contributes to that residual. The rotating-Hamiltonian drift was about four hundred-millionths in the adopted energy units.
Those errors are smaller than the percent-level direct-versus-averaged eccentricity differences in the default comparison. This does not certify every possible long integration. It establishes a specific reference check over the stated interval, with both an orbital-element diagnostic and a more phase-sensitive Cartesian diagnostic.
The averaged solver is checked differently. Finite numerical integrals of the instantaneous tidal potential reproduce its orbit average; the raw vectors preserve their geometry, Hamiltonian and axial projection. These tests probe the force and normalization as well as timestep convergence.
Reading: REBOUND 5.2.2 official Kozai example and IAS15 integrator · Tremaine & Yavetz, Why do Earth satellites stay up?, arXiv:1309.5244v1
Use a third force model to isolate averaging
A full Newtonian direct calculation retains all orders of the companion potential. The doubly averaged curve also drops terms beyond quadrupole order. Their difference therefore combines two physical approximations.
The public materials add a controlled intermediate calculation: IAS15 integrates the instantaneous quadrupole tidal acceleration, retaining both fast orbital clocks. Comparing it with the doubly averaged quadrupole changes averaging alone. Comparing it with the full Newtonian force changes multipole truncation at the same initial state.
At a mutual inclination of seventy-five degrees and an outer separation six times the inner semimajor axis, the measured periods are 5.005, 4.810 and 4.670 secular times for the full force, instantaneous quadrupole and double average. The outer-orbit smoothing window changes the quadrupole estimate between 4.745 and 4.810. At a separation ratio of twenty, the corresponding periods are 4.675, 4.665 and 4.670. These are finite-record measurements, not universal correction factors.
As a worked comparison, subtract the averaged compact period from the instantaneous-quadrupole period and divide by the averaged period. The relative shift is about three percent. Repeating with the full force gives about seven percent, so calling the whole shift an averaging error would assign the omitted spatial terms to the wrong cause.
The compact case visibly accumulates phase differences. Because nonlinear evolution changes which part of a cycle is sampled, the two period shifts are not guaranteed to add linearly. Use the three-model experiment to identify which approximations matter, and retain the raw trajectory for another choice of summary statistic.
Reading: Liu, Muñoz & Lai, Short-range forces in triple systems, arXiv:1409.6717v2 · REBOUND 5.2.2 official Kozai example and IAS15 integrator · Klein & Hamilton, Short-range forces beyond double averaging, arXiv:2606.19456v1
Stop where the declared physical problem ends
The near-polar preset reaches the near-primary exclusion before completing a cycle. Its saved full-force record ends at 2.180 secular times; the averaged record ends near 2.160. The last successful state is retained and no later curve is invented. A full period cannot be measured from this partial excursion.
The browser also stops a custom direct record for a close companion approach, loss of a bound inner osculating ellipse, nonfinite state or exhausted integration budget. These are reported boundaries, not collision or tidal-disruption models. Body radii in the scene are schematic.
The main scene displays the averaged ellipse and its changing plane. Its companion marker is a grip on the representative outer plane; the fast orbital phases have been removed. Inner and outer paths have separately stated display magnifications; the numerical records retain their actual units. Use the data row for the direct reference and its residual.
A convincing comparison states which model evolved each curve, what initial state it used, which time interval survived, and which observable was measured. Those details allow another reader to ask a sharper physical question with the same saved experiment.
Reading: REBOUND 5.2.2 official Kozai example and IAS15 integrator · Liu, Muñoz & Lai, Short-range forces in triple systems, arXiv:1409.6717v2