Sitemap
Towards AI

We train AI Engineers. We deploy Enterprise AI. Join 100K+ AI practitioners at Towards AI Academy or reach out for help making your company AI native. towardsai.com

Teaching an AI to Fly Rockets

From Natural Language Prompts to Physics Simulations

7 min readNov 22, 2025

--

When we imagine rocket science, we usually picture whiteboards full of equations or giant control rooms full of monitors.

But what if you could start with something as simple as a sentence?

“Launch a rocket straight up, add a crosswind, show me when it drifts off course, and how to correct it.”

No code. No formulas. Just a description of what you want to see.

My project is about turning that sentence into a working simulation:
an AI-driven physics sandbox where natural language becomes trajectories, forces, and visualizations.

To make the idea concrete, I built a small world around one classic problem in rocketry:
keeping a rocket on a perfectly vertical path while the wind tries to blow it away.

The Problem: A Rocket That Refuses to Stay Straight

Imagine a rocket launching from a pad on Earth.
The mission plan says it should go straight up — a path exactly 90° to the ground, no sideways drift.

Reality has other plans.

Wind pushes the rocket slightly sideways. Tiny imperfections in thrust add small angles. Those small deviations don’t stay small. Over time, the rocket can drift far from its ideal path, wasting fuel and possibly missing its target.

Engineers have to answer a very practical question:

How do we know, in real time, that the rocket is starting to wander — and how do we guide it back?

To explore this, I built a simple mental model with two rockets: one real, one imaginary.

Phantom Rocket vs Real Rocket

The trick is to introduce a phantom rocket.

The phantom rocket doesn’t exist in the sky. It only exists in the simulation.
It follows the ideal trajectory:

  • perfectly vertical,
  • unaffected by wind,
  • always exactly where the mission says it should be.

The real rocket is the one battling gravity and wind. It tries to follow the plan, but its path curves as the environment pushes it around.

Both rockets are “watched” by a radar station on the ground. From the radar’s point of view there are two key numbers:

  • the distance to the phantom rocket (the theoretical distance),
  • the distance to the real rocket (the actual distance).

The difference between those two distances is a measure of how far the rocket has drifted from perfection.

If the difference is small, we’re on course.
If it grows, the rocket is wandering.

From Natural Language to Simulation

Now comes the fun part: instead of hard-coding all of this, I want an AI to set it up from a natural language prompt.

A typical prompt might look like this:

“Simulate a vertical rocket launch from a radar station. Add wind that pushes the rocket sideways. Create a phantom rocket that always follows the perfect vertical path and show me how far the real rocket drifts over time.”

Behind the scenes, the system breaks that sentence into structure:

  • There is a rocket with mass, thrust, and gravity.
  • There is wind acting sideways.
  • There is a desired path: a straight line upwards.
  • There is a sensor: the radar station.
  • We want to measure error between ideal and actual, and visualize it.

A large language model (LLM) isn’t running the physics itself — it’s acting more like a translator and planner. It turns the prompt into:

  • configuration for the physics engine (gravity, wind, initial velocity),
  • definitions for the real rocket and phantom rocket,
  • logging instructions (what to record each step),
  • and visualization instructions (what to plot or render).

Think of it as:

Natural Language → Structured Plan → Physics Simulation.

Over time, that translation can be refined. We can add small model “weights” and rules that nudge the system toward more stable, physically consistent setups (“gravity points down”, “time steps shouldn’t explode the simulation”, and so on).

This is how it would go :

Engine Actually Does

Once the scenario is set up, the physics engine takes over.

Get Joel Frank’s stories in your inbox

Join Medium for free to get updates from this writer.

At each tiny slice of time, it:

  1. Calculates the forces on the real rocket
    — thrust upward, gravity downward, wind pushing sideways.
  2. Uses those forces to update acceleration, velocity, and position.
  3. Moves the phantom rocket along the perfect vertical line, ignoring the wind.

Computes two distances from the radar station:
one to the phantom rocket (ideal) and one to the real rocket (actual).

Logs the difference between those distances as the “off-course error”.

From this stream of data we can build exactly the kind of visuals scientists love.

How It Looks: Prompt, Code, and Trajectory

To make the interaction feel real, I designed the interface around three elements:
the prompt, the generated code, and the simulation view.

On the left, the user types a prompt in plain language.

On the right, two things appear:

  • a block of Python-style code that the AI is constructing,
  • and a live rocket visualization.

The code might show gravity, wind, and a loop that updates the rocket’s state over time. At the bottom of the block, you might see a subtle line:

(code generating…)

indicating that the AI is still filling in the details.

Next to it, a 2D or 3D rocket streaks upward. At first it hugs the ideal vertical path. As the simulated wind kicks in, its trajectory bends. The phantom rocket stays pinned to the perfect line, quietly judging.

Prompt + Code + Simulation

Press enter or click to view image in full size

Left side: the user’s natural language instructions.
Right side: a code editor panel and a rendered rocket trajectory.

This single image sells the whole idea:
you describe the physics; the AI writes and runs the experiment.

Making It Feel Like Real Rocket Science

Numbers alone are boring. The good news is that this setup naturally generates interesting plots.

One useful graph is error vs time. On the horizontal axis, we track time after launch. On the vertical axis, we plot the difference between the phantom distance and the actual distance. The curve hugs zero early on, then grows as wind pushes the rocket away. If a guidance algorithm kicks in and starts correcting the trajectory, the curve bends back down.

Another powerful view is a side-on trajectory plot. The vertical axis is altitude. The horizontal axis is horizontal drift. A bright straight line shows the desired vertical path. A second curve shows the real rocket, bowing away from that line as the wind acts. You can almost feel the guidance algorithm panic and try to pull it back.

These two visuals — error over time and path in space — are exactly the kind of outputs used in real aerospace guidance work. They also happen to look very good in an article.

Why This Matters Beyond Rockets

The rocket is just a character in a bigger story.

The pattern underneath it is much more general:

  • define an ideal behavior,
  • observe what really happens,
  • measure the gap,
  • and act to close it.

The same idea appears in drones fighting turbulence, self-driving cars on icy roads, satellites under small perturbations, even robots trying to walk over uneven terrain.

In my project, the physics sandbox and the LLM form a loop:

  1. I describe a new scenario in natural language.
  2. The LLM turns that description into a structured simulation.
  3. The physics engine runs it and returns data and visuals.
  4. I judge the outcome, tweak the prompt, or adjust the rules that guide the model.
Press enter or click to view image in full size

Each iteration tightens the connection between “what I mean” and “what the system simulates”. Over time, the AI becomes better at turning loose, human-level descriptions into precise, testable physics experiments.

Where This Could Go Next

Right now, the sandbox handles things like:

  • a rocket and its phantom twin,
  • gravity and wind,
  • radar distance and trajectory error.

The next steps are obvious and exciting:

  • let users switch from rockets to satellites, pendulums, galaxies, or cars,
  • let the AI propose its own “what if” scenarios (“what if wind reverses at high altitude?”, “what if thrust fluctuates?”),
  • and eventually, let another model look at the simulation data and try to rediscover the rules that generated it.

At that point, the system wouldn’t just be turning language into physics. It would be doing the reverse too: turning raw behavior back into candidate laws.

For now, though, I’m happy with a more modest achievement:

I can type a sentence about a rocket, and an AI helps me build a miniature universe where that rocket lives, drifts, and learns to fly straighter — all without me writing a single line of code by hand.

And that already feels like a small taste of the future of science.

Connect with me on Linkedin:https://www.linkedin.com/in/sachin-shankar-a32543388/

--

--

Joel Frank
Joel Frank

Written by Joel Frank

Sophomore focused on building impactful ideas through tech, writing, and curiosity, turning questions into action and thoughts into change.

Towards AI
Towards AI

Published in Towards AI

We train AI Engineers. We deploy Enterprise AI. Join 100K+ AI practitioners at Towards AI Academy or reach out for help making your company AI native. towardsai.com