Inspiration

I'm a gap-year engineering student who builds physics simulation tools independently. Every time I tested a new integrator or changed a parameter, I had to manually stare at output data to figure out what went wrong. There was no tool that said "this failed because your timestep is too large for this stiffness ratio" — I had to figure that out from first principles every single time.

The double pendulum was the final spark. It's one of the most beautiful demonstrations in physics — a completely deterministic system that becomes impossible to predict. I kept thinking my equations were wrong when trajectories diverged wildly. Then I realized: that IS the physics. The simulation was correct. My mental model was wrong.

PhysiX AI is the tool I wished existed when I started.

What it does

PhysiX AI is an AI-powered physics simulation debugger. You configure a physics system, run it, and the tool instantly tells you:

  • Why it failed (root cause analysis with confidence scores)
  • How bad it is (stability score 0–100 with energy drift, oscillation growth, and acceleration spike metrics)
  • How to fix it (prioritized repair recommendations)
  • What the best config is (Auto-Tune tests 10 combinations automatically)

It supports 5 physics systems: Spring-Mass Chain, Damped Pendulum, Double Pendulum (chaotic), Orbital Mechanics, and 3-Body Gravity. All 4 major numerical integrators are implemented: Euler, Semi-Implicit Euler, Velocity-Verlet, and Runge-Kutta 4.

Key features include a 3D Three.js viewer, live 2D animation, a 10×10 stability heatmap, side-by-side comparison mode, external log upload (CSV/JSON), integrator benchmarking, and an AI debug chat that explains instability in plain English.

Full demo: https://jolly-dieffenbachia-3510a1.netlify.app/

How we built it

I wrote the full requirements document first — specifying every physics system, integrator, analysis metric, UI tab, and edge case. Then I uploaded that document to MeDo and used its AI generation to scaffold the application structure.

The physics engine implements real numerical methods from scratch in JavaScript — no physics library. Each integrator (Euler, Semi-Implicit Euler, Velocity-Verlet, RK4) is a hand-coded function with the correct mathematical formulation.

The stability analysis computes five metrics per run: energy drift, explosion ratio, oscillation growth ratio, acceleration spike ratio, and stiffness index. These feed into a weighted scoring formula that produces the 0–100 stability score.

The 3D viewer uses Three.js loaded from CDN with custom orbit controls, per-system geometry builders, and circular trail buffers. The heatmap sweeps 100 parameter combinations asynchronously to avoid blocking the UI. The AI chat uses local pattern-matched fallback responses so it works without any API key during demos.

MeDo handled the React scaffolding and deployment. I iterated through its chat interface to refine the output, then published with one click.

Challenges we ran into

The double pendulum looked broken but wasn't.* Trajectories were diverging so wildly I spent hours doubting my equations. The chaos was real — I had to build special detection logic to distinguish "mathematical chaos (expected)" from "numerical instability (bad)".

Heatmap performance. Running 100 full simulations synchronously froze the browser. I had to restructure it with async/await and setTimeout(0) yields between cells to keep the UI responsive.

3D trail management. Naive trail rendering caused memory to grow unboundedly. I implemented a fixed-length circular buffer using Float32Array and BufferAttribute with dynamic draw ranges to keep memory constant regardless of simulation length.

Stiff system detection. The stiffness index formula needed to work across 5 completely different physics systems with different state spaces. Getting a single consistent metric that meant the same thing across Spring-Mass, Orbital, and 3-Body required several iterations.

MeDo complexity limit. MeDo couldn't directly host the self-contained HTML file since it generates apps from descriptions rather than deploying existing code. I adapted by using MeDo to build the React version from my requirements doc, and hosted the complete version separately on Netlify.

Accomplishments that we're proud of

  • Built a real numerical physics engine from scratch in JavaScript with correct implementations of all 4 integrators and 5 systems
  • The stability scoring system accurately distinguishes mathematical chaos from numerical instability — a genuinely hard problem
  • The Auto-Tune feature finds stable configurations automatically across the entire parameter space without user intervention
  • The 3D viewer renders all 5 physics systems with correct geometry, smooth animation, and orbit controls — all in a self-contained file
  • The heatmap sweeps 100 parameter combinations and renders a color-coded stability map that makes parameter sensitivity instantly visual
  • The app works completely offline with no API keys required — the AI chat falls back to local physics reasoning ## What we learned Building PhysiX AI taught me more about numerical methods in one week than months of textbook study.

The biggest lesson: integrator choice is everything. I always knew Euler was "less accurate" in theory, but watching energy explode in real time on my own charts made it visceral. Seeing a spring-mass system blow up at dt=0.12 with Euler, then stay perfectly stable with Velocity-Verlet at the same timestep — that clicked something no formula ever did.

I learned what symplectic integration actually means in practice. Velocity-Verlet preserves a modified Hamiltonian, which is why it stays bounded over long simulations. RK4 is more accurate per step but not symplectic — so it slowly leaks energy. That tradeoff was invisible to me before building this.

On the engineering side I learned: how to build a real-time stability scoring system from scratch, how to manage 3D trail buffers without memory leaks, how to design async parameter sweeps that don't block the UI, and how to write a physics-domain AI fallback that gives genuinely useful answers.

Using MeDo showed me how much faster you can move when AI handles scaffolding. The bottleneck became writing clear requirements — which turned out to be the most valuable skill of all.

What's next for PhysiX AI — Simulation Stability Lab

  • Claude API integration — replace local fallback with live Claude analysis for deeper, context-aware physics explanations
  • Custom system builder — let users define their own equations of motion and have PhysiX AI analyze them
  • Lyapunov exponent calculator — quantify chaos mathematically, not just visually
  • Export to video — record simulation playback as MP4 for presentations and papers
  • Collaborative mode — share simulation configs via URL so teams can debug together
  • Mobile version — responsive layout optimized for tablets so students can use it in labs
  • ROS integration — import real robotics simulation logs directly from Robot Operating System
Share this project:

Updates