Picture this: You’re floating in deep space, and there's a cute little beach-ball-size asteroid just 3 meters away. The rock’s mass is twice that of yours. You want to get to that asteroid, but you don't have a thruster. Luckily, you know some physics, and you think gravity will pull you and the asteroid together. Smart! The question is, *how long would it take*?

(And no, sorry, you don’t have a fire extinguisher like Sandra Bullock in *Gravity*, either.)

Got any intuition? Go ahead and make a guess! Are we talking minutes? Years? It matters, because you don’t have an infinite air supply. I’m going to show several ways in which you could figure this out in real time.

The problem above is actually one I suggested to a student. As part of my introductory physics course, students have to create a numerical calculation to solve a problem. In a *numerical* solution (instead of an analytical solution), the answer is arrived at in a stepwise manner, by breaking it into a series of smaller problems.

This is a good strategy in our case, because the gravitational force between two objects changes continuously as they get closer together. That’s complicated. So we can simplify the math by chopping the process up into short time intervals and assuming a fixed force within each increment. Here’s the recipe:

At each step: (1) Note the starting position. (2) Calculate the force at that distance. (3) Use that to get the (average) change in momentum over that interval. (4) Find the new position at the end of the interval. Then just rinse and repeat, over and over, till you reach the end. It might take hundreds or thousands of increments, but for computers, that’s a breeze.