Testing AI Scientific Engineering with the Three-Body Problem: From Numerical Integration to Chaos Visualization

GPT-5.6 Sol built a technically rigorous three-body problem simulator, passing independent review across physics, numerics, and frontend engineering.
A developer used the GPT-5.6 Sol-powered Row-Bot agent to build Three-Body Lab — a browser-based gravitational simulator with four numerical integrators, chaos visualization, and real-time conservation law monitoring. After an independent reviewer flagged issues in the physics engine and UI, the AI corrected its assumptions, expanded its test suite, and passed all numerical validation tests.
A Cross-Disciplinary Stress Test of AI Capability
The Three-Body Problem is one of classical mechanics' most famous challenges: three massive bodies interacting under Newtonian gravity, governed by fully deterministic equations, yet with no general closed-form solution for arbitrary initial conditions. Newton first recognized this difficulty, and Poincaré rigorously proved its non-integrability in the late 19th century, laying the foundations of modern chaos theory. The vast majority of configurations can only be evolved numerically, and the system typically exhibits Deterministic Chaos — tiny differences in initial conditions eventually lead to wildly divergent trajectories. This sensitivity can be quantified via Lyapunov exponents: a positive maximum Lyapunov exponent means neighboring trajectories diverge exponentially, imposing a fundamental physical limit on predictability — not an engineering one.
A developer used an AI agent called Row-Bot (powered by GPT-5.6 Sol) and deliberately posed this cross-disciplinary challenge: build an interactive three-body simulation website that is technically credible — not just three glowing dots moving arbitrarily on a canvas. The result was Three-Body Lab — a browser-based numerical gravity workbench built from scratch with React, TypeScript, and Vite.

The real value of this experiment wasn't whether AI could produce a polished UI, but whether it could simultaneously command six distinct domains — celestial mechanics, numerical analysis, deterministic chaos, scientific visualization, frontend engineering, and testing with technical documentation — and then correct its own mistaken assumptions after an independent technical review.
What GPT-5.6 Built
Four Numerical Integrators Covering Different Precision Requirements
The simulation core contains four independent numerical integrators, letting users switch between them in real time to observe differences in system evolution:
- Explicit Euler
- Symplectic Euler
- Velocity Verlet
- Fourth-Order Runge-Kutta (RK4)
This reflects commendable physical intuition: RK4 delivers strong local accuracy, while Velocity Verlet is a time-reversible symplectic method. Symplectic Integrators are designed for Hamiltonian systems, and their core advantage is exact preservation of phase-space volume — a consequence of Liouville's theorem in classical mechanics — keeping long-term energy errors bounded rather than continuously accumulating. By contrast, non-symplectic methods like standard RK4 achieve higher local accuracy but can exhibit monotonically growing energy errors over time, leading to systematic physical drift at long timescales. This isn't an arbitrary collection of algorithms — it reflects an accurate understanding of where different numerical methods are appropriate.
Four Initial Condition Presets Recreating Classic Orbital Scenarios
The simulation offers four classic configurations: the Figure-Eight Choreography (three equal-mass bodies chasing each other along a shared figure-eight orbit), the Lagrange Equilateral Solution (three bodies maintaining an equilateral triangle configuration while orbiting their common center of mass), a Hierarchical Three-Body System (a tight binary interacting with a lighter, more distant third body), and Chaotic Scattering (an incoming mass perturbing a binary system, potentially leading to capture, exchange, or ejection).
The key detail: each preset is transformed into a true barycentric, zero-total-momentum reference frame before integration begins. This kind of "invisible" correctness is exactly what separates a toy demo from a serious tool.
Making Numerical Errors Visible
A visually convincing orbit is not necessarily an accurate one — this is one of the most easily overlooked traps in numerical simulation. Three-Body Lab therefore continuously computes the system's physical invariants: total mechanical energy, linear momentum, angular momentum, and center-of-mass position.
The dashboard reports energy drift, momentum drift, angular momentum, and the closest approach distance reached during the run in real time, flagging the numerical state as nominal, caution, or unreliable based on the degree of invariant drift.
This distinction is critically important: a simulator should not silently continue drawing ostensibly authoritative trajectories after its numerical approximations have become untrustworthy. This kind of "self-honesty" is precisely the quality a scientific computing tool should embody.
Seeing Chaos Directly: The Shadow Copy Experiment
To make chaos phenomena "visible," the simulator can spawn a shadow copy of the system with just one initial coordinate perturbed by δ₀ = 10⁻⁷. Both systems follow identical deterministic equations using the same integrator.
At first, their trajectories appear perfectly identical; as time progresses, the interface measures their phase-space separation δ(t). The shadow bodies and trajectories gradually diverge from the original system, making "sensitive dependence on initial conditions" intuitively visible.
Particularly praiseworthy is that the interface reports this as a finite-time raw separation rate, not a definitive Lyapunov exponent. This distinction is mathematically crucial: rigorous Lyapunov exponent calculation requires simultaneously evolving the original orbit and a tangent vector in phase space, where the tangent vector satisfies the variational equations. To prevent the tangent vector from overflowing due to exponential growth, periodic Gram-Schmidt orthonormalization is required, and the maximum Lyapunov exponent is the time average of the growth rates from this process. This procedure is far more involved than simply measuring the separation between two trajectories. Explicitly acknowledging the need for this additional treatment — pursuing scientific transparency rather than an "impressive but misleading number" — is a mark of genuine professional rigor.
Engineering Details: Decoupling the Physics Clock from Rendering
Many browser simulations execute one physics step per animation frame, making results dependent on whether the monitor runs at 60 Hz, 120 Hz, or 144 Hz — or even on how busy the computer is.
Three-Body Lab uses an accumulated simulation clock — the architecture commonly called a "Fixed Timestep Game Loop" in game engine design: rendering is separated from numerical integration, maintaining a physics accumulation clock independent of the rendering frame rate, computing the real elapsed time since the last frame each tick and consuming it in fixed physical steps Δt. This ensures complete determinism in numerical integration — identical initial conditions produce exactly the same physical trajectory on any hardware, at any frame rate. In other words, the monitor does not change the laws of physics.
Additionally, point-mass gravity becomes singular as the separation between two bodies approaches zero. To avoid division-by-zero errors during extreme close encounters, the engine uses a Plummer-type softening parameter ε — a technique from astrophysical N-body simulation introduced by the Plummer (1911) spherically symmetric star cluster model, which modifies the gravitational potential from -GM/r to -GM/√(r²+ε²), eliminating the close-range singularity while preserving macroscopic dynamical features. Crucially, the potential diagnostics also use the corresponding softened potential — maintaining mathematical consistency between the force law and energy calculation, while clearly documenting this as an explicit modification to the ideal point-mass model.
Independent Review and AI Self-Correction
The most valuable part of this experiment was introducing an independent read-only reviewer agent to inspect the numerical engine and interface. It identified several substantive issues:
- The original potential energy formula did not include the same softening term used by the force law
- Two presets were labeled as barycentric but had not actually been transformed
- The chaos diagnostic description was overstated
- Simulation rate was partially dependent on display refresh rate
- Canvas resizing had edge cases
- "Closest approach" initially only tracked the current minimum separation
Row-Bot subsequently fixed these issues, expanded the test suite, and rebuilt the production bundle. Final validation covered internal force balance, center-of-mass and zero-momentum normalization, softened force/potential consistency, RK4 energy conservation on the figure-eight orbit, and Velocity Verlet time-reversibility, among others.
Final results: 6/6 numerical tests passing, 0 dependency vulnerabilities, 1,775 modules transformed, production JavaScript approximately 213.6 kB, approximately 68.5 kB gzipped.
What This Three-Body Experiment Really Demonstrates
The significance of this experiment goes far beyond "AI generated a pretty UI." The model had to reason across physics, mathematics, numerical methods, software architecture, visual design, testing, and science communication — then accept an independent technical review and fix its own mistaken assumptions.
This is exactly the kind of task that should be used to evaluate AI agents: not just generating code, but building something difficult, measuring whether it's correct, exposing where it's approximate, and improving it when evidence reveals problems.
From a software engineering perspective, "generating code that compiles" is the bare minimum. What actually approaches human expert capability is the ability to question one's own output, distinguish between "looks correct" and "actually correct," and iterate on improvements in the face of criticism. Problems like the three-body system — with clear physical constraints and abundant numerical pitfalls — are an ideal measuring stick for this capability, because beautiful animations are easy to fake, but conserved energy, time-reversible integration, and honestly labeled error states are not.
Key Takeaways
Related articles

Disaster and Glory of the Apollo Program: The History We Must Revisit Before Returning to the Moon
From the fatal Apollo 1 fire to Apollo 8's daring lunar orbit to Apollo 11's successful landing—revisiting the disasters, fears, and compromises of the Apollo program and their lessons for today's return to the Moon.

Netflix Trust Exercise Turns Into Firing Trap: Where Are the Boundaries of Corporate Trust?
A Netflix employee was fired after sharing private info in a trust exercise. We analyze the risks of corporate trust exercises and how employees can protect themselves.

AMD CDNA5 Architecture Deep Dive: Technical Evolution and the AI Computing Competition Landscape
Deep analysis of AMD's CDNA5 architecture covering Chiplet packaging upgrades, HBM memory evolution, and low-precision compute optimization, examining how AMD challenges NVIDIA's AI chip dominance.