Sitemap
Ronaph3

Ronaph3

Research notes on crypto market structure, quantitative methods, and AI agent systems. Reproducible projects: github.com/HeidenJhvx

A Correct Gravity Equation Can Still Produce the Wrong Orbit

3 min readNov 2, 2026

--

Comparing Euler, Velocity Verlet, and RK4 through energy drift, endpoint error, and numerical convergence.

A numerical simulation can use the correct physical equation and still produce nonphysical motion.

The integration method and time-step size are part of the scientific result, not incidental implementation details.

I built Orbital Numerics Lab to compare three numerical integrators using the same gravitational problem.

A Controlled Kepler Experiment

The model follows a test particle moving in a fixed inverse-square central gravitational field.

In normalized units:

  • Gravitational parameter μ = 1
  • Initial circular radius = 1
  • Initial orbital speed = 1
  • Orbital period = 2π

The acceleration is:

a(r) = −μr / |r|³

Two useful physical quantities are specific energy and angular momentum.

E = |v|²/2 − μ/|r|

h = x·vy − y·vx

Both should remain constant in the underlying idealized model.

Three Integrators, One Physical Problem

I implemented:

Explicit Euler

A simple first-order method that advances using the current derivative.

Velocity Verlet

A second-order method that uses acceleration at the beginning and end of the time step. It has useful symplectic and time-reversible properties.

Classic RK4

A fourth-order method that evaluates four slopes per step.

I ran all three methods over one orbital period using 160 equal time steps.

Get Ronaph3’s stories in your inbox

Join Medium for free to get updates from this writer.

The program measured maximum relative energy drift, endpoint position error, and changes in accuracy as the number of steps increased.

Results

Explicit Euler

  • Maximum relative energy drift: 2.6485 × 10⁻¹
  • Endpoint position error: 1.6745

Velocity Verlet

  • Maximum relative energy drift: 5.9317 × 10⁻⁷
  • Endpoint position error: 0.0032279

RK4

  • Maximum relative energy drift: 1.6305 × 10⁻⁸
  • Endpoint position error: 4.1917 × 10⁻⁷
Press enter or click to view image in full size
Press enter or click to view image in full size

Under these short-horizon conditions, RK4 produced the smallest endpoint and energy errors.

That does not establish RK4 as the best method for every simulation.

Symplectic integration is particularly relevant when preserving the qualitative structure of a dynamical system over long time horizons.

A one-period test cannot establish those long-term properties.

Why the Engineering Choices Matter

The implementation separates three concerns:

Physics: Acceleration, energy, angular momentum, and initial conditions.

Integration: Independent implementations of Euler, Verlet, and RK4.

Evaluation: Error measurements, grid refinement, tests, and result visualization.

This makes it possible to change the integration algorithm without changing the underlying physical model.

The project also includes a velocity-reversal test for Verlet and grid-refinement experiments, rather than relying on one numerical resolution.

Limits and Future Work

This is a dimensionless, two-body educational experiment.

It does not include mission ephemerides, atmospheric drag, J2 perturbations, propulsion, observational noise, relativistic corrections, or spacecraft control.

My next research direction would be long-horizon integration over thousands of orbital periods, adaptive methods, multiple eccentricities, and eventually N-body dynamics.

A further step would be connecting verified simulation with state estimation and control algorithms.

Code, 18 unit tests, charts, and methodology: [https://github.com/Rnph3/Orbital-Numerics-Lab]

Scope: Numerical-method comparison in an idealized gravitational model, not mission-grade orbit prediction.

References: Rutgers numerical errors notes · Illinois numerical integrators module.

--

--

Ronaph3
Ronaph3

Written by Ronaph3

Research notes on crypto market structure, quantitative methods, and AI agent systems. Reproducible projects: github.com/HeidenJhvx